From 8a072ffc7c0ddcde472877a51ace0bb14f86fb0a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 24 Apr 2009 11:45:21 +0200 Subject: GN-bug #572348 - Removed deprecated Gtk+ symbols Some still left, because those gone in kill-bonobo branch. --- filter/ChangeLog | 10 +++ filter/filter-datespec.c | 49 +++++--------- filter/filter-option.c | 34 +++------- filter/filter-rule.c | 80 ++++++++++------------ filter/filter.glade | 171 ++++++++--------------------------------------- 5 files changed, 101 insertions(+), 243 deletions(-) (limited to 'filter') diff --git a/filter/ChangeLog b/filter/ChangeLog index a30463deb5..656210ddce 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,13 @@ +2009-04-24 Milan Crha + + ** Fix for bug #572348 + + * filter.glade: + * filter-datespec.c: + * filter-rule.c: + * filter-option.c: + Remove deprecated Gtk+ symbols. + 2009-01-11 Tor Lillqvist * filter-option.c (get_dynamic_options): Add cast to avoid diff --git a/filter/filter-datespec.c b/filter/filter-datespec.c index 82b0e08197..599681c4d4 100644 --- a/filter/filter-datespec.c +++ b/filter/filter-datespec.c @@ -95,7 +95,7 @@ static const timespan timespans[] = { struct _FilterDatespecPrivate { GtkWidget *label_button; - GtkWidget *notebook_type, *option_type, *calendar_specify, *spin_relative, *option_relative, *option_past_future; + GtkWidget *notebook_type, *combobox_type, *calendar_specify, *spin_relative, *combobox_relative, *combobox_past_future; FilterDatespec_type type; int span; }; @@ -385,49 +385,39 @@ set_values (FilterDatespec *fds) case FDST_X_AGO: p->span = get_best_span(fds->value); gtk_spin_button_set_value((GtkSpinButton*)p->spin_relative, fds->value/timespans[p->span].seconds); - gtk_option_menu_set_history((GtkOptionMenu*)p->option_relative, p->span); - gtk_option_menu_set_history((GtkOptionMenu*)p->option_past_future, 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (p->combobox_relative), p->span); + gtk_combo_box_set_active (GTK_COMBO_BOX (p->combobox_past_future), 0); break; case FDST_X_FUTURE: p->span = get_best_span(fds->value); gtk_spin_button_set_value((GtkSpinButton*)p->spin_relative, fds->value/timespans[p->span].seconds); - gtk_option_menu_set_history((GtkOptionMenu*)p->option_relative, p->span); - gtk_option_menu_set_history((GtkOptionMenu*)p->option_past_future, 1); + gtk_combo_box_set_active (GTK_COMBO_BOX (p->combobox_relative), p->span); + gtk_combo_box_set_active (GTK_COMBO_BOX (p->combobox_past_future), 1); break; } gtk_notebook_set_current_page ((GtkNotebook*) p->notebook_type, note_type); - gtk_option_menu_set_history ((GtkOptionMenu*) p->option_type, note_type); + gtk_combo_box_set_active (GTK_COMBO_BOX (p->combobox_type), note_type); } static void -set_option_type (GtkMenu *menu, FilterDatespec *fds) +set_combobox_type (GtkComboBox *combobox, FilterDatespec *fds) { - GtkWidget *w; - - /* ugh, no other way to 'get_history' */ - w = gtk_menu_get_active (menu); - fds->priv->type = g_list_index (GTK_MENU_SHELL (menu)->children, w); + fds->priv->type = gtk_combo_box_get_active (combobox); gtk_notebook_set_current_page ((GtkNotebook*) fds->priv->notebook_type, fds->priv->type); } static void -set_option_relative (GtkMenu *menu, FilterDatespec *fds) +set_combobox_relative (GtkComboBox *combobox, FilterDatespec *fds) { - GtkWidget *w; - - w = gtk_menu_get_active (menu); - fds->priv->span = g_list_index (GTK_MENU_SHELL (menu)->children, w); + fds->priv->span = gtk_combo_box_get_active (combobox); } static void -set_option_past_future (GtkMenu *menu, FilterDatespec *fds) +set_combobox_past_future (GtkComboBox *combobox, FilterDatespec *fds) { - GtkWidget *w; - - w = gtk_menu_get_active (menu); - if(g_list_index (GTK_MENU_SHELL (menu)->children, w) == 0) + if (gtk_combo_box_get_active (combobox) == 0) fds->type = fds->priv->type = FDST_X_AGO; else fds->type = fds->priv->type = FDST_X_FUTURE; @@ -457,20 +447,17 @@ button_clicked (GtkButton *button, FilterDatespec *fds) gtk_dialog_set_has_separator (dialog, FALSE); p->notebook_type = glade_xml_get_widget (gui, "notebook_type"); - p->option_type = glade_xml_get_widget (gui, "option_type"); + p->combobox_type = glade_xml_get_widget (gui, "combobox_type"); p->calendar_specify = glade_xml_get_widget (gui, "calendar_specify"); p->spin_relative = glade_xml_get_widget (gui, "spin_relative"); - p->option_relative = glade_xml_get_widget (gui, "option_relative"); - p->option_past_future = glade_xml_get_widget (gui, "option_past_future"); + p->combobox_relative = glade_xml_get_widget (gui, "combobox_relative"); + p->combobox_past_future = glade_xml_get_widget (gui, "combobox_past_future"); set_values (fds); - g_signal_connect (GTK_OPTION_MENU (p->option_type)->menu, "deactivate", - G_CALLBACK (set_option_type), fds); - g_signal_connect (GTK_OPTION_MENU (p->option_relative)->menu, "deactivate", - G_CALLBACK (set_option_relative), fds); - g_signal_connect (GTK_OPTION_MENU (p->option_past_future)->menu, "deactivate", - G_CALLBACK (set_option_past_future), fds); + g_signal_connect (p->combobox_type, "changed", G_CALLBACK (set_combobox_type), fds); + g_signal_connect (p->combobox_relative, "changed", G_CALLBACK (set_combobox_relative), fds); + g_signal_connect (p->combobox_past_future, "changed", G_CALLBACK (set_combobox_past_future), fds); gtk_box_pack_start ((GtkBox *) dialog->vbox, toplevel, TRUE, TRUE, 3); diff --git a/filter/filter-option.c b/filter/filter-option.c index 7af511b543..3b93084d67 100644 --- a/filter/filter-option.c +++ b/filter/filter-option.c @@ -342,11 +342,11 @@ xml_decode (FilterElement *fe, xmlNodePtr node) } static void -option_changed (GtkWidget *widget, FilterElement *fe) +combobox_changed (GtkWidget *widget, FilterElement *fe) { FilterOption *fo = (FilterOption *)fe; - fo->current = g_object_get_data ((GObject *) widget, "option"); + fo->current = (struct _filter_option *) g_list_nth (fo->options, gtk_combo_box_get_active (GTK_COMBO_BOX (widget))); } static GSList * @@ -376,10 +376,7 @@ static GtkWidget * get_widget (FilterElement *fe) { FilterOption *fo = (FilterOption *)fe; - GtkWidget *menu; - GtkWidget *omenu; - GtkWidget *item; - GtkWidget *first = NULL; + GtkWidget *combobox; GList *l; struct _filter_option *op; int index = 0, current = 0; @@ -436,35 +433,20 @@ get_widget (FilterElement *fe) g_list_free (old_ops); } - menu = gtk_menu_new (); + combobox = gtk_combo_box_new_text (); l = fo->options; while (l) { op = l->data; - item = gtk_menu_item_new_with_label (_(op->title)); - g_object_set_data ((GObject *) item, "option", op); - g_signal_connect (item, "activate", G_CALLBACK (option_changed), fe); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show (item); - if (op == fo->current) { - current = index; - first = item; - } else if (!first) { - first = item; - } + gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _(op->title)); l = g_list_next (l); index++; } - omenu = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); - - if (first) - g_signal_emit_by_name (first, "activate", fe); - - gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current); + g_signal_connect (combobox, "changed", G_CALLBACK (combobox_changed), fe); + gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), current); - return omenu; + return combobox; } static void diff --git a/filter/filter-rule.c b/filter/filter-rule.c index 9febe8d0ee..7972de13d0 100644 --- a/filter/filter-rule.c +++ b/filter/filter-rule.c @@ -605,13 +605,13 @@ build_code (FilterRule *fr, GString *out) static void fr_grouping_changed(GtkWidget *w, FilterRule *fr) { - fr->grouping = gtk_option_menu_get_history((GtkOptionMenu *)w); + fr->grouping = gtk_combo_box_get_active (GTK_COMBO_BOX (w)); } static void fr_threading_changed(GtkWidget *w, FilterRule *fr) { - fr->threading = gtk_option_menu_get_history((GtkOptionMenu *)w); + fr->threading = gtk_combo_box_get_active (GTK_COMBO_BOX (w)); } struct _part_data { @@ -622,11 +622,20 @@ struct _part_data { }; static void -option_activate (GtkMenuItem *item, struct _part_data *data) +part_combobox_changed (GtkComboBox *combobox, struct _part_data *data) { - FilterPart *part = g_object_get_data ((GObject *) item, "part"); + FilterPart *part = NULL; FilterPart *newpart; + int index, i; + + index = gtk_combo_box_get_active (combobox); + for (i = 0, part = rule_context_next_part (data->f, part); part && i < index; i++, part = rule_context_next_part (data->f, part)) { + /* traverse until reached index */ + } + g_return_if_fail (part != NULL); + g_return_if_fail (i == index); + /* dont update if we haven't changed */ if (!strcmp (part->title, data->part->title)) return; @@ -644,17 +653,13 @@ option_activate (GtkMenuItem *item, struct _part_data *data) data->partwidget = filter_part_get_widget (newpart); if (data->partwidget) gtk_box_pack_start (GTK_BOX (data->container), data->partwidget, TRUE, TRUE, 0); - - g_object_set_data ((GObject *) data->container, "part", newpart); } static GtkWidget * get_rule_part_widget (RuleContext *f, FilterPart *newpart, FilterRule *fr) { FilterPart *part = NULL; - GtkWidget *menu; - GtkWidget *item; - GtkWidget *omenu; + GtkWidget *combobox; GtkWidget *hbox; GtkWidget *p; int index = 0, current = 0; @@ -674,26 +679,23 @@ get_rule_part_widget (RuleContext *f, FilterPart *newpart, FilterRule *fr) data->partwidget = p; data->container = hbox; - menu = gtk_menu_new (); + combobox = gtk_combo_box_new_text (); + /* sigh, this is a little ugly */ while ((part = rule_context_next_part (f, part))) { - item = gtk_menu_item_new_with_label (_(part->title)); - g_object_set_data ((GObject *) item, "part", part); - g_signal_connect (item, "activate", G_CALLBACK (option_activate), data); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show (item); + gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _(part->title)); + if (!strcmp (newpart->title, part->title)) current = index; index++; } - omenu = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); - gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current); - gtk_widget_show (omenu); + gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), current); + g_signal_connect (combobox, "changed", G_CALLBACK (part_combobox_changed), data); + gtk_widget_show (combobox); - gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), combobox, FALSE, FALSE, 0); if (p) gtk_box_pack_start (GTK_BOX (hbox), p, TRUE, TRUE, 0); @@ -836,7 +838,7 @@ get_widget (FilterRule *fr, struct _RuleContext *f) { GtkWidget *hbox, *vbox, *parts, *inframe; GtkWidget *add, *label, *name, *w; - GtkWidget *omenu, *menu, *item; + GtkWidget *combobox; GtkWidget *scrolledwindow; GtkObject *hadj, *vadj; GList *l; @@ -920,48 +922,40 @@ get_widget (FilterRule *fr, struct _RuleContext *f) const char *thread_types[] = { N_("If all conditions are met"), N_("If any conditions are met") }; label = gtk_label_new_with_mnemonic (_("_Find items:")); - menu = gtk_menu_new (); + combobox = gtk_combo_box_new_text (); for (i=0;i<2;i++) { - item = gtk_menu_item_new_with_label(_(thread_types[i])); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show (item); + gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _(thread_types[i])); } - omenu = gtk_option_menu_new (); - gtk_label_set_mnemonic_widget ((GtkLabel *)label, omenu); - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); - gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), fr->grouping); - gtk_widget_show (omenu); + gtk_label_set_mnemonic_widget ((GtkLabel *)label, combobox); + gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), fr->grouping); + gtk_widget_show (combobox); - gtk_box_pack_end (GTK_BOX (hbox), omenu, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (hbox), combobox, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); - g_signal_connect(omenu, "changed", G_CALLBACK(fr_grouping_changed), fr); + g_signal_connect (combobox, "changed", G_CALLBACK (fr_grouping_changed), fr); } if (f->flags & RULE_CONTEXT_THREADING) { const char *thread_types[] = { N_("None"), N_("All related"), N_("Replies"), N_("Replies and parents"), N_("No reply or parent") }; label = gtk_label_new_with_mnemonic (_("I_nclude threads")); - menu = gtk_menu_new (); + combobox = gtk_combo_box_new_text (); for (i=0;i<5;i++) { - item = gtk_menu_item_new_with_label(_(thread_types[i])); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show (item); + gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _(thread_types[i])); } - omenu = gtk_option_menu_new (); - gtk_label_set_mnemonic_widget ((GtkLabel *)label, omenu); - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); - gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), fr->threading); - gtk_widget_show (omenu); + gtk_label_set_mnemonic_widget ((GtkLabel *)label, combobox); + gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), fr->threading); + gtk_widget_show (combobox); - gtk_box_pack_end (GTK_BOX (hbox), omenu, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (hbox), combobox, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); - g_signal_connect(omenu, "changed", G_CALLBACK(fr_threading_changed), fr); + g_signal_connect (combobox, "changed", G_CALLBACK (fr_threading_changed), fr); } gtk_box_pack_start (GTK_BOX (inframe), hbox, FALSE, FALSE, 3); diff --git a/filter/filter.glade b/filter/filter.glade index 3b43c26249..3773a234c1 100644 --- a/filter/filter.glade +++ b/filter/filter.glade @@ -6,7 +6,7 @@ True - window1 + window1 GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -53,23 +53,11 @@ - - True - 0 - - - - True - - - - True - Incoming - True - - - - + + True + Incoming + False + True 0 @@ -298,7 +286,7 @@ 6 True - window1 + window1 GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -351,40 +339,13 @@ - + True - True - 0 - - - - True - - - - True - the current time - True - - - - - - True - the time you specify - True - - - - - - True - a time relative to the current time - True - - - - + the current time +the time you specify +a time relative to the current time + False + True 0 @@ -625,72 +586,17 @@ a time relative to when filtering occurs. - + True - True - 0 - - - - True - - - - True - seconds - True - - - - - - True - minutes - True - - - - - - True - hours - True - - - - - - True - days - True - - - - - - True - weeks - True - - - - - - True - months - True - - - - - - True - years - True - - - - + seconds +minutes +hours +days +weeks +months +years + False + True 0 @@ -700,33 +606,12 @@ a time relative to when filtering occurs. - + True - True - 0 - - - - True - - - - True - ago - True - - - - - - True - in the future - True - - - - - + ago +in the future + False + True 0 -- cgit v1.2.3