From 13e7847dc129db9df0f5f9b4f59632d445d372a0 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Wed, 29 May 2002 22:13:18 +0000 Subject: moved spell checking options to separate page, updated UI by Anna's design 2002-05-29 Radek Doulik * mail-composer-prefs.c: moved spell checking options to separate page, updated UI by Anna's design * mail-accounts.c (mail_accounts_load): use _ instead of U_ for clist (mail_accounts_tab_construct): justify marks column to right svn path=/trunk/; revision=17041 --- mail/ChangeLog | 4 + mail/mail-accounts.c | 1 + mail/mail-composer-prefs.c | 132 ++++++++++++-- mail/mail-composer-prefs.h | 5 + mail/mail-config.glade | 440 +++++++++++++++++++++++++++++---------------- 5 files changed, 416 insertions(+), 166 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 1dfdddfe42..06fe4756d7 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,7 +1,11 @@ 2002-05-29 Radek Doulik + * mail-composer-prefs.c: moved spell checking options to separate + page, updated UI by Anna's design + * mail-accounts.c (mail_accounts_load): use _ instead of U_ for clist + (mail_accounts_tab_construct): justify marks column to right 2002-05-28 Jeffrey Stedfast diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index 41b8f02504..9d2d78d4c5 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -783,6 +783,7 @@ mail_accounts_tab_construct (MailAccountsTab *prefs) mail_accounts_load (prefs); #else prefs->table = GTK_CLIST (gtk_object_get_data (GTK_OBJECT (widget), "table")); + gtk_clist_set_column_justification (prefs->table, 0, GTK_JUSTIFY_RIGHT); gtk_signal_connect (GTK_OBJECT (prefs->table), "select-row", account_cursor_change, prefs); diff --git a/mail/mail-composer-prefs.c b/mail/mail-composer-prefs.c index e18341e917..c90d7ca229 100644 --- a/mail/mail-composer-prefs.c +++ b/mail/mail-composer-prefs.c @@ -28,6 +28,8 @@ #include "mail-composer-prefs.h" #include "composer/e-msg-composer.h" +#include + #include #include @@ -37,6 +39,8 @@ #include "mail-config.h" +#include "art/mark.xpm" + static void mail_composer_prefs_class_init (MailComposerPrefsClass *class); static void mail_composer_prefs_init (MailComposerPrefs *dialog); static void mail_composer_prefs_destroy (GtkObject *obj); @@ -86,7 +90,9 @@ mail_composer_prefs_class_init (MailComposerPrefsClass *klass) static void mail_composer_prefs_init (MailComposerPrefs *composer_prefs) { - ; + composer_prefs->enabled_pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mark_xpm); + gdk_pixbuf_render_pixmap_and_mask (composer_prefs->enabled_pixbuf, + &composer_prefs->mark_pixmap, &composer_prefs->mark_bitmap, 128); } static void @@ -96,6 +102,9 @@ mail_composer_prefs_finalise (GtkObject *obj) gtk_object_unref (GTK_OBJECT (prefs->gui)); gtk_object_unref (GTK_OBJECT (prefs->pman)); + gdk_pixbuf_unref (prefs->enabled_pixbuf); + gdk_pixmap_unref (prefs->mark_pixmap); + gdk_bitmap_unref (prefs->mark_bitmap); ((GtkObjectClass *)(parent_class))->finalize (obj); } @@ -510,7 +519,7 @@ spell_select_lang (MailComposerPrefs *prefs, const gchar *abrev) for (i = 0; i < prefs->language_seq->_length; i ++) { if (!strcasecmp (abrev, prefs->language_seq->_buffer [i].abrev)) { - gtk_clist_select_row (GTK_CLIST (prefs->language), i, 0); + gtk_clist_set_pixmap (GTK_CLIST (prefs->language), i, 0, prefs->mark_pixmap, prefs->mark_bitmap); } } } @@ -518,10 +527,16 @@ spell_select_lang (MailComposerPrefs *prefs, const gchar *abrev) static void spell_set_ui_language (MailComposerPrefs *prefs) { + gint i; gchar *l, *last, *lang; gtk_clist_freeze (GTK_CLIST (prefs->language)); gtk_clist_unselect_all (GTK_CLIST (prefs->language)); + + for (i = 0; i < prefs->language_seq->_length; i ++) { + gtk_clist_set_pixmap (GTK_CLIST (prefs->language), i, 0, NULL, NULL); + } + last = prefs->language_str; while ((l = strchr (last, ' '))) { if (l != last) { @@ -552,15 +567,20 @@ spell_set_ui (MailComposerPrefs *prefs) static gchar * spell_get_language_str (MailComposerPrefs *prefs) { - GList *selection = GTK_CLIST (prefs->language)->selection; GString *str = g_string_new (NULL); + gint i; gchar *rv; - for (; selection; selection = selection->next) { - g_string_append (str, gtk_clist_get_row_data (GTK_CLIST (prefs->language), - GPOINTER_TO_INT (selection->data))); - if (selection->next) - g_string_append_c (str, ' '); + for (i = 0; i < GTK_CLIST (prefs->language)->rows; i ++) { + GdkPixmap *pmap = NULL; + GdkBitmap *bmap; + + gtk_clist_get_pixmap (GTK_CLIST (prefs->language), i, 0, &pmap, &bmap); + if (pmap) { + if (str->len) + g_string_append_c (str, ' '); + g_string_append (str, gtk_clist_get_row_data (GTK_CLIST (prefs->language), i)); + } } rv = str->str; @@ -679,9 +699,81 @@ spell_color_set (GtkWidget *widget, guint r, guint g, guint b, guint a, gpointer } static void -spell_language_changed (GtkWidget *widget, gint row, gint column, GdkEvent *event, gpointer user_data) +spell_language_select_row (GtkWidget *widget, gint row, gint column, GdkEvent *event, MailComposerPrefs *prefs) { - spell_changed (user_data); + GList *sel = GTK_CLIST (prefs->language)->selection; + + if (sel) { + GdkPixmap *pmap = NULL; + GdkBitmap *bmap; + gint row = GPOINTER_TO_INT (sel->data); + + gtk_clist_get_pixmap (GTK_CLIST (prefs->language), row, 0, &pmap, &bmap); + if (pmap) + gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->spell_able_button)->child), _("Disable")); + else + gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->spell_able_button)->child), _("Enable")); + } + + gtk_widget_set_sensitive (prefs->spell_able_button, TRUE); +} + +static void +spell_language_unselect_row (GtkWidget *widget, gint row, gint column, GdkEvent *event, MailComposerPrefs *prefs) +{ + gtk_widget_set_sensitive (prefs->spell_able_button, FALSE); +} + +static void +spell_language_enable (GtkWidget *widget, MailComposerPrefs *prefs) +{ + GList *sel = GTK_CLIST (prefs->language)->selection; + + if (sel) { + GdkPixmap *pmap = NULL; + GdkBitmap *bmap; + gint row = GPOINTER_TO_INT (sel->data); + + gtk_clist_get_pixmap (GTK_CLIST (prefs->language), row, 0, &pmap, &bmap); + if (pmap) { + gtk_clist_set_pixmap (GTK_CLIST (prefs->language), row, 0, NULL, NULL); + gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->spell_able_button)->child), _("Enable")); + } else { + gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->spell_able_button)->child), _("Disable")); + gtk_clist_set_pixmap (GTK_CLIST (prefs->language), row, 0, prefs->mark_pixmap, prefs->mark_bitmap); + } + + spell_changed (prefs); + } +} + +static void +spell_language_button_press (GtkWidget *widget, GdkEventButton *event, MailComposerPrefs *prefs) +{ + gint row, col; + + if (gtk_clist_get_selection_info (prefs->language, event->x, event->y, &row, &col)) { + if (col == 0) { + GList *sel = GTK_CLIST (prefs->language)->selection; + GdkPixmap *pmap = NULL; + GdkBitmap *bmap; + + gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "button_press_event"); + + gtk_clist_get_pixmap (GTK_CLIST (prefs->language), row, 0, &pmap, &bmap); + if (pmap) + gtk_clist_set_pixmap (GTK_CLIST (prefs->language), row, 0, NULL, NULL); + else + gtk_clist_set_pixmap (GTK_CLIST (prefs->language), row, 0, + prefs->mark_pixmap, prefs->mark_bitmap); + + if (sel && GPOINTER_TO_INT (sel->data) == row) + gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->spell_able_button)->child), + pmap ? _("Enable") : _("Disable")); + + spell_changed (prefs); + } + } } static void @@ -691,9 +783,10 @@ spell_setup (MailComposerPrefs *prefs) gtk_clist_freeze (GTK_CLIST (prefs->language)); for (i = 0; i < prefs->language_seq->_length; i ++) { - gchar *texts [1]; + gchar *texts [2]; - texts [0] = _(prefs->language_seq->_buffer [i].name); + texts [0] = NULL; + texts [1] = _(prefs->language_seq->_buffer [i].name); gtk_clist_append (GTK_CLIST (prefs->language), texts); gtk_clist_set_row_data (GTK_CLIST (prefs->language), i, prefs->language_seq->_buffer [i].abrev); } @@ -703,7 +796,13 @@ spell_setup (MailComposerPrefs *prefs) spell_set_ui (prefs); glade_xml_signal_connect_data (prefs->gui, "spellColorSet", GTK_SIGNAL_FUNC (spell_color_set), prefs); - glade_xml_signal_connect_data (prefs->gui, "spellLanguageChanged", GTK_SIGNAL_FUNC (spell_language_changed), prefs); + glade_xml_signal_connect_data (prefs->gui, "spellLanguageSelectRow", + GTK_SIGNAL_FUNC (spell_language_select_row), prefs); + glade_xml_signal_connect_data (prefs->gui, "spellLanguageUnselectRow", + GTK_SIGNAL_FUNC (spell_language_unselect_row), prefs); + glade_xml_signal_connect_data (prefs->gui, "spellLanguageEnable", GTK_SIGNAL_FUNC (spell_language_enable), prefs); + + gtk_signal_connect (GTK_OBJECT (prefs->language), "button_press_event", spell_language_button_press, prefs); } static gboolean @@ -742,7 +841,7 @@ spell_setup_check_options (MailComposerPrefs *prefs) static void mail_composer_prefs_construct (MailComposerPrefs *prefs) { - GtkWidget *toplevel, *widget, *menu; + GtkWidget *toplevel, *widget, *menu, *info_pixmap; GladeXML *gui; int style; char *names[][2] = {{"live_spell_check", "chkEnableSpellChecking"}, @@ -802,6 +901,11 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs) /* Spell Checking: GNOME Spell part */ prefs->colour = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerSpellCheckColor")); prefs->language = GTK_CLIST (glade_xml_get_widget (gui, "clistSpellCheckLanguage")); + prefs->spell_able_button = glade_xml_get_widget (gui, "buttonSpellCheckEnable"); + info_pixmap = glade_xml_get_widget (gui, "pixmapSpellInfo"); + gtk_clist_set_column_justification (prefs->language, 0, GTK_JUSTIFY_RIGHT); + gtk_clist_set_column_auto_resize (prefs->language, 0, TRUE); + gnome_pixmap_load_file (GNOME_PIXMAP (info_pixmap), EVOLUTION_IMAGES "/info-bulb.png"); if (!spell_setup_check_options (prefs)) { gtk_widget_hide (GTK_WIDGET (prefs->colour)); diff --git a/mail/mail-composer-prefs.h b/mail/mail-composer-prefs.h index 37dc78f29f..a23cfbfbcc 100644 --- a/mail/mail-composer-prefs.h +++ b/mail/mail-composer-prefs.h @@ -83,6 +83,11 @@ struct _MailComposerPrefs { gchar *language_str_orig; GdkColor spell_error_color; GdkColor spell_error_color_orig; + GdkPixmap *mark_pixmap; + GdkBitmap *mark_bitmap; + GdkPixbuf *enabled_pixbuf; + GtkWidget *spell_able_button; + /* Forwards and Replies */ GtkOptionMenu *forward_style; diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 3ca74ed6df..e4dd881ee7 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -4055,158 +4055,6 @@ Baltic (ISO-8859-4) - - - GtkHBox - hbox164 - False - 3 - - 0 - True - True - - - - GtkFrame - frameSpellChecking - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - False - True - - - - GtkVBox - vbox157 - False - 0 - - - GtkCheckButton - chkEnableSpellChecking - True - - False - True - - 0 - False - False - - - - - GtkHBox - hboxSpellCheckColor - 3 - False - 3 - - 0 - False - True - - - - GnomeColorPicker - colorpickerSpellCheckColor - True - - color_set - spellColorSet - Wed, 08 May 2002 17:06:36 GMT - - True - False - Pick a color - - 0 - False - False - - - - - GtkLabel - lblSpellCheckColor - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - - - - GtkFrame - frame5 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkScrolledWindow - scrolledwindow47 - 3 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - - GtkCList - clistSpellCheckLanguage - True - - select_row - spellLanguageChanged - Wed, 08 May 2002 17:08:46 GMT - - - unselect_row - spellLanguageChanged - Wed, 08 May 2002 17:08:54 GMT - - 1 - 80 - GTK_SELECTION_MULTIPLE - False - GTK_SHADOW_IN - - - GtkLabel - CList:title - label447 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - @@ -4452,6 +4300,294 @@ Signature #2 0 0 + + + GtkVBox + vbox158 + 3 + False + 3 + + + GtkHBox + hbox167 + False + 0 + + 0 + False + True + + + + GnomePixmap + pixmapSpellInfo + info.png + + 0 + False + True + + + + + GtkLabel + label453 + + GTK_JUSTIFY_LEFT + True + 0 + 0.5 + 0 + 0 + + 0 + False + False + + + + + + GtkHSeparator + hseparator1 + + 0 + False + True + + + + + GtkHBox + hbox166 + False + 0 + + 0 + True + True + + + + GtkScrolledWindow + scrolledwindow48 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkCList + clistSpellCheckLanguage + True + + select_row + spellLanguageSelectRow + Wed, 29 May 2002 20:11:34 GMT + + + unselect_row + spellLanguageUnselectRow + Wed, 29 May 2002 22:11:35 GMT + + 2 + 80,80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN + + + GtkLabel + CList:title + label451 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + CList:title + label452 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + + GtkVBox + vbox159 + False + 5 + + 0 + False + True + + + + GtkLabel + label454 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkVButtonBox + vbuttonbox26 + GTK_BUTTONBOX_START + 0 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + buttonSpellCheckEnable + False + True + True + + clicked + spellLanguageEnable + Wed, 29 May 2002 20:10:43 GMT + + + GTK_RELIEF_NORMAL + + + + + + + GtkFrame + frameSpellChecking + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + False + + + + GtkVBox + vbox157 + False + 0 + + + GtkCheckButton + chkEnableSpellChecking + True + + False + True + + 0 + False + False + + + + + GtkHBox + hboxSpellCheckColor + 3 + False + 3 + + 0 + False + True + + + + GtkLabel + lblSpellCheckColor + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + colorpickerSpellCheckColor + + 0 + False + False + + + + + GnomeColorPicker + colorpickerSpellCheckColor + True + + color_set + spellColorSet + Wed, 08 May 2002 17:06:36 GMT + + True + False + Pick a color + + 0 + False + False + + + + + + + + + GtkLabel + Notebook:tab + label450 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + -- cgit