diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 6e0fb89062..dfbd360d43 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -3540,7 +3540,6 @@ gtk_file_chooser_widget_dispose (GObject *object) g_clear_pointer (&priv->browse_files_popover, gtk_widget_destroy); g_clear_object (&priv->extra_widget); - remove_settings_signal (impl, gtk_widget_get_display (GTK_WIDGET (impl))); g_clear_pointer (&priv->bookmarks_manager, _gtk_bookmarks_manager_free); if (priv->external_entry && priv->location_entry == priv->external_entry) @@ -3605,9 +3604,6 @@ gtk_file_chooser_widget_unroot (GtkWidget *widget) priv->toplevel_current_focus_widget = NULL; } - remove_settings_signal (impl, gtk_widget_get_display (widget)); - check_icon_theme (impl); - GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->unroot (widget); } @@ -8666,6 +8662,15 @@ gtk_file_chooser_widget_set_save_entry (GtkFileChooserWidget *impl, } } +static void +display_changed_cb (GtkWidget *wiget, + GParamSpec *pspec, + GtkFileChooserWidget *impl) +{ + remove_settings_signal (impl, gtk_widget_get_display (GTK_WIDGET (impl))); + check_icon_theme (impl); +} + static void gtk_file_chooser_widget_init (GtkFileChooserWidget *impl) { @@ -8707,6 +8712,9 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl) gtk_widget_init_template (GTK_WIDGET (impl)); gtk_widget_set_size_request (priv->browse_files_tree_view, 280, -1); + g_signal_connect (impl, "notify::display,", G_CALLBACK (display_changed_cb), impl); + check_icon_theme (impl); + set_file_system_backend (impl); priv->bookmarks_manager = _gtk_bookmarks_manager_new (NULL, NULL); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 3fa16fdcb6..9dcfd581d5 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -7625,7 +7625,8 @@ gtk_widget_get_ancestor (GtkWidget *widget, * * Note that this function can only be called when the #GtkWidget * is attached to a toplevel, since the settings object is specific - * to a particular #GdkDisplay. + * to a particular #GdkDisplay. If you want to monitor the widget for + * changes in its settings, connect to notify::display. * * Returns: (transfer none): the relevant #GtkSettings object */