/** * gpk_animated_icon_enable_animation: **/ gboolean gpk_animated_icon_enable_animation (GpkAnimatedIcon *icon, gboolean enabled) { g_return_val_if_fail (GPK_IS_ANIMATED_ICON (icon), FALSE); if (!enabled) { if (icon->animation_id == 0) { g_debug ("ignoring stop on stopped icon"); return FALSE; } g_source_remove (icon->animation_id); icon->animation_id = 0; return TRUE; } /* don't double queue */ if (icon->animation_id != 0) { g_debug ("ignoring start on started icon"); return FALSE; } /* start */ icon->frame_counter = 0; icon->animation_id = g_timeout_add (icon->frame_delay, (GSourceFunc) gpk_animated_icon_update, icon); g_source_set_name_by_id (icon->animation_id, "[GpkAnimatedIcon] start update"); gpk_animated_icon_update (icon); return TRUE; }
static void gtk_tooltip_start_delay (GdkDisplay *display) { guint timeout; GtkTooltip *tooltip; tooltip = g_object_get_data (G_OBJECT (display), "gdk-display-current-tooltip"); if (!tooltip || GTK_TOOLTIP_VISIBLE (tooltip)) return; if (tooltip->timeout_id) g_source_remove (tooltip->timeout_id); if (tooltip->browse_mode_enabled) timeout = BROWSE_TIMEOUT; else timeout = HOVER_TIMEOUT; tooltip->timeout_id = gdk_threads_add_timeout_full (0, timeout, tooltip_popup_timeout, g_object_ref (display), g_object_unref); g_source_set_name_by_id (tooltip->timeout_id, "[gtk+] tooltip_popup_timeout"); }
static void add_startup_timeout (GdkX11Screen *screen, const char *startup_id) { StartupTimeoutData *data; StartupNotificationData *sn_data; data = g_object_get_data (G_OBJECT (screen), "appinfo-startup-data"); if (data == NULL) { data = g_new (StartupTimeoutData, 1); data->contexts = NULL; data->timeout_id = 0; g_object_set_data_full (G_OBJECT (screen), "appinfo-startup-data", data, free_startup_timeout); } sn_data = g_new (StartupNotificationData, 1); sn_data->display = g_object_ref (GDK_SCREEN_DISPLAY (screen)); sn_data->startup_id = g_strdup (startup_id); g_get_current_time (&sn_data->time); data->contexts = g_slist_prepend (data->contexts, sn_data); if (data->timeout_id == 0) { data->timeout_id = g_timeout_add_seconds (STARTUP_TIMEOUT_LENGTH_SECONDS, startup_timeout, data); g_source_set_name_by_id (data->timeout_id, "[gtk+] startup_timeout"); } }
static gboolean first_values (gpointer user_data) { compass_changed (); drv_data->timeout_id = g_timeout_add_seconds (1, (GSourceFunc) compass_changed, NULL); g_source_set_name_by_id (drv_data->timeout_id, "[fake_compass_set_polling] compass_changed"); return G_SOURCE_REMOVE; }
static void ensure_queued_save (ShellAppUsage *self) { if (self->save_id != 0) return; self->save_id = g_timeout_add_seconds (SAVE_APPS_TIMEOUT_SECONDS, idle_save_application_usage, self); g_source_set_name_by_id (self->save_id, "[gnome-shell] idle_save_application_usage"); }
void TestController::platformRunUntil(bool&, double timeout) { cancelTimeout(); if (timeout != m_noTimeout) { gTimeoutSourceId = g_timeout_add(timeout * 1000, timeoutCallback, 0); g_source_set_name_by_id(gTimeoutSourceId, "[WebKit] timeoutCallback"); } gtk_main(); }
static void establish_timeout (void) { if (timeout_id != 0) g_source_remove (timeout_id); timeout_id = g_timeout_add (opt_idle_timeout * 1000, on_timeout, NULL); g_source_set_name_by_id (timeout_id, "[gnome-shell] on_timeout"); }
void TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded() { if (m_waitToDumpWatchdogTimer) return; m_waitToDumpWatchdogTimer = g_timeout_add(waitToDumpWatchdogTimerInterval * 1000, waitToDumpWatchdogTimerCallback, 0); g_source_set_name_by_id(m_waitToDumpWatchdogTimer, "[WebKit] waitToDumpWatchdogTimerCallback"); }
static void webViewLoadProgressChanged(WebKitWebView *webView, GParamSpec *pspec, BrowserWindow *window) { gdouble progress = webkit_web_view_get_estimated_load_progress(webView); gtk_entry_set_progress_fraction(GTK_ENTRY(window->uriEntry), progress); if (progress == 1.0) { window->resetEntryProgressTimeoutId = g_timeout_add(500, (GSourceFunc)resetEntryProgress, window); g_source_set_name_by_id(window->resetEntryProgressTimeoutId, "[WebKit] resetEntryProgress"); } }
static void handle_no_searchable_sources (GrlSourceResultCb callback, gpointer user_data) { struct CallbackData *callback_data = g_new0 (struct CallbackData, 1); guint id; callback_data->user_callback = callback; callback_data->user_data = user_data; id = g_idle_add (handle_no_searchable_sources_idle, callback_data); g_source_set_name_by_id (id, "[grilo] handle_no_searchable_sources_idle"); }
void setSharedTimerFireInterval(double interval) { ASSERT(sharedTimerFiredFunction); guint intervalInMS = static_cast<guint>(interval * 1000); stopSharedTimer(); sharedTimer = g_timeout_add_full(GDK_PRIORITY_REDRAW, intervalInMS, sharedTimerTimeoutCallback, 0, 0); g_source_set_name_by_id(sharedTimer, "[WebKit] sharedTimerTimeoutCallback"); }
static void recorder_add_redraw_timeout (ShellRecorder *recorder) { if (recorder->redraw_timeout == 0) { recorder->redraw_timeout = g_timeout_add (MAXIMUM_PAUSE_TIME, recorder_redraw_timeout, recorder); g_source_set_name_by_id (recorder->redraw_timeout, "[gnome-shell] recorder_redraw_timeout"); } }
void LayerTreeHostGtk::scheduleLayerFlush() { if (!m_layerFlushSchedulingEnabled) return; // We use a GLib timer because otherwise GTK+ event handling during dragging can starve WebCore timers, which have a lower priority. if (!m_layerFlushTimerCallbackId) { m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 0, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0); g_source_set_name_by_id(m_layerFlushTimerCallbackId, "[WebKit] layerFlushTimerFiredCallback"); } }
static void recorder_add_update_pointer_timeout (ShellRecorder *recorder) { if (!recorder->update_pointer_timeout) { recorder->update_pointer_timeout = g_timeout_add (UPDATE_POINTER_TIME, recorder_update_pointer_timeout, recorder); g_source_set_name_by_id (recorder->update_pointer_timeout, "[gnome-shell] recorder_update_pointer_timeout"); } }
void TestRunner::setWaitToDump(bool waitUntilDone) { static const int timeoutSeconds = 30; m_waitToDump = waitUntilDone; if (m_waitToDump && shouldSetWaitToDumpWatchdog()) { guint id = g_timeout_add_seconds(timeoutSeconds, waitToDumpWatchdogFired, 0); g_source_set_name_by_id(id, "[WebKit] waitToDumpWatchdogFired"); setWaitToDumpWatchdog(id); } }
static void ensure_autoquit_on (void) { if (g_getenv ("HOTPLUG_SNIFFER_PERSIST") != NULL) return; autoquit_id = g_timeout_add_seconds (AUTOQUIT_TIMEOUT, autoquit_timeout_cb, NULL); g_source_set_name_by_id (autoquit_id, "[gnome-shell] autoquit_timeout_cb"); }
static void reset_timeout (GtkSearchEntry *entry) { GtkSearchEntryPrivate *priv = GET_PRIV (entry); if (priv->delayed_changed_id > 0) g_source_remove (priv->delayed_changed_id); priv->delayed_changed_id = g_timeout_add (DELAYED_TIMEOUT_ID, gtk_search_entry_changed_timeout_cb, entry); g_source_set_name_by_id (priv->delayed_changed_id, "[gtk+] gtk_search_entry_changed_timeout_cb"); }
void play_loop_start (guint *id) { if (*id != 0) return; *id = g_timeout_add_seconds (GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT, (GSourceFunc) play_loop_timeout_cb, NULL); g_source_set_name_by_id (*id, "[gnome-settings-daemon] play_loop_timeout_cb"); play_sound (); }
static void app_schedule_changed (App *app) { print_debug ("Scheduling changed"); if (app->changed_timeout_id == 0) { app->changed_timeout_id = g_timeout_add (2000, on_app_schedule_changed_cb, app); g_source_set_name_by_id (app->changed_timeout_id, "[gnome-shell] on_app_schedule_changed_cb"); } }
static void qemu_chr_socket_restart_timer(Chardev *chr) { SocketChardev *s = SOCKET_CHARDEV(chr); char *name; assert(s->connected == 0); s->reconnect_timer = g_timeout_add_seconds(s->reconnect_time, socket_reconnect_timeout, chr); name = g_strdup_printf("chardev-socket-reconnect-%s", chr->label); g_source_set_name_by_id(s->reconnect_timer, name); g_free(name); }
static gboolean startup_timeout (void *data) { StartupTimeoutData *std; GSList *tmp; GTimeVal now; int min_timeout; std = data; min_timeout = STARTUP_TIMEOUT_LENGTH; g_get_current_time (&now); tmp = std->contexts; while (tmp != NULL) { StartupNotificationData *sn_data; GSList *next; double elapsed; sn_data = tmp->data; next = tmp->next; elapsed = ((((double) now.tv_sec - sn_data->time.tv_sec) * G_USEC_PER_SEC + (now.tv_usec - sn_data->time.tv_usec))) / 1000.0; if (elapsed >= STARTUP_TIMEOUT_LENGTH) { std->contexts = g_slist_remove (std->contexts, sn_data); end_startup_notification (sn_data->display, sn_data->startup_id); free_startup_notification_data (sn_data); } else { min_timeout = MIN (min_timeout, (STARTUP_TIMEOUT_LENGTH - elapsed)); } tmp = next; } if (std->contexts == NULL) std->timeout_id = 0; else { std->timeout_id = g_timeout_add_seconds ((min_timeout + 500)/1000, startup_timeout, std); g_source_set_name_by_id (std->timeout_id, "[gtk+] startup_timeout"); } /* always remove this one, but we may have reinstalled another one. */ return G_SOURCE_REMOVE; }
static void queue_install_fonts_tag (const char *tag) { guint idle_id; if (tags == NULL) { tags = g_ptr_array_new (); idle_id = g_idle_add (pk_install_fonts_idle_cb, NULL); g_source_set_name_by_id (idle_id, "[PkGtkModule] install fonts"); } g_debug ("Queue install of: %s", tag); g_ptr_array_add (tags, (gpointer) g_strdup (tag)); }
static void start_progressive_loading (GtkWidget *picture) { /* This is obviously totally contrived (we slow down loading * on purpose to show how incremental loading works). * The real purpose of incremental loading is the case where * you are reading data from a slow source such as the network. * The timeout simply simulates a slow data source by inserting * pauses in the reading process. */ load_timeout = g_timeout_add (150, progressive_timeout, picture); g_source_set_name_by_id (load_timeout, "[gtk] progressive_timeout"); }
static void maybe_start_idle (GdkFrameClockIdle *clock_idle) { GdkFrameClockIdlePrivate *priv = clock_idle->priv; if (RUN_FLUSH_IDLE (priv) || RUN_PAINT_IDLE (priv)) { guint min_interval = 0; if (priv->min_next_frame_time != 0) { gint64 now = compute_frame_time (clock_idle); gint64 min_interval_us = MAX (priv->min_next_frame_time, now) - now; min_interval = (min_interval_us + 500) / 1000; } if (priv->flush_idle_id == 0 && RUN_FLUSH_IDLE (priv)) { priv->flush_idle_id = gdk_threads_add_timeout_full (GDK_PRIORITY_EVENTS + 1, min_interval, gdk_frame_clock_flush_idle, g_object_ref (clock_idle), (GDestroyNotify) g_object_unref); g_source_set_name_by_id (priv->flush_idle_id, "[gtk+] gdk_frame_clock_flush_idle"); } if (!priv->in_paint_idle && priv->paint_idle_id == 0 && RUN_PAINT_IDLE (priv)) { priv->paint_idle_id = gdk_threads_add_timeout_full (GDK_PRIORITY_REDRAW, min_interval, gdk_frame_clock_paint_idle, g_object_ref (clock_idle), (GDestroyNotify) g_object_unref); g_source_set_name_by_id (priv->paint_idle_id, "[gtk+] gdk_frame_clock_paint_idle"); } } }
void on_event (AtspiEvent *event, void *data) { if (atspi_accessible_get_role (event->source, NULL) == ATSPI_ROLE_DESKTOP_FRAME) { if (strstr (event->type, "add")) { AtspiAccessible *desktop = atspi_get_desktop (0); guint id; basic (desktop); g_object_unref (desktop); id = g_timeout_add (3000, kill_child, NULL); g_source_set_name_by_id (id, "[at-spi2-core] kill_child"); } else { guint id; id = g_idle_add (end, NULL); g_source_set_name_by_id (id, "[at-spi2-core] end"); } } g_boxed_free (ATSPI_TYPE_EVENT, event); }
static void et_status_bar_start_timer (EtStatusBar *self) { EtStatusBarPrivate *priv; priv = et_status_bar_get_instance_private (self); et_status_bar_remove_timer (self); priv->timer_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, 4, (GSourceFunc)et_status_bar_stop_timer, self, (GDestroyNotify)et_status_bar_reset_timer); g_source_set_name_by_id (priv->timer_id, "Statusbar stop timer"); }
void LayerTreeHostGtk::layerFlushTimerFired() { ASSERT(m_layerFlushTimerCallbackId); m_layerFlushTimerCallbackId = 0; flushAndRenderLayers(); if (toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations() && !m_layerFlushTimerCallbackId) { const double targetFPS = 60; double nextFlush = std::max((1 / targetFPS) - (currentTime() - m_lastFlushTime), 0.0); m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, nextFlush * 1000.0, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0); g_source_set_name_by_id(m_layerFlushTimerCallbackId, "[WebKit] layerFlushTimerFiredCallback"); } }
/** * pk_progress_bar_draw_pulse_bar: **/ static void pk_progress_bar_draw_pulse_bar (PkProgressBar *self) { /* have we already got zero percent? */ if (self->priv->timer_id != 0) return; if (TRUE) { self->priv->pulse_state.position = 1; self->priv->pulse_state.move_forward = TRUE; self->priv->timer_id = g_timeout_add (PK_PROGRESS_BAR_PULSE_TIMEOUT, (GSourceFunc) pk_progress_bar_pulse_bar, self); g_source_set_name_by_id (self->priv->timer_id, "[PkProgressBar] pulse"); } }
static void recorder_queue_redraw (ShellRecorder *recorder) { /* If we just queue a redraw on every mouse motion (for example), we * starve Clutter, which operates at a very low priority. So * we need to queue a "low priority redraw" after timeline updates */ if (recorder->state == RECORDER_STATE_RECORDING && recorder->redraw_idle == 0) { recorder->redraw_idle = g_idle_add_full (CLUTTER_PRIORITY_REDRAW + 1, recorder_idle_redraw, recorder, NULL); g_source_set_name_by_id (recorder->redraw_idle, "[gnome-shell] recorder_idle_redraw"); } }
/** * gpm_dpms_init: **/ static void gpm_dpms_init (GpmDpms *dpms) { dpms->priv = GPM_DPMS_GET_PRIVATE (dpms); /* DPMSCapable() can never change for a given display */ dpms->priv->display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default()); dpms->priv->dpms_capable = DPMSCapable (dpms->priv->display); dpms->priv->timer_id = g_timeout_add_seconds (GPM_DPMS_POLL_TIME, (GSourceFunc)gpm_dpms_poll_mode_cb, dpms); g_source_set_name_by_id (dpms->priv->timer_id, "[GpmDpms] poll"); /* ensure we clear the default timeouts (Standby: 1200s, Suspend: 1800s, Off: 2400s) */ gpm_dpms_clear_timeouts (dpms); }