本文整理汇总了C++中GTK_PROGRESS_BAR函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_PROGRESS_BAR函数的具体用法?C++ GTK_PROGRESS_BAR怎么用?C++ GTK_PROGRESS_BAR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_PROGRESS_BAR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: linphone_gtk_show_buddy_lookup_window
void linphone_gtk_show_buddy_lookup_window(SipSetupContext *ctx){
GtkListStore *store;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkTreeSelection *select;
GtkWidget *w=linphone_gtk_create_window("buddylookup");
GtkWidget *results=linphone_gtk_get_widget(w,"search_results");
GtkProgressBar *pb=GTK_PROGRESS_BAR(linphone_gtk_get_widget(w,"progressbar"));
store = gtk_list_store_new(LOOKUP_RESULT_NCOL, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(results),GTK_TREE_MODEL(store));
g_object_unref(G_OBJECT(store));
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Firstname, Lastname"),
renderer,
"text", LOOKUP_RESULT_NAME,
NULL);
g_object_set (G_OBJECT(column), "resizable", TRUE, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (results), column);
column = gtk_tree_view_column_new_with_attributes (_("SIP address"),
renderer,
"text", LOOKUP_RESULT_SIP_URI,
NULL);
g_object_set (G_OBJECT(column), "resizable", TRUE, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (results), column);
select = gtk_tree_view_get_selection (GTK_TREE_VIEW (results));
gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(results),LOOKUP_RESULT_ADDRESS);
g_object_set_data(G_OBJECT(w),"SipSetupContext",ctx);
g_object_weak_ref(G_OBJECT(w),(GWeakNotify)linphone_gtk_buddy_lookup_window_destroyed,w);
//g_signal_connect_swapped(G_OBJECT(w),"destroy",(GCallback)linphone_gtk_buddy_lookup_window_destroyed,w);
gtk_progress_bar_set_fraction(pb,0);
gtk_progress_bar_set_text(pb,NULL);
gtk_dialog_add_button(GTK_DIALOG(w),GTK_STOCK_CLOSE,GTK_RESPONSE_CLOSE);
g_object_set_data(G_OBJECT(w),"last_state",GINT_TO_POINTER(-1));
gtk_widget_show(w);
}
示例2: watch_thread
static gint watch_thread(gpointer data){
char msg[256];
//LOG(LOG_DEBUG, "IN : watch_thread()");
if(thread_running){
pthread_mutex_lock(&mutex);
sprintf(msg, _("%d hit"), hit_count);
if(GTK_IS_LABEL(label_match)){
gtk_label_set_text(GTK_LABEL(label_match), msg);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), search_progress);
}
pthread_mutex_unlock(&mutex);
// LOG(LOG_DEBUG, "OUT : watch_thread() : CONTINUE");
return(1);
}
gtk_timeout_remove(tag_timeout);
show_result_tree();
if(search_result == NULL)
push_message(_("No hit."));
else {
push_message("");
}
// if(ebook_search_method() != SEARCH_METHOD_GREP)
select_first_item();
gtk_grab_remove(cancel_dialog);
gtk_widget_destroy(cancel_dialog);
cancel_dialog=NULL;
label_cancel=NULL;
pthread_mutex_destroy(&mutex);
//LOG(LOG_DEBUG, "OUT : watch_thread()");
return(0);
}
示例3: replay_update_progress_bar
static void replay_update_progress_bar(int time_offset)
{
float fraction = (float)time_offset / time_span;
if (fraction > 1.0) {
log_debug("fraction=%f", fraction);
fraction = 1.0;
}
if (! direction_forward)
fraction = 1.0 - fraction;
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar), fraction);
char buf[32];
time_t tm = replay_start_time + time_offset;
struct tm *t = localtime(&tm);
int len = sprintf(buf, "%2d%% ", (int)(fraction * 100));
if (len > 0) {
strftime(&buf[len], sizeof(buf) - len, "[%b %d, %H:%M:%S]", t);
gtk_label_set_text(GTK_LABEL(desc_label), buf);
}
}
示例4: progress_bar_timeout_cb
static int progress_bar_timeout_cb (Simulation *s)
{
gchar *str;
double p;
g_return_val_if_fail (s != NULL, FALSE);
oregano_engine_get_progress (s->engine, &p);
if (p >= 1)
p = 0;
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (s->progress), p);
str = g_strdup_printf (_ ("Progress: <b>%s</b>"),
oregano_engine_get_current_operation (s->engine));
gtk_label_set_markup (s->progress_label, str);
g_free (str);
return TRUE;
}
示例5: append_progress_page
static void append_progress_page(TyonXceleratorCalibrationAssistant *assistant) {
TyonXceleratorCalibrationAssistantPrivate *priv = assistant->priv;
GtkWidget *vbox;
priv->progress_label = GTK_LABEL(gtk_label_new(NULL));
priv->progress_page = gtk_hbox_new(FALSE, 0);
priv->positional = TYON_2D_POSITIONAL(tyon_2d_positional_new());
vbox = gtk_vbox_new(FALSE, 0);
priv->progress_bar = GTK_PROGRESS_BAR(gtk_progress_bar_new());
gtk_box_pack_start(GTK_BOX(priv->progress_page), GTK_WIDGET(priv->positional), FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(priv->progress_page), vbox, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(priv->progress_label), TRUE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(priv->progress_bar), TRUE, FALSE, 0);
gtk_assistant_append_page(GTK_ASSISTANT(assistant), priv->progress_page);
gtk_assistant_set_page_title(GTK_ASSISTANT(assistant), priv->progress_page, _("Calibration"));
gtk_assistant_set_page_type(GTK_ASSISTANT(assistant), priv->progress_page, GTK_ASSISTANT_PAGE_PROGRESS);
gtk_assistant_set_page_complete(GTK_ASSISTANT(assistant), priv->progress_page, FALSE);
}
示例6: rejilla_status_dialog_init
static void
rejilla_status_dialog_init (RejillaStatusDialog *object)
{
RejillaStatusDialogPrivate *priv;
GtkWidget *main_box;
GtkWidget *box;
priv = REJILLA_STATUS_DIALOG_PRIVATE (object);
gtk_dialog_add_button (GTK_DIALOG (object),
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
box = gtk_vbox_new (FALSE, 4);
gtk_widget_show (box);
main_box = gtk_dialog_get_content_area (GTK_DIALOG (object));
gtk_box_pack_end (GTK_BOX (main_box),
box,
TRUE,
TRUE,
0);
priv->progress = gtk_progress_bar_new ();
gtk_widget_show (priv->progress);
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->progress), " ");
gtk_box_pack_start (GTK_BOX (box),
priv->progress,
TRUE,
TRUE,
0);
priv->action = gtk_label_new ("");
gtk_widget_show (priv->action);
gtk_label_set_use_markup (GTK_LABEL (priv->action), TRUE);
gtk_misc_set_alignment (GTK_MISC (priv->action), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (box),
priv->action,
FALSE,
TRUE,
0);
}
示例7: _lib_backgroundjobs_progress
static void _lib_backgroundjobs_progress(dt_lib_module_t *self, const guint *key, double progress)
{
if(!darktable.control->running) return;
gboolean i_own_lock = dt_control_gdk_lock();
dt_lib_backgroundjobs_t *d = (dt_lib_backgroundjobs_t*)self->data;
dt_bgjob_t *j = (dt_bgjob_t*)g_hash_table_lookup(d->jobs, key);
if(j)
{
if( j->type == 0 )
{
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(j->progressbar), CLAMP(progress, 0, 1.0));
#ifdef HAVE_UNITY
unity_launcher_entry_set_progress( j->darktable_launcher, CLAMP(progress, 0, 1.0));
#endif
}
}
if(i_own_lock) dt_control_gdk_unlock();
}
示例8: interface_set_playing
void interface_set_playing (PlayerState state)
{
GtkWidget *progress_area;
progress_area = interface_get_widget ("alignment_progress");
switch(state) {
case STATE_PLAY_LOCAL:
interface_set_playimage("gtk-media-pause");
gtk_widget_show (progress_area);
break;
case STATE_PLAY_STREAM:
interface_set_playimage("gtk-media-stop");
gtk_widget_hide (progress_area);
break;
case STATE_PLAY_NOTHING:
interface_set_playimage("gtk-media-play");
interface_set_songinfo ("", "");
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), 0);
break;
}
}
示例9: biblio_init
GuBiblio* biblio_init (GtkBuilder* builder) {
g_return_val_if_fail (GTK_IS_BUILDER (builder), NULL);
GuBiblio* b = g_new0 (GuBiblio, 1);
b->progressbar =
GTK_PROGRESS_BAR (gtk_builder_get_object (builder, "bibprogressbar"));
b->progressmon =
GTK_ADJUSTMENT (gtk_builder_get_object (builder, "bibprogressmon"));
b->list_biblios =
GTK_LIST_STORE (gtk_builder_get_object (builder, "list_biblios"));
b->filenm_label =
GTK_LABEL (gtk_builder_get_object (builder, "bibfilenm"));
b->refnr_label =
GTK_LABEL (gtk_builder_get_object (builder, "bibrefnr"));
b->list_filter =
GTK_ENTRY (gtk_builder_get_object (builder, "biblio_filter"));
b->biblio_treeview =
GTK_TREE_VIEW (gtk_builder_get_object (builder, "bibtreeview"));
b->progressval = 0.0;
return b;
}
示例10: _lib_backgroundjobs_progress
static void _lib_backgroundjobs_progress(dt_lib_module_t *self, const guint *key, double progress)
{
if(!darktable.control->running) return;
dt_lib_backgroundjobs_t *d = (dt_lib_backgroundjobs_t*)self->data;
gboolean i_own_lock = dt_control_gdk_lock();
dt_bgjob_t *j = (dt_bgjob_t*)g_hash_table_lookup(d->jobs, key);
if(j)
{
/* check if progress is above 1.0 and destroy bgjob if finished */
/* FIXME: actually we are having some rounding issues, where the */
/* FIXME: last item doesn't bring to total to 1.0 flat */
/* FIXME: so this is why we have the ugly kludge below */
if (progress > 0.999999)
{
if (GTK_IS_WIDGET(j->widget))
gtk_container_remove( GTK_CONTAINER(d->jobbox), j->widget );
#ifdef HAVE_UNITY
unity_launcher_entry_set_progress( j->darktable_launcher, 1.0 );
unity_launcher_entry_set_progress_visible( j->darktable_launcher, FALSE );
#endif
/* hide jobbox if theres no jobs left */
if (g_list_length(gtk_container_get_children(GTK_CONTAINER(d->jobbox))) == 0 )
gtk_widget_hide(d->jobbox);
}
else
{
if( j->type == 0 )
gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(j->progressbar), progress );
#ifdef HAVE_UNITY
unity_launcher_entry_set_progress( j->darktable_launcher, progress );
#endif
}
}
if(i_own_lock) dt_control_gdk_unlock();
}
示例11: main
int main(int argc, char *argv[]) {
GladeXML *xml;
GtkWidget *window1;
int a=1;
gtk_init(&argc, &argv);
/* load the interface */
xml = glade_xml_new("test.glade", NULL, NULL);
window1 = glade_xml_get_widget(xml, "window");
// treeview = glade_xml_get_widget(xml, "treeview");
// init_list(treeview);
GtkWidget *progress_bar = glade_xml_get_widget (xml, "progressbar1");
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progress_bar));
g_assert(progress_bar);
GtkWidget *my_button = glade_xml_get_widget (xml, butt "1");
g_signal_connect (G_OBJECT (my_button), "pressed", G_CALLBACK (button_clicked),&a);
g_assert(my_button);
gint func_ref = g_timeout_add (100, update_progress_bar, progress_bar);
gtk_widget_show (window1);
GTimer *wasted_time_tracker = g_timer_new ();
GtkWidget *widget = glade_xml_get_widget (xml, "WasteTimeWindow");
g_signal_connect (G_OBJECT (widget), "delete_event", G_CALLBACK (inform_user_of_time_wasted),wasted_time_tracker);
/* connect the signals in the interface */
glade_xml_signal_autoconnect(xml);
/* start the event loop */
gtk_main();
g_source_remove (func_ref);
return 0;
}
示例12: sync_progress_gtk
static void
sync_progress_gtk(gpointer data, LJSyncProgress progress, int cur, int max, const char *date) {
SyncStatus *status = data;
double fraction = 0.0;
StatusStage stage;
switch (progress) {
case LJ_SYNC_PROGRESS_ITEMS:
stage = STAGE_ENTRYMETA; break;
case LJ_SYNC_PROGRESS_ENTRIES:
stage = STAGE_ENTRY; break;
}
if (stage != status->stage) {
status->stage = stage;
show_status_stage(status);
}
if (max > 0) fraction = cur/(double)max;
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(status->progress),
fraction);
}
示例13: gtk_disable_setlocale
extern "C" const char *Init( int *argc, char ***argv )
{
// Need to use external library to load this image. Native loader seems broken :/
const gchar *splash_image_path = "Data/splash.png";
GtkWidget *vbox;
gtk_disable_setlocale();
if( !gtk_init_check(argc,argv) )
return "Couldn't initialize gtk (cannot open display)";
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position( GTK_WINDOW(window), GTK_WIN_POS_CENTER );
gtk_widget_set_size_request(window,468,-1);
gtk_window_set_deletable( GTK_WINDOW(window), FALSE );
gtk_window_set_resizable(GTK_WINDOW(window),FALSE);
gtk_window_set_role( GTK_WINDOW(window), "sm-startup" );
//gtk_window_set_icon( GTK_WINDOW(window), );
gtk_widget_realize(window);
splash = gtk_image_new_from_file(splash_image_path);
label = gtk_label_new(NULL);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_CENTER);
gtk_label_set_ellipsize(GTK_LABEL(label),PANGO_ELLIPSIZE_END);
gtk_label_set_line_wrap(GTK_LABEL(label),FALSE);
progressBar = gtk_progress_bar_new();
gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(progressBar), 0.0 );
vbox = gtk_vbox_new(FALSE,0);
gtk_container_add(GTK_CONTAINER(window),vbox);
gtk_box_pack_start(GTK_BOX(vbox),splash,FALSE,FALSE,0);
gtk_box_pack_end(GTK_BOX(vbox),progressBar,FALSE,FALSE,0);
gtk_box_pack_end(GTK_BOX(vbox),label,TRUE,TRUE,0);
gtk_widget_show_all(window);
gtk_main_iteration_do(FALSE);
return NULL;
}
示例14: progress_timer
gboolean progress_timer(gpointer data)
{
//TOFIX optimize, show only if hidden, hide only if visible
if(g_bMsgBox){
//hide progress dialog while waiting soem message box to finish
gtk_widget_hide(g_wndProgressDlg);
}
else
{
//ensure progress dialog is visible and pulse the progress
if(g_wndProgressDlg) gtk_widget_show(g_wndProgressDlg);
if(g_progress1){
if(ProgressDlg::m_nTotalSize > 0) //TOFIX what if two loads at te same time ? not static!??
{
gtk_progress_set_percentage(GTK_PROGRESS(g_progress1), ((double)ProgressDlg::m_nCurrentSize)/ProgressDlg::m_nTotalSize);
}
else
gtk_progress_bar_pulse(GTK_PROGRESS_BAR(g_progress1));
}
}
return TRUE;
}
示例15: qtcAnimationUpdateInfo
/* update the animation information for each widget. This will also queue a redraw
* and stop the animation if it is done. */
static gboolean
qtcAnimationUpdateInfo(gpointer key, gpointer value, gpointer user_data)
{
QTC_UNUSED(user_data);
AnimationInfo *animation_info = value;
GtkWidget *widget = key;
if ((widget == NULL) || (animation_info == NULL))
g_assert_not_reached();
/* remove the widget from the hash table if it is not drawable */
if (!gtk_widget_is_drawable(widget))
return TRUE;
if (GTK_IS_PROGRESS_BAR(widget)) {
gfloat fraction =
gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(widget));
/* stop animation for filled/not filled progress bars */
if (fraction <= 0.0 || fraction >= 1.0) {
return TRUE;
}
} else if (GTK_IS_ENTRY(widget)) {
gfloat fraction = gtk_entry_get_progress_fraction(GTK_ENTRY(widget));
/* stop animation for filled/not filled progress bars */
if(fraction <= 0.0 || fraction >= 1.0) {
return TRUE;
}
}
force_widget_redraw(widget);
/* stop at stop_time */
if(animation_info->stop_time != 0 &&
g_timer_elapsed(animation_info->timer, NULL) > animation_info->stop_time)
return TRUE;
return FALSE;
}