2006-12-22 Matthias Clasen <mclasen@redhat.com>
+ * *.c: Replace a lot of idle and timeout calls by
+ the new gdk_threads api.
+
* gdk/gdk.symbols:
* gdk/gdk.h:
* gdk/gdk.c: Add functions to allow threadsafe handling
* The timeout simply simulates a slow data source by inserting
* pauses in the reading process.
*/
- load_timeout = g_timeout_add (150,
+ load_timeout = gdk_threads_add_timeout (150,
progressive_timeout,
image);
}
: MAX (127, fabs (255 * cos (f * 2.0 * G_PI)))));
}
+ GDK_THREADS_ENTER ();
gtk_widget_queue_draw (da);
+ GDK_THREADS_LEAVE ();
frame_num++;
return TRUE;
gtk_container_add (GTK_CONTAINER (window), da);
- timeout_id = g_timeout_add (FRAME_DELAY, timeout, NULL);
+ timeout_id = gdk_threads_add_timeout (FRAME_DELAY, timeout, NULL);
gtk_widget_show_all (window);
gtk_main ();
* The timeout simply simulates a slow data source by inserting
* pauses in the reading process.
*/
- lc->load_timeout = g_timeout_add (100,
+ lc->load_timeout = gdk_threads_add_timeout (100,
progressive_timeout,
image);
}
status.readlen = readlen;
- status.timeout = g_timeout_add (100, update_timeout, &status);
+ status.timeout = gdk_threads_add_timeout (100, update_timeout, &status);
}
#endif
}
realize_callback (GtkWidget *widget,
WidgetInfo *info)
{
- g_timeout_add (500, (GSourceFunc)adjust_size_callback, info);
+ gdk_threads_add_timeout (500, (GSourceFunc)adjust_size_callback, info);
}
static WidgetInfo *
if (dial->timer)
g_source_remove (dial->timer);
- dial->timer = g_timeout_add (SCROLL_DELAY_LENGTH,
- (GtkFunction) gtk_dial_timer,
+ dial->timer = gdk_threads_add_timeout (SCROLL_DELAY_LENGTH,
+ (GSourceFunc) gtk_dial_timer,
(gpointer) dial);
}
}
gtk_widget_show (pdata->pbar);
/* Add a timer callback to update the value of the progress bar */
- pdata->timer = g_timeout_add (100, progress_timeout, pdata);
+ pdata->timer = gdk_threads_add_timeout (100, progress_timeout, pdata);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
static gboolean
gdk_window_update_idle (gpointer data)
{
- GDK_THREADS_ENTER ();
gdk_window_directfb_process_all_updates ();
- GDK_THREADS_LEAVE ();
return FALSE;
}
if (!update_idle)
{
- update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
+ update_idle = gdk_threads_add_idle (GDK_PRIORITY_REDRAW,
gdk_window_update_idle, NULL, NULL);
}
}
gpointer data);
+guint gdk_threads_add_idle_full (gint priority,
+ GSourceFunc function,
+ gpointer data,
+ GDestroyNotify notify);
+guint gdk_threads_add_idle (GSourceFunc function,
+ gpointer data);
+
+guint gdk_threads_add_timeout_full (gint priority,
+ guint interval,
+ GSourceFunc function,
+ gpointer data,
+ GDestroyNotify notify);
+guint gdk_threads_add_timeout (guint interval,
+ GSourceFunc function,
+ gpointer data);
+
+
#ifdef G_THREADS_ENABLED
# define GDK_THREADS_ENTER() G_STMT_START { \
if (gdk_threads_lock) \
static gboolean
gdk_window_update_idle (gpointer data)
{
- GDK_THREADS_ENTER ();
gdk_window_process_all_updates ();
- GDK_THREADS_LEAVE ();
return FALSE;
}
if (!update_idle)
{
- update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
+ update_idle = gdk_threads_add_idle_full (GDK_PRIORITY_REDRAW,
gdk_window_update_idle, NULL, NULL);
}
}
}
else
if (!ignore_core_timer)
- ignore_core_timer = g_timeout_add (PROXIMITY_OUT_DELAY,
+ ignore_core_timer = gdk_threads_add_timeout (PROXIMITY_OUT_DELAY,
ignore_core_timefunc, NULL);
}
#endif /* HAVE_WINTAB */
static gboolean
button_activate_timeout (gpointer data)
{
- GDK_THREADS_ENTER ();
-
gtk_button_finish_activate (data, TRUE);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
gtk_grab_add (widget);
- button->activate_timeout = g_timeout_add (ACTIVATE_TIMEOUT,
+ button->activate_timeout = gdk_threads_add_timeout (ACTIVATE_TIMEOUT,
button_activate_timeout,
button);
button->button_down = TRUE;
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
gboolean retval = FALSE;
- GDK_THREADS_ENTER ();
-
if (priv->timer)
{
calendar_arrow_action (calendar, priv->click_child);
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
priv->need_timer = FALSE;
- priv->timer = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
+ priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
timeout * SCROLL_DELAY_FACTOR,
(GSourceFunc) calendar_timer,
(gpointer) calendar, NULL);
retval = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
priv->need_timer = TRUE;
- priv->timer = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
+ priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
timeout,
(GSourceFunc) calendar_timer,
(gpointer) calendar, NULL);
{
GtkCellRendererTextPrivate *priv;
- GDK_THREADS_ENTER ();
-
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (data);
priv->entry_menu_popdown_timeout = 0;
if (!GTK_WIDGET_HAS_FOCUS (priv->entry))
gtk_cell_renderer_text_editing_done (GTK_CELL_EDITABLE (priv->entry), data);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
if (priv->entry_menu_popdown_timeout)
return;
- priv->entry_menu_popdown_timeout = g_timeout_add (500, popdown_timeout,
+ priv->entry_menu_popdown_timeout = gdk_threads_add_timeout (500, popdown_timeout,
data);
}
if (!gdk_display_supports_clipboard_persistence (clipboard->display))
return;
+ g_object_ref (clipboard);
+
clipboard_widget = get_clipboard_widget (clipboard->display);
clipboard->notify_signal_id = g_signal_connect (clipboard_widget, "selection_notify_event",
G_CALLBACK (gtk_clipboard_selection_notify), clipboard);
clipboard->notify_signal_id = 0;
clipboard->storing_selection = FALSE;
+
+ g_object_unref (clipboard);
}
/* Stores all clipboard selections on all displays, called from
if (clist->htimer)
return FALSE;
- clist->htimer = g_timeout_add
+ clist->htimer = gdk_threads_add_timeout
(SCROLL_TIME, (GSourceFunc) horizontal_timeout, clist);
if (!((x < 0 && clist->hadjustment->value == 0) ||
if (clist->vtimer)
return FALSE;
- clist->vtimer = g_timeout_add (SCROLL_TIME,
+ clist->vtimer = gdk_threads_add_timeout (SCROLL_TIME,
(GSourceFunc) vertical_timeout, clist);
if (clist->drag_button &&
static gint
horizontal_timeout (GtkCList *clist)
{
- GDK_THREADS_ENTER ();
-
clist->htimer = 0;
do_fake_motion (GTK_WIDGET (clist));
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
static gint
vertical_timeout (GtkCList *clist)
{
- GDK_THREADS_ENTER ();
-
clist->vtimer = 0;
do_fake_motion (GTK_WIDGET (clist));
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
static void gtk_combo_destroy (GtkObject *combo);
static GtkListItem *gtk_combo_find (GtkCombo *combo);
static gchar * gtk_combo_func (GtkListItem *li);
-static gint gtk_combo_focus_idle (GtkCombo *combo);
+static gboolean gtk_combo_focus_idle (GtkCombo *combo);
static gint gtk_combo_entry_focus_out (GtkEntry *entry,
GdkEventFocus *event,
GtkCombo *combo);
g_cclosure_new_object (G_CALLBACK (gtk_combo_focus_idle),
G_OBJECT (combo)));
g_source_attach (focus_idle, NULL);
+ g_source_unref (focus_idle);
/*g_signal_stop_emission_by_name (entry, "focus_out_event"); */
return TRUE;
GtkComboBox *combo_box;
gint x, y, width, height;
- GDK_THREADS_ENTER ();
-
combo_box = GTK_COMBO_BOX (user_data);
if (combo_box->priv->tree_view &&
combo_box->priv->resize_idle_id = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
{
if (!combo_box->priv->resize_idle_id)
combo_box->priv->resize_idle_id =
- g_idle_add (list_popup_resize_idle, combo_box);
+ gdk_threads_add_idle (list_popup_resize_idle, combo_box);
}
static void
combo_box->priv->auto_scroll = FALSE;
if (combo_box->priv->scroll_timer == 0)
- combo_box->priv->scroll_timer = g_timeout_add (SCROLL_TIME,
+ combo_box->priv->scroll_timer = gdk_threads_add_timeout (SCROLL_TIME,
(GSourceFunc) gtk_combo_box_list_scroll_timeout,
combo_box);
{
gint x, y;
- GDK_THREADS_ENTER ();
-
if (combo_box->priv->auto_scroll)
{
gdk_window_get_pointer (combo_box->priv->tree_view->window,
gtk_combo_box_list_auto_scroll (combo_box, x, y);
}
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
{
GtkComboBox *combo_box;
- GDK_THREADS_ENTER ();
-
combo_box = GTK_COMBO_BOX (data);
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (combo_box));
g_object_unref (combo_box);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
popdown_handler (GtkWidget *widget,
gpointer data)
{
- g_idle_add (popdown_idle, g_object_ref (data));
+ gdk_threads_add_idle (popdown_idle, g_object_ref (data));
}
static gboolean
{
GtkComboBox *combo_box;
- GDK_THREADS_ENTER ();
-
combo_box = GTK_COMBO_BOX (data);
if (GTK_IS_MENU (combo_box->priv->popup_widget) &&
combo_box->priv->popup_idle_id = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
*/
if (combo_box->priv->is_cell_renderer &&
combo_box->priv->cell_view && !combo_box->priv->tree_view)
- combo_box->priv->popup_idle_id = g_idle_add (popup_idle, combo_box);
+ combo_box->priv->popup_idle_id = gdk_threads_add_idle (popup_idle, combo_box);
}
static gboolean
gtk_container_idle_sizer (gpointer data)
{
- GDK_THREADS_ENTER ();
-
/* we may be invoked with a container_resize_queue of NULL, because
* queue_resize could have been adding an extra idle function while
* the queue still got processed. we better just ignore such case
gdk_window_process_all_updates ();
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
{
GTK_PRIVATE_SET_FLAG (resize_container, GTK_RESIZE_PENDING);
if (container_resize_queue == NULL)
- g_idle_add_full (GTK_PRIORITY_RESIZE,
+ gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE,
gtk_container_idle_sizer,
NULL, NULL);
container_resize_queue = g_slist_prepend (container_resize_queue, resize_container);
* to respond really late, we still are OK.
*/
gtk_drag_clear_source_info (info->context);
- g_timeout_add (ANIM_STEP_TIME, gtk_drag_anim_timeout, anim);
+ gdk_threads_add_timeout (ANIM_STEP_TIME, gtk_drag_anim_timeout, anim);
}
}
}
gtk_widget_hide (info->icon_window);
gdk_drag_drop (info->context, time);
- info->drop_timeout = g_timeout_add (DROP_ABORT_TIME,
+ info->drop_timeout = gdk_threads_add_timeout (DROP_ABORT_TIME,
gtk_drag_abort_timeout,
info);
}
gint x, y;
gboolean retval;
- GDK_THREADS_ENTER ();
-
if (anim->step == anim->n_steps)
{
gtk_drag_source_info_destroy (anim->info);
retval = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
GdkDragAction possible_actions;
guint32 time;
- GDK_THREADS_ENTER ();
-
info->update_idle = 0;
if (info->last_event)
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
* from the last move can catch up before we move again.
*/
if (!info->update_idle)
- info->update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW + 5,
+ info->update_idle = gdk_threads_add_idle_full (GDK_PRIORITY_REDRAW + 5,
gtk_drag_update_idle,
info,
NULL);
GtkDragSourceInfo *info = data;
guint32 time = GDK_CURRENT_TIME;
- GDK_THREADS_ENTER ();
-
if (info->proxy_dest)
time = info->proxy_dest->proxy_drop_time;
info->drop_timeout = 0;
gtk_drag_drop_finished (info, FALSE, time);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
{
GtkEntry *entry;
- GDK_THREADS_ENTER ();
-
entry = GTK_ENTRY (data);
entry->recompute_idle = 0;
update_im_cursor_location (entry);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
if (!entry->recompute_idle)
{
- entry->recompute_idle = g_idle_add_full (G_PRIORITY_HIGH_IDLE + 15, /* between resize and redraw */
+ entry->recompute_idle = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 15, /* between resize and redraw */
recompute_idle_func, entry, NULL);
}
}
static gboolean
gtk_entry_remove_password_hint (gpointer data)
{
- GDK_THREADS_ENTER();
-
/* Force the string to be redrawn, but now without a visible character */
gtk_entry_recompute (GTK_ENTRY (data));
- GDK_THREADS_LEAVE();
-
return FALSE;
}
password_hint->password_hint_length = 0;
password_hint->password_hint_timeout_id =
- g_timeout_add (password_hint_timeout,
+ gdk_threads_add_timeout (password_hint_timeout,
(GSourceFunc) gtk_entry_remove_password_hint,
entry);
}
GtkEntryPrivate *priv;
gint blink_timeout;
- GDK_THREADS_ENTER ();
-
entry = GTK_ENTRY (data);
priv = GTK_ENTRY_GET_PRIVATE (entry);
else if (entry->cursor_visible)
{
hide_cursor (entry);
- entry->blink_timeout = g_timeout_add (get_cursor_time (entry) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
+ entry->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
entry);
}
{
show_cursor (entry);
priv->blink_time += get_cursor_time (entry);
- entry->blink_timeout = g_timeout_add (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
+ entry->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
entry);
}
- GDK_THREADS_LEAVE ();
-
/* Remove ourselves */
return FALSE;
}
if (!entry->blink_timeout)
{
show_cursor (entry);
- entry->blink_timeout = g_timeout_add (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
+ entry->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
entry);
}
if (entry->blink_timeout != 0)
g_source_remove (entry->blink_timeout);
- entry->blink_timeout = g_timeout_add (get_cursor_time (entry) * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
+ entry->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
entry);
show_cursor (entry);
{
GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (data);
- GDK_THREADS_ENTER ();
-
completion->priv->completion_timeout = 0;
if (completion->priv->filter_model &&
else if (GTK_WIDGET_VISIBLE (completion->priv->popup_window))
_gtk_entry_completion_popdown (completion);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
}
completion->priv->completion_timeout =
- g_timeout_add (COMPLETION_TIMEOUT,
+ gdk_threads_add_timeout (COMPLETION_TIMEOUT,
gtk_entry_completion_timeout,
completion);
}
settings = gtk_widget_get_settings (widget);
g_object_get (settings, "gtk-timeout-expand", &timeout, NULL);
- priv->expand_timer = g_timeout_add (timeout, (GSourceFunc) expand_timeout, expander);
+ priv->expand_timer = gdk_threads_add_timeout (timeout, (GSourceFunc) expand_timeout, expander);
}
return TRUE;
GdkRectangle area;
gboolean finish = FALSE;
- GDK_THREADS_ENTER();
-
if (GTK_WIDGET_REALIZED (expander))
{
get_expander_bounds (expander, &area);
gtk_widget_queue_resize (GTK_WIDGET (expander));
}
- GDK_THREADS_LEAVE();
-
return !finish;
}
g_source_remove (priv->animation_timeout);
priv->animation_timeout =
- g_timeout_add (50,
+ gdk_threads_add_timeout (50,
(GSourceFunc) gtk_expander_animation_timeout,
expander);
}
profile_start ("start", NULL);
- GDK_THREADS_ENTER ();
-
impl = GTK_FILE_CHOOSER_DEFAULT (data);
g_assert (impl->load_state == LOAD_PRELOAD);
g_assert (impl->load_timeout_id != 0);
load_set_model (impl);
- GDK_THREADS_LEAVE ();
-
profile_end ("end", NULL);
return FALSE;
g_assert (impl->load_timeout_id == 0);
g_assert (impl->load_state != LOAD_PRELOAD);
- impl->load_timeout_id = g_timeout_add (MAX_LOADING_TIME, load_timeout_cb, impl);
+ impl->load_timeout_id = gdk_threads_add_timeout (MAX_LOADING_TIME, load_timeout_cb, impl);
impl->load_state = LOAD_PRELOAD;
}
struct stat *statbuf,
const char *mime_type);
-static gboolean execute_callbacks_idle (gpointer data);
-static void execute_callbacks (gpointer data);
+static gboolean execute_callbacks (gpointer data);
static gboolean fill_in_names (GtkFileFolderUnix *folder_unix,
GError **error);
-static void
+static gboolean
execute_callbacks (gpointer data)
{
GSList *l;
system_unix->execute_callbacks_idle_id = 0;
}
-static gboolean
-execute_callbacks_idle (gpointer data)
-{
- GDK_THREADS_ENTER ();
-
- execute_callbacks(data);
-
- GDK_THREADS_LEAVE ();
-
- return FALSE;
-}
-
static void
queue_callback (GtkFileSystemUnix *system_unix,
enum callback_types type,
system_unix->callbacks = g_slist_append (system_unix->callbacks, info);
if (!system_unix->execute_callbacks_idle_id)
- system_unix->execute_callbacks_idle_id = g_idle_add (execute_callbacks_idle, system_unix);
+ system_unix->execute_callbacks_idle_id = gdk_threads_add_idle (execute_callbacks, system_unix);
}
static GtkFileSystemHandle *
GtkFileFolderUnix *folder_unix = data;
GSList *children;
- GDK_THREADS_ENTER ();
-
if ((folder_unix->types & STAT_NEEDED_MASK) != 0)
fill_in_stats (folder_unix);
g_signal_emit_by_name (folder_unix, "finished-loading", 0);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
/* Start loading the folder contents in an idle */
if (!folder_unix->load_folder_id)
folder_unix->load_folder_id =
- g_idle_add ((GSourceFunc) load_folder, folder_unix);
+ gdk_threads_add_idle ((GSourceFunc) load_folder, folder_unix);
return handle;
}
WIN32_FILE_ATTRIBUTE_DATA *wfad,
const char *mime_type);
-static gboolean execute_callbacks_idle (gpointer data);
-static void execute_callbacks (gpointer data);
+static gboolean execute_callbacks (gpointer data);
static gboolean fill_in_names (GtkFileFolderWin32 *folder_win32,
GError **error);
g_return_val_if_fail (system_win32, FALSE);
if (system_win32->drives != GetLogicalDrives())
- g_signal_emit_by_name (system_win32, "volumes-changed", 0);
+ {
+ g_signal_emit_by_name (system_win32, "volumes-changed", 0);
+ }
return TRUE;
}
/* Set up an idle handler for volume changes. Once a second should
* be enough.
*/
- system_win32->timeout = g_timeout_add_full (0, 1000, check_volumes, system_win32, NULL);
+ system_win32->timeout = gdk_threads_add_timeout_full (0, 1000, check_volumes, system_win32, NULL);
system_win32->handles = g_hash_table_new (g_direct_hash, g_direct_equal);
-static void
+static gboolean
execute_callbacks (gpointer data)
{
GSList *l;
g_object_unref (system_win32);
system_win32->execute_callbacks_idle_id = 0;
-}
-static gboolean
-execute_callbacks_idle (gpointer data)
-{
- GDK_THREADS_ENTER ();
-
- execute_callbacks(data);
-
- GDK_THREADS_LEAVE ();
-
- return FALSE;
+ return FALSE:
}
static void
system_win32->callbacks = g_slist_append (system_win32->callbacks, info);
if (!system_win32->execute_callbacks_idle_id)
- system_win32->execute_callbacks_idle_id = g_idle_add (execute_callbacks_idle, system_win32);
+ system_win32->execute_callbacks_idle_id = gdk_threads_add_idle (execute_callbacks, system_win32);
}
static GtkFileSystemHandle *
GtkFileFolderWin32 *folder_win32 = data;
GSList *children;
- GDK_THREADS_ENTER ();
-
if ((folder_win32->types & STAT_NEEDED_MASK) != 0)
fill_in_stats (folder_win32);
g_signal_emit_by_name (folder_win32, "finished-loading", 0);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
/* Start loading the folder contents in an idle */
if (!folder_win32->load_folder_id)
folder_win32->load_folder_id =
- g_idle_add ((GSourceFunc) load_folder, folder_win32);
+ gdk_threads_add_idle ((GSourceFunc) load_folder, folder_win32);
return handle;
}
GtkIconTheme *icon_theme;
GtkIconThemePrivate *priv;
- GDK_THREADS_ENTER ();
-
icon_theme = GTK_ICON_THEME (user_data);
priv = icon_theme->priv;
priv->reset_styles_idle = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
if (!priv->reset_styles_idle)
priv->reset_styles_idle =
- g_idle_add_full (GTK_PRIORITY_RESIZE - 2,
+ gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE - 2,
reset_styles_idle, icon_theme, NULL);
}
GtkIconView *icon_view;
gdouble value;
- GDK_THREADS_ENTER ();
-
icon_view = data;
value = MIN (icon_view->priv->vadjustment->value +
gtk_icon_view_update_rubberband (icon_view);
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
icon_view->priv->event_last_y = event->y;
if (icon_view->priv->scroll_timeout_id == 0)
- icon_view->priv->scroll_timeout_id = g_timeout_add (30, rubberband_scroll_timeout,
+ icon_view->priv->scroll_timeout_id = gdk_threads_add_timeout (30, rubberband_scroll_timeout,
icon_view);
}
else
{
GtkIconView *icon_view;
- GDK_THREADS_ENTER ();
-
icon_view = GTK_ICON_VIEW (user_data);
icon_view->priv->layout_idle_id = 0;
gtk_icon_view_layout (icon_view);
- GDK_THREADS_LEAVE();
-
return FALSE;
}
if (icon_view->priv->layout_idle_id != 0)
return;
- icon_view->priv->layout_idle_id = g_idle_add (layout_callback, icon_view);
+ icon_view->priv->layout_idle_id = gdk_threads_add_idle (layout_callback, icon_view);
}
static void
{
GtkIconView *icon_view = GTK_ICON_VIEW (data);
- GDK_THREADS_ENTER ();
-
gtk_icon_view_autoscroll (icon_view);
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
if (icon_view->priv->scroll_timeout_id == 0)
{
icon_view->priv->scroll_timeout_id =
- g_timeout_add (50, drag_scroll_timeout, icon_view);
+ gdk_threads_add_timeout (50, drag_scroll_timeout, icon_view);
}
if (target == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
GtkIconView *icon_view;
GtkTreePath *path;
- GDK_THREADS_ENTER ();
-
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (data);
item->action_idle_handler = 0;
gtk_tree_path_free (path);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
{
case ACTION_ACTIVATE:
if (!item->action_idle_handler)
- item->action_idle_handler = g_idle_add (gtk_icon_view_item_accessible_idle_do_action, item);
+ item->action_idle_handler = gdk_threads_add_idle (gtk_icon_view_item_accessible_idle_do_action, item);
break;
default:
g_assert_not_reached ();
{
GtkImage *image;
- GDK_THREADS_ENTER ();
-
image = GTK_IMAGE (data);
image->data.anim.frame_timeout = 0;
if (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter) >= 0)
image->data.anim.frame_timeout =
- g_timeout_add (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter),
+ gdk_threads_add_timeout (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter),
animation_timeout,
image);
if (GTK_WIDGET_DRAWABLE (image))
gdk_window_process_updates (GTK_WIDGET (image)->window, TRUE);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
if (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter) >= 0)
image->data.anim.frame_timeout =
- g_timeout_add (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter),
+ gdk_threads_add_timeout (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter),
animation_timeout,
image);
}
{
if (list->htimer == 0)
{
- list->htimer = g_timeout_add
+ list->htimer = gdk_threads_add_timeout
(SCROLL_TIME, (GSourceFunc) gtk_list_horizontal_timeout, widget);
if (!((x < adj->value && adj->value <= 0) ||
if (!((y < 0 && focus_row == 0) ||
(y > widget->allocation.height && focus_row >= length - 1)))
- list->vtimer = g_timeout_add (SCROLL_TIME,
+ list->vtimer = gdk_threads_add_timeout (SCROLL_TIME,
(GSourceFunc) gtk_list_vertical_timeout,
list);
static gint
gtk_list_horizontal_timeout (GtkWidget *list)
{
- GDK_THREADS_ENTER ();
-
GTK_LIST (list)->htimer = 0;
do_fake_motion (list);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
static gint
gtk_list_vertical_timeout (GtkWidget *list)
{
- GDK_THREADS_ENTER ();
-
GTK_LIST (list)->vtimer = 0;
do_fake_motion (list);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
GtkSettings *settings;
gboolean touchscreen_mode;
- GDK_THREADS_ENTER ();
-
menu = GTK_MENU (data);
settings = gtk_widget_get_settings (GTK_WIDGET (menu));
gtk_menu_do_timeout_scroll (menu, touchscreen_mode);
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
guint timeout;
gboolean touchscreen_mode;
- GDK_THREADS_ENTER ();
-
menu = GTK_MENU (data);
settings = gtk_widget_get_settings (GTK_WIDGET (menu));
gtk_menu_remove_scroll_timeout (menu);
- menu->timeout_id = g_timeout_add (timeout, gtk_menu_scroll_timeout, menu);
-
- GDK_THREADS_LEAVE ();
+ menu->timeout_id = gdk_threads_add_timeout (timeout, gtk_menu_scroll_timeout, menu);
return FALSE;
}
gtk_menu_do_timeout_scroll (menu, touchscreen_mode);
- menu->timeout_id = g_timeout_add (timeout, gtk_menu_scroll_timeout_initial,
+ menu->timeout_id = gdk_threads_add_timeout (timeout, gtk_menu_scroll_timeout_initial,
menu);
}
-MENU_SCROLL_STEP2 : -MENU_SCROLL_STEP1;
menu->timeout_id =
- g_timeout_add (scroll_fast ?
+ gdk_threads_add_timeout (scroll_fast ?
MENU_SCROLL_TIMEOUT2 : MENU_SCROLL_TIMEOUT1,
gtk_menu_scroll_timeout, menu);
}
MENU_SCROLL_STEP2 : MENU_SCROLL_STEP1;
menu->timeout_id =
- g_timeout_add (scroll_fast ?
+ gdk_threads_add_timeout (scroll_fast ?
MENU_SCROLL_TIMEOUT2 : MENU_SCROLL_TIMEOUT1,
gtk_menu_scroll_timeout, menu);
}
GtkMenu *menu = user_data;
GdkWindow *child_window;
- GDK_THREADS_ENTER ();
-
gtk_menu_stop_navigating_submenu (menu);
if (GTK_WIDGET_REALIZED (menu))
}
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
"gtk-menu-popdown-delay", &popdown_delay,
NULL);
- menu->navigation_timeout = g_timeout_add (popdown_delay,
+ menu->navigation_timeout = gdk_threads_add_timeout (popdown_delay,
gtk_menu_stop_navigating_submenu_cb, menu);
#ifdef DRAW_STAY_UP_TRIANGLE
{
GdkEvent *event = gtk_get_current_event ();
- menu_item->timer = g_timeout_add (popup_delay,
+ menu_item->timer = gdk_threads_add_timeout (popup_delay,
gtk_menu_item_select_timeout,
menu_item);
if (event &&
GtkMenuItem *menu_item;
GtkWidget *parent;
- GDK_THREADS_ENTER ();
-
menu_item = GTK_MENU_ITEM (data);
parent = GTK_WIDGET (menu_item)->parent;
GTK_MENU_SHELL (menu_item->submenu)->ignore_enter = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
GtkNotebookPointerPosition pointer_position;
GList *element, *first_tab;
- GDK_THREADS_ENTER ();
-
priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
pointer_position = get_pointer_position (notebook);
gdk_window_raise (priv->drag_window);
}
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
settings = gtk_widget_get_settings (GTK_WIDGET (notebook));
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
- priv->dnd_timer = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
- (GSourceFunc) scroll_notebook_timer,
+ priv->dnd_timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
+ scroll_notebook_timer,
(gpointer) notebook);
}
}
GList *tab;
gint x, y;
- GDK_THREADS_ENTER ();
-
notebook = GTK_NOTEBOOK (data);
priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
gtk_notebook_switch_focus_tab (notebook, tab);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
settings = gtk_widget_get_settings (widget);
g_object_get (settings, "gtk-timeout-expand", &timeout, NULL);
- priv->switch_tab_timer = g_timeout_add (timeout,
- (GSourceFunc) gtk_notebook_switch_tab_timeout,
+ priv->switch_tab_timer = gdk_threads_add_timeout (timeout,
+ gtk_notebook_switch_tab_timeout,
widget);
}
}
}
}
-static gint
+static gboolean
gtk_notebook_timer (GtkNotebook *notebook)
{
gboolean retval = FALSE;
- GDK_THREADS_ENTER ();
-
if (notebook->timer)
{
gtk_notebook_do_arrow (notebook, notebook->click_child);
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
notebook->need_timer = FALSE;
- notebook->timer = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
+ notebook->timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
(GSourceFunc) gtk_notebook_timer,
(gpointer) notebook);
}
retval = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
- notebook->timer = g_timeout_add (timeout,
+ notebook->timer = gdk_threads_add_timeout (timeout,
(GSourceFunc) gtk_notebook_timer,
(gpointer) notebook);
notebook->need_timer = TRUE;
{
gboolean retval = FALSE;
- GDK_THREADS_ENTER ();
-
if (path_bar->timer)
{
if (path_bar->scrolling_up)
path_bar->need_timer = FALSE;
- path_bar->timer = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
+ path_bar->timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
(GSourceFunc)gtk_path_bar_scroll_timeout,
path_bar);
}
retval = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
path_bar->need_timer = TRUE;
- path_bar->timer = g_timeout_add (timeout,
+ path_bar->timer = gdk_threads_add_timeout (timeout,
(GSourceFunc)gtk_path_bar_scroll_timeout,
path_bar);
}
if (wait)
{
+ g_object_ref (op);
if (!op_unix->data_sent)
{
GDK_THREADS_LEAVE ();
GDK_THREADS_ENTER ();
}
g_main_loop_unref (op_unix->loop);
+ op_unix->loop = NULL;
+ g_object_unref (op);
}
}
win32_poll_status (op);
if (!gtk_print_operation_is_finished (op))
- op_win32->timeout_id = g_timeout_add (STATUS_POLLING_TIME,
+ op_win32->timeout_id = gdk_threads_add_timeout (STATUS_POLLING_TIME,
(GSourceFunc)win32_poll_status_timeout,
op);
g_object_unref (op);
{
op_win32->printerHandle = printerHandle;
win32_poll_status (op);
- op_win32->timeout_id = g_timeout_add (STATUS_POLLING_TIME,
+ op_win32->timeout_id = gdk_threads_add_timeout (STATUS_POLLING_TIME,
(GSourceFunc)win32_poll_status_timeout,
op);
}
GtkPrintOperation *op;
PreviewOp *pop = (PreviewOp *) data;
- GDK_THREADS_ENTER ();
-
op = GTK_PRINT_OPERATION (pop->preview);
cairo_surface_finish (pop->surface);
gtk_print_operation_preview_end_preview (pop->preview);
g_free (pop);
-
- GDK_THREADS_LEAVE ();
}
static gboolean
gboolean retval = TRUE;
cairo_t *cr;
- GDK_THREADS_ENTER ();
-
pop = (PreviewOp *) data;
op = GTK_PRINT_OPERATION (pop->preview);
if (op->priv->nr_of_pages <= pop->page_nr)
retval = FALSE;
- GDK_THREADS_LEAVE ();
-
return retval;
}
pop->page_nr = 0;
pop->print_context = context;
- g_idle_add_full (G_PRIORITY_DEFAULT_IDLE + 10,
- preview_print_idle,
- pop,
- preview_print_idle_done);
+ gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE + 10,
+ preview_print_idle,
+ pop,
+ preview_print_idle_done);
}
PrintPagesData *data;
GtkPrintOperationPrivate *priv;
- GDK_THREADS_ENTER ();
-
data = (PrintPagesData*)user_data;
priv = data->op->priv;
g_object_unref (data->op);
g_free (data);
-
- GDK_THREADS_LEAVE ();
}
static void
GtkPageSetup *page_setup;
gboolean done = FALSE;
- GDK_THREADS_ENTER ();
-
data = (PrintPagesData*)user_data;
priv = data->op->priv;
update_progress (data);
- GDK_THREADS_LEAVE ();
-
return !done;
}
static gboolean
show_progress_timeout (PrintPagesData *data)
{
- GDK_THREADS_ENTER ();
-
gtk_window_present (GTK_WINDOW (data->progress));
data->op->priv->show_progress_timeout_id = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
G_CALLBACK (handle_progress_response), op);
priv->show_progress_timeout_id =
- g_timeout_add (SHOW_PROGRESS_TIME,
+ gdk_threads_add_timeout (SHOW_PROGRESS_TIME,
(GSourceFunc)show_progress_timeout,
data);
priv->manual_orientation = TRUE;
}
- priv->print_pages_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE + 10,
- print_pages_idle,
- data,
- print_pages_idle_done);
+ priv->print_pages_idle_id = gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE + 10,
+ print_pages_idle,
+ data,
+ print_pages_idle_done);
/* Recursive main loop to make sure we don't exit on sync operations */
if (priv->is_sync)
{
priv->rloop = g_main_loop_new (NULL, FALSE);
+ g_object_ref (op);
GDK_THREADS_LEAVE ();
g_main_loop_run (priv->rloop);
GDK_THREADS_ENTER ();
g_main_loop_unref (priv->rloop);
priv->rloop = NULL;
+ g_object_unref (op);
}
}
if (priv->mark_conflicts_id != 0)
return;
- priv->mark_conflicts_id = g_idle_add (mark_conflicts_callback,
+ priv->mark_conflicts_id = gdk_threads_add_idle (mark_conflicts_callback,
dialog);
}
{
GtkRange *range;
- GDK_THREADS_ENTER ();
range = GTK_RANGE (data);
gtk_range_scroll (range, range->timer->step);
- GDK_THREADS_LEAVE ();
return TRUE;
}
GtkSettings *settings;
guint timeout;
- GDK_THREADS_ENTER ();
settings = gtk_widget_get_settings (GTK_WIDGET (data));
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
range = GTK_RANGE (data);
- range->timer->timeout_id = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
+ range->timer->timeout_id = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
second_timeout,
range);
- GDK_THREADS_LEAVE ();
-
/* remove self */
return FALSE;
}
range->timer = g_new (GtkRangeStepTimer, 1);
- range->timer->timeout_id = g_timeout_add (timeout,
+ range->timer->timeout_id = gdk_threads_add_timeout (timeout,
initial_timeout,
range);
range->timer->step = step;
{
GtkRange *range;
- GDK_THREADS_ENTER ();
range = GTK_RANGE (data);
gtk_range_update_value (range);
range->update_timeout_id = 0;
- GDK_THREADS_LEAVE ();
/* self-remove */
return FALSE;
{
gtk_range_remove_update_timer (range);
- range->update_timeout_id = g_timeout_add (UPDATE_DELAY,
+ range->update_timeout_id = gdk_threads_add_timeout (UPDATE_DELAY,
update_timeout,
range);
}
const gchar *uri, *name;
gboolean retval;
- GDK_THREADS_ENTER ();
-
impl = GTK_RECENT_CHOOSER_DEFAULT (user_data);
g_assert ((impl->load_state == LOAD_EMPTY) ||
impl->recent_items = gtk_recent_chooser_get_items (GTK_RECENT_CHOOSER (impl));
if (!impl->recent_items)
{
- GDK_THREADS_LEAVE ();
-
impl->load_state = LOAD_FINISHED;
return FALSE;
retval = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
{
GtkRecentChooserDefault *impl;
- GDK_THREADS_ENTER ();
-
impl = GTK_RECENT_CHOOSER_DEFAULT (user_data);
if (impl->load_id != 0)
(impl->load_state == LOAD_FINISHED));
set_busy_cursor (impl, FALSE);
-
- GDK_THREADS_LEAVE ();
}
/* clears the current model and reloads the recently used resources */
set_busy_cursor (impl, TRUE);
impl->load_state = LOAD_EMPTY;
- impl->load_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE + 30,
+ impl->load_id = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 30,
load_recent_items,
impl,
cleanup_after_load);
gboolean retval;
GtkWidget *item;
- GDK_THREADS_ENTER ();
-
pdata = (MenuPopulateData *) data;
priv = pdata->menu->priv;
else
retval = TRUE;
- GDK_THREADS_LEAVE ();
-
return retval;
}
/* dispose our menu items first */
gtk_recent_chooser_menu_dispose_items (menu);
- menu->priv->populate_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE + 30,
+ menu->priv->populate_id = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 30,
idle_populate_func,
pdata,
idle_populate_clean_up);
priv->filename = g_build_filename (g_get_home_dir (),
GTK_RECENTLY_USED_FILE,
NULL);
- priv->poll_timeout = g_timeout_add (POLL_DELTA,
+ priv->poll_timeout = gdk_threads_add_timeout (POLL_DELTA,
gtk_recent_manager_poll_timeout,
manager);
}
priv->filename = g_strdup (filename);
- priv->poll_timeout = g_timeout_add (POLL_DELTA,
+ priv->poll_timeout = gdk_threads_add_timeout (POLL_DELTA,
gtk_recent_manager_poll_timeout,
manager);
/* Local Functions */
static void gtk_selection_init (void);
-static gint gtk_selection_incr_timeout (GtkIncrInfo *info);
-static gint gtk_selection_retrieval_timeout (GtkRetrievalInfo *info);
+static gboolean gtk_selection_incr_timeout (GtkIncrInfo *info);
+static gboolean gtk_selection_retrieval_timeout (GtkRetrievalInfo *info);
static void gtk_selection_retrieval_report (GtkRetrievalInfo *info,
GdkAtom type,
gint format,
current_retrievals = g_list_append (current_retrievals, info);
gdk_selection_convert (widget->window, selection, target, time_);
- g_timeout_add (1000, (GSourceFunc) gtk_selection_retrieval_timeout, info);
+ gdk_threads_add_timeout (1000,
+ (GSourceFunc) gtk_selection_retrieval_timeout, info);
return TRUE;
}
gdk_window_get_events (info->requestor) |
GDK_PROPERTY_CHANGE_MASK);
current_incrs = g_list_append (current_incrs, info);
- g_timeout_add (1000, (GSourceFunc) gtk_selection_incr_timeout, info);
+ gdk_threads_add_timeout (1000, (GSourceFunc) gtk_selection_incr_timeout, info);
}
/* If it was a MULTIPLE request, set the property to indicate which
GList *tmp_list;
gboolean retval;
- GDK_THREADS_ENTER ();
-
/* Determine if retrieval has finished by checking if it still in
list of pending retrievals */
retval = TRUE; /* timeout will happen again */
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
* results:
*************************************************************/
-static gint
+static gboolean
gtk_selection_retrieval_timeout (GtkRetrievalInfo *info)
{
GList *tmp_list;
gboolean retval;
- GDK_THREADS_ENTER ();
-
/* Determine if retrieval has finished by checking if it still in
list of pending retrievals */
retval = TRUE; /* timeout will happen again */
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
GtkStateType previous_state);
static void gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
GtkArrowType arrow_type);
-static gint gtk_spin_button_timer (GtkSpinButton *spin_button);
+static gboolean gtk_spin_button_timer (GtkSpinButton *spin_button);
static void gtk_spin_button_stop_spinning (GtkSpinButton *spin);
static void gtk_spin_button_value_changed (GtkAdjustment *adjustment,
GtkSpinButton *spin_button);
spin->timer_step = step;
spin->need_timer = TRUE;
- spin->timer = g_timeout_add (timeout,
+ spin->timer = gdk_threads_add_timeout (timeout,
(GSourceFunc) gtk_spin_button_timer,
(gpointer) spin);
}
{
gboolean retval = FALSE;
- GDK_THREADS_ENTER ();
-
if (spin_button->timer)
{
if (spin_button->click_child == GTK_ARROW_UP)
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
spin_button->need_timer = FALSE;
- spin_button->timer = g_timeout_add (timeout,
+ spin_button->timer = gdk_threads_add_timeout (timeout,
(GSourceFunc) gtk_spin_button_timer,
(gpointer) spin_button);
}
}
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
gtk_status_icon_blinker (status_icon);
priv->blinking_timeout =
- g_timeout_add (BLINK_TIMEOUT,
+ gdk_threads_add_timeout (BLINK_TIMEOUT,
(GSourceFunc) gtk_status_icon_blinker,
status_icon);
}
gint x, y;
GdkModifierType mask;
- GDK_THREADS_ENTER ();
-
text = GTK_TEXT (data);
text->timer = 0;
gdk_event_free (event);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
{
if (text->timer == 0)
{
- text->timer = g_timeout_add (SCROLL_TIME,
+ text->timer = gdk_threads_add_timeout (SCROLL_TIME,
gtk_text_scroll_timeout,
text);
{
GtkTextView *text_view = data;
- GDK_THREADS_ENTER ();
-
/* Note that some of this code is duplicated at the end of size_allocate,
* keep in sync with that.
*/
gtk_text_view_flush_first_validate (text_view);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
GtkTextView *text_view = data;
gboolean result = TRUE;
- GDK_THREADS_ENTER ();
-
DV(g_print(G_STRLOC"\n"));
gtk_text_layout_validate (text_view->layout, 2000);
result = FALSE;
}
- GDK_THREADS_LEAVE ();
-
return result;
}
if (!text_view->first_validate_idle)
{
- text_view->first_validate_idle = g_idle_add_full (GTK_PRIORITY_RESIZE - 2, first_validate_callback, text_view, NULL);
+ text_view->first_validate_idle = gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE - 2, first_validate_callback, text_view, NULL);
DV (g_print (G_STRLOC": adding first validate idle %d\n",
text_view->first_validate_idle));
}
if (!text_view->incremental_validate_idle)
{
- text_view->incremental_validate_idle = g_idle_add_full (GTK_TEXT_VIEW_PRIORITY_VALIDATE, incremental_validate_callback, text_view, NULL);
+ text_view->incremental_validate_idle = gdk_threads_add_idle_full (GTK_TEXT_VIEW_PRIORITY_VALIDATE, incremental_validate_callback, text_view, NULL);
DV (g_print (G_STRLOC": adding incremental validate idle %d\n",
text_view->incremental_validate_idle));
}
gboolean visible;
gint blink_timeout;
- GDK_THREADS_ENTER ();
-
text_view = GTK_TEXT_VIEW (data);
priv = GTK_TEXT_VIEW_GET_PRIVATE (text_view);
text_view->blink_timeout = 0;
}
else if (visible)
- text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
+ text_view->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
text_view);
else
{
- text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
+ text_view->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
text_view);
priv->blink_time += get_cursor_time (text_view);
text_window_invalidate_cursors (text_view->text_window);
- GDK_THREADS_LEAVE ();
-
/* Remove ourselves */
return FALSE;
}
{
gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
- text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
+ text_view->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
text_view);
}
gtk_text_view_stop_cursor_blink (text_view);
gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
- text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
+ text_view->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
text_view);
}
G_STRLOC, text_view->first_validate_idle));
}
-static gint
+static gboolean
selection_scan_timeout (gpointer data)
{
GtkTextView *text_view;
- GDK_THREADS_ENTER ();
-
text_view = GTK_TEXT_VIEW (data);
DV(g_print (G_STRLOC": calling move_mark_to_pointer_and_scroll\n"));
gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
- GDK_THREADS_LEAVE ();
-
return TRUE; /* remain installed. */
}
GtkTextView *text_view;
GtkTextIter newplace;
- GDK_THREADS_ENTER ();
-
text_view = GTK_TEXT_VIEW (data);
get_iter_at_pointer (text_view, &newplace);
text_view->dnd_mark,
DND_SCROLL_MARGIN, FALSE, 0.0, 0.0);
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
g_source_remove (text_view->scroll_timeout);
text_view->scroll_timeout =
- g_timeout_add (50, selection_scan_timeout, text_view);
+ gdk_threads_add_timeout (50, selection_scan_timeout, text_view);
return TRUE;
}
g_source_remove (text_view->scroll_timeout);
text_view->scroll_timeout =
- g_timeout_add (50, drag_scan_timeout, text_view);
+ gdk_threads_add_timeout (50, drag_scan_timeout, text_view);
/* TRUE return means don't propagate the drag motion to parent
* widgets that may also be drop sites.
GtkToolbarPrivate *priv;
GList *list;
- GDK_THREADS_ENTER ();
-
priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
if (priv->need_sync)
priv->is_sliding = FALSE;
priv->idle_id = 0;
- GDK_THREADS_LEAVE();
return FALSE;
}
priv->is_sliding = TRUE;
if (!priv->idle_id)
- priv->idle_id = g_idle_add (slide_idle_handler, toolbar);
+ priv->idle_id = gdk_threads_add_idle (slide_idle_handler, toolbar);
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
vertical = (toolbar->orientation == GTK_ORIENTATION_VERTICAL);
gtk_widget_show (tooltips->tip_window);
}
-static gint
+static gboolean
gtk_tooltips_timeout (gpointer data)
{
GtkTooltips *tooltips = (GtkTooltips *) data;
- GDK_THREADS_ENTER ();
-
if (tooltips->active_tips_data != NULL &&
GTK_WIDGET_DRAWABLE (tooltips->active_tips_data->widget))
gtk_tooltips_draw_tips (tooltips);
tooltips->timer_tag = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
delay = STICKY_DELAY;
else
delay = tooltips->delay;
- tooltips->timer_tag = g_timeout_add (delay,
+ tooltips->timer_tag = gdk_threads_add_timeout (delay,
gtk_tooltips_timeout,
(gpointer) tooltips);
}
gint *tx,
gint *ty);
-static gint scroll_row_timeout (gpointer data);
+static gboolean scroll_row_timeout (gpointer data);
static void remove_scroll_timeout (GtkTreeView *tree_view);
static guint tree_view_signals [LAST_SIGNAL] = { 0 };
GtkTreeView *tree_view = GTK_TREE_VIEW (data);
GtkTreePath *path;
- GDK_THREADS_ENTER ();
-
if (tree_view->priv->prelight_node)
{
path = _gtk_tree_view_find_path (tree_view,
tree_view->priv->auto_expand_timeout = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
if (tree_view->priv->hover_expand)
{
tree_view->priv->auto_expand_timeout =
- g_timeout_add (AUTO_EXPAND_TIMEOUT, auto_expand_timeout, tree_view);
+ gdk_threads_add_timeout (AUTO_EXPAND_TIMEOUT, auto_expand_timeout, tree_view);
}
}
if (tree_view->priv->scroll_timeout == 0)
{
- tree_view->priv->scroll_timeout = g_timeout_add (150, scroll_row_timeout, tree_view);
+ tree_view->priv->scroll_timeout = gdk_threads_add_timeout (150, scroll_row_timeout, tree_view);
}
}
{
gboolean retval;
- GDK_THREADS_ENTER ();
-
retval = do_validate_rows (tree_view, TRUE);
if (! retval && tree_view->priv->validate_rows_timer)
{
tree_view->priv->validate_rows_timer = 0;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
static gboolean
presize_handler_callback (gpointer data)
{
- GDK_THREADS_ENTER ();
-
do_presize_handler (GTK_TREE_VIEW (data));
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
if (! tree_view->priv->presize_handler_timer)
{
tree_view->priv->presize_handler_timer =
- g_idle_add_full (GTK_PRIORITY_RESIZE - 2, presize_handler_callback, tree_view, NULL);
+ gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE - 2, presize_handler_callback, tree_view, NULL);
}
if (! tree_view->priv->validate_rows_timer)
{
tree_view->priv->validate_rows_timer =
- g_idle_add_full (GTK_TREE_VIEW_PRIORITY_VALIDATE, (GSourceFunc) validate_rows_handler, tree_view, NULL);
+ gdk_threads_add_idle_full (GTK_TREE_VIEW_PRIORITY_VALIDATE, (GSourceFunc) validate_rows_handler, tree_view, NULL);
}
}
static gboolean
scroll_sync_handler (GtkTreeView *tree_view)
{
-
- GDK_THREADS_ENTER ();
-
if (tree_view->priv->height <= tree_view->priv->vadjustment->page_size)
gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), 0);
else if (gtk_tree_row_reference_valid (tree_view->priv->top_row))
tree_view->priv->scroll_sync_timer = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
if (!tree_view->priv->scroll_sync_timer)
{
tree_view->priv->scroll_sync_timer =
- g_idle_add_full (GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC, (GSourceFunc) scroll_sync_handler, tree_view, NULL);
+ gdk_threads_add_idle_full (GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC, (GSourceFunc) scroll_sync_handler, tree_view, NULL);
}
}
GtkTreeViewDropPosition pos;
gboolean result = FALSE;
- GDK_THREADS_ENTER ();
-
gtk_tree_view_get_drag_dest_row (tree_view,
&dest_path,
&pos);
result = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return result;
}
-static gint
+static gboolean
scroll_row_timeout (gpointer data)
{
GtkTreeView *tree_view = data;
- GDK_THREADS_ENTER ();
-
gtk_tree_view_vertical_autoscroll (tree_view);
if (tree_view->priv->rubber_band_status == RUBBER_BAND_ACTIVE)
gtk_tree_view_update_rubber_band (tree_view);
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE))
{
tree_view->priv->open_dest_timeout =
- g_timeout_add (AUTO_EXPAND_TIMEOUT, open_row_timeout, tree_view);
+ gdk_threads_add_timeout (AUTO_EXPAND_TIMEOUT, open_row_timeout, tree_view);
}
else if (tree_view->priv->scroll_timeout == 0)
{
tree_view->priv->scroll_timeout =
- g_timeout_add (150, scroll_row_timeout, tree_view);
+ gdk_threads_add_timeout (150, scroll_row_timeout, tree_view);
}
if (target == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
static gboolean
gtk_tree_view_search_entry_flush_timeout (GtkTreeView *tree_view)
{
- GDK_THREADS_ENTER ();
-
gtk_tree_view_search_dialog_hide (tree_view->priv->search_window, tree_view);
tree_view->priv->typeselect_flush_timeout = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
}
tree_view->priv->typeselect_flush_timeout =
- g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+ gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
static gboolean
expand_collapse_timeout (gpointer data)
{
- gboolean retval;
-
- GDK_THREADS_ENTER ();
-
- retval = do_expand_collapse (data);
-
- GDK_THREADS_LEAVE ();
-
- return retval;
+ return do_expand_collapse (data);
}
static gboolean
if (animate)
{
- tree_view->priv->expand_collapse_timeout = g_timeout_add (50, expand_collapse_timeout, tree_view);
+ tree_view->priv->expand_collapse_timeout = gdk_threads_add_timeout (50, expand_collapse_timeout, tree_view);
tree_view->priv->expanded_collapsed_node = node;
tree_view->priv->expanded_collapsed_tree = tree;
if (animate)
{
- tree_view->priv->expand_collapse_timeout = g_timeout_add (50, expand_collapse_timeout, tree_view);
+ tree_view->priv->expand_collapse_timeout = gdk_threads_add_timeout (50, expand_collapse_timeout, tree_view);
tree_view->priv->expanded_collapsed_node = node;
tree_view->priv->expanded_collapsed_tree = tree;
{
g_source_remove (tree_view->priv->typeselect_flush_timeout);
tree_view->priv->typeselect_flush_timeout =
- g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+ gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
}
{
GtkTreeView *tree_view = (GtkTreeView *)data;
- GDK_THREADS_ENTER ();
-
tree_view->priv->disable_popdown = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
gtk_tree_view_search_enable_popdown (GtkWidget *widget,
gpointer data)
{
- g_timeout_add (200, gtk_tree_view_real_search_enable_popdown, data);
+ gdk_threads_add_timeout_full (G_PRIORITY_HIGH, 200, gtk_tree_view_real_search_enable_popdown, g_object_ref (data), g_object_unref);
}
static gboolean
{
g_source_remove (tree_view->priv->typeselect_flush_timeout);
tree_view->priv->typeselect_flush_timeout =
- g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+ gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
}
{
g_source_remove (tree_view->priv->typeselect_flush_timeout);
tree_view->priv->typeselect_flush_timeout =
- g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+ gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
}
{
g_source_remove (tree_view->priv->typeselect_flush_timeout);
tree_view->priv->typeselect_flush_timeout =
- g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+ gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
}
static gboolean
do_updates_idle (GtkUIManager *self)
{
- GDK_THREADS_ENTER ();
do_updates (self);
- GDK_THREADS_LEAVE ();
return FALSE;
}
if (self->private_data->update_tag != 0)
return;
- self->private_data->update_tag = g_idle_add ((GSourceFunc)do_updates_idle,
+ self->private_data->update_tag = gdk_threads_add_idle (
+ (GSourceFunc)do_updates_idle,
self);
}
{
GtkWindow *window;
- GDK_THREADS_ENTER ();
window = GTK_WINDOW (data);
if (window->keys_changed_handler)
}
g_signal_emit (window, window_signals[KEYS_CHANGED], 0);
- GDK_THREADS_LEAVE ();
return FALSE;
}
gtk_window_notify_keys_changed (GtkWindow *window)
{
if (!window->keys_changed_handler)
- window->keys_changed_handler = g_idle_add (handle_keys_changed, window);
+ window->keys_changed_handler = gdk_threads_add_idle (handle_keys_changed, window);
}
/**
!cups_backend->got_default_printer)
return TRUE;
+ g_object_ref (cups_backend);
+ GDK_THREADS_LEAVE ();
+
cups_backend->list_printers_pending = TRUE;
request = gtk_cups_request_new (NULL,
(GtkPrintCupsResponseCallbackFunc) cups_request_printer_list_cb,
request,
NULL);
+ GDK_THREADS_ENTER ();
+ g_object_unref (cups_backend);
return TRUE;
}
if (cups_backend->list_printers_poll == 0)
{
cups_request_printer_list (cups_backend);
- cups_backend->list_printers_poll = g_timeout_add (3000,
+ cups_backend->list_printers_poll = gdk_threads_add_timeout (3000,
(GSourceFunc) cups_request_printer_list,
backend);
}
profiler = GTK_WIDGET_PROFILER (data);
- g_idle_add_full (G_PRIORITY_HIGH, toplevel_idle_after_expose_cb, profiler, NULL);
+ gdk_threads_add_idle_full (G_PRIORITY_HIGH, toplevel_idle_after_expose_cb, profiler, NULL);
return FALSE;
}
(* set_filename_fn) (GTK_FILE_CHOOSER (chooser), data);
- g_timeout_add (2000, set_filename_timeout_cb, &closure);
+ gdk_threads_add_timeout (2000, set_filename_timeout_cb, &closure);
gtk_dialog_run (GTK_DIALOG (chooser));
retval = (* compare_filename_fn) (GTK_FILE_CHOOSER (chooser), data);
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (closure.chooser), path);
- g_timeout_add (2000, confirm_overwrite_timeout_cb, &closure);
+ gdk_threads_add_timeout (2000, confirm_overwrite_timeout_cb, &closure);
gtk_dialog_run (GTK_DIALOG (closure.chooser));
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (closure.chooser));
static void
sleep_in_main_loop (int milliseconds)
{
- g_timeout_add (milliseconds, sleep_timeout_cb, NULL);
+ gdk_threads_add_timeout (milliseconds, sleep_timeout_cb, NULL);
gtk_main ();
}
static void
wait_for_callback (TestCallbackClosure *closure)
{
- g_timeout_add (CALLBACK_TIMEOUT_MS, timeout_cb, closure);
+ gdk_threads_add_timeout (CALLBACK_TIMEOUT_MS, timeout_cb, closure);
gtk_main ();
}
gtk_widget_show (GTK_WIDGET (info.window));
- g_idle_add (stress_test_old_api, &info);
+ gdk_threads_add_idle (stress_test_old_api, &info);
gtk_widget_show_all (GTK_WIDGET (info.window));
progress = GTK_BIN (page)->child;
gtk_assistant_set_page_complete (GTK_ASSISTANT (widget), page, FALSE);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), 0.0);
- g_timeout_add (300, (GSourceFunc) progress_timeout, widget);
+ gdk_threads_add_timeout (300, (GSourceFunc) progress_timeout, widget);
}
else
g_print ("prepare: %d\n", gtk_assistant_get_current_page (GTK_ASSISTANT (widget)));
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
#if 1
- g_timeout_add (1000, (GSourceFunc) capital_animation, model);
+ gdk_threads_add_timeout (1000, (GSourceFunc) capital_animation, model);
#endif
gtk_widget_show_all (window);
{
n_animations += 20;
- timer = g_timeout_add (1000, (GSourceFunc) animation_timer, NULL);
+ timer = gdk_threads_add_timeout (1000, (GSourceFunc) animation_timer, NULL);
}
int
if (!popdown_timer)
{
g_print ("added popdown\n");
- popdown_timer = g_timeout_add (500, popdown_cb, NULL);
+ popdown_timer = gdk_threads_add_timeout (500, popdown_cb, NULL);
}
}
}
-gint
+gboolean
popup_cb (gpointer data)
{
if (!popped_up)
popped_up = TRUE;
}
- popdown_timer = g_timeout_add (500, popdown_cb, NULL);
+ popdown_timer = gdk_threads_add_timeout (500, popdown_cb, NULL);
g_print ("added popdown\n");
popup_timer = FALSE;
guint time)
{
if (!popup_timer)
- popup_timer = g_timeout_add (500, popup_cb, NULL);
+ popup_timer = gdk_threads_add_timeout (500, popup_cb, NULL);
return TRUE;
}
gtk_entry_completion_set_text_column (completion, 0);
/* Fill the completion dynamically */
- g_timeout_add (1000, (GSourceFunc) animation_timer, completion);
+ gdk_threads_add_timeout (1000, (GSourceFunc) animation_timer, completion);
/* Fourth entry */
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Model-less entry completion"), FALSE, FALSE, 0);
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_widget_show (menuitem);
- g_timeout_add (250, change_item, submenu);
+ gdk_threads_add_timeout (250, change_item, submenu);
menuitem = gtk_menu_item_new_with_label ("bar");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4, TRUE));
toggle_dynamic (GtkWidget *button,
GtkUIManager *merge)
{
- g_timeout_add (2000, (GSourceFunc)delayed_toggle_dynamic, merge);
+ gdk_threads_add_timeout (2000, (GSourceFunc)delayed_toggle_dynamic, merge);
}
static void
if (!blink_timeout)
{
- blink_timeout = g_timeout_add (1000, blink_cb, window);
+ blink_timeout = gdk_threads_add_timeout (1000, blink_cb, window);
gtk_widget_hide (window);
g_object_set_data (G_OBJECT (window), "blink", GUINT_TO_POINTER (blink_timeout));
}
else
{
- timeout = g_timeout_add (2000, timeout_handler, NULL);
+ timeout = gdk_threads_add_timeout (2000, timeout_handler, NULL);
}
}
icons = g_slist_append (icons, icon);
- timeout = g_timeout_add (2000, timeout_handler, icon);
+ timeout = gdk_threads_add_timeout (2000, timeout_handler, icon);
}
gtk_main ();
gdouble hue = 0.0;
if (enabled && buffer->color_cycle_timeout == 0)
- buffer->color_cycle_timeout = g_timeout_add (200, color_cycle_timeout, buffer);
+ buffer->color_cycle_timeout = gdk_threads_add_timeout (200, color_cycle_timeout, buffer);
else if (!enabled && buffer->color_cycle_timeout != 0)
{
g_source_remove (buffer->color_cycle_timeout);
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), NULL);
add_item_to_list (store, item, "New");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
- g_timeout_add (3000, (GSourceFunc) timeout_cb, item);
+ gdk_threads_add_timeout (3000, (GSourceFunc) timeout_cb, item);
gtk_tool_item_set_expand (item, TRUE);
menu = gtk_menu_new ();
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (item), menu);
add_item_to_list (store, item, "Open");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
- g_timeout_add (3000, (GSourceFunc) timeout_cb1, item);
+ gdk_threads_add_timeout (3000, (GSourceFunc) timeout_cb1, item);
menu = gtk_menu_new ();
for (i = 0; i < 20; i++)
g_signal_connect (button, "realize", G_CALLBACK (gtk_widget_grab_focus), NULL);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 400);
gtk_widget_show_all (window);
- g_timeout_add (1000, (GSourceFunc) futz, NULL);
+ gdk_threads_add_timeout (1000, (GSourceFunc) futz, NULL);
gtk_main ();
return 0;
}