StWidget: use a handler id to disconnect the callback

g_signal_handlers_disconnect_by_func() is much more expensive
than g_signal_handler_disconnect(), so use the latter.

https://bugzilla.gnome.org/show_bug.cgi?id=704077
This commit is contained in:
Emilio Pozuelo Monfort 2013-07-12 11:07:18 +02:00
parent 9163372786
commit c9b079cbb5

View File

@ -67,6 +67,8 @@ struct _StWidgetPrivate
gboolean hover : 1; gboolean hover : 1;
gboolean can_focus : 1; gboolean can_focus : 1;
gulong texture_file_changed_id;
AtkObject *accessible; AtkObject *accessible;
AtkRole accessible_role; AtkRole accessible_role;
AtkStateSet *local_state_set; AtkStateSet *local_state_set;
@ -362,9 +364,11 @@ st_widget_dispose (GObject *gobject)
priv->label_actor = NULL; priv->label_actor = NULL;
} }
g_signal_handlers_disconnect_by_func (st_texture_cache_get_default (), if (priv->texture_file_changed_id != 0)
st_widget_texture_cache_changed, {
actor); g_signal_handler_disconnect (st_texture_cache_get_default (), priv->texture_file_changed_id);
priv->texture_file_changed_id = 0;
}
g_clear_object (&priv->prev_first_child); g_clear_object (&priv->prev_first_child);
g_clear_object (&priv->prev_last_child); g_clear_object (&priv->prev_last_child);
@ -1552,8 +1556,8 @@ st_widget_init (StWidget *actor)
g_signal_connect (actor, "notify::first-child", G_CALLBACK (st_widget_first_child_notify), NULL); g_signal_connect (actor, "notify::first-child", G_CALLBACK (st_widget_first_child_notify), NULL);
g_signal_connect (actor, "notify::last-child", G_CALLBACK (st_widget_last_child_notify), NULL); g_signal_connect (actor, "notify::last-child", G_CALLBACK (st_widget_last_child_notify), NULL);
g_signal_connect (st_texture_cache_get_default (), "texture-file-changed", priv->texture_file_changed_id = g_signal_connect (st_texture_cache_get_default (), "texture-file-changed",
G_CALLBACK (st_widget_texture_cache_changed), actor); G_CALLBACK (st_widget_texture_cache_changed), actor);
for (i = 0; i < G_N_ELEMENTS (priv->paint_states); i++) for (i = 0; i < G_N_ELEMENTS (priv->paint_states); i++)
st_theme_node_paint_state_init (&priv->paint_states[i]); st_theme_node_paint_state_init (&priv->paint_states[i]);