[nautilus/wip/antoniof/new-pathbar] pathbar: Refactor signals
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/new-pathbar] pathbar: Refactor signals
- Date: Sat, 18 Dec 2021 21:12:38 +0000 (UTC)
commit 87153b03311d7d554db712e1cd6bcbd1f92b705c
Author: António Fernandes <antoniof gnome org>
Date: Sat Dec 18 21:06:57 2021 +0000
pathbar: Refactor signals
NautilusPathBar::path-clicked is never emited.
NautilusPathBar::location-changed uses a parameter type that's gone in
GTK 4: GtkPlacesOpenFlags.
Generate a GType for our own NautilusOpenFlags enum type to be used as a
signal parameter, remove the unused signal and repurpose its signal
handler to handle the second signal (which no longer has a signature
compatible with the GtkPlacesSidebar one).
src/meson.build | 1 +
src/nautilus-pathbar.c | 22 +++++++---------------
src/nautilus-window.c | 12 +++++-------
3 files changed, 13 insertions(+), 22 deletions(-)
---
diff --git a/src/meson.build b/src/meson.build
index f1948160b..48c094b38 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -14,6 +14,7 @@ libnautilus_sources = [
c_template: 'nautilus-enum-types.c.template',
h_template: 'nautilus-enum-types.h.template',
sources: [
+ 'nautilus-enums.h',
'nautilus-search-popover.h',
'nautilus-special-location-bar.h',
'nautilus-query.h',
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 638fb89b7..b532cfe62 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -25,6 +25,8 @@
#include "nautilus-pathbar.h"
#include "nautilus-properties-window.h"
+#include "nautilus-enums.h"
+#include "nautilus-enum-types.h"
#include "nautilus-file.h"
#include "nautilus-file-utilities.h"
#include "nautilus-global-preferences.h"
@@ -37,7 +39,6 @@
enum
{
OPEN_LOCATION,
- PATH_CLICKED,
LAST_SIGNAL
};
@@ -157,7 +158,7 @@ action_pathbar_open_item_new_tab (GSimpleAction *action,
if (location)
{
- g_signal_emit (user_data, path_bar_signals[OPEN_LOCATION], 0, location, GTK_PLACES_OPEN_NEW_TAB);
+ g_signal_emit (user_data, path_bar_signals[OPEN_LOCATION], 0, location, NAUTILUS_OPEN_FLAG_NEW_TAB);
g_object_unref (location);
}
}
@@ -181,7 +182,7 @@ action_pathbar_open_item_new_window (GSimpleAction *action,
if (location)
{
- g_signal_emit (user_data, path_bar_signals[OPEN_LOCATION], 0, location, GTK_PLACES_OPEN_NEW_WINDOW);
+ g_signal_emit (user_data, path_bar_signals[OPEN_LOCATION], 0, location,
NAUTILUS_OPEN_FLAG_NEW_WINDOW);
g_object_unref (location);
}
}
@@ -448,16 +449,7 @@ nautilus_path_bar_class_init (NautilusPathBarClass *path_bar_class)
NULL, NULL, NULL,
G_TYPE_NONE, 2,
G_TYPE_FILE,
- GTK_TYPE_PLACES_OPEN_FLAGS);
- path_bar_signals [PATH_CLICKED] =
- g_signal_new ("path-clicked",
- G_OBJECT_CLASS_TYPE (path_bar_class),
- G_SIGNAL_RUN_FIRST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- G_TYPE_FILE);
+ NAUTILUS_TYPE_WINDOW_OPEN_FLAGS);
}
void
@@ -586,7 +578,7 @@ button_clicked_cb (GtkButton *button,
{
g_signal_emit (button_data->path_bar, path_bar_signals[OPEN_LOCATION], 0,
button_data->path,
- GTK_PLACES_OPEN_NEW_WINDOW);
+ NAUTILUS_OPEN_FLAG_NEW_WINDOW);
}
else
{
@@ -710,7 +702,7 @@ on_multi_press_gesture_pressed (GtkGestureMultiPress *gesture,
{
g_signal_emit (self, path_bar_signals[OPEN_LOCATION], 0,
button_data->path,
- GTK_PLACES_OPEN_NEW_TAB);
+ NAUTILUS_OPEN_FLAG_NEW_TAB);
}
}
break;
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 7220acbf5..c05174cf7 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1728,11 +1728,11 @@ nautilus_window_show_operation_notification (NautilusWindow *window,
}
static void
-path_bar_location_changed_callback (GtkWidget *widget,
- GFile *location,
- NautilusWindow *window)
+on_path_bar_open_location (NautilusWindow *window,
+ GFile *location,
+ NautilusOpenFlags open_flags)
{
- nautilus_window_open_location_full (window, location, 0, NULL, NULL);
+ nautilus_window_open_location_full (window, location, open_flags, NULL, NULL);
}
static void
@@ -1892,10 +1892,8 @@ setup_toolbar (NautilusWindow *window)
/* connect to the pathbar signals */
path_bar = nautilus_toolbar_get_path_bar (NAUTILUS_TOOLBAR (window->toolbar));
- g_signal_connect_object (path_bar, "path-clicked",
- G_CALLBACK (path_bar_location_changed_callback), window, 0);
g_signal_connect_swapped (path_bar, "open-location",
- G_CALLBACK (open_location_cb), window);
+ G_CALLBACK (on_path_bar_open_location), window);
/* connect to the location entry signals */
location_entry = nautilus_toolbar_get_location_entry (NAUTILUS_TOOLBAR (window->toolbar));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]