static gboolean pbar_update (GCancellable *cancellable) { gtk_progress_bar_pulse ((GtkProgressBar *) pbar); gtk_progress_bar_set_text ((GtkProgressBar *) pbar, txt); /* Return TRUE to reschedule the timeout. */ return !g_cancellable_is_cancelled (cancellable); }
static gboolean main_progress_bar_pulse_cb (gpointer user_data) { GtkProgressBar *progress_bar = GTK_PROGRESS_BAR (user_data); gtk_progress_bar_pulse (progress_bar); return TRUE; }
static gboolean progress_pulse_timeout (STlinkGUI *gui) { if (gui->progress.activity_mode) { gtk_progress_bar_pulse (gui->progress.bar); } else { gtk_progress_bar_set_fraction (gui->progress.bar, gui->progress.fraction); } return TRUE; }
static gboolean pulse_it (GtkWidget *widget) { gtk_progress_bar_pulse (GTK_PROGRESS_BAR (widget)); pulse_id = g_timeout_add (pulse_time, (GSourceFunc)pulse_it, widget); return G_SOURCE_REMOVE; }
static gboolean progress_dialog_pulse_cb (gpointer data) { g_return_val_if_fail (data != NULL, FALSE); gtk_progress_bar_pulse (GTK_PROGRESS_BAR (data)); return TRUE; }
void xfburn_progress_dialog_pulse_progress_bar (XfburnProgressDialog * dialog) { XfburnProgressDialogPrivate *priv = XFBURN_PROGRESS_DIALOG_GET_PRIVATE (dialog); gdk_threads_enter (); gtk_progress_bar_pulse (GTK_PROGRESS_BAR (priv->progress_bar)); gdk_threads_leave (); }
gboolean update_progress_bar (gpointer data) { gtk_progress_bar_pulse (GTK_PROGRESS_BAR (data)); /* Return true so the function will be called again; returning false removes * this timeout function. */ return TRUE; }
static gboolean task_pulse_cb (gpointer user_data) { GthTaskProgress *self = user_data; gtk_progress_bar_pulse (GTK_PROGRESS_BAR (self->fraction_progressbar)); return (self->pulse_event != 0); }
/* timer callback to pulse the progress bar */ static gboolean scan_finger_pulse_progress(gpointer data) { GtkWidget *dialog = data; GtkWidget *progressbar = g_object_get_data(G_OBJECT(dialog), "progressbar"); if (!progressbar) return FALSE; gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progressbar)); return TRUE; }
static gboolean update_progress_bar (gpointer data) { GiggleCloneDialog *dialog; dialog = GIGGLE_CLONE_DIALOG (data); gtk_progress_bar_pulse (GTK_PROGRESS_BAR (dialog->priv->progress_bar)); return TRUE; }
static void move_progress(GtkWidget *entry, gpointer progress) { gdouble step; g_return_if_fail(GTK_IS_PROGRESS_BAR(progress)); step = g_random_double_range(0.03, 0.1); gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(progress), step); gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress)); }
static void gimp_progress_bar_pulse (gpointer user_data) { GimpProgressBar *bar = GIMP_PROGRESS_BAR (user_data); gtk_progress_bar_pulse (GTK_PROGRESS_BAR (bar)); if (gtk_widget_is_drawable (GTK_WIDGET (bar))) while (gtk_events_pending ()) gtk_main_iteration (); }
static gboolean pbar_update (gpointer user_data) { GCancellable *cancellable = G_CANCELLABLE (user_data); gtk_progress_bar_pulse ((GtkProgressBar *) pbar); gtk_progress_bar_set_text ((GtkProgressBar *) pbar, txt); /* Return TRUE to reschedule the timeout. */ return !g_cancellable_is_cancelled (cancellable); }
gboolean pulse_bar(gpointer data) { gdk_threads_enter(); gtk_progress_bar_pulse (GTK_PROGRESS_BAR (data)); gdk_threads_leave(); /* Return true so the function will be called again; * returning false removes this timeout function. */ return TRUE; }
static void gimp_thumb_box_progress_pulse (GimpProgress *progress) { if (gimp_thumb_box_progress_is_active (progress)) { GimpThumbBox *box = GIMP_THUMB_BOX (progress); GtkProgressBar *bar = GTK_PROGRESS_BAR (box->progress); gtk_progress_bar_pulse (bar); } }
static void toggle_activity_mode(GtkWidget *widget, ProgressData *pdata){ pdata -> activity_mode = !pdata -> activity_mode; if(pdata -> activity_mode){ // becomes a running bar gtk_progress_bar_set_pulse_step(pdata->pbar, 0.05); gtk_progress_bar_pulse(GTK_PROGRESS_BAR(pdata->pbar)); } else // shows actual progress fraction gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pdata->pbar), 0.0); }
static void update_progress (NautilusProgressInfoWidget *self) { double progress; progress = nautilus_progress_info_get_progress (self->priv->info); if (progress < 0) { gtk_progress_bar_pulse (GTK_PROGRESS_BAR (self->priv->progress_bar)); } else { gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (self->priv->progress_bar), progress); } }
static gboolean eds_check_query (gpointer data) { PlannerPlugin *plugin = data; GtkProgressBar *progress = GTK_PROGRESS_BAR (glade_xml_get_widget (plugin->priv->glade, "progressbar")); gtk_progress_bar_pulse (progress); return TRUE; }
static gboolean on_pulse_timeout (gpointer user_data) { GtkProgressBar *progress = GTK_PROGRESS_BAR (user_data); if (gtk_progress_bar_get_pulse_step (progress) != 0) { gtk_progress_bar_pulse (progress); return TRUE; } return FALSE; }
static void update_progress (ProgressWidgetData *data) { double progress; progress = nautilus_progress_info_get_progress (data->info); if (progress < 0) { gtk_progress_bar_pulse (data->progress_bar); } else { gtk_progress_bar_set_fraction (data->progress_bar, progress); } }
/** * progress: The progress bar to pulse * * Called to pulse the progress bar when we're in pulse mode * * Returns TRUE if the bar pulsed **/ static gboolean pulse_timer (GtkProgressBar *progress) { g_assert (GTK_IS_PROGRESS_BAR (progress)); if (gtk_progress_bar_get_pulse_step (progress) != 0) { gtk_progress_bar_pulse (progress); return TRUE; } return FALSE; }
int main(int argc, char **argv) { GtkWidget *top_window, *outside_frame, *inside_frame, *progress_bar; /* Must initialize libcurl before any threads are started */ curl_global_init(CURL_GLOBAL_ALL); /* Init thread */ g_thread_init(NULL); gdk_threads_init (); gdk_threads_enter (); gtk_init(&argc, &argv); /* Base window */ top_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); /* Frame */ outside_frame = gtk_frame_new(NULL); gtk_frame_set_shadow_type(GTK_FRAME(outside_frame), GTK_SHADOW_OUT); gtk_container_add(GTK_CONTAINER(top_window), outside_frame); /* Frame */ inside_frame = gtk_frame_new(NULL); gtk_frame_set_shadow_type(GTK_FRAME(inside_frame), GTK_SHADOW_IN); gtk_container_set_border_width(GTK_CONTAINER(inside_frame), 5); gtk_container_add(GTK_CONTAINER(outside_frame), inside_frame); /* Progress bar */ progress_bar = gtk_progress_bar_new(); gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progress_bar)); /* Make uniform pulsing */ gint pulse_ref = g_timeout_add (300, pulse_bar, progress_bar); g_object_set_data(G_OBJECT(progress_bar), "pulse_id", GINT_TO_POINTER(pulse_ref)); gtk_container_add(GTK_CONTAINER(inside_frame), progress_bar); gtk_widget_show_all(top_window); printf("gtk_widget_show_all\n"); g_signal_connect(G_OBJECT (top_window), "delete-event", G_CALLBACK(cb_delete), NULL); if(!g_thread_create(&create_thread, progress_bar, FALSE, NULL) != 0) g_warning("can't create the thread"); gtk_main(); gdk_threads_leave(); printf("gdk_threads_leave\n"); return 0; }
static gboolean progress_bar_pulse_cb (ProgressBarData *data) { TotemYouTubePlugin *self = data->plugin; if (self->progress_bar_increment[data->tree_view] != 0.0) { g_slice_free (ProgressBarData, data); return FALSE; /* The first entry has been retrieved */ } gtk_progress_bar_pulse (self->progress_bar[data->tree_view]); return TRUE; }
//update progress bar static gboolean progress_timeout(gpointer data){ ProgressData *pdata = (ProgressData*)data; gdouble new_val; if (pdata -> activity_mode) gtk_progress_bar_pulse(GTK_PROGRESS_BAR(pdata->pbar)); else{ new_val = gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(pdata->pbar)) + 0.01; if(new_val > 1.0) new_val = 0.0; gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pdata->pbar), new_val); } return TRUE; }
void progress_change_cb(GtkMozEmbed *embed, gint cur, gint max, MinimoBrowser* browser) { browser->totalBytes += cur; if (max < 1) gtk_progress_bar_pulse(GTK_PROGRESS_BAR(browser->progressBar)); else { float tmp = (cur/max); if ( tmp <= 1 && tmp >=0) gtk_progress_bar_update(GTK_PROGRESS_BAR(browser->progressBar), cur/max); } }
void *linphone_gtk_wait(LinphoneCore *lc, void *ctx, LinphoneWaitingState ws, const char *purpose, float progress){ GtkWidget *w; switch(ws){ case LinphoneWaitingStart: gdk_threads_enter(); w=linphone_gtk_create_window("waiting"); gtk_window_set_transient_for(GTK_WINDOW(w),GTK_WINDOW(linphone_gtk_get_main_window())); gtk_window_set_position(GTK_WINDOW(w),GTK_WIN_POS_CENTER_ON_PARENT); if (purpose) { gtk_progress_bar_set_text( GTK_PROGRESS_BAR(linphone_gtk_get_widget(w,"progressbar")), purpose); } gtk_widget_show(w); /*g_message("Creating waiting window");*/ run_gtk(); gdk_threads_leave(); return w; break; case LinphoneWaitingProgress: w=(GtkWidget*)ctx; gdk_threads_enter(); if (progress>=0){ gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(linphone_gtk_get_widget(w,"progressbar")), progress); }else { gtk_progress_bar_pulse( GTK_PROGRESS_BAR(linphone_gtk_get_widget(w,"progressbar")) ); } /*g_message("Updating progress");*/ run_gtk(); gdk_threads_leave(); g_usleep(50000); return w; break; case LinphoneWaitingFinished: w=(GtkWidget*)ctx; gdk_threads_enter(); gtk_widget_destroy(w); run_gtk(); gdk_threads_leave(); return NULL; break; } return NULL; }
/* * Periodically animate the progress bar as long as the version checking thread * is still working. When the thread has finished, signal (using g_idle_add()) * the GUI to run the dialog that contains latest version information. */ static gboolean version_progress_update(gpointer data) { Dialogs *_dialogs = (Dialogs *)data; if (_dialogs) gtk_progress_bar_pulse(GTK_PROGRESS_BAR(_dialogs->ver_progress_bar)); if (ver_check_done) { if (_dialogs) gtk_widget_hide(_dialogs->ver_progress_window); g_idle_add(version_info_show, (gpointer)_dialogs); } return !ver_check_done; }
static gboolean pulse_it (GtkWidget *widget) { guint pulse_id; if (GTK_IS_ENTRY (widget)) gtk_entry_progress_pulse (GTK_ENTRY (widget)); else gtk_progress_bar_pulse (GTK_PROGRESS_BAR (widget)); pulse_id = g_timeout_add (pulse_time, (GSourceFunc)pulse_it, widget); g_object_set_data_full (G_OBJECT (widget), "pulse_id", GUINT_TO_POINTER (pulse_id), remove_pulse); return G_SOURCE_REMOVE; }
static void gimp_progress_bar_set_value (gdouble percentage, gpointer user_data) { GimpProgressBar *bar = GIMP_PROGRESS_BAR (user_data); if (percentage >= 0.0) gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), percentage); else gtk_progress_bar_pulse (GTK_PROGRESS_BAR (bar)); if (gtk_widget_is_drawable (GTK_WIDGET (bar))) while (gtk_events_pending ()) gtk_main_iteration (); }
void gnc_window_show_progress (const char *message, double percentage) { GncWindow *window; GtkWidget *progressbar; window = progress_bar_hack_window; if (window == NULL) return; progressbar = gnc_window_get_progressbar (window); if (progressbar == NULL) { DEBUG( "no progressbar in hack-window" ); return; } gnc_update_splash_screen(message, percentage); if (percentage < 0) { gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar), " "); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar), 0.0); if (GNC_WINDOW_GET_IFACE(window)->ui_set_sensitive != NULL) GNC_WINDOW_GET_IFACE(window)->ui_set_sensitive(window, TRUE); } else { if (message) gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar), message); if ((percentage == 0) && (GNC_WINDOW_GET_IFACE(window)->ui_set_sensitive != NULL)) GNC_WINDOW_GET_IFACE(window)->ui_set_sensitive(window, FALSE); if (percentage <= 100) { gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar), percentage / 100); } else { gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progressbar)); } } /* make sure new text is up */ while (gtk_events_pending ()) gtk_main_iteration (); }