diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2013-08-24 08:40:54 -0700 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2013-08-24 08:40:54 -0700 |
commit | 2759def4968f89c1a2370ca5b2b91af84dc4afd3 (patch) | |
tree | c5ed30009845bf2a4f2bfbb352e2b49af51e2368 | |
parent | 0f30343e9a13518c346d26378c9651723245338c (diff) | |
download | nautilus-2759def4968f89c1a2370ca5b2b91af84dc4afd3.tar.gz |
pathbar: add a return value from path-event signal
And make it so the return value is actually given in the callback,
instead of depending on the window and the pathbar agree on what
happened.
https://bugzilla.gnome.org/show_bug.cgi?id=706605
-rw-r--r-- | src/nautilus-pathbar.c | 9 | ||||
-rw-r--r-- | src/nautilus-window.c | 12 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c index f7227016e..b16f7f4f3 100644 --- a/src/nautilus-pathbar.c +++ b/src/nautilus-pathbar.c @@ -983,10 +983,10 @@ nautilus_path_bar_class_init (NautilusPathBarClass *path_bar_class) path_bar_signals [PATH_EVENT] = g_signal_new ("path-event", G_OBJECT_CLASS_TYPE (path_bar_class), - G_SIGNAL_RUN_FIRST, + G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusPathBarClass, path_event), NULL, NULL, NULL, - G_TYPE_NONE, 2, + G_TYPE_BOOLEAN, 2, G_TYPE_FILE, GDK_TYPE_EVENT); @@ -1260,6 +1260,7 @@ button_event_cb (GtkWidget *button, ButtonData *button_data; NautilusPathBar *path_bar; GList *button_list; + gboolean retval; button_data = BUTTON_DATA (data); path_bar = NAUTILUS_PATH_BAR (gtk_widget_get_parent (button)); @@ -1278,9 +1279,9 @@ button_event_cb (GtkWidget *button, button_list = g_list_find (path_bar->priv->button_list, button_data); g_assert (button_list != NULL); - g_signal_emit (path_bar, path_bar_signals [PATH_EVENT], 0, button_data->path, event); + g_signal_emit (path_bar, path_bar_signals [PATH_EVENT], 0, button_data->path, event, &retval); - return (event->button != GDK_BUTTON_PRIMARY); + return retval; } static void diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 08cea59ce..bc7427295 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -1071,7 +1071,7 @@ path_bar_location_changed_callback (GtkWidget *widget, } } -static void +static gboolean path_bar_path_event_callback (NautilusPathBar *path_bar, GFile *location, GdkEventButton *event, @@ -1097,7 +1097,11 @@ path_bar_path_event_callback (NautilusPathBar *path_bar, slot = nautilus_window_get_active_slot (window); nautilus_window_slot_open_location (slot, location, flags); } - } else if (event->button == 3) { + + return FALSE; + } + + if (event->button == 3) { slot = nautilus_window_get_active_slot (window); view = nautilus_window_slot_get_view (slot); if (view != NULL) { @@ -1105,7 +1109,11 @@ path_bar_path_event_callback (NautilusPathBar *path_bar, nautilus_view_pop_up_location_context_menu (view, event, uri); g_free (uri); } + + return TRUE; } + + return FALSE; } static void |