[gtk+] gtkplacesview: Fix unmounted open in tab/window
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtkplacesview: Fix unmounted open in tab/window
- Date: Sat, 22 Apr 2017 09:54:36 +0000 (UTC)
commit 73d13fbdacd83db465b06b3362e61e898ef10325
Author: Carlos Soriano <csoriano gnome org>
Date: Fri Apr 21 17:58:30 2017 +0200
gtkplacesview: Fix unmounted open in tab/window
We were send the "open-location" signal without mounting first the
location if necessary, making the open in tab/window context menu not
work for those.
This patch makes sure we mount the location before emitting the signal.
https://bugzilla.gnome.org/show_bug.cgi?id=771269
gtk/gtkplacesview.c | 67 +++++++--------------------------------------------
1 files changed, 9 insertions(+), 58 deletions(-)
---
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index 12c81b0..1e6ba34 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -1533,82 +1533,33 @@ popup_menu_detach_cb (GtkWidget *attach_widget,
}
static void
-get_view_and_file (GtkPlacesViewRow *row,
- GtkWidget **view,
- GFile **file)
-{
- if (view)
- *view = gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_PLACES_VIEW);
-
- if (file)
- {
- GVolume *volume;
- GMount *mount;
-
- volume = gtk_places_view_row_get_volume (row);
- mount = gtk_places_view_row_get_mount (row);
-
- if (mount)
- {
- *file = g_mount_get_default_location (mount);
- }
- else if (volume)
- {
- *file = g_volume_get_activation_root (volume);
- }
- else
- {
- *file = gtk_places_view_row_get_file (row);
- if (*file) {
- g_object_ref (*file);
- }
- }
- }
-}
-
-static void
open_cb (GtkMenuItem *item,
GtkPlacesViewRow *row)
{
- GtkWidget *view;
- GFile *file;
-
- get_view_and_file (row, &view, &file);
-
- if (file)
- emit_open_location (GTK_PLACES_VIEW (view), file, GTK_PLACES_OPEN_NORMAL);
+ GtkPlacesView *self;
- g_clear_object (&file);
+ self = GTK_PLACES_VIEW (gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_PLACES_VIEW));
+ activate_row (self, row, GTK_PLACES_OPEN_NORMAL);
}
static void
open_in_new_tab_cb (GtkMenuItem *item,
GtkPlacesViewRow *row)
{
- GtkWidget *view;
- GFile *file;
-
- get_view_and_file (row, &view, &file);
+ GtkPlacesView *self;
- if (file)
- emit_open_location (GTK_PLACES_VIEW (view), file, GTK_PLACES_OPEN_NEW_TAB);
-
- g_clear_object (&file);
+ self = GTK_PLACES_VIEW (gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_PLACES_VIEW));
+ activate_row (self, row, GTK_PLACES_OPEN_NEW_TAB);
}
static void
open_in_new_window_cb (GtkMenuItem *item,
GtkPlacesViewRow *row)
{
- GtkWidget *view;
- GFile *file;
+ GtkPlacesView *self;
- get_view_and_file (row, &view, &file);
-
- if (file)
- emit_open_location (GTK_PLACES_VIEW (view), file, GTK_PLACES_OPEN_NEW_WINDOW);
-
- g_clear_object (&file);
+ self = GTK_PLACES_VIEW (gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_PLACES_VIEW));
+ activate_row (self, row, GTK_PLACES_OPEN_NEW_WINDOW);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]