From 0806967bd0118313a7bd4c5567603a8abba266b0 Mon Sep 17 00:00:00 2001 From: Johnny Jacob Date: Tue, 11 Jul 2006 17:20:36 +0000 Subject: Fixes #246235. Deleted the option menu and replaced with radio buttons. 2006-07-11 Johnny Jacob Fixes #246235. * em-vfolder-rule.c (get_widget): Deleted the option menu and replaced with radio buttons. * mail-dialogs.glade: Removed option menu and added radio buttons svn path=/trunk/; revision=32290 --- mail/ChangeLog | 7 ++++ mail/em-vfolder-rule.c | 48 +++++++++++++++++----- mail/em-vfolder-rule.h | 4 +- mail/mail-dialogs.glade | 103 +++++++++++++++++++++++++++++++----------------- 4 files changed, 114 insertions(+), 48 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 24754d5d53..1d4c4dc4ef 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2006-07-11 Johnny Jacob + + Fixes #246235. + * em-vfolder-rule.c (get_widget): Deleted the option menu and + replaced with radio buttons. + * mail-dialogs.glade: Removed option menu and added radio buttons + 2006-07-11 Johnny Jacob ** Fixes Bug # 324241 diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c index 467392c685..848d6dc5c5 100644 --- a/mail/em-vfolder-rule.c +++ b/mail/em-vfolder-rule.c @@ -57,9 +57,9 @@ static void em_vfolder_rule_finalise(GObject *obj); /* DO NOT internationalise these strings */ static const char *with_names[] = { "specific", - "local", + "local_remote_active", "remote_active", - "local_remote_active" + "local" }; static FilterRuleClass *parent_class = NULL; @@ -256,7 +256,6 @@ xml_encode(FilterRule *fr) EMVFolderRule *vr =(EMVFolderRule *)fr; xmlNodePtr node, set, work; GList *l; - node = FILTER_RULE_CLASS(parent_class)->xml_encode(fr); g_assert(node != NULL); g_assert(vr->with >= 0 && vr->with < sizeof(with_names)/sizeof(with_names[0])); @@ -373,6 +372,7 @@ struct _source_data { const char *current; GtkListStore *model; GtkTreeView *list; + GtkWidget *source_selector; GtkButton *buttons[BUTTON_LAST]; }; @@ -414,10 +414,25 @@ static void select_source_with_changed(GtkWidget *widget, struct _source_data *data) { em_vfolder_rule_with_t with; + GList *group = NULL; + gboolean sensitive = FALSE; + gint i = 0; + + if ( !gtk_toggle_button_get_active (widget) ) + return; - with = gtk_option_menu_get_history((GtkOptionMenu *)widget); - if (with < EM_VFOLDER_RULE_WITH_SPECIFIC || with > EM_VFOLDER_RULE_WITH_LOCAL_REMOTE_ACTIVE) + group = gtk_radio_button_get_group (widget); + + for (i=0; i< g_list_length(group); i++) { + if ( g_list_nth_data (group, with = i) == widget ) + break; + } + + if ( with < EM_VFOLDER_RULE_WITH_SPECIFIC || with > EM_VFOLDER_RULE_WITH_LOCAL ) with = 0; + + gtk_widget_set_sensitive (data->source_selector, !with ); + data->vr->with = with; } @@ -598,7 +613,8 @@ get_widget(FilterRule *fr, RuleContext *rc) EMVFolderRule *vr =(EMVFolderRule *)fr; GtkWidget *widget, *frame, *list; struct _source_data *data; - GtkOptionMenu *omenu; + GtkRadioButton *rb; + GList *group; const char *source; GtkTreeIter iter; GladeXML *gui; @@ -641,9 +657,23 @@ get_widget(FilterRule *fr, RuleContext *rc) g_signal_connect(data->list, "cursor-changed", G_CALLBACK(select_source), data); - omenu =(GtkOptionMenu *)glade_xml_get_widget(gui, "source_option"); - gtk_option_menu_set_history(omenu, vr->with); - g_signal_connect(omenu, "changed", G_CALLBACK(select_source_with_changed), data); + rb = (GtkRadioButton *)glade_xml_get_widget (gui, "local_rb"); + g_signal_connect (GTK_WIDGET(rb), "toggled", G_CALLBACK(select_source_with_changed), data); + + rb = (GtkRadioButton *)glade_xml_get_widget (gui, "remote_rb"); + g_signal_connect (GTK_WIDGET(rb), "toggled", G_CALLBACK(select_source_with_changed), data); + + rb = (GtkRadioButton *)glade_xml_get_widget (gui, "local_and_remote_rb"); + g_signal_connect (GTK_WIDGET(rb), "toggled", G_CALLBACK(select_source_with_changed), data); + + rb = (GtkRadioButton *)glade_xml_get_widget (gui, "specific_rb"); + g_signal_connect (GTK_WIDGET(rb), "toggled", G_CALLBACK(select_source_with_changed), data); + + data->source_selector = (GtkWidget *)glade_xml_get_widget (gui, "source_selector"); + + rb = g_list_nth_data(gtk_radio_button_get_group (rb), vr->with); + gtk_toggle_button_set_active (rb, TRUE); + gtk_signal_emit_by_name (rb, "toggled"); set_sensitive(data); diff --git a/mail/em-vfolder-rule.h b/mail/em-vfolder-rule.h index 717df74709..b5afa50c74 100644 --- a/mail/em-vfolder-rule.h +++ b/mail/em-vfolder-rule.h @@ -34,9 +34,9 @@ /* perhaps should be bits? */ enum _em_vfolder_rule_with_t { EM_VFOLDER_RULE_WITH_SPECIFIC, - EM_VFOLDER_RULE_WITH_LOCAL, - EM_VFOLDER_RULE_WITH_REMOTE_ACTIVE, EM_VFOLDER_RULE_WITH_LOCAL_REMOTE_ACTIVE, + EM_VFOLDER_RULE_WITH_REMOTE_ACTIVE, + EM_VFOLDER_RULE_WITH_LOCAL, }; typedef struct _EMVFolderRule EMVFolderRule; diff --git a/mail/mail-dialogs.glade b/mail/mail-dialogs.glade index 89093ec45a..45677b6ffe 100644 --- a/mail/mail-dialogs.glade +++ b/mail/mail-dialogs.glade @@ -1600,48 +1600,77 @@ Please select a follow up action from the "Flag" menu. 6 - + True True - 0 - - - - True + All local folders + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + - - - True - specific folders only - True - - + + + True + True + All active remote folders + True + GTK_RELIEF_NORMAL + True + False + False + True + local_rb + + + 0 + False + False + + - - - True - with all local folders - True - - + + + True + True + All local and active remote folders + True + GTK_RELIEF_NORMAL + True + False + False + True + local_rb + + + 0 + False + False + + - - - True - with all active remote folders - True - - + + + True + True + Specific folders + True + GTK_RELIEF_NORMAL + True + False + False + True + local_rb - - - True - with all local and active remote folders - True - - - - 0 @@ -1651,7 +1680,7 @@ Please select a follow up action from the "Flag" menu. - + True False 6 -- cgit v1.2.3