mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 22:30:22 +00:00
Add a selected_volume argument to ::populate-popup
Nautilus needs this in order to implement a Format command for a volume's popup menu. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
parent
9ded1c0c99
commit
9d8e3be6d7
@ -181,7 +181,8 @@ struct _GtkPlacesSidebarClass {
|
|||||||
GtkPlacesOpenFlags open_flags);
|
GtkPlacesOpenFlags open_flags);
|
||||||
void (* populate_popup) (GtkPlacesSidebar *sidebar,
|
void (* populate_popup) (GtkPlacesSidebar *sidebar,
|
||||||
GtkMenu *menu,
|
GtkMenu *menu,
|
||||||
GFile *selected_item);
|
GFile *selected_item,
|
||||||
|
GVolume *selected_volume);
|
||||||
void (* show_error_message) (GtkPlacesSidebar *sidebar,
|
void (* show_error_message) (GtkPlacesSidebar *sidebar,
|
||||||
const char *primary,
|
const char *primary,
|
||||||
const char *secondary);
|
const char *secondary);
|
||||||
@ -342,10 +343,10 @@ emit_open_location (GtkPlacesSidebar *sidebar, GFile *location, GtkPlacesOpenFla
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
emit_populate_popup (GtkPlacesSidebar *sidebar, GtkMenu *menu, GFile *selected_item)
|
emit_populate_popup (GtkPlacesSidebar *sidebar, GtkMenu *menu, GFile *selected_item, GVolume *selected_volume)
|
||||||
{
|
{
|
||||||
g_signal_emit (sidebar, places_sidebar_signals[POPULATE_POPUP], 0,
|
g_signal_emit (sidebar, places_sidebar_signals[POPULATE_POPUP], 0,
|
||||||
menu, selected_item);
|
menu, selected_item, selected_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3206,9 +3207,10 @@ bookmarks_build_popup_menu (GtkPlacesSidebar *sidebar)
|
|||||||
else
|
else
|
||||||
file = NULL;
|
file = NULL;
|
||||||
|
|
||||||
emit_populate_popup (sidebar, GTK_MENU (sidebar->popup_menu), file);
|
emit_populate_popup (sidebar, GTK_MENU (sidebar->popup_menu), file, sel_info.volume);
|
||||||
|
|
||||||
g_object_unref (file);
|
if (file)
|
||||||
|
g_object_unref (file);
|
||||||
|
|
||||||
free_selection_info (&sel_info);
|
free_selection_info (&sel_info);
|
||||||
}
|
}
|
||||||
@ -4002,7 +4004,8 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
|
|||||||
* GtkPlacesSidebar::populate-popup:
|
* GtkPlacesSidebar::populate-popup:
|
||||||
* @sidebar: the object which received the signal.
|
* @sidebar: the object which received the signal.
|
||||||
* @menu: a #GtkMenu.
|
* @menu: a #GtkMenu.
|
||||||
* @selected_item: #GFile with the item to which the menu should refer.
|
* @selected_item: #GFile with the item to which the menu should refer, or #NULL in the case of a @selected_volume.
|
||||||
|
* @selected_volume: #GVolume if the selected item is a volume, or #NULL if it is a file.
|
||||||
*
|
*
|
||||||
* The places sidebar emits this signal when the user invokes a contextual
|
* The places sidebar emits this signal when the user invokes a contextual
|
||||||
* menu on one of its items. In the signal handler, the application may
|
* menu on one of its items. In the signal handler, the application may
|
||||||
@ -4014,6 +4017,11 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
|
|||||||
* gtk_places_sidebar_get_location() to get the file to which the item
|
* gtk_places_sidebar_get_location() to get the file to which the item
|
||||||
* refers.
|
* refers.
|
||||||
*
|
*
|
||||||
|
* The @selected_item argument may be #NULL in case the selection refers to
|
||||||
|
* a volume. In this case, @selected_volume will be non-NULL. In this case,
|
||||||
|
* the calling application will have to g_object_ref() the @selected_volume and
|
||||||
|
* keep it around for the purposes of its menu item's "activate" callback.
|
||||||
|
*
|
||||||
* The @menu and all its menu items are destroyed after the user
|
* The @menu and all its menu items are destroyed after the user
|
||||||
* dismisses the menu. The menu is re-created (and thus, this signal is
|
* dismisses the menu. The menu is re-created (and thus, this signal is
|
||||||
* emitted) every time the user activates the contextual menu.
|
* emitted) every time the user activates the contextual menu.
|
||||||
@ -4026,8 +4034,9 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
|
|||||||
G_SIGNAL_RUN_FIRST,
|
G_SIGNAL_RUN_FIRST,
|
||||||
G_STRUCT_OFFSET (GtkPlacesSidebarClass, populate_popup),
|
G_STRUCT_OFFSET (GtkPlacesSidebarClass, populate_popup),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
_gtk_marshal_VOID__OBJECT_OBJECT,
|
_gtk_marshal_VOID__OBJECT_OBJECT_OBJECT,
|
||||||
G_TYPE_NONE, 2,
|
G_TYPE_NONE, 3,
|
||||||
|
G_TYPE_OBJECT,
|
||||||
G_TYPE_OBJECT,
|
G_TYPE_OBJECT,
|
||||||
G_TYPE_OBJECT);
|
G_TYPE_OBJECT);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user