summaryrefslogtreecommitdiff
path: root/modules/other
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2007-12-22 20:18:13 +0000
committerChristian Persch <chpe@src.gnome.org>2007-12-22 20:18:13 +0000
commitf23743295217601b6c7e31ad6d2493ccdec00c3e (patch)
tree81b8025bc4917002c0fef4a022196dfaf0ec4a77 /modules/other
parent629fad2ff1511cf0ebc6a09d99780a97e480742a (diff)
downloadgtk+-f23743295217601b6c7e31ad6d2493ccdec00c3e.tar.gz
Use gdk_threads_add_idle. Bug #504571.
svn path=/trunk/; revision=19222
Diffstat (limited to 'modules/other')
-rw-r--r--modules/other/gail/gail.c15
-rw-r--r--modules/other/gail/gailbutton.c13
-rw-r--r--modules/other/gail/gailcell.c6
-rw-r--r--modules/other/gail/gailcombo.c25
-rw-r--r--modules/other/gail/gailcombo.h4
-rw-r--r--modules/other/gail/gailcombobox.c11
-rw-r--r--modules/other/gail/gailentry.c17
-rw-r--r--modules/other/gail/gailexpander.c13
-rw-r--r--modules/other/gail/gailmenuitem.c16
-rw-r--r--modules/other/gail/gailnotebook.c25
-rw-r--r--modules/other/gail/gailnotebookpage.c12
-rw-r--r--modules/other/gail/gailnotebookpage.h1
-rw-r--r--modules/other/gail/gailoptionmenu.c13
-rw-r--r--modules/other/gail/gailrange.c9
-rw-r--r--modules/other/gail/gailtextview.c6
-rw-r--r--modules/other/gail/gailtreeview.c68
-rw-r--r--modules/other/gail/gailtreeview.h1
-rw-r--r--modules/other/gail/gailwindow.c27
18 files changed, 91 insertions, 191 deletions
diff --git a/modules/other/gail/gail.c b/modules/other/gail/gail.c
index 217eb8caae..3fcbd4c211 100644
--- a/modules/other/gail/gail.c
+++ b/modules/other/gail/gail.c
@@ -509,12 +509,9 @@ gail_switch_page_watcher (GSignalInvocationHint *ihint,
return TRUE;
}
-
-static gint
+static gboolean
gail_focus_idle_handler (gpointer data)
{
- GDK_THREADS_ENTER();
-
focus_notify_handler = 0;
/*
* The widget which was to receive focus may have been removed
@@ -522,10 +519,7 @@ gail_focus_idle_handler (gpointer data)
if (!next_focus_widget)
{
if (next_focus_widget != data)
- {
- GDK_THREADS_LEAVE ();
- return FALSE;
- }
+ return FALSE;
}
else
{
@@ -536,8 +530,7 @@ gail_focus_idle_handler (gpointer data)
gail_focus_notify (data);
- GDK_THREADS_LEAVE ();
- return FALSE;
+ return FALSE;
}
static void
@@ -656,7 +649,7 @@ gail_focus_notify_when_idle (GtkWidget *widget)
}
}
- focus_notify_handler = g_idle_add (gail_focus_idle_handler, widget);
+ focus_notify_handler = gdk_threads_add_idle (gail_focus_idle_handler, widget);
}
static gboolean
diff --git a/modules/other/gail/gailbutton.c b/modules/other/gail/gailbutton.c
index 46b7db33a8..3ac2ea497f 100644
--- a/modules/other/gail/gailbutton.c
+++ b/modules/other/gail/gailbutton.c
@@ -547,7 +547,7 @@ gail_button_do_action (AtkAction *action,
}
g_queue_push_head (button->action_queue, (gpointer) i);
if (!button->action_idle_handler)
- button->action_idle_handler = g_idle_add (idle_do_action, button);
+ button->action_idle_handler = gdk_threads_add_idle (idle_do_action, button);
break;
default:
return_value = FALSE;
@@ -564,8 +564,6 @@ idle_do_action (gpointer data)
GailButton *gail_button;
GdkEvent tmp_event;
- GDK_THREADS_ENTER ();
-
gail_button = GAIL_BUTTON (data);
gail_button->action_idle_handler = 0;
widget = GTK_ACCESSIBLE (gail_button)->widget;
@@ -578,10 +576,7 @@ idle_do_action (gpointer data)
if (widget == NULL /* State is defunct */ ||
!GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
- {
- GDK_THREADS_LEAVE ();
- return FALSE;
- }
+ return FALSE;
else
gtk_widget_event (widget, &tmp_event);
@@ -627,9 +622,7 @@ idle_do_action (gpointer data)
}
}
- GDK_THREADS_LEAVE ();
-
- return FALSE;
+ return FALSE;
}
static gint
diff --git a/modules/other/gail/gailcell.c b/modules/other/gail/gailcell.c
index 6848631863..f9f0ab4d46 100644
--- a/modules/other/gail/gailcell.c
+++ b/modules/other/gail/gailcell.c
@@ -510,7 +510,7 @@ gail_cell_action_do_action (AtkAction *action,
if (cell->action_idle_handler)
return FALSE;
cell->action_func = info->do_action_func;
- cell->action_idle_handler = g_idle_add (idle_do_action, cell);
+ cell->action_idle_handler = gdk_threads_add_idle (idle_do_action, cell);
return TRUE;
}
@@ -519,14 +519,10 @@ idle_do_action (gpointer data)
{
GailCell *cell;
- GDK_THREADS_ENTER ();
-
cell = GAIL_CELL (data);
cell->action_idle_handler = 0;
cell->action_func (cell);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
diff --git a/modules/other/gail/gailcombo.c b/modules/other/gail/gailcombo.c
index 45d6ade37e..c99a0f6b14 100644
--- a/modules/other/gail/gailcombo.c
+++ b/modules/other/gail/gailcombo.c
@@ -187,16 +187,12 @@ notify_deselect (gpointer data)
{
GailCombo *combo;
- GDK_THREADS_ENTER ();
-
combo = GAIL_COMBO (data);
combo->old_selection = NULL;
combo->deselect_idle_handler = 0;
g_signal_emit_by_name (data, "selection_changed");
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -205,15 +201,11 @@ notify_select (gpointer data)
{
GailCombo *combo;
- GDK_THREADS_ENTER ();
-
combo = GAIL_COMBO (data);
combo->select_idle_handler = 0;
g_signal_emit_by_name (data, "selection_changed");
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -240,7 +232,7 @@ gail_combo_selection_changed_gtk (GtkWidget *widget,
{
gail_combo->old_selection = slist->data;
if (gail_combo->select_idle_handler == 0)
- gail_combo->select_idle_handler = g_idle_add (notify_select, gail_combo);
+ gail_combo->select_idle_handler = gdk_threads_add_idle (notify_select, gail_combo);
}
if (gail_combo->deselect_idle_handler)
{
@@ -251,7 +243,7 @@ gail_combo_selection_changed_gtk (GtkWidget *widget,
else
{
if (gail_combo->deselect_idle_handler == 0)
- gail_combo->deselect_idle_handler = g_idle_add (notify_deselect, gail_combo);
+ gail_combo->deselect_idle_handler = gdk_threads_add_idle (notify_deselect, gail_combo);
if (gail_combo->select_idle_handler)
{
g_source_remove (gail_combo->select_idle_handler);
@@ -344,7 +336,7 @@ gail_combo_do_action (AtkAction *action,
if (combo->action_idle_handler)
return FALSE;
- combo->action_idle_handler = g_idle_add (idle_do_action, combo);
+ combo->action_idle_handler = gdk_threads_add_idle (idle_do_action, combo);
return TRUE;
}
else
@@ -369,17 +361,12 @@ idle_do_action (gpointer data)
gboolean do_popup;
GdkEvent tmp_event;
- GDK_THREADS_ENTER ();
-
gail_combo = GAIL_COMBO (data);
gail_combo->action_idle_handler = 0;
widget = GTK_ACCESSIBLE (gail_combo)->widget;
if (widget == NULL /* State is defunct */ ||
!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
- {
- GDK_THREADS_LEAVE ();
- return FALSE;
- }
+ return FALSE;
combo = GTK_COMBO (widget);
@@ -399,6 +386,7 @@ idle_do_action (gpointer data)
gtk_widget_event (action_widget, &tmp_event);
+ /* FIXME !*/
g_idle_add (_gail_combo_button_release, combo);
}
else
@@ -409,11 +397,10 @@ idle_do_action (gpointer data)
action_widget = combo->popwin;
gtk_widget_event (action_widget, &tmp_event);
+ /* FIXME !*/
g_idle_add (_gail_combo_popup_release, combo);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
diff --git a/modules/other/gail/gailcombo.h b/modules/other/gail/gailcombo.h
index 79157af448..c3e99c7725 100644
--- a/modules/other/gail/gailcombo.h
+++ b/modules/other/gail/gailcombo.h
@@ -42,10 +42,10 @@ struct _GailCombo
{
GailContainer parent;
+ gpointer old_selection;
gchar *press_description;
- guint action_idle_handler;
- gpointer old_selection;
+ guint action_idle_handler;
guint select_idle_handler;
guint deselect_idle_handler;
};
diff --git a/modules/other/gail/gailcombobox.c b/modules/other/gail/gailcombobox.c
index 316e719f14..6083e22fb6 100644
--- a/modules/other/gail/gailcombobox.c
+++ b/modules/other/gail/gailcombobox.c
@@ -379,7 +379,7 @@ gail_combo_box_do_action (AtkAction *action,
if (combo_box->action_idle_handler)
return FALSE;
- combo_box->action_idle_handler = g_idle_add (idle_do_action, combo_box);
+ combo_box->action_idle_handler = gdk_threads_add_idle (idle_do_action, combo_box);
return TRUE;
}
else
@@ -395,17 +395,12 @@ idle_do_action (gpointer data)
AtkObject *popup;
gboolean do_popup;
- GDK_THREADS_ENTER ();
-
gail_combo_box = GAIL_COMBO_BOX (data);
gail_combo_box->action_idle_handler = 0;
widget = GTK_ACCESSIBLE (gail_combo_box)->widget;
if (widget == NULL || /* State is defunct */
!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
- {
- GDK_THREADS_LEAVE ();
- return FALSE;
- }
+ return FALSE;
combo_box = GTK_COMBO_BOX (widget);
@@ -416,8 +411,6 @@ idle_do_action (gpointer data)
else
gtk_combo_box_popdown (combo_box);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
diff --git a/modules/other/gail/gailentry.c b/modules/other/gail/gailentry.c
index 4910bc7566..e7fa3dbb22 100644
--- a/modules/other/gail/gailentry.c
+++ b/modules/other/gail/gailentry.c
@@ -1067,14 +1067,10 @@ idle_notify_insert (gpointer data)
{
GailEntry *entry;
- GDK_THREADS_ENTER ();
-
entry = GAIL_ENTRY (data);
entry->insert_idle_handler = 0;
gail_entry_notify_insert (entry);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -1117,7 +1113,7 @@ _gail_entry_insert_text_cb (GtkEntry *entry,
* or in an idle handler if it not updated.
*/
if (gail_entry->insert_idle_handler == 0)
- gail_entry->insert_idle_handler = g_idle_add (idle_notify_insert, gail_entry);
+ gail_entry->insert_idle_handler = gdk_threads_add_idle (idle_notify_insert, gail_entry);
}
static gunichar
@@ -1274,7 +1270,7 @@ gail_entry_do_action (AtkAction *action,
if (entry->action_idle_handler)
return_value = FALSE;
else
- entry->action_idle_handler = g_idle_add (idle_do_action, entry);
+ entry->action_idle_handler = gdk_threads_add_idle (idle_do_action, entry);
break;
default:
return_value = FALSE;
@@ -1289,22 +1285,15 @@ idle_do_action (gpointer data)
GailEntry *entry;
GtkWidget *widget;
- GDK_THREADS_ENTER ();
-
entry = GAIL_ENTRY (data);
entry->action_idle_handler = 0;
widget = GTK_ACCESSIBLE (entry)->widget;
if (widget == NULL /* State is defunct */ ||
!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
- {
- GDK_THREADS_LEAVE ();
- return FALSE;
- }
+ return FALSE;
gtk_widget_activate (widget);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
diff --git a/modules/other/gail/gailexpander.c b/modules/other/gail/gailexpander.c
index 8d43e2fdc8..2b90102092 100644
--- a/modules/other/gail/gailexpander.c
+++ b/modules/other/gail/gailexpander.c
@@ -434,7 +434,7 @@ gail_expander_do_action (AtkAction *action,
if (expander->action_idle_handler)
return_value = FALSE;
else
- expander->action_idle_handler = g_idle_add (idle_do_action, expander);
+ expander->action_idle_handler = gdk_threads_add_idle (idle_do_action, expander);
break;
default:
return_value = FALSE;
@@ -449,24 +449,17 @@ idle_do_action (gpointer data)
GtkWidget *widget;
GailExpander *gail_expander;
- GDK_THREADS_ENTER ();
-
gail_expander = GAIL_EXPANDER (data);
gail_expander->action_idle_handler = 0;
widget = GTK_ACCESSIBLE (gail_expander)->widget;
if (widget == NULL /* State is defunct */ ||
!GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
- {
- GDK_THREADS_LEAVE ();
- return FALSE;
- }
+ return FALSE;
gtk_widget_activate (widget);
- GDK_THREADS_LEAVE ();
-
- return FALSE;
+ return FALSE;
}
static gint
diff --git a/modules/other/gail/gailmenuitem.c b/modules/other/gail/gailmenuitem.c
index 0425cae426..d5dc8f9417 100644
--- a/modules/other/gail/gailmenuitem.c
+++ b/modules/other/gail/gailmenuitem.c
@@ -311,8 +311,11 @@ gail_menu_item_do_action (AtkAction *action,
return FALSE;
else
{
- g_object_ref (gail_menu_item);
- gail_menu_item->action_idle_handler = g_idle_add (idle_do_action, gail_menu_item);
+ gail_menu_item->action_idle_handler =
+ gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE,
+ idle_do_action,
+ g_object_ref (gail_menu_item),
+ (GDestroyNotify) g_object_unref);
}
return TRUE;
}
@@ -352,18 +355,12 @@ idle_do_action (gpointer data)
GailMenuItem *menu_item;
gboolean item_mapped;
- GDK_THREADS_ENTER ();
-
menu_item = GAIL_MENU_ITEM (data);
menu_item->action_idle_handler = 0;
item = GTK_ACCESSIBLE (menu_item)->widget;
if (item == NULL /* State is defunct */ ||
!GTK_WIDGET_SENSITIVE (item) || !GTK_WIDGET_VISIBLE (item))
- {
- g_object_unref (menu_item);
- GDK_THREADS_LEAVE ();
return FALSE;
- }
item_parent = gtk_widget_get_parent (item);
gtk_menu_shell_select_item (GTK_MENU_SHELL (item_parent), item);
@@ -376,9 +373,6 @@ idle_do_action (gpointer data)
if (!item_mapped)
ensure_menus_unposted (menu_item);
- g_object_unref (menu_item);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
diff --git a/modules/other/gail/gailnotebook.c b/modules/other/gail/gailnotebook.c
index 1e60ac44af..d2671542a0 100644
--- a/modules/other/gail/gailnotebook.c
+++ b/modules/other/gail/gailnotebook.c
@@ -310,7 +310,7 @@ gail_notebook_real_notify_gtk (GObject *obj,
{
if (gail_notebook->idle_focus_id)
g_source_remove (gail_notebook->idle_focus_id);
- gail_notebook->idle_focus_id = g_idle_add (gail_notebook_check_focus_tab, atk_obj);
+ gail_notebook->idle_focus_id = gdk_threads_add_idle (gail_notebook_check_focus_tab, atk_obj);
}
}
else
@@ -337,6 +337,10 @@ gail_notebook_finalize (GObject *object)
}
g_list_free (notebook->page_cache);
+
+ if (notebook->idle_focus_id)
+ g_source_remove (notebook->idle_focus_id);
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -593,9 +597,8 @@ gail_notebook_focus_cb (GtkWidget *widget,
{
case GTK_DIR_LEFT:
case GTK_DIR_RIGHT:
- if (gail_notebook->idle_focus_id)
- g_source_remove (gail_notebook->idle_focus_id);
- gail_notebook->idle_focus_id = g_idle_add (gail_notebook_check_focus_tab, atk_obj);
+ if (gail_notebook->idle_focus_id == 0)
+ gail_notebook->idle_focus_id = gdk_threads_add_idle (gail_notebook_check_focus_tab, atk_obj);
break;
default:
break;
@@ -612,8 +615,6 @@ gail_notebook_check_focus_tab (gpointer data)
GailNotebook *gail_notebook;
GtkNotebook *gtk_notebook;
- GDK_THREADS_ENTER ();
-
atk_obj = ATK_OBJECT (data);
gail_notebook = GAIL_NOTEBOOK (atk_obj);
widget = GTK_ACCESSIBLE (atk_obj)->widget;
@@ -623,10 +624,7 @@ gail_notebook_check_focus_tab (gpointer data)
gail_notebook->idle_focus_id = 0;
if (!gtk_notebook->focus_tab)
- {
- GDK_THREADS_LEAVE ();
- return FALSE;
- }
+ return FALSE;
old_focus_page_num = gail_notebook->focus_tab_page;
focus_page_num = g_list_index (gtk_notebook->children, gtk_notebook->focus_tab->data);
@@ -640,8 +638,6 @@ gail_notebook_check_focus_tab (gpointer data)
g_object_unref (obj);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -651,5 +647,8 @@ gail_notebook_destroyed (gpointer data)
GailNotebook *gail_notebook = GAIL_NOTEBOOK (data);
if (gail_notebook->idle_focus_id)
- g_source_remove (gail_notebook->idle_focus_id);
+ {
+ g_source_remove (gail_notebook->idle_focus_id);
+ gail_notebook->idle_focus_id = 0;
+ }
}
diff --git a/modules/other/gail/gailnotebookpage.c b/modules/other/gail/gailnotebookpage.c
index b830f912ed..4489d76e93 100644
--- a/modules/other/gail/gailnotebookpage.c
+++ b/modules/other/gail/gailnotebookpage.c
@@ -184,12 +184,12 @@ notify_child_added (gpointer data)
GailNotebookPage *page;
AtkObject *atk_object, *atk_parent;
- GDK_THREADS_ENTER ();
-
g_return_val_if_fail (GAIL_IS_NOTEBOOK_PAGE (data), FALSE);
page = GAIL_NOTEBOOK_PAGE (data);
atk_object = ATK_OBJECT (data);
+ page->notify_child_added_id = 0;
+
/* The widget page->notebook may be deleted before this handler is called */
if (page->notebook != NULL)
{
@@ -198,8 +198,6 @@ notify_child_added (gpointer data)
g_signal_emit_by_name (atk_parent, "children_changed::add", page->index, atk_object, NULL);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -236,7 +234,7 @@ gail_notebook_page_new (GtkNotebook *notebook,
atk_object->role = ATK_ROLE_PAGE_TAB;
atk_object->layer = ATK_LAYER_WIDGET;
- g_idle_add (notify_child_added, atk_object);
+ page->notify_child_added_id = gdk_threads_add_idle (notify_child_added, atk_object);
/*
* We get notified of changes to the label
*/
@@ -329,8 +327,10 @@ gail_notebook_page_finalize (GObject *object)
if (page->textutil)
g_object_unref (page->textutil);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ if (page->notify_child_added_id)
+ g_source_remove (page->notify_child_added_id);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static G_CONST_RETURN gchar*
diff --git a/modules/other/gail/gailnotebookpage.h b/modules/other/gail/gailnotebookpage.h
index 50af79cfcb..022f4affc7 100644
--- a/modules/other/gail/gailnotebookpage.h
+++ b/modules/other/gail/gailnotebookpage.h
@@ -47,6 +47,7 @@ struct _GailNotebookPage
GtkNotebookPage *page;
gint index;
+ guint notify_child_added_id;
GailTextUtil *textutil;
};
diff --git a/modules/other/gail/gailoptionmenu.c b/modules/other/gail/gailoptionmenu.c
index 873e939770..a78d75c142 100644
--- a/modules/other/gail/gailoptionmenu.c
+++ b/modules/other/gail/gailoptionmenu.c
@@ -256,7 +256,7 @@ gail_option_menu_do_action (AtkAction *action,
if (button->action_idle_handler)
return_value = FALSE;
else
- button->action_idle_handler = g_idle_add (idle_do_action, button);
+ button->action_idle_handler = gdk_threads_add_idle (idle_do_action, button);
break;
default:
return_value = FALSE;
@@ -273,18 +273,13 @@ idle_do_action (gpointer data)
GdkEvent tmp_event;
GailButton *gail_button;
- GDK_THREADS_ENTER ();
-
gail_button = GAIL_BUTTON (data);
gail_button->action_idle_handler = 0;
widget = GTK_ACCESSIBLE (gail_button)->widget;
if (widget == NULL /* State is defunct */ ||
!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
- {
- GDK_THREADS_LEAVE ();
- return FALSE;
- }
+ return FALSE;
button = GTK_BUTTON (widget);
@@ -303,9 +298,7 @@ idle_do_action (gpointer data)
gtk_widget_event (widget, &tmp_event);
- GDK_THREADS_LEAVE ();
-
- return FALSE;
+ return FALSE;
}
static gint
diff --git a/modules/other/gail/gailrange.c b/modules/other/gail/gailrange.c
index 2313aeeda7..bf6eaa4522 100644
--- a/modules/other/gail/gailrange.c
+++ b/modules/other/gail/gailrange.c
@@ -412,7 +412,7 @@ gail_range_do_action (AtkAction *action,
if (range->action_idle_handler)
return_value = FALSE;
else
- range->action_idle_handler = g_idle_add (idle_do_action, range);
+ range->action_idle_handler = gdk_threads_add_idle (idle_do_action, range);
}
else
return_value = FALSE;
@@ -425,22 +425,15 @@ idle_do_action (gpointer data)
GailRange *range;
GtkWidget *widget;
- GDK_THREADS_ENTER ();
-
range = GAIL_RANGE (data);
range->action_idle_handler = 0;
widget = GTK_ACCESSIBLE (range)->widget;
if (widget == NULL /* State is defunct */ ||
!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
- {
- GDK_THREADS_LEAVE ();
return FALSE;
- }
gtk_widget_activate (widget);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
diff --git a/modules/other/gail/gailtextview.c b/modules/other/gail/gailtextview.c
index e99e02a1fe..962ecdf9e9 100644
--- a/modules/other/gail/gailtextview.c
+++ b/modules/other/gail/gailtextview.c
@@ -1591,7 +1591,7 @@ _gail_text_view_changed_cb (GtkTextBuffer *buffer,
{
if (!gail_text_view->insert_notify_handler)
{
- gail_text_view->insert_notify_handler = g_idle_add (insert_idle_handler, accessible);
+ gail_text_view->insert_notify_handler = gdk_threads_add_idle (insert_idle_handler, accessible);
}
return;
}
@@ -1680,8 +1680,6 @@ insert_idle_handler (gpointer data)
GailTextView *gail_text_view;
GtkTextBuffer *buffer;
- GDK_THREADS_ENTER ();
-
gail_text_view = GAIL_TEXT_VIEW (data);
g_signal_emit_by_name (data,
@@ -1703,8 +1701,6 @@ insert_idle_handler (gpointer data)
gail_text_view->previous_selection_bound = get_selection_bound (buffer);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
diff --git a/modules/other/gail/gailtreeview.c b/modules/other/gail/gailtreeview.c
index ef3e42e076..627ab9275f 100644
--- a/modules/other/gail/gailtreeview.c
+++ b/modules/other/gail/gailtreeview.c
@@ -687,7 +687,11 @@ gail_tree_view_finalize (GObject *object)
/* remove any idle handlers still pending */
if (view->idle_garbage_collect_id)
- g_source_remove (view->idle_garbage_collect_id);
+ g_source_remove (view->idle_garbage_collect_id);
+ if (view->idle_cursor_changed_id)
+ g_source_remove (view->idle_cursor_changed_id);
+ if (view->idle_expand_id)
+ g_source_remove (view->idle_expand_id);
if (view->caption)
g_object_unref (view->caption);
@@ -2299,8 +2303,9 @@ gail_tree_view_expand_row_gtk (GtkTreeView *tree_view,
*/
/* this seems wrong since it overwrites any other pending expand handlers... */
gailview->idle_expand_path = gtk_tree_path_copy (path);
- if (gailview->idle_expand_id) g_source_remove (gailview->idle_expand_id);
- gailview->idle_expand_id = g_idle_add (idle_expand_row, gailview);
+ if (gailview->idle_expand_id)
+ g_source_remove (gailview->idle_expand_id);
+ gailview->idle_expand_id = gdk_threads_add_idle (idle_expand_row, gailview);
return FALSE;
}
@@ -2314,7 +2319,7 @@ idle_expand_row (gpointer data)
GtkTreeModel *tree_model;
gint n_inserted, row;
- GDK_THREADS_ENTER ();
+ gailview->idle_expand_id = 0;
path = gailview->idle_expand_path;
tree_view = GTK_TREE_VIEW (GTK_ACCESSIBLE (gailview)->widget);
@@ -2322,14 +2327,11 @@ idle_expand_row (gpointer data)
g_assert (GTK_IS_TREE_VIEW (tree_view));
tree_model = gtk_tree_view_get_model(tree_view);
-
- g_assert (GTK_IS_TREE_MODEL (tree_model));
+ if (!tree_model)
+ return FALSE;
if (!path || !gtk_tree_model_get_iter (tree_model, &iter, path))
- {
- GDK_THREADS_LEAVE ();
- return FALSE;
- }
+ return FALSE;
/*
* Update visibility of cells below expansion row
@@ -2358,7 +2360,6 @@ idle_expand_row (gpointer data)
else
{
/* We can get here if the row expanded callback deleted the row */
- GDK_THREADS_LEAVE ();
return FALSE;
}
@@ -2380,8 +2381,6 @@ idle_expand_row (gpointer data)
gtk_tree_path_free (path);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -2661,45 +2660,42 @@ columns_changed (GtkTreeView *tree_view)
static void
cursor_changed (GtkTreeView *tree_view)
{
+ GailTreeView *gailview;
+
+ gailview = GAIL_TREE_VIEW (gtk_widget_get_accessible (GTK_WIDGET (tree_view)));
+ if (gailview->idle_cursor_changed_id != 0)
+ return;
+
/*
* We notify the focus change in a idle handler so that the processing
* of the cursor change is completed when the focus handler is called.
* This will allow actions to be called in the focus handler
*/
- g_idle_add (idle_cursor_changed, gtk_widget_get_accessible (GTK_WIDGET (tree_view)));
+ gailview->idle_cursor_changed_id = gdk_threads_add_idle (idle_cursor_changed, gailview);
}
static gint
idle_cursor_changed (gpointer data)
{
+ GailTreeView *gail_tree_view = GAIL_TREE_VIEW (data);
GtkTreeView *tree_view;
GtkWidget *widget;
- AtkObject *parent;
AtkObject *cell;
- GDK_THREADS_ENTER ();
+ gail_tree_view->idle_cursor_changed_id = 0;
- parent = ATK_OBJECT (data);
-
- widget = GTK_ACCESSIBLE (parent)->widget;
+ widget = GTK_ACCESSIBLE (gail_tree_view)->widget;
/*
* Widget has been deleted
*/
if (widget == NULL)
- {
- GDK_THREADS_LEAVE ();
- return FALSE;
- }
+ return FALSE;
tree_view = GTK_TREE_VIEW (widget);
cell = gail_tree_view_ref_focus_cell (tree_view);
if (cell)
{
- GailTreeView *gail_tree_view;
-
- gail_tree_view = GAIL_TREE_VIEW (parent);
-
if (cell != gail_tree_view->focus_cell)
{
if (gail_tree_view->focus_cell)
@@ -2711,7 +2707,7 @@ idle_cursor_changed (gpointer data)
if (GTK_WIDGET_HAS_FOCUS (widget))
gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_ACTIVE, FALSE);
- g_signal_emit_by_name (parent,
+ g_signal_emit_by_name (gail_tree_view,
"active-descendant-changed",
cell);
}
@@ -2719,8 +2715,6 @@ idle_cursor_changed (gpointer data)
g_object_unref (cell);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -2855,13 +2849,14 @@ model_row_inserted (GtkTreeModel *tree_model,
if (gailview->idle_expand_id)
{
g_source_remove (gailview->idle_expand_id);
+ gailview->idle_expand_id = 0;
+
/* don't do this if the insertion precedes the idle path, since it will now be invalid */
if (path && gailview->idle_expand_path &&
(gtk_tree_path_compare (path, gailview->idle_expand_path) > 0))
set_expand_state (tree_view, tree_model, gailview, gailview->idle_expand_path, FALSE);
if (gailview->idle_expand_path)
gtk_tree_path_free (gailview->idle_expand_path);
- gailview->idle_expand_id = 0;
}
/* Check to see if row is visible */
row = get_row_from_tree_path (tree_view, path);
@@ -3542,8 +3537,9 @@ clean_cell_info (GailTreeView *gailview,
cell_info->in_use = FALSE;
if (!gailview->garbage_collection_pending) {
gailview->garbage_collection_pending = TRUE;
+ g_assert (gailview->idle_garbage_collect_id == 0);
gailview->idle_garbage_collect_id =
- g_idle_add (idle_garbage_collect_cell_data, gailview);
+ gdk_threads_add_idle (idle_garbage_collect_cell_data, gailview);
}
}
}
@@ -3648,13 +3644,11 @@ clean_cols (GailTreeView *gailview,
}
}
-
static gboolean
idle_garbage_collect_cell_data (gpointer data)
{
GailTreeView *tree_view;
- GDK_THREADS_ENTER ();
g_assert (GAIL_IS_TREE_VIEW (data));
tree_view = (GailTreeView *)data;
@@ -3666,9 +3660,7 @@ idle_garbage_collect_cell_data (gpointer data)
tree_view->garbage_collection_pending = garbage_collect_cell_data (data);
- GDK_THREADS_LEAVE ();
-
- /* N.B.: if for some reason another handler has re-enterantly been queued
+ /* N.B.: if for some reason another handler has re-enterantly been queued
* while this handler was being serviced, it has its own gsource, therefore this handler
* should always return FALSE.
*/
@@ -4105,7 +4097,7 @@ cell_destroyed (gpointer data)
if (!cell_info->view->garbage_collection_pending) {
cell_info->view->garbage_collection_pending = TRUE;
cell_info->view->idle_garbage_collect_id =
- g_idle_add (idle_garbage_collect_cell_data, cell_info->view);
+ gdk_threads_add_idle (idle_garbage_collect_cell_data, cell_info->view);
}
}
}
diff --git a/modules/other/gail/gailtreeview.h b/modules/other/gail/gailtreeview.h
index 6f153318e7..655b876a76 100644
--- a/modules/other/gail/gailtreeview.h
+++ b/modules/other/gail/gailtreeview.h
@@ -54,6 +54,7 @@ struct _GailTreeView
GtkAdjustment *old_vadj;
guint idle_expand_id;
guint idle_garbage_collect_id;
+ guint idle_cursor_changed_id;
GtkTreePath *idle_expand_path;
gboolean garbage_collection_pending;
};
diff --git a/modules/other/gail/gailwindow.c b/modules/other/gail/gailwindow.c
index 2e5d5e32d6..c14989f76a 100644
--- a/modules/other/gail/gailwindow.c
+++ b/modules/other/gail/gailwindow.c
@@ -511,15 +511,10 @@ idle_notify_name_change (gpointer data)
GailWindow *window;
AtkObject *obj;
- GDK_THREADS_ENTER ();
-
window = GAIL_WINDOW (data);
window->name_change_handler = 0;
if (GTK_ACCESSIBLE (window)->widget == NULL)
- {
- GDK_THREADS_LEAVE ();
- return FALSE;
- }
+ return FALSE;
obj = ATK_OBJECT (window);
if (obj->name == NULL)
@@ -530,7 +525,7 @@ idle_notify_name_change (gpointer data)
g_object_notify (G_OBJECT (obj), "accessible-name");
}
g_signal_emit_by_name (obj, "visible_data_changed");
- GDK_THREADS_LEAVE ();
+
return FALSE;
}
@@ -562,7 +557,7 @@ gail_window_real_notify_gtk (GObject *obj,
window->previous_name = g_strdup (name);
if (window->name_change_handler == 0)
- window->name_change_handler = g_idle_add (idle_notify_name_change, atk_obj);
+ window->name_change_handler = gdk_threads_add_idle (idle_notify_name_change, atk_obj);
}
}
else
@@ -825,15 +820,11 @@ update_screen_info (gpointer data)
{
int screen_n = GPOINTER_TO_INT (data);
- GDK_THREADS_ENTER ();
-
gail_screens [screen_n].update_handler = 0;
gail_screens [screen_n].update_stacked_windows = FALSE;
get_stacked_windows (&gail_screens [screen_n]);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -844,8 +835,6 @@ update_desktop_info (gpointer data)
GailScreenInfo *info;
int i;
- GDK_THREADS_ENTER ();
-
info = &gail_screens [screen_n];
info->update_desktop_handler = 0;
@@ -858,8 +847,6 @@ update_desktop_info (gpointer data)
}
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -887,8 +874,8 @@ filter_func (GdkXEvent *gdkxevent,
gail_screens [screen_n].update_stacked_windows = TRUE;
if (!gail_screens [screen_n].update_handler)
{
- gail_screens [screen_n].update_handler = g_idle_add (update_screen_info,
- GINT_TO_POINTER (screen_n));
+ gail_screens [screen_n].update_handler = gdk_threads_add_idle (update_screen_info,
+ GINT_TO_POINTER (screen_n));
}
}
}
@@ -908,8 +895,8 @@ filter_func (GdkXEvent *gdkxevent,
info->desktop_changed [j] = TRUE;
if (!info->update_desktop_handler)
{
- info->update_desktop_handler = g_idle_add (update_desktop_info,
- GINT_TO_POINTER (i));
+ info->update_desktop_handler = gdk_threads_add_idle (update_desktop_info,
+ GINT_TO_POINTER (i));
}
break;
}