summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2006-08-15 18:11:13 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2006-08-15 18:11:13 +0000
commitce94b03def34e32f223700c198a55d930f1d1759 (patch)
tree6e220b69937c8b950e2ed7f309efd01db460a883
parent6f535cb264390189df7a92cd6655e32f5cd3c1db (diff)
downloadgtk+-ce94b03def34e32f223700c198a55d930f1d1759.tar.gz
Don't store GSource pointers, but ids. (gtk_file_chooser_entry_dispose):
2006-08-15 Matthias Clasen <mclasen@redhat.com> * gtk/gtkfilechooserentry.c (struct _GtkFileChooserEntry): Don't store GSource pointers, but ids. (gtk_file_chooser_entry_dispose): Remove idles. (idle_add, idle_add): Factor this out. (gtk_file_chooser_entry_maybe_update_directory): (add_completion_idle): And use it here. (#350039, Chris Wilson)
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.pre-2-107
-rw-r--r--gtk/gtkfilechooserentry.c61
3 files changed, 53 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index bba27499e3..72b55a069f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2006-08-15 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtkfilechooserentry.c (struct _GtkFileChooserEntry): Don't
+ store GSource pointers, but ids.
+ (gtk_file_chooser_entry_dispose): Remove idles.
+ (idle_add, idle_add): Factor this out.
+ (gtk_file_chooser_entry_maybe_update_directory):
+ (add_completion_idle): And use it here. (#350039, Chris Wilson)
+
* gtk/gtkicontheme.c (do_theme_change): Run the reset_styles
idle at a priority higher than size negotiation. (#350517,
Søren Sandmann)
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index bba27499e3..72b55a069f 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,5 +1,12 @@
2006-08-15 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtkfilechooserentry.c (struct _GtkFileChooserEntry): Don't
+ store GSource pointers, but ids.
+ (gtk_file_chooser_entry_dispose): Remove idles.
+ (idle_add, idle_add): Factor this out.
+ (gtk_file_chooser_entry_maybe_update_directory):
+ (add_completion_idle): And use it here. (#350039, Chris Wilson)
+
* gtk/gtkicontheme.c (do_theme_change): Run the reset_styles
idle at a priority higher than size negotiation. (#350517,
Søren Sandmann)
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index c4924542c0..221230483b 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -51,8 +51,8 @@ struct _GtkFileChooserEntry
GtkFilePath *current_folder_path;
gchar *file_part;
gint file_part_pos;
- GSource *check_completion_idle;
- GSource *load_directory_idle;
+ guint check_completion_idle;
+ guint load_directory_idle;
GtkFileFolder *current_folder;
GtkFileSystemHandle *load_folder_handle;
@@ -214,6 +214,18 @@ gtk_file_chooser_entry_dispose (GObject *object)
chooser_entry->file_system = NULL;
}
+ if (chooser_entry->check_completion_idle)
+ {
+ g_source_remove (chooser_entry->check_completion_idle);
+ chooser_entry->check_completion_idle = 0;
+ }
+
+ if (chooser_entry->load_directory_idle)
+ {
+ g_source_remove (chooser_entry->load_directory_idle);
+ chooser_entry->load_directory_idle = 0;
+ }
+
G_OBJECT_CLASS (_gtk_file_chooser_entry_parent_class)->dispose (object);
}
@@ -492,7 +504,7 @@ check_completion_callback (GtkFileChooserEntry *chooser_entry)
g_assert (chooser_entry->file_part);
- chooser_entry->check_completion_idle = NULL;
+ chooser_entry->check_completion_idle = 0;
if (strcmp (chooser_entry->file_part, "") == 0)
goto done;
@@ -512,19 +524,30 @@ check_completion_callback (GtkFileChooserEntry *chooser_entry)
return FALSE;
}
+static guint
+idle_add (GtkFileChooserEntry *chooser_entry,
+ GCallback cb)
+{
+ GSource *source;
+ guint id;
+
+ source = g_idle_source_new ();
+ g_source_set_priority (source, G_PRIORITY_HIGH);
+ g_source_set_closure (source,
+ g_cclosure_new_object (cb, G_OBJECT (chooser_entry)));
+ id = g_source_attach (source, NULL);
+ g_source_unref (source);
+
+ return id;
+}
+
static void
add_completion_idle (GtkFileChooserEntry *chooser_entry)
{
/* idle to update the selection based on the file list */
- if (chooser_entry->check_completion_idle == NULL)
- {
- chooser_entry->check_completion_idle = g_idle_source_new ();
- g_source_set_priority (chooser_entry->check_completion_idle, G_PRIORITY_HIGH);
- g_source_set_closure (chooser_entry->check_completion_idle,
- g_cclosure_new_object (G_CALLBACK (check_completion_callback),
- G_OBJECT (chooser_entry)));
- g_source_attach (chooser_entry->check_completion_idle, NULL);
- }
+ if (chooser_entry->check_completion_idle == 0)
+ chooser_entry->check_completion_idle =
+ idle_add (chooser_entry, G_CALLBACK (check_completion_callback));
}
@@ -627,7 +650,7 @@ load_directory_callback (GtkFileChooserEntry *chooser_entry)
GDK_THREADS_ENTER ();
- chooser_entry->load_directory_idle = NULL;
+ chooser_entry->load_directory_idle = 0;
/* guard against bogus settings*/
if (chooser_entry->current_folder_path == NULL ||
@@ -783,15 +806,9 @@ gtk_file_chooser_entry_maybe_update_directory (GtkFileChooserEntry *chooser_entr
chooser_entry->current_folder_path = folder_path;
- if (queue_idle && chooser_entry->load_directory_idle == NULL)
- {
- chooser_entry->load_directory_idle = g_idle_source_new ();
- g_source_set_priority (chooser_entry->load_directory_idle, G_PRIORITY_HIGH);
- g_source_set_closure (chooser_entry->load_directory_idle,
- g_cclosure_new_object (G_CALLBACK (load_directory_callback),
- G_OBJECT (chooser_entry)));
- g_source_attach (chooser_entry->load_directory_idle, NULL);
- }
+ if (queue_idle && chooser_entry->load_directory_idle == 0)
+ chooser_entry->load_directory_idle =
+ idle_add (chooser_entry, G_CALLBACK (load_directory_callback));
}