[gnome-control-center] background: Fix warning when opening background selection dialog
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] background: Fix warning when opening background selection dialog
- Date: Wed, 10 Oct 2018 23:04:08 +0000 (UTC)
commit 9da8e1b68d39741c0ea2b851a4551d2910dbd541
Author: Robert Ancell <robert ancell canonical com>
Date: Thu Oct 11 09:42:29 2018 +1300
background: Fix warning when opening background selection dialog
This was due to the callback occurring before all the widgets had been added to
the dialog.
Also remove the workaround for the handler occuring during/after dispose by
using g_signal_connect_object.
The warnings were:
(gnome-control-center:13048): Gtk-CRITICAL **: 09:42:17.841: gtk_bin_get_child: assertion 'GTK_IS_BIN
(bin)' failed
(gnome-control-center:13048): Gtk-CRITICAL **: 09:42:17.841: gtk_icon_view_unselect_all: assertion
'GTK_IS_ICON_VIEW (icon_view)' failed
panels/background/cc-background-chooser-dialog.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
---
diff --git a/panels/background/cc-background-chooser-dialog.c
b/panels/background/cc-background-chooser-dialog.c
index 8d7bb675d..81f913ac5 100644
--- a/panels/background/cc-background-chooser-dialog.c
+++ b/panels/background/cc-background-chooser-dialog.c
@@ -87,8 +87,6 @@ static const GtkTargetEntry color_targets[] =
{ "application/x-color", 0, COLOR }
};
-static void on_visible_child_notify (CcBackgroundChooserDialog *chooser);
-
static void
cc_background_chooser_dialog_realize (GtkWidget *widget)
{
@@ -126,18 +124,6 @@ cc_background_chooser_dialog_dispose (GObject *object)
g_clear_object (&chooser->copy_cancellable);
}
- /* GtkStack triggers notify::visible-child during dispose and this
- * means that we have to explicitly disconnect the signal handler
- * before calling up to the parent implementation, or
- * on_visible_child_notify() will get called while we're in an
- * inconsistent state.
- */
- if (chooser->stack != NULL)
- {
- g_signal_handlers_disconnect_by_func (chooser->stack, on_visible_child_notify, chooser);
- chooser->stack = NULL;
- }
-
g_clear_pointer (&chooser->item_to_focus, gtk_tree_row_reference_free);
g_clear_object (&chooser->pictures_source);
g_clear_object (&chooser->colors_source);
@@ -475,7 +461,6 @@ cc_background_chooser_dialog_init (CcBackgroundChooserDialog *chooser)
gtk_widget_show (chooser->stack);
gtk_stack_set_homogeneous (GTK_STACK (chooser->stack), TRUE);
gtk_container_add (GTK_CONTAINER (vbox), chooser->stack);
- g_signal_connect_swapped (chooser->stack, "notify::visible-child", G_CALLBACK (on_visible_child_notify),
chooser);
/* Add drag and drop support for bg images */
gtk_drag_dest_set (chooser->stack, GTK_DEST_DEFAULT_ALL, NULL, 0, GDK_ACTION_COPY);
@@ -566,6 +551,8 @@ cc_background_chooser_dialog_init (CcBackgroundChooserDialog *chooser)
gtk_dialog_add_button (GTK_DIALOG (chooser), _("_Select"), GTK_RESPONSE_OK);
gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
gtk_dialog_set_response_sensitive (GTK_DIALOG (chooser), GTK_RESPONSE_OK, FALSE);
+
+ g_signal_connect_object (chooser->stack, "notify::visible-child", G_CALLBACK (on_visible_child_notify),
chooser, G_CONNECT_SWAPPED);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]