diff options
author | Carlos Soriano <csoriano@gnome.org> | 2016-02-29 23:13:51 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-03-04 20:15:52 -0500 |
commit | fdde27ea9ced5b8489127ed69e00f9ca363c799f (patch) | |
tree | 3355d39144db4a78f927cb01d77a9edcec6ebe34 /gtk | |
parent | fec0c4c201cc26f6b43c64e5e8e844f8a553527b (diff) | |
download | gtk+-fdde27ea9ced5b8489127ed69e00f9ca363c799f.tar.gz |
gtkplacessidebar: add new other locations with flags signal
We weren't using the open flags on the other locations signal, which
makes impossible for applications like nautilus to act in the same
way that for any other location where the user can choose between
opening in the current view, in a new window or in a new tab.
Add a new signal with an open flags parameter and deprecate
the other-location signal.
https://bugzilla.gnome.org/show_bug.cgi?id=754743
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkfilechooserwidget.c | 7 | ||||
-rw-r--r-- | gtk/gtkplacessidebar.c | 66 | ||||
-rw-r--r-- | gtk/ui/gtkfilechooserwidget.ui | 2 |
3 files changed, 64 insertions, 11 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 74d224e704..653c11d58b 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -2831,8 +2831,9 @@ location_mode_set (GtkFileChooserWidget *impl, /* Callback used when the places sidebar asks us to show other locations */ static void -places_sidebar_show_other_locations_cb (GtkPlacesSidebar *sidebar, - GtkFileChooserWidget *impl) +places_sidebar_show_other_locations_with_flags_cb (GtkPlacesSidebar *sidebar, + GtkPlacesOpenFlags open_flags, + GtkFileChooserWidget *impl) { GtkFileChooserWidgetPrivate *priv = impl->priv; @@ -8504,7 +8505,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class) gtk_widget_class_bind_template_callback (widget_class, path_bar_clicked); gtk_widget_class_bind_template_callback (widget_class, places_sidebar_open_location_cb); gtk_widget_class_bind_template_callback (widget_class, places_sidebar_show_error_message_cb); - gtk_widget_class_bind_template_callback (widget_class, places_sidebar_show_other_locations_cb); + gtk_widget_class_bind_template_callback (widget_class, places_sidebar_show_other_locations_with_flags_cb); gtk_widget_class_bind_template_callback (widget_class, search_entry_activate_cb); gtk_widget_class_bind_template_callback (widget_class, search_entry_stop_cb); gtk_widget_class_bind_template_callback (widget_class, new_folder_popover_active); diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 91f958f4a0..760b60786a 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -206,6 +206,9 @@ struct _GtkPlacesSidebarClass { void (* show_other_locations) (GtkPlacesSidebar *sidebar); + void (* show_other_locations_with_flags) (GtkPlacesSidebar *sidebar, + GtkPlacesOpenFlags open_flags); + void (* mount) (GtkPlacesSidebar *sidebar, GMountOperation *mount_operation); void (* unmount) (GtkPlacesSidebar *sidebar, @@ -222,6 +225,7 @@ enum { DRAG_ACTION_ASK, DRAG_PERFORM_DROP, SHOW_OTHER_LOCATIONS, + SHOW_OTHER_LOCATIONS_WITH_FLAGS, MOUNT, UNMOUNT, LAST_SIGNAL @@ -347,6 +351,14 @@ emit_show_other_locations (GtkPlacesSidebar *sidebar) } static void +emit_show_other_locations_with_flags (GtkPlacesSidebar *sidebar, + GtkPlacesOpenFlags open_flags) +{ + g_signal_emit (sidebar, places_sidebar_signals[SHOW_OTHER_LOCATIONS_WITH_FLAGS], + 0, open_flags); +} + +static void emit_mount_operation (GtkPlacesSidebar *sidebar, GMountOperation *mount_op) { @@ -2322,17 +2334,30 @@ open_row (GtkSidebarRow *row, NULL); if (place_type == PLACES_OTHER_LOCATIONS) - emit_show_other_locations (sidebar); + { + emit_show_other_locations (sidebar); + emit_show_other_locations_with_flags (sidebar, open_flags); + } else if (uri != NULL) - open_uri (sidebar, uri, open_flags); + { + open_uri (sidebar, uri, open_flags); + } else if (place_type == PLACES_CONNECT_TO_SERVER) - emit_show_connect_to_server (sidebar); + { + emit_show_connect_to_server (sidebar); + } else if (place_type == PLACES_ENTER_LOCATION) - emit_show_enter_location (sidebar); + { + emit_show_enter_location (sidebar); + } else if (volume != NULL) - open_volume (sidebar, volume, open_flags); + { + open_volume (sidebar, volume, open_flags); + } else if (drive != NULL) - open_drive (sidebar, drive, open_flags); + { + open_drive (sidebar, drive, open_flags); + } g_object_unref (sidebar); if (drive) @@ -4333,18 +4358,45 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class) * For example, the application may bring up a page showing persistent * volumes and discovered network addresses. * + * Deprecated: 3.20: use the #GtkPlacesSidebar::show-other-locations-with-flags + * which includes the open flags in order to allow the user to specify to open + * in a new tab or window, in a similar way than #GtkPlacesSidebar::open-location + * * Since: 3.18 */ places_sidebar_signals [SHOW_OTHER_LOCATIONS] = g_signal_new (I_("show-other-locations"), G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_FIRST, + G_SIGNAL_RUN_FIRST | G_SIGNAL_DEPRECATED, G_STRUCT_OFFSET (GtkPlacesSidebarClass, show_other_locations), NULL, NULL, _gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); /** + * GtkPlacesSidebar::show-other-locations-with-flags: + * @sidebar: the object which received the signal. + * @open_flags: a single value from #GtkPlacesOpenFlags specifying how it should be opened. + * + * The places sidebar emits this signal when it needs the calling + * application to present a way to show other locations e.g. drives + * and network access points. + * For example, the application may bring up a page showing persistent + * volumes and discovered network addresses. + * + * Since: 3.20 + */ + places_sidebar_signals [SHOW_OTHER_LOCATIONS_WITH_FLAGS] = + g_signal_new (I_("show-other-locations-with-flags"), + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkPlacesSidebarClass, show_other_locations_with_flags), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 1, + GTK_TYPE_PLACES_OPEN_FLAGS); + + /** * GtkPlacesSidebar::mount: * @sidebar: the object which received the signal. * @mount_operation: the #GMountOperation that is going to start. diff --git a/gtk/ui/gtkfilechooserwidget.ui b/gtk/ui/gtkfilechooserwidget.ui index 1b74232994..bc762032eb 100644 --- a/gtk/ui/gtkfilechooserwidget.ui +++ b/gtk/ui/gtkfilechooserwidget.ui @@ -22,7 +22,7 @@ </style> <signal name="open-location" handler="places_sidebar_open_location_cb" swapped="no"/> <signal name="show-error-message" handler="places_sidebar_show_error_message_cb" swapped="no"/> - <signal name="show-other-locations" handler="places_sidebar_show_other_locations_cb" swapped="no"/> + <signal name="show-other-locations-with-flags" handler="places_sidebar_show_other_locations_with_flags_cb" swapped="no"/> </object> <packing> <property name="resize">0</property> |