filechooserwidget: Properly watch for different display

The value returned by gtk_widget_get_settings() depends on the widget's
display, so watch for notify::display instead of using (un)root for
this.

Fixes the warnings seen when show a file chooser from the inspector.
This commit is contained in:
Timm Bäder 2019-08-28 11:50:59 +02:00
parent b9473bc99c
commit 9952f72680
2 changed files with 14 additions and 5 deletions

View File

@ -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);

View File

@ -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
*/