diff options
author | Radek Doulik <rodo@src.gnome.org> | 2002-06-06 23:54:39 +0800 |
---|---|---|
committer | Radek Doulik <rodo@src.gnome.org> | 2002-06-06 23:54:39 +0800 |
commit | f6956dfe32ead2baabb43fd407038486c8980859 (patch) | |
tree | 67d8bf59c9a5e87f1b7cde160694a2cc536c6e54 | |
parent | 1f993cacd1ac269ea4e7a77c57edbce732b9e8b5 (diff) | |
download | gsoc2013-evolution-f6956dfe32ead2baabb43fd407038486c8980859.tar.gz gsoc2013-evolution-f6956dfe32ead2baabb43fd407038486c8980859.tar.zst gsoc2013-evolution-f6956dfe32ead2baabb43fd407038486c8980859.zip |
enhanced signature editor
svn path=/trunk/; revision=17132
-rw-r--r-- | mail/mail-composer-prefs.c | 15 | ||||
-rw-r--r-- | mail/mail-config.c | 20 | ||||
-rw-r--r-- | mail/mail-config.glade | 6 | ||||
-rw-r--r-- | mail/mail-config.h | 2 | ||||
-rw-r--r-- | mail/mail-signature-editor.c | 63 |
5 files changed, 88 insertions, 18 deletions
diff --git a/mail/mail-composer-prefs.c b/mail/mail-composer-prefs.c index 669c02c4fe..cef953ba82 100644 --- a/mail/mail-composer-prefs.c +++ b/mail/mail-composer-prefs.c @@ -34,6 +34,7 @@ #include <bonobo/bonobo-object-client.h> #include <gal/widgets/e-gui-utils.h> +#include <gal/widgets/e-unicode.h> #include "widgets/misc/e-charset-picker.h" @@ -247,9 +248,9 @@ mail_composer_prefs_new_signature (MailComposerPrefs *prefs, gboolean html) sig = mail_config_signature_add (html); if (prefs) { - name [0] = e_utf8_to_gtk_string (prefs->sig_clist, sig->name); - row = gtk_clist_append (GTK_CLIST (prefs->sig_clist), name); - gtk_clist_set_row_data (GTK_CLIST (prefs->sig_clist), row, sig); + name [0] = e_utf8_to_gtk_string (GTK_WIDGET (prefs->sig_clist), sig->name); + row = gtk_clist_append (prefs->sig_clist, name); + gtk_clist_set_row_data (prefs->sig_clist, row, sig); gtk_clist_select_row (GTK_CLIST (prefs->sig_clist), row, 0); g_free (name [0]); /*gtk_widget_grab_focus (prefs->sig_name);*/ @@ -290,12 +291,12 @@ sig_row_select (GtkCList *clist, int row, int col, GdkEvent *event, MailComposer MailConfigSignature *sig; printf ("sig_row_select\n"); - gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_delete, TRUE); - gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_edit, TRUE); - sig = gtk_clist_get_row_data (prefs->sig_clist, row); prefs->sig_row = row; + gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_delete, TRUE); + gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_edit, sig->script == NULL); + sig_load_preview (prefs, sig); } @@ -316,7 +317,7 @@ sig_fill_clist (GtkCList *clist) gtk_clist_freeze (clist); for (l = mail_config_get_signature_list (); l; l = l->next) { - name [0] = e_utf8_to_gtk_string (clist, ((MailConfigSignature *) l->data)->name); + name [0] = e_utf8_to_gtk_string (GTK_WIDGET (clist), ((MailConfigSignature *) l->data)->name); row = gtk_clist_append (clist, name); gtk_clist_set_row_data (clist, row, l->data); g_free (name [0]); diff --git a/mail/mail-config.c b/mail/mail-config.c index 673c8f2bbd..7e0d4095d6 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -130,6 +130,8 @@ typedef struct { int signatures; MailConfigLabel labels[5]; + + gboolean signature_info; } MailConfig; static MailConfig *config = NULL; @@ -968,6 +970,9 @@ config_read (void) label_defaults[i].color, NULL); } g_free (path); + + config->signature_info = bonobo_config_get_boolean_with_default (config->db, + "/Mail/Info/show_signature_editor_info", TRUE, NULL); } #define bonobo_config_set_string_wrapper(db, path, val, ev) bonobo_config_set_string (db, path, val ? val : "", ev) @@ -1334,6 +1339,9 @@ mail_config_write_on_exit (void) /* Message Preview */ if (config->preview_hash) g_hash_table_foreach_remove (config->preview_hash, hash_save_state, "Preview"); + + /* signature editor info label */ + bonobo_config_set_boolean (config->db, "/Mail/Info/show_signature_editor_info", config->signature_info, NULL); CORBA_exception_init (&ev); Bonobo_ConfigDatabase_sync (config->db, &ev); @@ -2966,3 +2974,15 @@ mail_config_signature_set_html (MailConfigSignature *sig, gboolean html) mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_HTML_CHANGED, sig); } } + +gboolean +mail_config_get_show_signature_info (void) +{ + return config->signature_info; +} + +void +mail_config_set_show_signature_info (gboolean show) +{ + config->signature_info = show; +} diff --git a/mail/mail-config.glade b/mail/mail-config.glade index cab9d8f94c..1dc55654f1 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -4198,7 +4198,7 @@ Baltic (ISO-8859-4) <name>cmdSignatureAdd</name> <can_default>True</can_default> <can_focus>True</can_focus> - <label>_Add...</label> + <label>_Add</label> <relief>GTK_RELIEF_NORMAL</relief> </widget> @@ -4207,7 +4207,7 @@ Baltic (ISO-8859-4) <name>cmdSignatureAddScript</name> <can_default>True</can_default> <can_focus>True</can_focus> - <label>Add Sc_ript...</label> + <label>Add Sc_ript</label> <relief>GTK_RELIEF_NORMAL</relief> </widget> @@ -4216,7 +4216,7 @@ Baltic (ISO-8859-4) <name>cmdSignatureEdit</name> <can_default>True</can_default> <can_focus>True</can_focus> - <label>_Edit...</label> + <label>_Edit</label> <relief>GTK_RELIEF_NORMAL</relief> </widget> diff --git a/mail/mail-config.h b/mail/mail-config.h index 92f2073a32..b92d917bd4 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -308,6 +308,8 @@ void mail_config_signature_emit_event (MailConfigSigEvent event, MailConfigSigna void mail_config_write_account_sig (MailConfigAccount *account, gint i); void mail_config_signature_run_script (gchar *script); +gboolean mail_config_get_show_signature_info (void); +void mail_config_set_show_signature_info (gboolean show); #ifdef __cplusplus } diff --git a/mail/mail-signature-editor.c b/mail/mail-signature-editor.c index 0ebaca5c72..d0a21630d2 100644 --- a/mail/mail-signature-editor.c +++ b/mail/mail-signature-editor.c @@ -34,6 +34,7 @@ #include "e-msg-composer.h" #include "mail-signature-editor.h" +#include "mail-config.h" /* * Signature editor @@ -44,6 +45,7 @@ struct _ESignatureEditor { GtkWidget *win; GtkWidget *control; GtkWidget *name_entry; + GtkWidget *info_frame; MailConfigSignature *sig; gboolean html; @@ -55,7 +57,7 @@ typedef struct _ESignatureEditor ESignatureEditor; #define E_SIGNATURE_EDITOR(o) ((ESignatureEditor *) o) #define DEFAULT_WIDTH 600 -#define DEFAULT_HEIGHT 500 +#define DEFAULT_HEIGHT 350 enum { REPLY_YES = 0, REPLY_NO, REPLY_CANCEL }; @@ -298,6 +300,13 @@ format_html_cb (BonoboUIComponent *component, bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", editor->html, NULL); } +static void +check_hide_info_toggled (GtkWidget *widget, ESignatureEditor *editor) +{ + gtk_widget_hide (editor->info_frame); + mail_config_set_show_signature_info (FALSE); +} + void mail_signature_editor (MailConfigSignature *sig) { @@ -305,7 +314,7 @@ mail_signature_editor (MailConfigSignature *sig) ESignatureEditor *editor; BonoboUIComponent *component; BonoboUIContainer *container; - GtkWidget *vbox, *hbox, *label; + GtkWidget *vbox, *hbox, *label, *frame, *vbox1, *pixmap, *check; gchar *title; if (!sig->filename || !*sig->filename) @@ -316,11 +325,10 @@ mail_signature_editor (MailConfigSignature *sig) editor->sig = sig; editor->html = sig->html; - title = g_strdup_printf ("Edit signature (%s)", sig->filename); + title = g_strdup_printf ("Edit signature"); editor->win = bonobo_window_new ("e-sig-editor", title); gtk_window_set_default_size (GTK_WINDOW (editor->win), DEFAULT_WIDTH, DEFAULT_HEIGHT); gtk_window_set_policy (GTK_WINDOW (editor->win), FALSE, TRUE, FALSE); - gtk_window_set_modal (GTK_WINDOW (editor->win), TRUE); g_free (title); container = bonobo_ui_container_new (); @@ -353,17 +361,56 @@ mail_signature_editor (MailConfigSignature *sig) GTK_SIGNAL_FUNC (delete_event_cb), editor); vbox = gtk_vbox_new (FALSE, 0); - hbox = gtk_hbox_new (FALSE, 0); - label = gtk_label_new (_("Signature name:")); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 4); + hbox = gtk_hbox_new (FALSE, 4); + vbox1 = gtk_vbox_new (FALSE, 3); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), 3); + label = gtk_label_new (_("Type the name by which you would like to refer to this signature.")); + gtk_misc_set_alignment (GTK_MISC (label), 0, 0); + gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, TRUE, 0); + label = gtk_label_new (_("Name:")); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); editor->name_entry = gtk_entry_new (); e_utf8_gtk_entry_set_text (GTK_ENTRY (editor->name_entry), sig->name); gtk_signal_connect (GTK_OBJECT (editor->name_entry), "changed", GTK_SIGNAL_FUNC (sig_name_changed), editor); gtk_box_pack_start_defaults (GTK_BOX (hbox), editor->name_entry); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 3); + frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); + gtk_box_pack_start (GTK_BOX (vbox1), hbox, FALSE, TRUE, 0); + gtk_container_add (GTK_CONTAINER (frame), vbox1); + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0); gtk_widget_show_all (vbox); gtk_box_pack_start_defaults (GTK_BOX (vbox), editor->control); + /* info frame */ + if (mail_config_get_show_signature_info ()) { + editor->info_frame = gtk_frame_new (_("Signature hint")); + gtk_container_set_border_width (GTK_CONTAINER (editor->info_frame), 3); + + hbox = gtk_hbox_new (FALSE, 3); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 3); + + pixmap = gnome_pixmap_new_from_file (EVOLUTION_IMAGES "/info-bulb.png"); + gtk_box_pack_start (GTK_BOX (hbox), pixmap, FALSE, TRUE, 0); + + vbox1 = gtk_vbox_new (FALSE, 3); + label = gtk_label_new (_("If you would like to use old signature, " + "you may import it by opening the \"Insert\" " + "menu, and select either the \"Text file\" " + "or the \"HTML file\" item.")); + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtk_misc_set_alignment (GTK_MISC (label), 0, 0); + gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, TRUE, 0); + gtk_box_pack_start_defaults (GTK_BOX (hbox), vbox1); + check = gtk_check_button_new_with_label (_("Hide signature hints")); + gtk_signal_connect (GTK_OBJECT (check), "toggled", check_hide_info_toggled, editor); + gtk_box_pack_end (GTK_BOX (vbox1), check, FALSE, TRUE, 3); + + gtk_container_add (GTK_CONTAINER (editor->info_frame), hbox); + gtk_widget_show_all (editor->info_frame); + gtk_box_pack_end (GTK_BOX (vbox), editor->info_frame, FALSE, TRUE, 0); + } + /* info frame end */ + bonobo_window_set_contents (BONOBO_WINDOW (editor->win), vbox); bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", editor->html, NULL); gtk_widget_show (GTK_WIDGET (editor->win)); |