Commit e4f6c9d4 authored by Emmanuele Bassi's avatar Emmanuele Bassi Committed by Emmanuele Bassi
Browse files

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)
parent f060a986
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> 2006-08-14 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_remove): Null the * gtk/gtkcombobox.c (gtk_combo_box_remove): Null the
......
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> 2006-08-14 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_remove): Null the * gtk/gtkcombobox.c (gtk_combo_box_remove): Null the
......
...@@ -884,6 +884,7 @@ gtk_recent_chooser_add_filter (GtkRecentChooser *chooser, ...@@ -884,6 +884,7 @@ gtk_recent_chooser_add_filter (GtkRecentChooser *chooser,
GtkRecentFilter *filter) GtkRecentFilter *filter)
{ {
g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); 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); GTK_RECENT_CHOOSER_GET_IFACE (chooser)->add_filter (chooser, filter);
} }
...@@ -902,6 +903,7 @@ gtk_recent_chooser_remove_filter (GtkRecentChooser *chooser, ...@@ -902,6 +903,7 @@ gtk_recent_chooser_remove_filter (GtkRecentChooser *chooser,
GtkRecentFilter *filter) GtkRecentFilter *filter)
{ {
g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); 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); GTK_RECENT_CHOOSER_GET_IFACE (chooser)->remove_filter (chooser, filter);
} }
...@@ -940,6 +942,7 @@ gtk_recent_chooser_set_filter (GtkRecentChooser *chooser, ...@@ -940,6 +942,7 @@ gtk_recent_chooser_set_filter (GtkRecentChooser *chooser,
GtkRecentFilter *filter) GtkRecentFilter *filter)
{ {
g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); 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); g_object_set (G_OBJECT (chooser), "filter", filter, NULL);
} }
......
...@@ -671,28 +671,40 @@ static void ...@@ -671,28 +671,40 @@ static void
gtk_recent_chooser_menu_add_filter (GtkRecentChooser *chooser, gtk_recent_chooser_menu_add_filter (GtkRecentChooser *chooser,
GtkRecentFilter *filter) GtkRecentFilter *filter)
{ {
g_warning (_("This function is not implemented for " GtkRecentChooserMenu *menu;
"widgets of class '%s'"),
g_type_name (G_OBJECT_TYPE (chooser))); menu = GTK_RECENT_CHOOSER_MENU (chooser);
gtk_recent_chooser_menu_set_current_filter (menu, filter);
} }
static void static void
gtk_recent_chooser_menu_remove_filter (GtkRecentChooser *chooser, gtk_recent_chooser_menu_remove_filter (GtkRecentChooser *chooser,
GtkRecentFilter *filter) GtkRecentFilter *filter)
{ {
g_warning (_("This function is not implemented for " GtkRecentChooserMenu *menu;
"widgets of class '%s'"),
g_type_name (G_OBJECT_TYPE (chooser))); 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 * static GSList *
gtk_recent_chooser_menu_list_filters (GtkRecentChooser *chooser) gtk_recent_chooser_menu_list_filters (GtkRecentChooser *chooser)
{ {
g_warning (_("This function is not implemented for " GtkRecentChooserMenu *menu;
"widgets of class '%s'"), GSList *retval = NULL;
g_type_name (G_OBJECT_TYPE (chooser)));
if (menu->priv->current_filter)
retval = g_slist_prepend (retval, menu->priv->current_filter);
return NULL; return retval;
} }
static void static void
...@@ -706,8 +718,11 @@ gtk_recent_chooser_menu_set_current_filter (GtkRecentChooserMenu *menu, ...@@ -706,8 +718,11 @@ gtk_recent_chooser_menu_set_current_filter (GtkRecentChooserMenu *menu,
if (priv->current_filter) if (priv->current_filter)
g_object_unref (G_OBJECT (priv->current_filter)); g_object_unref (G_OBJECT (priv->current_filter));
priv->current_filter = filter; if (filter)
g_object_ref_sink (priv->current_filter); {
priv->current_filter = filter;
g_object_ref_sink (priv->current_filter);
}
g_object_notify (G_OBJECT (menu), "filter"); g_object_notify (G_OBJECT (menu), "filter");
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment