diff options
author | António Fernandes <antoniof@gnome.org> | 2022-09-01 21:10:47 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-09-01 23:09:29 +0100 |
commit | 0782b7cdd210ba69e0e4343f0b5673bfe55bf4d0 (patch) | |
tree | d6c4b470f171d4e7d043c7722f789d21d9aa386e | |
parent | 50e3f19587a115eb0b58ea381efa354e918503ac (diff) | |
download | nautilus-0782b7cdd210ba69e0e4343f0b5673bfe55bf4d0.tar.gz |
toolbar: Drop :window property
Toolbar holds a reference to the window, which owns the toolbar.
This reference cycle is problematic, so drop the property and just
peek the window by walking up the hierarchy.
Long term we should just dismantle NautilusToolbar completely, by
moving most logic to each their respective control and manage
everything from NautilusWindow.
-rw-r--r-- | src/nautilus-toolbar.c | 20 | ||||
-rw-r--r-- | src/nautilus-window.c | 3 |
2 files changed, 5 insertions, 18 deletions
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c index 4c1eb8cae..aad0fd3d0 100644 --- a/src/nautilus-toolbar.c +++ b/src/nautilus-toolbar.c @@ -72,7 +72,7 @@ struct _NautilusToolbar enum { - PROP_WINDOW = 1, + PROP_0, PROP_SHOW_LOCATION_ENTRY, PROP_WINDOW_SLOT, PROP_SEARCHING, @@ -117,10 +117,13 @@ update_action (NautilusToolbar *self, const char *action_name, gboolean enabled) { + GtkWidget *window; GAction *action; + window = gtk_widget_get_ancestor (GTK_WIDGET (self), NAUTILUS_TYPE_WINDOW); + /* Activate/deactivate */ - action = g_action_map_lookup_action (G_ACTION_MAP (self->window), action_name); + action = g_action_map_lookup_action (G_ACTION_MAP (window), action_name); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled); } @@ -355,12 +358,6 @@ nautilus_toolbar_set_property (GObject *object, switch (property_id) { - case PROP_WINDOW: - { - self->window = g_value_get_object (value); - } - break; - case PROP_SHOW_LOCATION_ENTRY: { nautilus_toolbar_set_show_location_entry (self, g_value_get_boolean (value)); @@ -451,13 +448,6 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass) oclass->finalize = nautilus_toolbar_finalize; oclass->constructed = nautilus_toolbar_constructed; - properties[PROP_WINDOW] = - g_param_spec_object ("window", - "The NautilusWindow", - "The NautilusWindow this toolbar is part of", - NAUTILUS_TYPE_WINDOW, - G_PARAM_WRITABLE | - G_PARAM_STATIC_STRINGS); properties[PROP_SHOW_LOCATION_ENTRY] = g_param_spec_boolean ("show-location-entry", "Whether to show the location entry", diff --git a/src/nautilus-window.c b/src/nautilus-window.c index eb6bec176..5e1f9d9a5 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -1350,9 +1350,6 @@ setup_toolbar (NautilusWindow *window) GtkWidget *path_bar; GtkWidget *location_entry; - - g_object_set (window->toolbar, "window", window, NULL); - /* connect to the pathbar signals */ path_bar = nautilus_toolbar_get_path_bar (NAUTILUS_TOOLBAR (window->toolbar)); |