diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2006-08-14 20:58:21 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@src.gnome.org> | 2006-08-14 20:58:21 +0000 |
commit | e4f6c9d4d00daf6bac3898e75268ebdb92bba091 (patch) | |
tree | 071c9c5f0bd7b54a77bdb16f9a39406f24ba0e0f | |
parent | f060a9866f4a1b6214ac8defd13cb875b9050630 (diff) | |
download | gtk+-e4f6c9d4d00daf6bac3898e75268ebdb92bba091.tar.gz |
Add a check on the filter argument, instead of blindly passing it to
2006-08-14 Emmanuele Bassi <ebassi@gnome.org>
* gtk/gtkrecentchooser.c:
(gtk_recent_chooser_add_filter),
(gtk_recent_chooser_remove_filter),
(gtk_recent_chooser_set_filter): Add a check on the
filter argument, instead of blindly passing it to
underlying implementation.
* gtk/gtkrecentchoosermenu.c:
(gtk_recent_chooser_menu_add_filter),
(gtk_recent_chooser_menu_remove_filter),
(gtk_recent_chooser_menu_list_filters): Implement
these GtkRecentChooser methods, by setting and
returning the only GtkRecentFilter object supported
by a GtkRecentChooserMenu. (#347856, reported by Rod
Butcher)
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 18 | ||||
-rw-r--r-- | gtk/gtkrecentchooser.c | 3 | ||||
-rw-r--r-- | gtk/gtkrecentchoosermenu.c | 39 |
4 files changed, 66 insertions, 12 deletions
@@ -1,3 +1,21 @@ +2006-08-14 Emmanuele Bassi <ebassi@gnome.org> + + * gtk/gtkrecentchooser.c: + (gtk_recent_chooser_add_filter), + (gtk_recent_chooser_remove_filter), + (gtk_recent_chooser_set_filter): Add a check on the + filter argument, instead of blindly passing it to + underlying implementation. + + * gtk/gtkrecentchoosermenu.c: + (gtk_recent_chooser_menu_add_filter), + (gtk_recent_chooser_menu_remove_filter), + (gtk_recent_chooser_menu_list_filters): Implement + these GtkRecentChooser methods, by setting and + returning the only GtkRecentFilter object supported + by a GtkRecentChooserMenu. (#347856, reported by Rod + Butcher) + 2006-08-14 Matthias Clasen <mclasen@redhat.com> * gtk/gtkcombobox.c (gtk_combo_box_remove): Null the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 7b6d3da39f..eea2417b96 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,21 @@ +2006-08-14 Emmanuele Bassi <ebassi@gnome.org> + + * gtk/gtkrecentchooser.c: + (gtk_recent_chooser_add_filter), + (gtk_recent_chooser_remove_filter), + (gtk_recent_chooser_set_filter): Add a check on the + filter argument, instead of blindly passing it to + underlying implementation. + + * gtk/gtkrecentchoosermenu.c: + (gtk_recent_chooser_menu_add_filter), + (gtk_recent_chooser_menu_remove_filter), + (gtk_recent_chooser_menu_list_filters): Implement + these GtkRecentChooser methods, by setting and + returning the only GtkRecentFilter object supported + by a GtkRecentChooserMenu. (#347856, reported by Rod + Butcher) + 2006-08-14 Matthias Clasen <mclasen@redhat.com> * gtk/gtkcombobox.c (gtk_combo_box_remove): Null the diff --git a/gtk/gtkrecentchooser.c b/gtk/gtkrecentchooser.c index fe2c39dc19..06b5fdd764 100644 --- a/gtk/gtkrecentchooser.c +++ b/gtk/gtkrecentchooser.c @@ -884,6 +884,7 @@ gtk_recent_chooser_add_filter (GtkRecentChooser *chooser, GtkRecentFilter *filter) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); + g_return_if_fail (GTK_IS_RECENT_FILTER (filter)); GTK_RECENT_CHOOSER_GET_IFACE (chooser)->add_filter (chooser, filter); } @@ -902,6 +903,7 @@ gtk_recent_chooser_remove_filter (GtkRecentChooser *chooser, GtkRecentFilter *filter) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); + g_return_if_fail (GTK_IS_RECENT_FILTER (filter)); GTK_RECENT_CHOOSER_GET_IFACE (chooser)->remove_filter (chooser, filter); } @@ -940,6 +942,7 @@ gtk_recent_chooser_set_filter (GtkRecentChooser *chooser, GtkRecentFilter *filter) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); + g_return_if_fail (GTK_IS_RECENT_FILTER (filter)); g_object_set (G_OBJECT (chooser), "filter", filter, NULL); } diff --git a/gtk/gtkrecentchoosermenu.c b/gtk/gtkrecentchoosermenu.c index 1e066744b3..6f1b636993 100644 --- a/gtk/gtkrecentchoosermenu.c +++ b/gtk/gtkrecentchoosermenu.c @@ -671,28 +671,40 @@ static void gtk_recent_chooser_menu_add_filter (GtkRecentChooser *chooser, GtkRecentFilter *filter) { - g_warning (_("This function is not implemented for " - "widgets of class '%s'"), - g_type_name (G_OBJECT_TYPE (chooser))); + GtkRecentChooserMenu *menu; + + menu = GTK_RECENT_CHOOSER_MENU (chooser); + + gtk_recent_chooser_menu_set_current_filter (menu, filter); } static void gtk_recent_chooser_menu_remove_filter (GtkRecentChooser *chooser, GtkRecentFilter *filter) { - g_warning (_("This function is not implemented for " - "widgets of class '%s'"), - g_type_name (G_OBJECT_TYPE (chooser))); + GtkRecentChooserMenu *menu; + + menu = GTK_RECENT_CHOOSER_MENU (chooser); + + if (filter == menu->priv->current_filter) + { + g_object_unref (menu->priv->current_filter); + menu->priv->current_filter = NULL; + + g_object_notify (G_OBJECT (menu), "filter"); + } } static GSList * gtk_recent_chooser_menu_list_filters (GtkRecentChooser *chooser) { - g_warning (_("This function is not implemented for " - "widgets of class '%s'"), - g_type_name (G_OBJECT_TYPE (chooser))); + GtkRecentChooserMenu *menu; + GSList *retval = NULL; + + if (menu->priv->current_filter) + retval = g_slist_prepend (retval, menu->priv->current_filter); - return NULL; + return retval; } static void @@ -706,8 +718,11 @@ gtk_recent_chooser_menu_set_current_filter (GtkRecentChooserMenu *menu, if (priv->current_filter) g_object_unref (G_OBJECT (priv->current_filter)); - priv->current_filter = filter; - g_object_ref_sink (priv->current_filter); + if (filter) + { + priv->current_filter = filter; + g_object_ref_sink (priv->current_filter); + } g_object_notify (G_OBJECT (menu), "filter"); } |