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, GTK_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,
110 g_object_interface_install_property (g_iface,
111 g_param_spec_object ("recent-manager",
112 P_("Recent Manager"),
113 P_("The RecentManager object to use"),
114 GTK_TYPE_RECENT_MANAGER,
115 G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
116 g_object_interface_install_property (g_iface,
117 g_param_spec_boolean ("show-private",
119 P_("Whether the private items should be displayed"),
122 g_object_interface_install_property (g_iface,
123 g_param_spec_boolean ("show-tips",
125 P_("Whether there should be a tooltip on the item"),
128 g_object_interface_install_property (g_iface,
129 g_param_spec_boolean ("show-icons",
131 P_("Whether there should be an icon near the item"),
134 g_object_interface_install_property (g_iface,
135 g_param_spec_boolean ("show-not-found",
136 P_("Show Not Found"),
137 P_("Whether the items pointing to unavailable resources should be displayed"),
140 g_object_interface_install_property (g_iface,
141 g_param_spec_boolean ("select-multiple",
142 P_("Select Multiple"),
143 P_("Whether to allow multiple items to be selected"),
146 g_object_interface_install_property (g_iface,
147 g_param_spec_boolean ("local-only",
149 P_("Whether the selected resource(s) should be limited to local file: URIs"),
152 g_object_interface_install_property (g_iface,
153 g_param_spec_int ("limit",
155 P_("The maximum number of items to be displayed"),
160 g_object_interface_install_property (g_iface,
161 g_param_spec_enum ("sort-type",
163 P_("The sorting order of the items displayed"),
164 GTK_TYPE_RECENT_SORT_TYPE,
165 GTK_RECENT_SORT_NONE,
167 g_object_interface_install_property (g_iface,
168 g_param_spec_object ("filter",
170 P_("The current filter for selecting which resources are displayed"),
171 GTK_TYPE_RECENT_FILTER,
176 gtk_recent_chooser_error_quark (void)
178 return g_quark_from_static_string ("gtk-recent-chooser-error-quark");
182 * _gtk_recent_chooser_get_recent_manager:
183 * @chooser: a #GtkRecentChooser
185 * Gets the #GtkRecentManager used by @chooser.
187 * Return value: the recent manager for @chooser.
192 _gtk_recent_chooser_get_recent_manager (GtkRecentChooser *chooser)
194 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL);
196 return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->get_recent_manager (chooser);
200 * gtk_recent_chooser_set_show_private:
201 * @chooser: a #GtkRecentChooser
202 * @show_private: %TRUE to show private items, %FALSE otherwise
204 * Whether to show recently used resources marked registered as private.
209 gtk_recent_chooser_set_show_private (GtkRecentChooser *chooser,
210 gboolean show_private)
212 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
214 g_object_set (chooser, "show-private", show_private, NULL);
218 * gtk_recent_chooser_get_show_private:
219 * @chooser: a #GtkRecentChooser
221 * Returns whether @chooser should display recently used resources
222 * registered as private.
224 * Return value: %TRUE if the recent chooser should show private items,
230 gtk_recent_chooser_get_show_private (GtkRecentChooser *chooser)
232 gboolean show_private;
234 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
236 g_object_get (chooser, "show-private", &show_private, NULL);
242 * gtk_recent_chooser_set_show_not_found:
243 * @chooser: a #GtkRecentChooser
244 * @show_not_found: whether to show the local items we didn't find
246 * Sets whether @chooser should display the recently used resources that
247 * it didn't find. This only applies to local resources.
252 gtk_recent_chooser_set_show_not_found (GtkRecentChooser *chooser,
253 gboolean show_not_found)
255 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
257 g_object_set (chooser, "show-not-found", show_not_found, NULL);
261 * gtk_recent_chooser_get_show_not_found:
262 * @chooser: a #GtkRecentChooser
264 * Retrieves whether @chooser should show the recently used resources that
267 * Return value: %TRUE if the resources not found should be displayed, and
273 gtk_recent_chooser_get_show_not_found (GtkRecentChooser *chooser)
275 gboolean show_not_found;
277 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
279 g_object_get (chooser, "show-not-found", &show_not_found, NULL);
281 return show_not_found;
285 * gtk_recent_chooser_set_show_icons:
286 * @chooser: a #GtkRecentChooser
287 * @show_icons: whether to show an icon near the resource
289 * Sets whether @chooser should show an icon near the resource when
295 gtk_recent_chooser_set_show_icons (GtkRecentChooser *chooser,
298 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
300 g_object_set (chooser, "show-icons", show_icons, NULL);
304 * gtk_recent_chooser_get_show_icons:
305 * @chooser: a #GtkRecentChooser
307 * Retrieves whether @chooser should show an icon near the resource.
309 * Return value: %TRUE if the icons should be displayed, %FALSE otherwise.
314 gtk_recent_chooser_get_show_icons (GtkRecentChooser *chooser)
318 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
320 g_object_get (chooser, "show-icons", &show_icons, NULL);
326 * gtk_recent_chooser_set_select_multiple:
327 * @chooser: a #GtkRecentChooser
328 * @select_multiple: %TRUE if @chooser can select more than one item
330 * Sets whether @chooser can select multiple items.
335 gtk_recent_chooser_set_select_multiple (GtkRecentChooser *chooser,
336 gboolean select_multiple)
338 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
340 g_object_set (chooser, "select-multiple", select_multiple, NULL);
344 * gtk_recent_chooser_get_select_multiple:
345 * @chooser: a #GtkRecentChooser
347 * Gets whether @chooser can select multiple items.
349 * Return value: %TRUE if @chooser can select more than one item.
354 gtk_recent_chooser_get_select_multiple (GtkRecentChooser *chooser)
356 gboolean select_multiple;
358 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
360 g_object_get (chooser, "select-multiple", &select_multiple, NULL);
362 return select_multiple;
366 * gtk_recent_chooser_set_local_only:
367 * @chooser: a #GtkRecentChooser
368 * @local_only: %TRUE if only local files can be shown
370 * Sets whether only local resources, that is resources using the file:// URI
371 * scheme, should be shown in the recently used resources selector. If
372 * @local_only is %TRUE (the default) then the shown resources are guaranteed
373 * to be accessible through the operating system native file system.
378 gtk_recent_chooser_set_local_only (GtkRecentChooser *chooser,
381 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
383 g_object_set (chooser, "local-only", local_only, NULL);
387 * gtk_recent_chooser_get_local_only:
388 * @chooser: a #GtkRecentChooser
390 * Gets whether only local resources should be shown in the recently used
391 * resources selector. See gtk_recent_chooser_set_local_only()
393 * Return value: %TRUE if only local resources should be shown.
398 gtk_recent_chooser_get_local_only (GtkRecentChooser *chooser)
402 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
404 g_object_get (chooser, "local-only", &local_only, NULL);
410 * gtk_recent_chooser_set_limit:
411 * @chooser: a #GtkRecentChooser
412 * @limit: a positive integer, or -1 for all items
414 * Sets the number of items that should be returned by
415 * gtk_recent_chooser_get_items() and gtk_recent_chooser_get_uris().
420 gtk_recent_chooser_set_limit (GtkRecentChooser *chooser,
423 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
425 g_object_set (chooser, "limit", limit, NULL);
429 * gtk_recent_chooser_get_limit:
430 * @chooser: a #GtkRecentChooser
432 * Gets the number of items returned by gtk_recent_chooser_get_items()
433 * and gtk_recent_chooser_get_uris().
435 * Return value: A positive integer, or -1 meaning that all items are
441 gtk_recent_chooser_get_limit (GtkRecentChooser *chooser)
445 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), 10);
447 g_object_get (chooser, "limit", &limit, NULL);
453 * gtk_recent_chooser_set_show_tips:
454 * @chooser: a #GtkRecentChooser
455 * @show_tips: %TRUE if tooltips should be shown
457 * Sets whether to show a tooltips on the widget.
462 gtk_recent_chooser_set_show_tips (GtkRecentChooser *chooser,
465 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
467 g_object_set (chooser, "show-tips", show_tips, NULL);
471 * gtk_recent_chooser_get_show_tips:
472 * @chooser: a #GtkRecentChooser
474 * Gets whether @chooser should display tooltips.
476 * Return value: %TRUE if the recent chooser should show tooltips,
482 gtk_recent_chooser_get_show_tips (GtkRecentChooser *chooser)
486 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
488 g_object_get (chooser, "show-tips", &show_tips, NULL);
494 * gtk_recent_chooser_set_show_numbers:
495 * @chooser: a #GtkRecentChooser
496 * @show_numbers: %TRUE to show numbers, %FALSE otherwise
498 * Whether to show recently used resources prepended by a unique number.
500 * Do not use this function: use gtk_recent_chooser_menu_set_show_numbers()
506 gtk_recent_chooser_set_show_numbers (GtkRecentChooser *chooser,
507 gboolean show_numbers)
511 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
513 /* This is the result of a minor screw up: the "show-numbers" property
514 * was removed from the GtkRecentChooser interface, but the accessors
515 * remained in the interface API; now we need to check whether the
516 * implementation of the RecentChooser interface has a "show-numbers"
517 * boolean property installed before accessing it, and avoid an
518 * assertion failure using a more graceful warning. This should really
519 * go away as soon as we can break API and remove these accessors.
521 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (chooser),
523 if (!pspec || pspec->value_type != G_TYPE_BOOLEAN)
525 g_warning ("Choosers of type `%s' do not support showing numbers",
526 G_OBJECT_TYPE_NAME (chooser));
531 g_object_set (chooser, "show-numbers", show_numbers, NULL);
535 * gtk_recent_chooser_get_show_numbers:
536 * @chooser: a #GtkRecentChooser
538 * Returns whether @chooser should display recently used resources
539 * prepended by a unique number.
541 * Do not use this function: use gtk_recent_chooser_menu_get_show_numbers()
544 * Return value: %TRUE if the recent chooser should show display numbers,
550 gtk_recent_chooser_get_show_numbers (GtkRecentChooser *chooser)
553 gboolean show_numbers;
555 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
557 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (chooser),
559 if (!pspec || pspec->value_type != G_TYPE_BOOLEAN)
561 g_warning ("Choosers of type `%s' do not support showing numbers",
562 G_OBJECT_TYPE_NAME (chooser));
567 g_object_get (chooser, "show-numbers", &show_numbers, NULL);
574 * gtk_recent_chooser_set_sort_type:
575 * @chooser: a #GtkRecentChooser
576 * @sort_type: sort order that the chooser should use
578 * Changes the sorting order of the recently used resources list displayed by
584 gtk_recent_chooser_set_sort_type (GtkRecentChooser *chooser,
585 GtkRecentSortType sort_type)
587 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
589 g_object_set (chooser, "sort-type", sort_type, NULL);
593 * gtk_recent_chooser_get_sort_type:
594 * @chooser: a #GtkRecentChooser
596 * Gets the value set by gtk_recent_chooser_set_sort_type().
598 * Return value: the sorting order of the @chooser.
603 gtk_recent_chooser_get_sort_type (GtkRecentChooser *chooser)
605 GtkRecentSortType sort_type;
607 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), GTK_RECENT_SORT_NONE);
609 g_object_get (chooser, "sort-type", &sort_type, NULL);
615 * gtk_recent_chooser_set_sort_func:
616 * @chooser: a #GtkRecentChooser
617 * @sort_func: the comparison function
618 * @sort_data: user data to pass to @sort_func, or %NULL
619 * @data_destroy: destroy notifier for @sort_data, or %NULL
621 * Sets the comparison function used when sorting to be @sort_func. If
622 * the @chooser has the sort type set to #GTK_RECENT_SORT_CUSTOM then
623 * the chooser will sort using this function.
625 * To the comparison function will be passed two #GtkRecentInfo structs and
626 * @sort_data; @sort_func should return a positive integer if the first
627 * item comes before the second, zero if the two items are equal and
628 * a negative integer if the first item comes after the second.
633 gtk_recent_chooser_set_sort_func (GtkRecentChooser *chooser,
634 GtkRecentSortFunc sort_func,
636 GDestroyNotify data_destroy)
638 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
640 GTK_RECENT_CHOOSER_GET_IFACE (chooser)->set_sort_func (chooser,
647 * gtk_recent_chooser_set_current_uri:
648 * @chooser: a #GtkRecentChooser
650 * @error: return location for a #GError, or %NULL
652 * Sets @uri as the current URI for @chooser.
654 * Return value: %TRUE if the URI was found.
659 gtk_recent_chooser_set_current_uri (GtkRecentChooser *chooser,
663 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
665 return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->set_current_uri (chooser, uri, error);
669 * gtk_recent_chooser_get_current_uri:
670 * @chooser: a #GtkRecentChooser
672 * Gets the URI currently selected by @chooser.
674 * Return value: a newly allocated string holding a URI.
679 gtk_recent_chooser_get_current_uri (GtkRecentChooser *chooser)
681 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL);
683 return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->get_current_uri (chooser);
687 * gtk_recent_chooser_get_current_item:
688 * @chooser: a #GtkRecentChooser
690 * Gets the #GtkRecentInfo currently selected by @chooser.
692 * Return value: a #GtkRecentInfo. Use gtk_recent_info_unref() when
693 * when you have finished using it.
698 gtk_recent_chooser_get_current_item (GtkRecentChooser *chooser)
700 GtkRecentManager *manager;
701 GtkRecentInfo *retval;
704 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL);
706 uri = gtk_recent_chooser_get_current_uri (chooser);
710 manager = _gtk_recent_chooser_get_recent_manager (chooser);
711 retval = gtk_recent_manager_lookup_item (manager, uri, NULL);
718 * gtk_recent_chooser_select_uri:
719 * @chooser: a #GtkRecentChooser
721 * @error: return location for a #GError, or %NULL
723 * Selects @uri inside @chooser.
725 * Return value: %TRUE if @uri was found.
730 gtk_recent_chooser_select_uri (GtkRecentChooser *chooser,
734 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE);
736 return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->select_uri (chooser, uri, error);
740 * gtk_recent_chooser_unselect_uri:
741 * @chooser: a #GtkRecentChooser
744 * Unselects @uri inside @chooser.
749 gtk_recent_chooser_unselect_uri (GtkRecentChooser *chooser,
752 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
754 GTK_RECENT_CHOOSER_GET_IFACE (chooser)->unselect_uri (chooser, uri);
758 * gtk_recent_chooser_select_all:
759 * @chooser: a #GtkRecentChooser
761 * Selects all the items inside @chooser, if the @chooser supports
762 * multiple selection.
767 gtk_recent_chooser_select_all (GtkRecentChooser *chooser)
769 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
771 GTK_RECENT_CHOOSER_GET_IFACE (chooser)->select_all (chooser);
775 * gtk_recent_chooser_unselect_all:
776 * @chooser: a #GtkRecentChooser
778 * Unselects all the items inside @chooser.
783 gtk_recent_chooser_unselect_all (GtkRecentChooser *chooser)
785 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
787 GTK_RECENT_CHOOSER_GET_IFACE (chooser)->unselect_all (chooser);
791 * gtk_recent_chooser_get_items:
792 * @chooser: a #GtkRecentChooser
794 * Gets the list of recently used resources in form of #GtkRecentInfo objects.
796 * The return value of this function is affected by the "sort-type" and
797 * "limit" properties of @chooser.
799 * Return value: A newly allocated list of #GtkRecentInfo objects. You should
800 * use gtk_recent_info_unref() on every item of the list, and then free
801 * the list itself using g_list_free().
806 gtk_recent_chooser_get_items (GtkRecentChooser *chooser)
808 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL);
810 return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->get_items (chooser);
814 * gtk_recent_chooser_get_uris:
815 * @chooser: a #GtkRecentChooser
816 * @length: return location for a the length of the URI list, or %NULL
818 * Gets the URI of the recently used resources.
820 * The return value of this function is affected by the "sort-type" and "limit"
821 * properties of @chooser.
823 * Since the returned array is %NULL terminated, @length may be %NULL.
825 * Return value: A newly allocated, %NULL terminated array of strings. Use
826 * g_strfreev() to free it.
831 gtk_recent_chooser_get_uris (GtkRecentChooser *chooser,
838 items = gtk_recent_chooser_get_items (chooser);
842 n_items = g_list_length (items);
843 retval = g_new0 (gchar *, n_items + 1);
845 for (l = items, i = 0; l != NULL; l = l->next)
847 GtkRecentInfo *info = (GtkRecentInfo *) l->data;
850 g_assert (info != NULL);
852 uri = gtk_recent_info_get_uri (info);
853 g_assert (uri != NULL);
855 retval[i++] = g_strdup (uri);
862 g_list_foreach (items,
863 (GFunc) gtk_recent_info_unref,
871 * gtk_recent_chooser_add_filter:
872 * @chooser: a #GtkRecentChooser
873 * @filter: a #GtkRecentFilter
875 * Adds @filter to the list of #GtkRecentFilter objects held by @chooser.
877 * If no previous filter objects were defined, this function will call
878 * gtk_recent_chooser_set_filter().
883 gtk_recent_chooser_add_filter (GtkRecentChooser *chooser,
884 GtkRecentFilter *filter)
886 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
887 g_return_if_fail (GTK_IS_RECENT_FILTER (filter));
889 GTK_RECENT_CHOOSER_GET_IFACE (chooser)->add_filter (chooser, filter);
893 * gtk_recent_chooser_remove_filter:
894 * @chooser: a #GtkRecentChooser
895 * @filter: a #GtkRecentFilter
897 * Removes @filter from the list of #GtkRecentFilter objects held by @chooser.
902 gtk_recent_chooser_remove_filter (GtkRecentChooser *chooser,
903 GtkRecentFilter *filter)
905 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
906 g_return_if_fail (GTK_IS_RECENT_FILTER (filter));
908 GTK_RECENT_CHOOSER_GET_IFACE (chooser)->remove_filter (chooser, filter);
912 * gtk_recent_chooser_list_filters:
913 * @chooser: a #GtkRecentChooser
915 * Gets the #GtkRecentFilter objects held by @chooser.
917 * Return value: A singly linked list of #GtkRecentFilter objects. You
918 * should just free the returned list using g_slist_free().
923 gtk_recent_chooser_list_filters (GtkRecentChooser *chooser)
925 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL);
927 return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->list_filters (chooser);
931 * gtk_recent_chooser_set_filter:
932 * @chooser: a #GtkRecentChooser
933 * @filter: a #GtkRecentFilter
935 * Sets @filter as the current #GtkRecentFilter object used by @chooser
936 * to affect the displayed recently used resources.
941 gtk_recent_chooser_set_filter (GtkRecentChooser *chooser,
942 GtkRecentFilter *filter)
944 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
945 g_return_if_fail (GTK_IS_RECENT_FILTER (filter));
947 g_object_set (G_OBJECT (chooser), "filter", filter, NULL);
951 * gtk_recent_chooser_get_filter:
952 * @chooser: a #GtkRecentChooser
954 * Gets the #GtkRecentFilter object currently used by @chooser to affect
955 * the display of the recently used resources.
957 * Return value: a #GtkRecentFilter object.
962 gtk_recent_chooser_get_filter (GtkRecentChooser *chooser)
964 GtkRecentFilter *filter;
966 g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL);
968 g_object_get (G_OBJECT (chooser), "filter", &filter, NULL);
970 /* we need this hack because g_object_get() increases the refcount
971 * of the returned object; see also gtk_file_chooser_get_filter()
972 * inside gtkfilechooser.c
975 g_object_unref (filter);
981 _gtk_recent_chooser_item_activated (GtkRecentChooser *chooser)
983 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
985 g_signal_emit (chooser, chooser_signals[ITEM_ACTIVATED], 0);
989 _gtk_recent_chooser_selection_changed (GtkRecentChooser *chooser)
991 g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser));
993 g_signal_emit (chooser, chooser_signals[SELECTION_CHANGED], 0);
996 #define __GTK_RECENT_CHOOSER_C__
997 #include "gtkaliasdef.c"