void _gtk_recent_chooser_selection_changed (GtkRecentChooser *chooser) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); g_signal_emit (chooser, chooser_signals[SELECTION_CHANGED], 0); }
void _gtk_recent_chooser_item_activated (GtkRecentChooser *chooser) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); g_signal_emit (chooser, chooser_signals[ITEM_ACTIVATED], 0); }
/** * _gtk_recent_chooser_get_recent_manager: * @chooser: a #GtkRecentChooser * * Gets the #GtkRecentManager used by @chooser. * * Return value: the recent manager for @chooser. * * Since: 2.10 */ GtkRecentManager * _gtk_recent_chooser_get_recent_manager (GtkRecentChooser *chooser) { g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL); return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->get_recent_manager (chooser); }
void gl_ui_cmd_file_open_recent (GtkRecentChooser *chooser, glWindow *window) { GtkRecentInfo *item; gchar *utf8_filename; gl_debug (DEBUG_COMMANDS, "START"); g_return_if_fail (chooser && GTK_IS_RECENT_CHOOSER(chooser)); g_return_if_fail (window && GL_IS_WINDOW(window)); item = gtk_recent_chooser_get_current_item (chooser); if (!item) return; utf8_filename = gl_recent_get_utf8_filename (item); gl_debug (DEBUG_COMMANDS, "Selected %s\n", utf8_filename); gl_file_open_recent (utf8_filename, window); gtk_recent_info_unref (item); gl_debug (DEBUG_COMMANDS, "END"); }
/** * gtk_recent_chooser_unselect_all: * @chooser: a #GtkRecentChooser * * Unselects all the items inside @chooser. * * Since: 2.10 */ void gtk_recent_chooser_unselect_all (GtkRecentChooser *chooser) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); GTK_RECENT_CHOOSER_GET_IFACE (chooser)->unselect_all (chooser); }
/** * gtk_recent_chooser_get_current_uri: * @chooser: a #GtkRecentChooser * * Gets the URI currently selected by @chooser. * * Return value: a newly allocated string holding a URI. * * Since: 2.10 */ gchar * gtk_recent_chooser_get_current_uri (GtkRecentChooser *chooser) { g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL); return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->get_current_uri (chooser); }
static void gtk_recent_action_connect_proxy (GtkAction *action, GtkWidget *widget) { GtkRecentAction *recent_action = GTK_RECENT_ACTION (action); GtkRecentActionPrivate *priv = recent_action->priv; /* it can only be a recent chooser implementor anyway... */ if (GTK_IS_RECENT_CHOOSER (widget) && !g_slist_find (priv->choosers, widget)) { if (priv->sort_func) { gtk_recent_chooser_set_sort_func (GTK_RECENT_CHOOSER (widget), priv->sort_func, priv->sort_data, priv->data_destroy); } g_signal_connect_swapped (widget, "selection_changed", G_CALLBACK (delegate_selection_changed), action); g_signal_connect_swapped (widget, "item-activated", G_CALLBACK (delegate_item_activated), action); } if (GTK_ACTION_CLASS (gtk_recent_action_parent_class)->connect_proxy) GTK_ACTION_CLASS (gtk_recent_action_parent_class)->connect_proxy (action, widget); }
/** * gtk_recent_chooser_list_filters: * @chooser: a #GtkRecentChooser * * Gets the #GtkRecentFilter objects held by @chooser. * * Return value: (element-type GtkRecentFilter) (transfer container): A singly linked list * of #GtkRecentFilter objects. You * should just free the returned list using g_slist_free(). * * Since: 2.10 */ GSList * gtk_recent_chooser_list_filters (GtkRecentChooser *chooser) { g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL); return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->list_filters (chooser); }
/** * gtk_recent_chooser_get_items: * @chooser: a #GtkRecentChooser * * Gets the list of recently used resources in form of #GtkRecentInfo objects. * * The return value of this function is affected by the “sort-type” and * “limit” properties of @chooser. * * Return value: (element-type GtkRecentInfo) (transfer full): A newly allocated * list of #GtkRecentInfo objects. You should * use gtk_recent_info_unref() on every item of the list, and then free * the list itself using g_list_free(). * * Since: 2.10 */ GList * gtk_recent_chooser_get_items (GtkRecentChooser *chooser) { g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL); return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->get_items (chooser); }
/** * _gtk_recent_chooser_set_delegate: * @receiver: a #GObject implementing #GtkRecentChooser * @delegate: another #GObject implementing #GtkRecentChooser * * Establishes that calls on @receiver for #GtkRecentChooser * methods should be delegated to @delegate, and that * #GtkRecentChooser signals emitted on @delegate should be * forwarded to @receiver. Must be used in conjunction with * _gtk_recent_chooser_delegate_iface_init(). */ void _gtk_recent_chooser_set_delegate (GtkRecentChooser *receiver, GtkRecentChooser *delegate) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (receiver)); g_return_if_fail (GTK_IS_RECENT_CHOOSER (delegate)); g_object_set_data (G_OBJECT (receiver), "gtk-recent-chooser-delegate", delegate); g_signal_connect (delegate, "notify", G_CALLBACK (delegate_notify), receiver); g_signal_connect (delegate, "selection-changed", G_CALLBACK (delegate_selection_changed), receiver); g_signal_connect (delegate, "item-activated", G_CALLBACK (delegate_item_activated), receiver); }
/** * gtk_recent_chooser_set_show_tips: * @chooser: a #GtkRecentChooser * @show_tips: %TRUE if tooltips should be shown * * Sets whether to show a tooltips containing the full path of each * recently used resource in a #GtkRecentChooser widget. * * Since: 2.10 */ void gtk_recent_chooser_set_show_tips (GtkRecentChooser *chooser, gboolean show_tips) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); g_object_set (chooser, "show-tips", show_tips, NULL); }
/** * gtk_recent_chooser_set_limit: * @chooser: a #GtkRecentChooser * @limit: a positive integer, or -1 for all items * * Sets the number of items that should be returned by * gtk_recent_chooser_get_items() and gtk_recent_chooser_get_uris(). * * Since: 2.10 */ void gtk_recent_chooser_set_limit (GtkRecentChooser *chooser, gint limit) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); g_object_set (chooser, "limit", limit, NULL); }
/** * gtk_recent_chooser_set_local_only: * @chooser: a #GtkRecentChooser * @local_only: %TRUE if only local files can be shown * * Sets whether only local resources, that is resources using the file:// URI * scheme, should be shown in the recently used resources selector. If * @local_only is %TRUE (the default) then the shown resources are guaranteed * to be accessible through the operating system native file system. * * Since: 2.10 */ void gtk_recent_chooser_set_local_only (GtkRecentChooser *chooser, gboolean local_only) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); g_object_set (chooser, "local-only", local_only, NULL); }
/** * gtk_recent_chooser_unselect_uri: * @chooser: a #GtkRecentChooser * @uri: a URI * * Unselects @uri inside @chooser. * * Since: 2.10 */ void gtk_recent_chooser_unselect_uri (GtkRecentChooser *chooser, const gchar *uri) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); GTK_RECENT_CHOOSER_GET_IFACE (chooser)->unselect_uri (chooser, uri); }
/** * gtk_recent_chooser_set_select_multiple: * @chooser: a #GtkRecentChooser * @select_multiple: %TRUE if @chooser can select more than one item * * Sets whether @chooser can select multiple items. * * Since: 2.10 */ void gtk_recent_chooser_set_select_multiple (GtkRecentChooser *chooser, gboolean select_multiple) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); g_object_set (chooser, "select-multiple", select_multiple, NULL); }
/** * gtk_recent_chooser_set_sort_type: * @chooser: a #GtkRecentChooser * @sort_type: sort order that the chooser should use * * Changes the sorting order of the recently used resources list displayed by * @chooser. * * Since: 2.10 */ void gtk_recent_chooser_set_sort_type (GtkRecentChooser *chooser, GtkRecentSortType sort_type) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); g_object_set (chooser, "sort-type", sort_type, NULL); }
/** * gtk_recent_chooser_set_show_not_found: * @chooser: a #GtkRecentChooser * @show_not_found: whether to show the local items we didn’t find * * Sets whether @chooser should display the recently used resources that * it didn’t find. This only applies to local resources. * * Since: 2.10 */ void gtk_recent_chooser_set_show_not_found (GtkRecentChooser *chooser, gboolean show_not_found) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); g_object_set (chooser, "show-not-found", show_not_found, NULL); }
/** * gtk_recent_chooser_set_show_private: * @chooser: a #GtkRecentChooser * @show_private: %TRUE to show private items, %FALSE otherwise * * Whether to show recently used resources marked registered as private. * * Since: 2.10 */ void gtk_recent_chooser_set_show_private (GtkRecentChooser *chooser, gboolean show_private) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); g_object_set (chooser, "show-private", show_private, NULL); }
/** * gtk_recent_chooser_remove_filter: * @chooser: a #GtkRecentChooser * @filter: a #GtkRecentFilter * * Removes @filter from the list of #GtkRecentFilter objects held by @chooser. * * Since: 2.10 */ void 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); }
/** * gtk_recent_chooser_select_uri: * @chooser: a #GtkRecentChooser * @uri: a URI * @error: (allow-none): return location for a #GError, or %NULL * * Selects @uri inside @chooser. * * Return value: %TRUE if @uri was found. * * Since: 2.10 */ gboolean gtk_recent_chooser_select_uri (GtkRecentChooser *chooser, const gchar *uri, GError **error) { g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE); return GTK_RECENT_CHOOSER_GET_IFACE (chooser)->select_uri (chooser, uri, error); }
/** * gtk_recent_chooser_set_filter: * @chooser: a #GtkRecentChooser * @filter: (allow-none): a #GtkRecentFilter * * Sets @filter as the current #GtkRecentFilter object used by @chooser * to affect the displayed recently used resources. * * Since: 2.10 */ void gtk_recent_chooser_set_filter (GtkRecentChooser *chooser, GtkRecentFilter *filter) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); g_return_if_fail (filter == NULL || GTK_IS_RECENT_FILTER (filter)); g_object_set (G_OBJECT (chooser), "filter", filter, NULL); }
/** * gtk_recent_chooser_get_local_only: * @chooser: a #GtkRecentChooser * * Gets whether only local resources should be shown in the recently used * resources selector. See gtk_recent_chooser_set_local_only() * * Return value: %TRUE if only local resources should be shown. * * Since: 2.10 */ gboolean gtk_recent_chooser_get_local_only (GtkRecentChooser *chooser) { gboolean local_only; g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE); g_object_get (chooser, "local-only", &local_only, NULL); return local_only; }
/** * gtk_recent_chooser_get_show_private: * @chooser: a #GtkRecentChooser * * Returns whether @chooser should display recently used resources * registered as private. * * Return value: %TRUE if the recent chooser should show private items, * %FALSE otherwise. * * Since: 2.10 */ gboolean gtk_recent_chooser_get_show_private (GtkRecentChooser *chooser) { gboolean show_private; g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE); g_object_get (chooser, "show-private", &show_private, NULL); return show_private; }
/** * gtk_recent_chooser_get_show_not_found: * @chooser: a #GtkRecentChooser * * Retrieves whether @chooser should show the recently used resources that * were not found. * * Return value: %TRUE if the resources not found should be displayed, and * %FALSE otheriwse. * * Since: 2.10 */ gboolean gtk_recent_chooser_get_show_not_found (GtkRecentChooser *chooser) { gboolean show_not_found; g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE); g_object_get (chooser, "show-not-found", &show_not_found, NULL); return show_not_found; }
/** * gtk_recent_chooser_get_select_multiple: * @chooser: a #GtkRecentChooser * * Gets whether @chooser can select multiple items. * * Return value: %TRUE if @chooser can select more than one item. * * Since: 2.10 */ gboolean gtk_recent_chooser_get_select_multiple (GtkRecentChooser *chooser) { gboolean select_multiple; g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE); g_object_get (chooser, "select-multiple", &select_multiple, NULL); return select_multiple; }
/** * gtk_recent_chooser_get_show_tips: * @chooser: a #GtkRecentChooser * * Gets whether @chooser should display tooltips containing the full path * of a recently user resource. * * Return value: %TRUE if the recent chooser should show tooltips, * %FALSE otherwise. * * Since: 2.10 */ gboolean gtk_recent_chooser_get_show_tips (GtkRecentChooser *chooser) { gboolean show_tips; g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), FALSE); g_object_get (chooser, "show-tips", &show_tips, NULL); return show_tips; }
/** * gtk_recent_chooser_get_sort_type: * @chooser: a #GtkRecentChooser * * Gets the value set by gtk_recent_chooser_set_sort_type(). * * Return value: the sorting order of the @chooser. * * Since: 2.10 */ GtkRecentSortType gtk_recent_chooser_get_sort_type (GtkRecentChooser *chooser) { GtkRecentSortType sort_type; g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), GTK_RECENT_SORT_NONE); g_object_get (chooser, "sort-type", &sort_type, NULL); return sort_type; }
/** * gtk_recent_chooser_get_limit: * @chooser: a #GtkRecentChooser * * Gets the number of items returned by gtk_recent_chooser_get_items() * and gtk_recent_chooser_get_uris(). * * Return value: A positive integer, or -1 meaning that all items are * returned. * * Since: 2.10 */ gint gtk_recent_chooser_get_limit (GtkRecentChooser *chooser) { gint limit; g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), 10); g_object_get (chooser, "limit", &limit, NULL); return limit; }
/** * gtk_recent_chooser_set_sort_func: * @chooser: a #GtkRecentChooser * @sort_func: the comparison function * @sort_data: (allow-none): user data to pass to @sort_func, or %NULL * @data_destroy: (allow-none): destroy notifier for @sort_data, or %NULL * * Sets the comparison function used when sorting to be @sort_func. If * the @chooser has the sort type set to #GTK_RECENT_SORT_CUSTOM then * the chooser will sort using this function. * * To the comparison function will be passed two #GtkRecentInfo structs and * @sort_data; @sort_func should return a positive integer if the first * item comes before the second, zero if the two items are equal and * a negative integer if the first item comes after the second. * * Since: 2.10 */ void gtk_recent_chooser_set_sort_func (GtkRecentChooser *chooser, GtkRecentSortFunc sort_func, gpointer sort_data, GDestroyNotify data_destroy) { g_return_if_fail (GTK_IS_RECENT_CHOOSER (chooser)); GTK_RECENT_CHOOSER_GET_IFACE (chooser)->set_sort_func (chooser, sort_func, sort_data, data_destroy); }
/** * gtk_recent_chooser_get_filter: * @chooser: a #GtkRecentChooser * * Gets the #GtkRecentFilter object currently used by @chooser to affect * the display of the recently used resources. * * Return value: (transfer none): a #GtkRecentFilter object. * * Since: 2.10 */ GtkRecentFilter * gtk_recent_chooser_get_filter (GtkRecentChooser *chooser) { GtkRecentFilter *filter; g_return_val_if_fail (GTK_IS_RECENT_CHOOSER (chooser), NULL); g_object_get (G_OBJECT (chooser), "filter", &filter, NULL); /* we need this hack because g_object_get() increases the refcount * of the returned object; see also gtk_file_chooser_get_filter() * inside gtkfilechooser.c */ if (filter) g_object_unref (filter); return filter; }