Пример #1
0
void statusbar_progress_all (gint done, gint total, gint step) 
{
	GtkProgressBar *progressbar = GTK_PROGRESS_BAR(
					mainwindow_get_mainwindow()->progressbar);
	gchar buf[32];
	
	if (total && done % step == 0) {
#ifdef GENERIC_UMPC
		/* use a more compact format */
		const gchar *format = "%d/%d";
#else
		const gchar *format = "%d / %d";
#endif
		g_snprintf(buf, sizeof(buf), format, done, total);
		gtk_progress_bar_set_text(progressbar, buf);
		gtk_progress_bar_set_fraction(progressbar,
			 (gfloat)done / (gfloat)total);
		if (!gtk_widget_get_visible(GTK_WIDGET(progressbar)))
			gtk_widget_show(GTK_WIDGET(progressbar));
	} else if (total == 0) {
		gtk_progress_bar_set_text(progressbar, "");
		gtk_progress_bar_set_fraction(progressbar, 0.0);
		gtk_widget_hide(GTK_WIDGET(progressbar));
	}
}
Пример #2
0
static void
update_sensitivity (GutachterWidget* self)
{
  GtkProgressBar* progress = GTK_PROGRESS_BAR (PRIV (self)->progress);

  gtk_widget_set_sensitive (PRIV (self)->notebook,
                            PRIV (self)->suite != NULL);

  if (PRIV (self)->suite)
    {
      if (gutachter_suite_get_status (PRIV (self)->suite) == GUTACHTER_SUITE_INDETERMINED)
        {
          gtk_progress_bar_set_fraction (progress, 0.0);
        }
      else
        {
          gtk_progress_bar_pulse (progress);
          gtk_progress_bar_set_text (progress, _("Loading Test Paths..."));
        }
    }
  else
    {
      gtk_progress_bar_set_fraction (progress, 0.0);
      gtk_progress_bar_set_text (progress, _("no test selected"));
    }
}
Пример #3
0
static void
gxi_update_progress_bar (const gchar *message, double percentage)
{
    if (!progress_window)
    {
        progress_window = gtk_window_new (GTK_WINDOW_POPUP);
        progress_bar = GTK_PROGRESS_BAR (gtk_progress_bar_new ());
        gtk_container_set_border_width (GTK_CONTAINER (progress_window), 12);
        gtk_container_add (GTK_CONTAINER (progress_window),
                           GTK_WIDGET (progress_bar));
        gtk_widget_show (GTK_WIDGET (progress_bar));
    }

    if (percentage < 0)
    {
        gtk_progress_bar_set_text (progress_bar, NULL);
        gtk_progress_bar_set_fraction (progress_bar, 0.0);
        gtk_widget_hide (progress_window);
    }
    else
    {
        gtk_progress_bar_set_text (progress_bar, message);
        if (percentage <= 100)
            gtk_progress_bar_set_fraction (progress_bar, percentage / 100);
        else
            gtk_progress_bar_pulse (progress_bar);
        gtk_widget_show (progress_window);
    }
}
Пример #4
0
static gboolean
gimmix_timer (void)
{
	gchar 	time[15];
	int 	new_status;
	float 	fraction;
	
	mpd_status_update (gmo);
	new_status = mpd_player_get_state (gmo);
	if (status == new_status)
	{
		if (status == MPD_PLAYER_PLAY || status == MPD_PLAYER_PAUSE)
		{
			gimmix_get_progress_status (gmo, &fraction, time);
			gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), fraction);
			gtk_progress_bar_set_text (GTK_PROGRESS_BAR(progress), time);
			
			/* Update the system tray tooltip progress bar */
			if (strncasecmp(cfg_get_key_value(conf, "enable_systray"), "true", 4) == 0)
				if (strncasecmp(cfg_get_key_value(conf, "enable_notification"), "true", 4) == 0)
				{
					gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(tooltip->progressbar), fraction);
					gtk_progress_bar_set_text (GTK_PROGRESS_BAR(tooltip->progressbar), time);
				}
		}
		return TRUE;
	}
	else
	{
		status = new_status;
		return TRUE;
	}
}
Пример #5
0
void
ghb_live_encode_done(signal_user_data_t *ud, gboolean success)
{
    GtkWidget *widget;
    GtkWidget *prog;

    ud->preview->live_id = -1;
    prog = GHB_WIDGET(ud->builder, "live_encode_progress");
    if (success &&
        ud->preview->encode_frame == ud->preview->frame)
    {
        gtk_progress_bar_set_text(GTK_PROGRESS_BAR(prog), "Done");
        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(prog), 1);
        ud->preview->encoded[ud->preview->encode_frame] = TRUE;
#if defined(_ENABLE_GST)
        live_preview_start(ud);
#endif
        widget = GHB_WIDGET(ud->builder, "live_progress_box");
        gtk_widget_hide (widget);
        widget = GHB_WIDGET(ud->builder, "live_preview_progress");
        gtk_widget_show (widget);
    }
    else
    {
        gtk_progress_bar_set_text(GTK_PROGRESS_BAR(prog), "");
        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(prog), 0);
        ud->preview->encoded[ud->preview->encode_frame] = FALSE;
    }
}
Пример #6
0
/*--------------------------------------------------------------------------*/
static void
update_progress_bar (GtkProgressBar *bar,
		     gint            bytes,
		     gint            total)
{
	gchar *string;

	if ( total > 0 ) {

		string = g_strdup_printf ("%.0f%% (%d Bytes of %d Bytes)",
					  100.0*((gdouble)bytes/(gdouble)total),
					  bytes,
					  total);

		gtk_progress_bar_set_text (bar, string);
		gtk_progress_bar_set_fraction (bar, (gdouble)bytes/(gdouble)total);

		g_free (string);

	} else {

		gtk_progress_bar_set_text (bar, "");
		gtk_progress_bar_set_fraction (bar, 0.0);

	}
}
Пример #7
0
static void
gimmix_status_changed (MpdObj *mo, ChangedStatusType id)
{
	if (id&MPD_CST_SONGID)
	{	
		gimmix_set_song_info ();
		gimmix_update_current_playlist ();
	}

	if (id&MPD_CST_STATE)
	{
		int state = mpd_player_get_state (gmo);
		if (state == MPD_PLAYER_PLAY)
		{
			gtk_image_set_from_stock (GTK_IMAGE(image_play), "gtk-media-pause", GTK_ICON_SIZE_BUTTON);
			gtk_tooltips_set_tip (play_button_tooltip, play_button, _("Pause <x or c>"), NULL);
			gimmix_set_song_info ();
		}
		if (state == MPD_PLAYER_PAUSE)
		{
			gtk_image_set_from_stock (GTK_IMAGE(image_play), "gtk-media-play", GTK_ICON_SIZE_BUTTON);
			gtk_tooltips_set_tip (play_button_tooltip, play_button, _("Play <x or c>"), NULL);
		}
		if (state == MPD_PLAYER_STOP)
		{
			gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.0);
			gtk_progress_bar_set_text (GTK_PROGRESS_BAR(progress), _("Stopped"));
			if (strncasecmp(cfg_get_key_value(conf, "enable_systray"), "true", 4) == 0)
			{
				gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(tooltip->progressbar), 0.0);
				gtk_progress_bar_set_text (GTK_PROGRESS_BAR(tooltip->progressbar), _("Stopped"));
			}
			gimmix_show_ver_info ();
			
			gtk_image_set_from_stock (GTK_IMAGE(image_play), "gtk-media-play", GTK_ICON_SIZE_BUTTON);
			gtk_tooltips_set_tip (play_button_tooltip, play_button, _("Play <x or c>"), NULL);
		}
		g_object_ref_sink (play_button_tooltip);
		gimmix_update_current_playlist ();
	}
	
	if (id&MPD_CST_PLAYLIST)
		gimmix_update_current_playlist ();

	if (id&MPD_CST_VOLUME)
		gimmix_update_volume ();

	if (id&MPD_CST_RANDOM)
		gimmix_update_shuffle ();

	if (id&MPD_CST_REPEAT)
		gimmix_update_repeat ();

	return;
}
Пример #8
0
static gboolean
watch_extract_thread (gpointer user_data)
{
	ExtractProgress ep;

	g_static_mutex_lock (&extractProgressM);
	memcpy (&ep, &extractProgress, sizeof (ExtractProgress));
	g_static_mutex_unlock (&extractProgressM);

	if (ep.status != lastKnownProgress.status) {
		switch (ep.status) {
		case STATUS_INIT:
			break;
		case STATUS_MKDIR:
			gtk_progress_bar_set_text (GTK_PROGRESS_BAR (W(progress)),
				_("Creating folders..."));
			break;
		case STATUS_EXTRACT:
			gtk_progress_bar_set_text (GTK_PROGRESS_BAR (W(progress)),
				_("0%"));
			break;
		case STATUS_DONE:
			break;
		default:
			break;
		};
	}

	if (ep.current != lastKnownProgress.current || ep.max != lastKnownProgress.max) {
		if (ep.max == 0)
			gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (W(progress)), 0.0);
		else
			gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (W(progress)),
				(gdouble) ep.current / (gdouble) ep.max);

		if (ep.status == STATUS_EXTRACT && ep.file) {
			char *tmp, *basename;

			basename = g_path_get_basename (ep.file);
			tmp = str_to_utf8 (basename, NULL);
			g_free (basename);
			basename = g_strdup_printf ("%.1f%%: %s",
				((gdouble) ep.current / (gdouble) ep.max) * 100, tmp);
			g_free (tmp);

			gtk_progress_bar_set_text (GTK_PROGRESS_BAR (W(progress)),
				basename);
			g_free (basename);
		}
	}

	memcpy (&lastKnownProgress, &ep, sizeof (ExtractProgress));
	return TRUE;
}
Пример #9
0
static void toggle_show_text(GtkWidget *widget, ProgressData *pdata){
    const gchar *text;

    text = gtk_progress_bar_get_text(GTK_PROGRESS_BAR(pdata->pbar));
    if(text && *text){
        gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pdata->pbar), "");
    }
    else{
        gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pdata->pbar), "some text");
    }
}
Пример #10
0
void SetProgressBar(double percent){
	gtk_widget_show(progress);
	if ((int)(percent*100) >= 0){
		char text[20];
		sprintf(text,"%d%%",(int)(percent*100));
		gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress),percent);
		gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress), text);
		if (percent == 1){
			gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress), "Download Complete");
		}
	}
}
Пример #11
0
static void progress_update_stop (APProgressBar *progress_bar) {
  if (progress_bar->timeout) {
    purple_timeout_remove (progress_bar->timeout);
    progress_bar->timeout = 0;
  }
  gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress_bar->bar), 1.0);
  if (progress_bar->type == AP_UPDATE_PROFILE) {
  gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progress_bar->bar), 
                  _("waiting for new profile content"));
  } else if (progress_bar->type == AP_UPDATE_STATUS) {
  gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progress_bar->bar), 
                  _("waiting for new status content"));
  }
}
Пример #12
0
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 ();
}
Пример #13
0
gboolean
download_songs_cb_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) {

        gchar *file;
        gchar temp[MAXLEN];
        int * n = (int *)data;

        if (abort_pressed) {
                return 0;
        }

        gtk_tree_model_get (model, iter, COLUMN_NAME, &file, -1);

        if (strncmp(file, PARENTDIR, 2)) {
                strncpy(remote_item, remote_path, MAXLEN-1);
                if (strlen(remote_path) != 1) {
                        strncat(remote_item, "\\", MAXLEN-1);
                }
                strncat(remote_item, file, MAXLEN-1);

                strncpy(dest_file, dest_dir, MAXLEN-1);
                strncat(dest_file, "/", MAXLEN-1);
                strncat(dest_file, file, MAXLEN-1);

                gtk_entry_set_text(GTK_ENTRY(aifp_file_entry), file);
                gtk_editable_set_position(GTK_EDITABLE(aifp_file_entry), -1);

                gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar_op),
                                              (float)(*n + 1) / number_of_songs);

                if (ifp_is_file (&ifpdev, remote_item) == TRUE) {
                        sprintf(temp, _("%d / %d files"), *n + 1, number_of_songs);
                        gtk_progress_bar_set_text(GTK_PROGRESS_BAR (progressbar_op), temp);
                        ifp_download_file (&ifpdev, remote_item, dest_file, update_progress, NULL);
                } else {
                        sprintf(temp, _("%d / %d directories"), *n + 1, number_of_songs);
                        gtk_progress_bar_set_text(GTK_PROGRESS_BAR (progressbar_op), temp);
                        ifp_download_dir (&ifpdev, remote_item, dest_file, update_progress, NULL);
                }

                aifp_update_info();
                g_free(file);

                (*n)++;
        }

        return TRUE;
}
Пример #14
0
static void on_percent(FmFileOpsJob* job, guint percent, FmProgressDisplay* data)
{
    if(data->dlg)
    {
        char percent_text[64];
        g_snprintf(percent_text, 64, "%d %%", percent);
        gtk_progress_bar_set_fraction(data->progress, (gdouble)percent/100);
        gtk_progress_bar_set_text(data->progress, percent_text);

        gdouble elapsed = g_timer_elapsed(data->timer, NULL);
        if(elapsed >= 0.5)
        {
            gdouble remaining = elapsed * (100 - percent) / percent;
            if(data->remaining_time)
            {
                char time_str[32];
                guint secs = (guint)remaining;
                guint mins = 0;
                guint hrs = 0;
                if(secs > 60)
                {
                    mins = secs / 60;
                    secs %= 60;
                    if(mins > 60)
                    {
                        hrs = mins / 60;
                        mins %= 60;
                    }
                }
                g_snprintf(time_str, 32, "%02d:%02d:%02d", hrs, mins, secs);
                gtk_label_set_text(data->remaining_time, time_str);
            }
        }
    }
}
Пример #15
0
void
aifp_update_info(void) {

        gchar temp[MAXLEN], tmp[MAXLEN];
        gfloat space;

        if (transfer_mode == UPLOAD_MODE) {
                sprintf(temp, "%d", number_of_songs);
                sprintf(tmp, _(" (%.1f MB)"), (float)songs_size / (1024*1024));
                strncat (temp, tmp, MAXLEN-1);
                gtk_label_set_text(GTK_LABEL(label_songs), temp);
        }

        battery_status = ifp_battery(&ifpdev);
        gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar_battery), battery_status / 4.0);

        ifp_model(&ifpdev, temp, sizeof(temp));
        capacity = ifp_capacity(&ifpdev);
        sprintf(tmp, _(" (capacity = %.1f MB)"), (float)capacity / (1024*1024));
        strncat (temp, tmp, MAXLEN-1);
        gtk_label_set_text(GTK_LABEL(label_model), temp);

        freespace = ifp_freespace(&ifpdev);
        sprintf(temp, _(" Free space (%.1f MB)"), (float)freespace / (1024*1024));

        space = (float)freespace/capacity;

        gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progressbar_freespace), temp);
        gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar_freespace), space);
}
Пример #16
0
/* ---------------------------------
 * p_doProgress
 * ---------------------------------
 */
static void
p_doProgress(GapMorphShapeContext *msctx)
{
  guchar *progressText;
  gdouble percentage;

  if(msctx->doProgress != TRUE)
  {
    return;
  }
  percentage = (gdouble)msctx->countGeneratedPoints / MAX(1.0, (gdouble)msctx->numShapePoints);
  
  progressText = g_strdup_printf(_("generating workpoint:%d (%d)")
                     , (int)msctx->countGeneratedPoints
                     , (int)msctx->numShapePoints
                     );
  gtk_progress_bar_set_text(GTK_PROGRESS_BAR(msctx->progressBar), progressText);
  gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(msctx->progressBar), percentage);
  g_free(progressText);

  while (gtk_events_pending ())
  {
    gtk_main_iteration ();
  }
}  /* end p_doProgress */
Пример #17
0
/* -----------------------------------------------
 * p_do_master_progress
 * -----------------------------------------------
 */
static void
p_do_master_progress(GtkWidget *progressBar
   , const char *workpointFileName,  gdouble framesToProcess, gdouble frameNr)
{
  if(progressBar != NULL)
  {
    char *msg;
    gdouble percentage;
    
    percentage = frameNr / MAX(1.0, framesToProcess);
    msg = gap_base_shorten_filename(NULL       /* prefix */
                        ,workpointFileName     /* filenamepart */
                        ,NULL                  /* suffix */
                        ,130                   /* l_max_chars */
                        );
    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressBar), msg);
    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressBar), percentage);
    g_free(msg);

    while (gtk_events_pending ())
    {
      gtk_main_iteration ();
    }
  }
}
Пример #18
0
static void
stlink_gui_open_file (STlinkGUI *gui)
{
	GtkWidget    *dialog;
	GtkListStore *store;
	GtkTreeIter   iter;

	dialog = gtk_file_chooser_dialog_new ("Open file",
	                                      gui->window,
	                                      GTK_FILE_CHOOSER_ACTION_OPEN,
	                                      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
	                                      GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
	                                      NULL);

	if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
		gui->filename =
			gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));

		store = GTK_LIST_STORE (gtk_tree_view_get_model (gui->filemem_treeview));
		if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) {
			gtk_list_store_clear (store);
		}

		stlink_gui_set_sensitivity (gui, FALSE);
		gtk_notebook_set_current_page (gui->notebook, PAGE_FILEMEM);
		gtk_widget_show (GTK_WIDGET (gui->progress.bar));
		gtk_progress_bar_set_text (gui->progress.bar, "Reading file");
		g_thread_new ("file", (GThreadFunc) stlink_gui_populate_filemem_view, gui);
	}
	gtk_widget_destroy (dialog);
}
Пример #19
0
G_MODULE_EXPORT void progress_update(gfloat fraction)
{
	static gint last = 0.0;
	static GtkWidget *pbar = NULL;
	gchar * tmpbuf = NULL;
	gint value = 0;

	if (!pbar)
		pbar = GTK_WIDGET(gtk_builder_get_object((GtkBuilder *)DATA_GET(global_data,"builder"), "progressbar"));
	g_return_if_fail(pbar);

	fraction = fraction > 1.0 ? 1.0:fraction;
	fraction = fraction < 0.0 ? 0.0:fraction;
	value = (gint)(fraction*100.0);
	if (value != last)
	{
		tmpbuf = g_strdup_printf("%i%% complete",value);
		gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pbar),tmpbuf);
		g_free(tmpbuf);
		gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pbar),fraction);
	}
	last = value;
	while (gtk_events_pending())
		gtk_main_iteration();
}
Пример #20
0
/* Fill up the progress bar, 10% every second when the button is clicked. Then,
 * set the page as complete when the progress bar is filled. */
static void 
button_clicked (GtkButton *button, 
                GtkAssistant *assistant)
{
  GtkProgressBar *progress;
  GtkWidget *page;
  gdouble percent = 0.0;
  
  gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
  page = gtk_assistant_get_nth_page (assistant, 3);
  progress = GTK_PROGRESS_BAR (g_object_get_data (G_OBJECT (page), "pbar"));
  
  while (percent <= 100.0)
  {
    gchar *message = g_strdup_printf ("%.0f%% Complete", percent);
    gtk_progress_bar_set_fraction (progress, percent / 100.0);
    gtk_progress_bar_set_text (progress, message);
    
    while (gtk_events_pending ())
      gtk_main_iteration ();
    
    g_usleep (500000);
    percent += 5.0;        
  }
  
  gtk_assistant_set_page_complete (assistant, page, TRUE);
}
Пример #21
0
/**
 * gwy_app_wait_set_fraction:
 * @fraction: The progress of the operation, as a number from 0 to 1.
 *
 * Sets the amount of progress the progress bar on the dialog displays.
 *
 * Returns: %TRUE if the operation can continue, %FALSE if user cancelled it
 *          meanwhile.
 **/
gboolean
gwy_app_wait_set_fraction(gdouble fraction)
{
    gchar buf[8];

    if (silent_waiting)
        return TRUE;

    while (gtk_events_pending())
        gtk_main_iteration();
    if (canceled)
        return FALSE;

    g_return_val_if_fail(dialog, FALSE);
    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), fraction);
    if (fraction < 0.0 || fraction > 1.0) {
        g_warning("Fraction outside [0, 1] range");
        fraction = CLAMP(fraction, 0.0, 1.0);
    }
    g_snprintf(buf, sizeof(buf), "%d %%", (gint)(100*fraction + 0.4));
    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress), buf);

    while (gtk_events_pending())
        gtk_main_iteration();

    return !canceled;
}
Пример #22
0
void ease_dialog_progress_set_label (EaseDialogProgress* self, const char* str) {
#line 114 "ease-dialog-progress.vala"
	g_return_if_fail (self != NULL);
#line 116 "ease-dialog-progress.vala"
	gtk_progress_bar_set_text (self->priv->progress, str);
#line 270 "ease-dialog-progress.c"
}
Пример #23
0
static void 
fill_activated (GtkMenuItem *item, 
                GtkProgressBar *progress)
{
  gtk_progress_bar_set_fraction (progress, 1.0);
  gtk_progress_bar_set_text (progress, "One Hundred Percent");
}
Пример #24
0
GtkWidget *widget_progressbar_create(
	AttributeSet *Attr, tag_attr *attr, gint Type)
{
	GList            *element;
	GtkWidget        *widget;
	gchar            *text;

#ifdef DEBUG_TRANSITS
	fprintf(stderr, "%s(): Entering.\n", __func__);
#endif

	/* Thunor: This is all original code moved across when refactoring */
	widget = gtk_progress_bar_new();

	/* Thunor: This is all original code moved across when refactoring */
	if (attributeset_is_avail(Attr, ATTR_LABEL)) {
		text = attributeset_get_first(&element, Attr, ATTR_LABEL);
		gtk_progress_bar_set_text(GTK_PROGRESS_BAR(widget), text);
	}

#ifdef DEBUG_TRANSITS
	fprintf(stderr, "%s(): Exiting.\n", __func__);
#endif

	return widget;
}
Пример #25
0
gboolean
vol_update_progress(gpointer data) {

	volume_t * vol = (volume_t *)data;

	if (vol->slot) {

		float fraction = 0.0f;
		char str_progress[10];

		AQUALUNG_MUTEX_LOCK(vol->thread_mutex);
		if (vol->n_chunks != 0) {
			fraction = (float)vol->chunks_read / vol->n_chunks;
		}
		AQUALUNG_MUTEX_UNLOCK(vol->thread_mutex);

		if (fraction < 0 || fraction > 1.0f) {
			fraction = 0.0f;
		}

		gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(vol->progress), fraction);
		snprintf(str_progress, 10, "%.0f%%", fraction * 100.0f);
		gtk_progress_bar_set_text(GTK_PROGRESS_BAR(vol->progress), str_progress);
	}

	return TRUE;
}
Пример #26
0
static gboolean
update_stage(gpointer data)
{
    StageUpdate* update = (StageUpdate*) data;

    gdk_threads_enter();

    gtk_progress_bar_set_text(update->dialog->progress, update->info);

    if (update->ratio >= 0.0)
    {
        gtk_progress_bar_set_fraction(update->dialog->progress, update->ratio);
    }
    else
    {
        gtk_progress_bar_pulse(update->dialog->progress);
    }

    gdk_threads_leave();

    g_free(update->info);
    g_free(update);

    return FALSE;
}
Пример #27
0
static void 
clear_activated (GtkMenuItem *item, 
                 GtkProgressBar *progress)
{
  gtk_progress_bar_set_fraction (progress, 0.0);
  gtk_progress_bar_set_text (progress, "Reset to Zero");
}
Пример #28
0
void layer_new_mouse(void)
{
	// Local variables
	GdkCursor			*selection_cursor;			// Holds the new temporary selection cursor


	// If no project is loaded then don't run this function
	if (NULL == get_current_slide())
	{
		// Make a beep, then return
		gdk_beep();
		return;
	}

	// Change the focus of the window to be this widget
	set_delete_focus(FOCUS_LAYER);

	// Change the cursor to something suitable
	selection_cursor = gdk_cursor_new(GDK_CROSSHAIR);
	gdk_window_set_cursor(get_main_drawing_area()->window, selection_cursor);
	gdk_cursor_unref(selection_cursor);

	// Set a toggle so the release button callback will know to do the rest
	set_new_layer_selected(TYPE_MOUSE_CURSOR);

	// Update the status bar
	gtk_progress_bar_set_text(GTK_PROGRESS_BAR(get_status_bar()), _(" Please click the insertion point"));
	gdk_flush();
}
Пример #29
0
/* event handler for page 4, most important part of this program, a new guy: progressbar comes */
static void button_clicked( GtkButton *button, GtkAssistant *assistant ) {
  /* 
   * Fill up the progress bar, 10% every second when the button is clicked.
   * Then set the page as complete when the progress bar is filled
   */
  /* first, deactive the button */
  gtk_widget_set_sensitive( GTK_WIDGET( button ), FALSE );
  GtkWidget *current_page = gtk_assistant_get_nth_page( assistant, 3 );
  GtkProgressBar *progressbar = GTK_PROGRESS_BAR( g_object_get_data( G_OBJECT(current_page), "pbar" ) );

  gdouble percent = 0.f;
  while ( percent <= 100.f ) {
    gchar *msg = g_strdup_printf( "%.0f%% Complete", percent );
    gtk_progress_bar_set_fraction( progressbar, percent / 100.f );
    gtk_progress_bar_set_text( progressbar, msg );

    while ( gtk_events_pending() ) {
      gtk_main_iteration();
    }

    g_usleep( 500000 );
    percent += 5.f;
  }

  gtk_assistant_set_page_complete( assistant, current_page, TRUE );
}
Пример #30
0
void sal_gui_progress_set(vm_t *vm)
{
    obj_t *box = (obj_t *)sal_stack_pop(vm->stack); /* progress bar widget */
    obj_t *obj = (obj_t *)sal_stack_pop(vm->stack); /* value */

    switch(obj->type) {
    case OBJECT_STRING: /* text */
        gtk_progress_bar_set_text(
            GTK_PROGRESS_BAR(box->data),
            string_get_value(obj));
        break;
    case OBJECT_FLOAT: { /* 0 - 1 */
        float val = float_get_value(obj);
        if (val<0) val = 0;
        if (val>1) val = 1;
        gtk_progress_bar_set_fraction(
            GTK_PROGRESS_BAR(box->data),
            (gdouble)val);
    }
    break;
    case OBJECT_INTEGER: { /* 0 - 100 */
        int val = integer_get_value(obj);
        if (val<0) val = 0;
        if (val>100) val = 100;
        gtk_progress_bar_set_fraction(
            GTK_PROGRESS_BAR(box->data),
            (gdouble)0.01*val);
    }
    break;
    default:
        fprintf(stderr, "Don't know how to handle this obj (%d).\n", obj->type);
    }
}