[nautilus/wip/antoniof/gtk4-preparation-discontinued-api: 4/12] pathbar: Stop overriding GtkWidget.style_updated() and .screen_changed()
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gtk4-preparation-discontinued-api: 4/12] pathbar: Stop overriding GtkWidget.style_updated() and .screen_changed()
- Date: Sat, 1 Jan 2022 21:58:00 +0000 (UTC)
commit 6dce63dcc75eeb5f93b6f2841e73f3e6b05ccb13
Author: António Fernandes <antoniof gnome org>
Date: Fri Dec 31 13:29:57 2021 +0000
pathbar: Stop overriding GtkWidget.style_updated() and .screen_changed()
Both vfuncs are gone in GTK 4.
They were used for the sake of updating icons live the icon theme is
changed. I don't see any need for that. If GTK doesn't update the icons
automatically, the icon is updated next time the pathbar is updated for
other reasons (such as switching locations).
src/nautilus-pathbar.c | 102 -------------------------------------------------
1 file changed, 102 deletions(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 4dea6168f..8df2651a7 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -95,7 +95,6 @@ struct _NautilusPathBar
gpointer current_button_data;
GList *button_list;
- gulong settings_signal_id;
GActionGroup *action_group;
@@ -111,9 +110,6 @@ struct _NautilusPathBar
G_DEFINE_TYPE (NautilusPathBar, nautilus_path_bar, GTK_TYPE_BOX);
-static void nautilus_path_bar_check_icon_theme (NautilusPathBar *self);
-static void nautilus_path_bar_update_button_appearance (ButtonData *button_data,
- gboolean current_dir);
static void nautilus_path_bar_update_button_state (ButtonData *button_data,
gboolean current_dir);
static void nautilus_path_bar_update_path (NautilusPathBar *self,
@@ -322,27 +318,9 @@ nautilus_path_bar_finalize (GObject *object)
G_OBJECT_CLASS (nautilus_path_bar_parent_class)->finalize (object);
}
-/* Removes the settings signal handler. It's safe to call multiple times */
-static void
-remove_settings_signal (NautilusPathBar *self,
- GdkScreen *screen)
-{
- GtkSettings *settings;
-
- settings = gtk_settings_get_for_screen (screen);
-
- g_clear_signal_handler (&self->settings_signal_id, settings);
-}
-
static void
nautilus_path_bar_dispose (GObject *object)
{
- NautilusPathBar *self;
-
- self = NAUTILUS_PATH_BAR (object);
-
- remove_settings_signal (self, gtk_widget_get_screen (GTK_WIDGET (object)));
-
G_OBJECT_CLASS (nautilus_path_bar_parent_class)->dispose (object);
}
@@ -387,30 +365,6 @@ get_dir_name (ButtonData *button_data)
}
}
-static void
-nautilus_path_bar_style_updated (GtkWidget *widget)
-{
- GTK_WIDGET_CLASS (nautilus_path_bar_parent_class)->style_updated (widget);
-
- nautilus_path_bar_check_icon_theme (NAUTILUS_PATH_BAR (widget));
-}
-
-static void
-nautilus_path_bar_screen_changed (GtkWidget *widget,
- GdkScreen *previous_screen)
-{
- if (GTK_WIDGET_CLASS (nautilus_path_bar_parent_class)->screen_changed)
- {
- GTK_WIDGET_CLASS (nautilus_path_bar_parent_class)->screen_changed (widget, previous_screen);
- }
- /* We might nave a new settings, so we remove the old one */
- if (previous_screen)
- {
- remove_settings_signal (NAUTILUS_PATH_BAR (widget), previous_screen);
- }
- nautilus_path_bar_check_icon_theme (NAUTILUS_PATH_BAR (widget));
-}
-
static void
button_data_free (ButtonData *button_data)
{
@@ -433,17 +387,12 @@ static void
nautilus_path_bar_class_init (NautilusPathBarClass *path_bar_class)
{
GObjectClass *gobject_class;
- GtkWidgetClass *widget_class;
gobject_class = (GObjectClass *) path_bar_class;
- widget_class = (GtkWidgetClass *) path_bar_class;
gobject_class->finalize = nautilus_path_bar_finalize;
gobject_class->dispose = nautilus_path_bar_dispose;
- widget_class->style_updated = nautilus_path_bar_style_updated;
- widget_class->screen_changed = nautilus_path_bar_screen_changed;
-
path_bar_signals [OPEN_LOCATION] =
g_signal_new ("open-location",
G_OBJECT_CLASS_TYPE (path_bar_class),
@@ -483,57 +432,6 @@ nautilus_path_bar_set_templates_menu (NautilusPathBar *self,
g_idle_add ((GSourceFunc) bind_current_view_menu_model_to_popover, self);
}
-/* Changes the icons wherever it is needed */
-static void
-reload_icons (NautilusPathBar *self)
-{
- GList *list;
-
- for (list = self->button_list; list; list = list->next)
- {
- ButtonData *button_data;
-
- button_data = BUTTON_DATA (list->data);
- if (button_data->type != NORMAL_BUTTON || button_data->is_root)
- {
- nautilus_path_bar_update_button_appearance (button_data,
- list->next == NULL);
- }
- }
-}
-
-/* Callback used when a GtkSettings value changes */
-static void
-settings_notify_cb (GObject *object,
- GParamSpec *pspec,
- NautilusPathBar *self)
-{
- const char *name;
-
- name = g_param_spec_get_name (pspec);
-
- if (!strcmp (name, "gtk-icon-theme-name") || !strcmp (name, "gtk-icon-sizes"))
- {
- reload_icons (self);
- }
-}
-
-static void
-nautilus_path_bar_check_icon_theme (NautilusPathBar *self)
-{
- GtkSettings *settings;
-
- if (self->settings_signal_id)
- {
- return;
- }
-
- settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (self)));
- self->settings_signal_id = g_signal_connect (settings, "notify", G_CALLBACK (settings_notify_cb), self);
-
- reload_icons (self);
-}
-
/* Public functions and their helpers */
static void
nautilus_path_bar_clear_buttons (NautilusPathBar *self)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]