From 3c39e5ea2a6e7175e906d290b8a8e4531121547c Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Mon, 24 Jan 2005 21:11:07 +0000 Subject: Fixes #46287 2005-01-21 JP Rosevear Fixes #46287 * mail-config.glade: remove enable/disable button * em-composer-prefs.h: remove unused button * em-composer-prefs.c (spell_language_toggled): handle the cell being toggled (spell_setup): enable/disable button is gone (em_composer_prefs_construct): setup a listener for the toggle cell svn path=/trunk/; revision=28535 --- mail/ChangeLog | 20 +++++++++- mail/em-composer-prefs.c | 86 ++++++------------------------------------- mail/em-composer-prefs.h | 1 - mail/mail-config.glade | 95 ++++++++++++++++-------------------------------- 4 files changed, 63 insertions(+), 139 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 5f77219536..3b7d1ae020 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,21 @@ +2005-01-24 JP Rosevear + + * searchtypes.xml: add back body contains + +2005-01-21 JP Rosevear + + Fixes #46287 + + * mail-config.glade: remove enable/disable button + + * em-composer-prefs.h: remove unused button + + * em-composer-prefs.c (spell_language_toggled): handle the cell + being toggled + (spell_setup): enable/disable button is gone + (em_composer_prefs_construct): setup a listener for the toggle + cell + 2005-01-24 Radek Doulik * em-popup.[ch]: removed EM_POPUP_SELECT_MARK_[NO]JUNK masks @@ -13,7 +31,7 @@ * searchtypes.xml: changed for 69122. 2005-01-21 JP Rosevear - + Fixes #46404 * em-folder-view.c (emfv_print_response): use the config in the diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c index f9e1750251..33f0908a1c 100644 --- a/mail/em-composer-prefs.c +++ b/mail/em-composer-prefs.c @@ -579,28 +579,6 @@ spell_color_set (GtkWidget *widget, guint r, guint g, guint b, guint a, EMCompos gconf_client_set_int (prefs->gconf, GNOME_SPELL_GCONF_DIR "/spell_error_color_blue", b, NULL); } -static void -spell_live_toggled (GtkWidget *widget, gpointer user_data) -{ - /* FIXME: what gconf key is this? */ -} - -static void -spell_language_selection_changed (GtkTreeSelection *selection, EMComposerPrefs *prefs) -{ - GtkTreeIter iter; - GtkTreeModel *model; - gboolean state = FALSE; - - if (gtk_tree_selection_get_selected (selection, &model, &iter)) { - gtk_tree_model_get ((GtkTreeModel *) model, &iter, 0, &state, -1); - gtk_button_set_label ((GtkButton *) prefs->spell_able_button, state ? _("Disable") : _("Enable")); - state = TRUE; - } - - gtk_widget_set_sensitive (prefs->spell_able_button, state); -} - static char * spell_get_language_str (EMComposerPrefs *prefs) { @@ -637,58 +615,25 @@ spell_get_language_str (EMComposerPrefs *prefs) return rv; } -static void -spell_language_enable (GtkWidget *widget, EMComposerPrefs *prefs) -{ - GtkTreeIter iter; - GtkTreeModel *model; - GtkTreeSelection *selection; - gboolean state; - char *str; - - selection = gtk_tree_view_get_selection (prefs->language); - if (!gtk_tree_selection_get_selected (selection, &model, &iter)) - return; - - gtk_tree_model_get (model, &iter, 0, &state, -1); - gtk_list_store_set ((GtkListStore *) model, &iter, 0, !state, -1); - gtk_button_set_label ((GtkButton *) prefs->spell_able_button, state ? _("Enable") : _("Disable")); - - str = spell_get_language_str (prefs); - gconf_client_set_string (prefs->gconf, GNOME_SPELL_GCONF_DIR "/language", str ? str : "", NULL); - g_free (str); -} - -static gboolean -spell_language_button_press (GtkTreeView *treeview, GdkEventButton *event, EMComposerPrefs *prefs) +static void +spell_language_toggled (GtkCellRendererToggle *renderer, const char *path_string, EMComposerPrefs *prefs) { - GtkTreeViewColumn *column = NULL; - GtkTreePath *path = NULL; + GtkTreePath *path = gtk_tree_path_new_from_string (path_string); GtkTreeModel *model; GtkTreeIter iter; gboolean enabled; char *str; - if (!(gtk_tree_view_get_path_at_pos (treeview, event->x, event->y, &path, &column, NULL, NULL))) - return FALSE; - - /* FIXME: This routine should just be a "toggled" event handler on the checkbox cell renderer which - has "activatable" set. */ - - if (strcmp (gtk_tree_view_column_get_title (column), _("Enabled")) != 0) - return FALSE; - - model = gtk_tree_view_get_model (treeview); + model = gtk_tree_view_get_model (prefs->language); gtk_tree_model_get_iter (model, &iter, path); gtk_tree_model_get (model, &iter, 0, &enabled, -1); gtk_list_store_set ((GtkListStore *) model, &iter, 0, !enabled, -1); - gtk_button_set_label ((GtkButton *) prefs->spell_able_button, enabled ? _("Enable") : _("Disable")); str = spell_get_language_str (prefs); gconf_client_set_string (prefs->gconf, GNOME_SPELL_GCONF_DIR "/language", str ? str : "", NULL); g_free (str); - - return FALSE; + + gtk_tree_path_free (path); } static void @@ -715,14 +660,6 @@ spell_setup (EMComposerPrefs *prefs) widget = glade_xml_get_widget (prefs->gui, "colorpickerSpellCheckColor"); g_signal_connect (widget, "color_set", G_CALLBACK (spell_color_set), prefs); - - widget = glade_xml_get_widget (prefs->gui, "buttonSpellCheckEnable"); - g_signal_connect (widget, "clicked", G_CALLBACK (spell_language_enable), prefs); - - widget = glade_xml_get_widget (prefs->gui, "chkEnableSpellChecking"); - g_signal_connect (widget, "toggled", G_CALLBACK (spell_live_toggled), prefs); - - g_signal_connect (prefs->language, "button_press_event", G_CALLBACK (spell_language_button_press), prefs); } static gboolean @@ -879,6 +816,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) GladeXML *gui; GtkListStore *model; GtkTreeSelection *selection; + GtkCellRenderer *cell_renderer; int style; char *buf; EMConfig *ec; @@ -942,19 +880,19 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) prefs->language = GTK_TREE_VIEW (glade_xml_get_widget (gui, "listSpellCheckLanguage")); model = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER); gtk_tree_view_set_model (prefs->language, (GtkTreeModel *) model); + cell_renderer = gtk_cell_renderer_toggle_new (); gtk_tree_view_insert_column_with_attributes (prefs->language, -1, _("Enabled"), - gtk_cell_renderer_toggle_new (), + cell_renderer, "active", 0, NULL); + g_signal_connect (cell_renderer, "toggled", G_CALLBACK (spell_language_toggled), prefs); + gtk_tree_view_insert_column_with_attributes (prefs->language, -1, _("Language(s)"), gtk_cell_renderer_text_new (), "text", 1, NULL); selection = gtk_tree_view_get_selection (prefs->language); - gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); - g_signal_connect (selection, "changed", G_CALLBACK (spell_language_selection_changed), prefs); - - prefs->spell_able_button = glade_xml_get_widget (gui, "buttonSpellCheckEnable"); + gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE); info_pixmap = glade_xml_get_widget (gui, "pixmapSpellInfo"); gtk_image_set_from_stock (GTK_IMAGE (info_pixmap), GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_BUTTON); if (!spell_setup_check_options (prefs)) { diff --git a/mail/em-composer-prefs.h b/mail/em-composer-prefs.h index 74a2a3cf98..ca64ead692 100644 --- a/mail/em-composer-prefs.h +++ b/mail/em-composer-prefs.h @@ -77,7 +77,6 @@ struct _EMComposerPrefs { gboolean spell_active; struct _GdkPixbuf *enabled_pixbuf; - struct _GtkWidget *spell_able_button; /* Forwards and Replies */ struct _GtkOptionMenu *forward_style; diff --git a/mail/mail-config.glade b/mail/mail-config.glade index d8a7196158..225ba5b756 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -7231,57 +7231,6 @@ For example: "Work" or "Personal" False 12 - - - True - False - 6 - - - - True - gtk-dialog-info - 6 - 0.5 - 0 - 0 - 0 - - - 0 - False - True - - - - - - True - This page allows you to configure spell checking behavior and language. The list of languages here reflects only the languages for which you have a dictionary installed. - False - False - GTK_JUSTIFY_LEFT - True - False - 0 - 0.5 - 0 - 0 - - - 0 - True - True - - - - - 0 - False - False - - - True @@ -7402,33 +7351,53 @@ For example: "Work" or "Personal" - + True False 6 - + True - False - True - True - _Enable - True - GTK_RELIEF_NORMAL - True + gtk-dialog-info + 4 + 0.5 + 0 + 0 + 0 0 False - False + True + + + + + + True + The list of languages here reflects only the languages for which you have a dictionary installed. + False + False + GTK_JUSTIFY_LEFT + True + False + 0 + 0.5 + 0 + 0 + + + 0 + True + True 0 False - False + True @@ -7607,7 +7576,7 @@ For example: "Work" or "Personal" 0 False - False + True -- cgit