Commit c9d88b06 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

remove the idle callback when disposing the widget

parent e494be09
......@@ -50,6 +50,7 @@ struct _EggFileFormatChooserPrivate
GtkTreeSelection *selection;
guint idle_hack;
guint last_id;
gulong size_changed_event;
GtkFileChooser *chooser;
GtkFileFilter *all_files;
......@@ -356,9 +357,12 @@ find_by_extension (GtkTreeModel *model,
}
static int
emit_default_size_changed (gpointer data)
emit_default_size_changed (gpointer user_data)
{
g_signal_emit_by_name (data, "default-size-changed");
EggFileFormatChooser *self = user_data;
self->priv->size_changed_event = 0;
g_signal_emit_by_name (self->priv->chooser, "default-size-changed");
return FALSE;
}
......@@ -366,15 +370,10 @@ static void
expander_unmap_cb (GtkWidget *widget,
gpointer user_data)
{
GtkWidget *parent;
EggFileFormatChooser *self = user_data;
parent = gtk_widget_get_parent (widget);
while ((parent != NULL) && !GTK_IS_FILE_CHOOSER (parent))
parent = gtk_widget_get_parent (parent);
if (parent != NULL)
{
gdk_threads_add_idle (emit_default_size_changed, parent);
}
if (self->priv->size_changed_event == 0)
self->priv->size_changed_event = gdk_threads_add_idle (emit_default_size_changed, self);
}
static void
......@@ -390,6 +389,8 @@ egg_file_format_chooser_init (EggFileFormatChooser *self)
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EGG_TYPE_FILE_FORMAT_CHOOSER,
EggFileFormatChooserPrivate);
self->priv->size_changed_event = 0;
/* file filters */
self->priv->all_files = g_object_ref_sink (gtk_file_filter_new ());
......@@ -503,6 +504,11 @@ egg_file_format_chooser_dispose (GObject *obj)
g_source_remove (self->priv->idle_hack);
self->priv->idle_hack = 0;
}
if (self->priv->size_changed_event != 0)
{
g_source_remove (self->priv->size_changed_event);
self->priv->size_changed_event = 0;
}
}
G_OBJECT_CLASS (egg_file_format_chooser_parent_class)->dispose (obj);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment