1 /* GTK - The GIMP Toolkit
2 * gtkrecentchooser.c - Abstract interface for recent file selectors GUIs
4 * Copyright (C) 2006, Emmanuele Bassi
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
24 #include "gtkrecentchooser.h"
25 #include "gtkrecentchooserprivate.h"
26 #include "gtkrecentmanager.h"
28 #include "gtktypebuiltins.h"
29 #include "gtkprivate.h"
30 #include "gtkmarshalers.h"
42 static void gtk_recent_chooser_class_init (gpointer g_iface);
44 static guint chooser_signals[LAST_SIGNAL] = { 0, };
47 gtk_recent_chooser_get_type (void)
49 static GType chooser_type = 0;
53 chooser_type = g_type_register_static_simple (G_TYPE_INTERFACE,
54 I_("GtkRecentChooser"),
55 sizeof (GtkRecentChooserIface),
56 (GClassInitFunc) gtk_recent_chooser_class_init,
59 g_type_interface_add_prerequisite (chooser_type, G_TYPE_OBJECT);
66 gtk_recent_chooser_class_init (gpointer g_iface)
68 GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
71 * GtkRecentChooser::selection-changed
72 * @chooser: the object which received the signal
74 * This signal is emitted when there is a change in the set of
75 * selected recently used resources. This can happen when a user
76 * modifies the selection with the mouse or the keyboard, or when
77 * explicitely calling functions to change the selection.
81 chooser_signals[SELECTION_CHANGED] =
82 g_signal_new (I_("selection-changed"),
85 G_STRUCT_OFFSET (GtkRecentChooserIface, selection_changed),
87 g_cclosure_marshal_VOID__VOID,
91 * GtkRecentChooser::item-activated
92 * @chooser: the object which received the signal
94 * This signal is emitted when the user "activates" a recent item
95 * in the recent chooser. This can happen by double-clicking on an item
96 * in the recently used resources list, or by pressing
97 * <keycap>Enter</keycap>.
101 chooser_signals[ITEM_ACTIVATED] =
102 g_signal_new (I_("item-activated"),
105 G_STRUCT_OFFSET (GtkRecentChooserIface, item_activated),
107 g_cclosure_marshal_VOID__VOID,
111 * GtkRecentChooser:recent-manager:
113 * The #GtkRecentManager instance used by the #GtkRecentChooser to
114 * display the list of recently used resources.
118 g_object_interface_install_property (g_iface,
119 g_param_spec_object ("recent-manager",
120 P_("Recent Manager"),
121 P_("The RecentManager object to use"),
122 GTK_TYPE_RECENT_MANAGER,
123 GTK_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
125 * GtkRecentManager:show-private:
127 * Whether this #GtkRecentChooser should display recently used resources
128 * marked with the "private" flag. Such resources should be considered
129 * private to the applications and groups that have added them.
133 g_object_interface_install_property (g_iface,
134 g_param_spec_boolean ("show-private",
136 P_("Whether the private items should be displayed"),
138 GTK_PARAM_READWRITE));
140 * GtkRecentChooser:show-tips:
142 * Whether this #GtkRecentChooser should display a tooltip containing the
143 * full path of the recently used resources.
147 g_object_interface_install_property (g_iface,
148 g_param_spec_boolean ("show-tips",
150 P_("Whether there should be a tooltip on the item"),
152 GTK_PARAM_READWRITE));
154 * GtkRecentChooser:show-icons:
156 * Whether this #GtkRecentChooser should display an icon near the item.
160 g_object_interface_install_property (g_iface,
161 g_param_spec_boolean ("show-icons",
163 P_("Whether there should be an icon near the item"),
165 GTK_PARAM_READWRITE));
167 * GtkRecentChooser:show-not-found:
169 * Whether this #GtkRecentChooser should display the recently used resources
170 * even if not present anymore. Setting this to %FALSE will perform a
171 * potentially expensive check on every local resource (every remote
172 * resource will always be displayed).
176 g_object_interface_install_property (g_iface,
177 g_param_spec_boolean ("show-not-found",
178 P_("Show Not Found"),
179 P_("Whether the items pointing to unavailable resources should be displayed"),
181 GTK_PARAM_READWRITE));
183 * GtkRecentChooser:select-multiple:
185 * Allow the user to select multiple resources.
189 g_object_interface_install_property (g_iface,
190 g_param_spec_boolean ("select-multiple",
191 P_("Select Multiple"),
192 P_("Whether to allow multiple items to be selected"),
194 GTK_PARAM_READWRITE));
196 * GtkRecentChooser:local-only:
198 * Whether this #GtkRecentChooser should display only local (file:)
203 g_object_interface_install_property (g_iface,
204 g_param_spec_boolean ("local-only",
206 P_("Whether the selected resource(s) should be limited to local file: URIs"),
208 GTK_PARAM_READWRITE));
210 * GtkRecentChooser:limit:
212 * The maximum number of recently used resources to be displayed,
213 * or -1 to display all items. By default, the
214 * GtkSetting:gtk-recent-files-limit setting is respected: you can
215 * override that limit on a particular instance of #GtkRecentChooser
216 * by setting this property.
220 g_object_interface_install_property (g_iface,
221 g_param_spec_int ("limit",
223 P_("The maximum number of items to be displayed"),
227 GTK_PARAM_READWRITE));
229 * GtkRecentChooser:sort-type:
231 * Sorting order to be used when displaying the recently used resources.
235 g_object_interface_install_property (g_iface,
236 g_param_spec_enum ("sort-type",
238 P_("The sorting order of the items displayed"),
239 GTK_TYPE_RECENT_SORT_TYPE,
240 GTK_RECENT_SORT_NONE,
241 GTK_PARAM_READWRITE));
243 * GtkRecentChooser:filter:
245 * The #GtkRecentFilter object to be used when displaying
246 * the recently used resources.
250 g_object_interface_install_property (g_iface,
251 g_param_spec_object ("filter",
253 P_("The current filter for selecting which resources are displayed"),
254 GTK_TYPE_RECENT_FILTER,
255 GTK_PARAM_READWRITE));
259 gtk_recent_chooser_error_quark (void)
261 return g_quark_from_static_string ("gtk-recent-chooser-error-quark");
265 * _gtk_recent_chooser_get_recent_manager:
266 * @chooser: a #GtkRecentChooser
268 * Gets the #GtkRecentManager used by @chooser.
270 * Return value: the recent manager for @chooser.
275 _gtk_recent_chooser_get_recent_manager (GtkRecentChooser *chooser)
277 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL);
279 return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->get_recent_manager (chooser);
283 * gtk_recent_chooser_set_show_private:
284 * @chooser: a #GtkRecentChooser
285 * @show_private: %TRUE to show private items, %FALSE otherwise
287 * Whether to show recently used resources marked registered as private.
292 gtk_recent_chooser_set_show_private (GtkRecentChooser *chooser,
293 gboolean show_private)
295 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
297 g_object_set (chooser, "show-private", show_private, NULL);
301 * gtk_recent_chooser_get_show_private:
302 * @chooser: a #GtkRecentChooser
304 * Returns whether @chooser should display recently used resources
305 * registered as private.
307 * Return value: %TRUE if the recent chooser should show private items,
313 gtk_recent_chooser_get_show_private (GtkRecentChooser *chooser)
315 gboolean show_private;
317 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
319 g_object_get (chooser, "show-private", &show_private, NULL);
325 * gtk_recent_chooser_set_show_not_found:
326 * @chooser: a #GtkRecentChooser
327 * @show_not_found: whether to show the local items we didn't find
329 * Sets whether @chooser should display the recently used resources that
330 * it didn't find. This only applies to local resources.
335 gtk_recent_chooser_set_show_not_found (GtkRecentChooser *chooser,
336 gboolean show_not_found)
338 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
340 g_object_set (chooser, "show-not-found", show_not_found, NULL);
344 * gtk_recent_chooser_get_show_not_found:
345 * @chooser: a #GtkRecentChooser
347 * Retrieves whether @chooser should show the recently used resources that
350 * Return value: %TRUE if the resources not found should be displayed, and
356 gtk_recent_chooser_get_show_not_found (GtkRecentChooser *chooser)
358 gboolean show_not_found;
360 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
362 g_object_get (chooser, "show-not-found", &show_not_found, NULL);
364 return show_not_found;
368 * gtk_recent_chooser_set_show_icons:
369 * @chooser: a #GtkRecentChooser
370 * @show_icons: whether to show an icon near the resource
372 * Sets whether @chooser should show an icon near the resource when
378 gtk_recent_chooser_set_show_icons (GtkRecentChooser *chooser,
381 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
383 g_object_set (chooser, "show-icons", show_icons, NULL);
387 * gtk_recent_chooser_get_show_icons:
388 * @chooser: a #GtkRecentChooser
390 * Retrieves whether @chooser should show an icon near the resource.
392 * Return value: %TRUE if the icons should be displayed, %FALSE otherwise.
397 gtk_recent_chooser_get_show_icons (GtkRecentChooser *chooser)
401 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
403 g_object_get (chooser, "show-icons", &show_icons, NULL);
409 * gtk_recent_chooser_set_select_multiple:
410 * @chooser: a #GtkRecentChooser
411 * @select_multiple: %TRUE if @chooser can select more than one item
413 * Sets whether @chooser can select multiple items.
418 gtk_recent_chooser_set_select_multiple (GtkRecentChooser *chooser,
419 gboolean select_multiple)
421 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
423 g_object_set (chooser, "select-multiple", select_multiple, NULL);
427 * gtk_recent_chooser_get_select_multiple:
428 * @chooser: a #GtkRecentChooser
430 * Gets whether @chooser can select multiple items.
432 * Return value: %TRUE if @chooser can select more than one item.
437 gtk_recent_chooser_get_select_multiple (GtkRecentChooser *chooser)
439 gboolean select_multiple;
441 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
443 g_object_get (chooser, "select-multiple", &select_multiple, NULL);
445 return select_multiple;
449 * gtk_recent_chooser_set_local_only:
450 * @chooser: a #GtkRecentChooser
451 * @local_only: %TRUE if only local files can be shown
453 * Sets whether only local resources, that is resources using the file:// URI
454 * scheme, should be shown in the recently used resources selector. If
455 * @local_only is %TRUE (the default) then the shown resources are guaranteed
456 * to be accessible through the operating system native file system.
461 gtk_recent_chooser_set_local_only (GtkRecentChooser *chooser,
464 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
466 g_object_set (chooser, "local-only", local_only, NULL);
470 * gtk_recent_chooser_get_local_only:
471 * @chooser: a #GtkRecentChooser
473 * Gets whether only local resources should be shown in the recently used
474 * resources selector. See gtk_recent_chooser_set_local_only()
476 * Return value: %TRUE if only local resources should be shown.
481 gtk_recent_chooser_get_local_only (GtkRecentChooser *chooser)
485 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
487 g_object_get (chooser, "local-only", &local_only, NULL);
493 * gtk_recent_chooser_set_limit:
494 * @chooser: a #GtkRecentChooser
495 * @limit: a positive integer, or -1 for all items
497 * Sets the number of items that should be returned by
498 * gtk_recent_chooser_get_items() and gtk_recent_chooser_get_uris().
503 gtk_recent_chooser_set_limit (GtkRecentChooser *chooser,
506 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
508 g_object_set (chooser, "limit", limit, NULL);
512 * gtk_recent_chooser_get_limit:
513 * @chooser: a #GtkRecentChooser
515 * Gets the number of items returned by gtk_recent_chooser_get_items()
516 * and gtk_recent_chooser_get_uris().
518 * Return value: A positive integer, or -1 meaning that all items are
524 gtk_recent_chooser_get_limit (GtkRecentChooser *chooser)
528 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), 10);
530 g_object_get (chooser, "limit", &limit, NULL);
536 * gtk_recent_chooser_set_show_tips:
537 * @chooser: a #GtkRecentChooser
538 * @show_tips: %TRUE if tooltips should be shown
540 * Sets whether to show a tooltips containing the full path of each
541 * recently used resource in a #GtkRecentChooser widget.
546 gtk_recent_chooser_set_show_tips (GtkRecentChooser *chooser,
549 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
551 g_object_set (chooser, "show-tips", show_tips, NULL);
555 * gtk_recent_chooser_get_show_tips:
556 * @chooser: a #GtkRecentChooser
558 * Gets whether @chooser should display tooltips containing the full path
559 * of a recently user resource.
561 * Return value: %TRUE if the recent chooser should show tooltips,
567 gtk_recent_chooser_get_show_tips (GtkRecentChooser *chooser)
571 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
573 g_object_get (chooser, "show-tips", &show_tips, NULL);
579 * gtk_recent_chooser_set_show_numbers:
580 * @chooser: a #GtkRecentChooser
581 * @show_numbers: %TRUE to show numbers, %FALSE otherwise
583 * Whether to show recently used resources prepended by a unique number.
585 * Deprecated: 2.12: Use gtk_recent_chooser_menu_set_show_numbers() instead.
590 gtk_recent_chooser_set_show_numbers (GtkRecentChooser *chooser,
591 gboolean show_numbers)
595 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
597 /* This is the result of a minor screw up: the "show-numbers" property
598 * was removed from the GtkRecentChooser interface, but the accessors
599 * remained in the interface API; now we need to check whether the
600 * implementation of the RecentChooser interface has a "show-numbers"
601 * boolean property installed before accessing it, and avoid an
602 * assertion failure using a more graceful warning. This should really
603 * go away as soon as we can break API and remove these accessors.
605 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (chooser),
607 if (!pspec || pspec->value_type != G_TYPE_BOOLEAN)
609 g_warning ("Choosers of type `%s' do not support showing numbers",
610 G_OBJECT_TYPE_NAME (chooser));
615 g_object_set (chooser, "show-numbers", show_numbers, NULL);
619 * gtk_recent_chooser_get_show_numbers:
620 * @chooser: a #GtkRecentChooser
622 * Returns whether @chooser should display recently used resources
623 * prepended by a unique number.
625 * Deprecated: 2.12: use gtk_recent_chooser_menu_get_show_numbers() instead.
627 * Return value: %TRUE if the recent chooser should show display numbers,
633 gtk_recent_chooser_get_show_numbers (GtkRecentChooser *chooser)
636 gboolean show_numbers;
638 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
640 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (chooser),
642 if (!pspec || pspec->value_type != G_TYPE_BOOLEAN)
644 g_warning ("Choosers of type `%s' do not support showing numbers",
645 G_OBJECT_TYPE_NAME (chooser));
650 g_object_get (chooser, "show-numbers", &show_numbers, NULL);
657 * gtk_recent_chooser_set_sort_type:
658 * @chooser: a #GtkRecentChooser
659 * @sort_type: sort order that the chooser should use
661 * Changes the sorting order of the recently used resources list displayed by
667 gtk_recent_chooser_set_sort_type (GtkRecentChooser *chooser,
668 GtkRecentSortType sort_type)
670 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
672 g_object_set (chooser, "sort-type", sort_type, NULL);
676 * gtk_recent_chooser_get_sort_type:
677 * @chooser: a #GtkRecentChooser
679 * Gets the value set by gtk_recent_chooser_set_sort_type().
681 * Return value: the sorting order of the @chooser.
686 gtk_recent_chooser_get_sort_type (GtkRecentChooser *chooser)
688 GtkRecentSortType sort_type;
690 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), GTK_RECENT_SORT_NONE);
692 g_object_get (chooser, "sort-type", &sort_type, NULL);
698 * gtk_recent_chooser_set_sort_func:
699 * @chooser: a #GtkRecentChooser
700 * @sort_func: the comparison function
701 * @sort_data: user data to pass to @sort_func, or %NULL
702 * @data_destroy: destroy notifier for @sort_data, or %NULL
704 * Sets the comparison function used when sorting to be @sort_func. If
705 * the @chooser has the sort type set to #GTK_RECENT_SORT_CUSTOM then
706 * the chooser will sort using this function.
708 * To the comparison function will be passed two #GtkRecentInfo structs and
709 * @sort_data; @sort_func should return a positive integer if the first
710 * item comes before the second, zero if the two items are equal and
711 * a negative integer if the first item comes after the second.
716 gtk_recent_chooser_set_sort_func (GtkRecentChooser *chooser,
717 GtkRecentSortFunc sort_func,
719 GDestroyNotify data_destroy)
721 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
723 GTK_RECENT_CHOOSER_GET_IFACE (chooser)->set_sort_func (chooser,
730 * gtk_recent_chooser_set_current_uri:
731 * @chooser: a #GtkRecentChooser
733 * @error: return location for a #GError, or %NULL
735 * Sets @uri as the current URI for @chooser.
737 * Return value: %TRUE if the URI was found.
742 gtk_recent_chooser_set_current_uri (GtkRecentChooser *chooser,
746 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
748 return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->set_current_uri (chooser, uri, error);
752 * gtk_recent_chooser_get_current_uri:
753 * @chooser: a #GtkRecentChooser
755 * Gets the URI currently selected by @chooser.
757 * Return value: a newly allocated string holding a URI.
762 gtk_recent_chooser_get_current_uri (GtkRecentChooser *chooser)
764 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL);
766 return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->get_current_uri (chooser);
770 * gtk_recent_chooser_get_current_item:
771 * @chooser: a #GtkRecentChooser
773 * Gets the #GtkRecentInfo currently selected by @chooser.
775 * Return value: a #GtkRecentInfo. Use gtk_recent_info_unref() when
776 * when you have finished using it.
781 gtk_recent_chooser_get_current_item (GtkRecentChooser *chooser)
783 GtkRecentManager *manager;
784 GtkRecentInfo *retval;
787 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL);
789 uri = gtk_recent_chooser_get_current_uri (chooser);
793 manager = _gtk_recent_chooser_get_recent_manager (chooser);
794 retval = gtk_recent_manager_lookup_item (manager, uri, NULL);
801 * gtk_recent_chooser_select_uri:
802 * @chooser: a #GtkRecentChooser
804 * @error: return location for a #GError, or %NULL
806 * Selects @uri inside @chooser.
808 * Return value: %TRUE if @uri was found.
813 gtk_recent_chooser_select_uri (GtkRecentChooser *chooser,
817 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
819 return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->select_uri (chooser, uri, error);
823 * gtk_recent_chooser_unselect_uri:
824 * @chooser: a #GtkRecentChooser
827 * Unselects @uri inside @chooser.
832 gtk_recent_chooser_unselect_uri (GtkRecentChooser *chooser,
835 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
837 GTK_RECENT_CHOOSER_GET_IFACE (chooser)->unselect_uri (chooser, uri);
841 * gtk_recent_chooser_select_all:
842 * @chooser: a #GtkRecentChooser
844 * Selects all the items inside @chooser, if the @chooser supports
845 * multiple selection.
850 gtk_recent_chooser_select_all (GtkRecentChooser *chooser)
852 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
854 GTK_RECENT_CHOOSER_GET_IFACE (chooser)->select_all (chooser);
858 * gtk_recent_chooser_unselect_all:
859 * @chooser: a #GtkRecentChooser
861 * Unselects all the items inside @chooser.
866 gtk_recent_chooser_unselect_all (GtkRecentChooser *chooser)
868 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
870 GTK_RECENT_CHOOSER_GET_IFACE (chooser)->unselect_all (chooser);
874 * gtk_recent_chooser_get_items:
875 * @chooser: a #GtkRecentChooser
877 * Gets the list of recently used resources in form of #GtkRecentInfo objects.
879 * The return value of this function is affected by the "sort-type" and
880 * "limit" properties of @chooser.
882 * Return value: A newly allocated list of #GtkRecentInfo objects. You should
883 * use gtk_recent_info_unref() on every item of the list, and then free
884 * the list itself using g_list_free().
889 gtk_recent_chooser_get_items (GtkRecentChooser *chooser)
891 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL);
893 return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->get_items (chooser);
897 * gtk_recent_chooser_get_uris:
898 * @chooser: a #GtkRecentChooser
899 * @length: return location for a the length of the URI list, or %NULL
901 * Gets the URI of the recently used resources.
903 * The return value of this function is affected by the "sort-type" and "limit"
904 * properties of @chooser.
906 * Since the returned array is %NULL terminated, @length may be %NULL.
908 * Return value: A newly allocated, %NULL terminated array of strings. Use
909 * g_strfreev() to free it.
914 gtk_recent_chooser_get_uris (GtkRecentChooser *chooser,
921 items = gtk_recent_chooser_get_items (chooser);
923 n_items = g_list_length (items);
924 retval = g_new0 (gchar *, n_items + 1);
926 for (l = items, i = 0; l != NULL; l = l->next)
928 GtkRecentInfo *info = (GtkRecentInfo *) l->data;
931 g_assert (info != NULL);
933 uri = gtk_recent_info_get_uri (info);
934 g_assert (uri != NULL);
936 retval[i++] = g_strdup (uri);
943 g_list_foreach (items,
944 (GFunc) gtk_recent_info_unref,
952 * gtk_recent_chooser_add_filter:
953 * @chooser: a #GtkRecentChooser
954 * @filter: a #GtkRecentFilter
956 * Adds @filter to the list of #GtkRecentFilter objects held by @chooser.
958 * If no previous filter objects were defined, this function will call
959 * gtk_recent_chooser_set_filter().
964 gtk_recent_chooser_add_filter (GtkRecentChooser *chooser,
965 GtkRecentFilter *filter)
967 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
968 g_return_if_fail (GTK_IS_RECENT_FILTER (filter));
970 GTK_RECENT_CHOOSER_GET_IFACE (chooser)->add_filter (chooser, filter);
974 * gtk_recent_chooser_remove_filter:
975 * @chooser: a #GtkRecentChooser
976 * @filter: a #GtkRecentFilter
978 * Removes @filter from the list of #GtkRecentFilter objects held by @chooser.
983 gtk_recent_chooser_remove_filter (GtkRecentChooser *chooser,
984 GtkRecentFilter *filter)
986 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
987 g_return_if_fail (GTK_IS_RECENT_FILTER (filter));
989 GTK_RECENT_CHOOSER_GET_IFACE (chooser)->remove_filter (chooser, filter);
993 * gtk_recent_chooser_list_filters:
994 * @chooser: a #GtkRecentChooser
996 * Gets the #GtkRecentFilter objects held by @chooser.
998 * Return value: A singly linked list of #GtkRecentFilter objects. You
999 * should just free the returned list using g_slist_free().
1004 gtk_recent_chooser_list_filters (GtkRecentChooser *chooser)
1006 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL);
1008 return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->list_filters (chooser);
1012 * gtk_recent_chooser_set_filter:
1013 * @chooser: a #GtkRecentChooser
1014 * @filter: a #GtkRecentFilter
1016 * Sets @filter as the current #GtkRecentFilter object used by @chooser
1017 * to affect the displayed recently used resources.
1022 gtk_recent_chooser_set_filter (GtkRecentChooser *chooser,
1023 GtkRecentFilter *filter)
1025 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
1026 g_return_if_fail (GTK_IS_RECENT_FILTER (filter));
1028 g_object_set (G_OBJECT (chooser), "filter", filter, NULL);
1032 * gtk_recent_chooser_get_filter:
1033 * @chooser: a #GtkRecentChooser
1035 * Gets the #GtkRecentFilter object currently used by @chooser to affect
1036 * the display of the recently used resources.
1038 * Return value: a #GtkRecentFilter object.
1043 gtk_recent_chooser_get_filter (GtkRecentChooser *chooser)
1045 GtkRecentFilter *filter;
1047 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL);
1049 g_object_get (G_OBJECT (chooser), "filter", &filter, NULL);
1051 /* we need this hack because g_object_get() increases the refcount
1052 * of the returned object; see also gtk_file_chooser_get_filter()
1053 * inside gtkfilechooser.c
1056 g_object_unref (filter);
1062 _gtk_recent_chooser_item_activated (GtkRecentChooser *chooser)
1064 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
1066 g_signal_emit (chooser, chooser_signals[ITEM_ACTIVATED], 0);
1070 _gtk_recent_chooser_selection_changed (GtkRecentChooser *chooser)
1072 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
1074 g_signal_emit (chooser, chooser_signals[SELECTION_CHANGED], 0);
1077 #define __GTK_RECENT_CHOOSER_C__
1078 #include "gtkaliasdef.c"