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
This commit is contained in:
parent
fa08a3bfe6
commit
9da8e1b68d
1 changed files with 2 additions and 15 deletions
|
@ -87,8 +87,6 @@ static const GtkTargetEntry color_targets[] =
|
||||||
{ "application/x-color", 0, COLOR }
|
{ "application/x-color", 0, COLOR }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void on_visible_child_notify (CcBackgroundChooserDialog *chooser);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cc_background_chooser_dialog_realize (GtkWidget *widget)
|
cc_background_chooser_dialog_realize (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
@ -126,18 +124,6 @@ cc_background_chooser_dialog_dispose (GObject *object)
|
||||||
g_clear_object (&chooser->copy_cancellable);
|
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_pointer (&chooser->item_to_focus, gtk_tree_row_reference_free);
|
||||||
g_clear_object (&chooser->pictures_source);
|
g_clear_object (&chooser->pictures_source);
|
||||||
g_clear_object (&chooser->colors_source);
|
g_clear_object (&chooser->colors_source);
|
||||||
|
@ -475,7 +461,6 @@ cc_background_chooser_dialog_init (CcBackgroundChooserDialog *chooser)
|
||||||
gtk_widget_show (chooser->stack);
|
gtk_widget_show (chooser->stack);
|
||||||
gtk_stack_set_homogeneous (GTK_STACK (chooser->stack), TRUE);
|
gtk_stack_set_homogeneous (GTK_STACK (chooser->stack), TRUE);
|
||||||
gtk_container_add (GTK_CONTAINER (vbox), chooser->stack);
|
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 */
|
/* Add drag and drop support for bg images */
|
||||||
gtk_drag_dest_set (chooser->stack, GTK_DEST_DEFAULT_ALL, NULL, 0, GDK_ACTION_COPY);
|
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_add_button (GTK_DIALOG (chooser), _("_Select"), GTK_RESPONSE_OK);
|
||||||
gtk_dialog_set_default_response (GTK_DIALOG (chooser), 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);
|
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
|
static void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue