[nautilus] pathbar: add a return value from path-event signal



commit 2759def4968f89c1a2370ca5b2b91af84dc4afd3
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Aug 24 08:40:54 2013 -0700

    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

 src/nautilus-pathbar.c |    9 +++++----
 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 f722701..b16f7f4 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 08cea59..bc74272 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]