void update_status_bar_text(TestGtkBrowser *browser) { gchar message[256]; gtk_statusbar_pop(GTK_STATUSBAR(browser->statusBar), 1); if (browser->tempMessage) gtk_statusbar_push(GTK_STATUSBAR(browser->statusBar), 1, browser->tempMessage); else { if (browser->loadPercent) { g_snprintf(message, 255, "%s (%d%% complete, %d bytes of %d loaded)", browser->statusMessage, browser->loadPercent, browser->bytesLoaded, browser->maxBytesLoaded); } else if (browser->bytesLoaded) { g_snprintf(message, 255, "%s (%d bytes loaded)", browser->statusMessage, browser->bytesLoaded); } else if (browser->statusMessage == NULL) { g_snprintf(message, 255, " "); } else { g_snprintf(message, 255, "%s", browser->statusMessage); } gtk_statusbar_push(GTK_STATUSBAR(browser->statusBar), 1, message); } }
static gboolean remmina_main_selection_func(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer user_data) { RemminaMain *remminamain; guint context_id; GtkTreeIter iter; gchar buf[1000]; remminamain = (RemminaMain*) user_data; if (path_currently_selected) return TRUE; if (!gtk_tree_model_get_iter(model, &iter, path)) return TRUE; remmina_main_clear_selection_data(remminamain); gtk_tree_model_get(model, &iter, NAME_COLUMN, &remminamain->priv->selected_name, FILENAME_COLUMN, &remminamain->priv->selected_filename, -1); context_id = gtk_statusbar_get_context_id(GTK_STATUSBAR(remminamain->priv->statusbar), "status"); gtk_statusbar_pop(GTK_STATUSBAR(remminamain->priv->statusbar), context_id); if (remminamain->priv->selected_filename) { gtk_action_group_set_sensitive(remminamain->priv->file_sensitive_group, TRUE); g_snprintf(buf, sizeof(buf), "%s (%s)", remminamain->priv->selected_name, remminamain->priv->selected_filename); gtk_statusbar_push(GTK_STATUSBAR(remminamain->priv->statusbar), context_id, buf); } else { gtk_statusbar_push(GTK_STATUSBAR(remminamain->priv->statusbar), context_id, remminamain->priv->selected_name); } return TRUE; }
void on_page_switch (GtkNotebook * notebook, gpointer page, guint page_num, gpointer data) { Netinfo *netinfo; char *title; netinfo = get_netinfo_for_page (notebook, page_num); if (!netinfo) return; if (netinfo->running) { netinfo_progress_indicator_start (netinfo); if (netinfo->stbar_text) { gtk_statusbar_pop (GTK_STATUSBAR (netinfo->status_bar), 0); gtk_statusbar_push (GTK_STATUSBAR (netinfo->status_bar), 0, netinfo->stbar_text); } } else { netinfo_progress_indicator_stop (netinfo); gtk_statusbar_pop (GTK_STATUSBAR (netinfo->status_bar), 0); gtk_statusbar_push (GTK_STATUSBAR (netinfo->status_bar), 0, _("Idle")); } /* Dear Translator: This is the Window Title. 'Network Tools' is the * name of the application */ title = g_strdup_printf (_("%s - Network Tools"), gtk_label_get_text (GTK_LABEL (netinfo->page_label))); gtk_window_set_title (GTK_WINDOW (netinfo->main_window), title); g_free (title); }
G_MODULE_EXPORT void statusbar_remove_all (GtkStatusbar *s) { gtk_statusbar_push (s, 0, "One"); gtk_statusbar_push (s, 0, "Two"); gtk_statusbar_remove_all (s, 0); }
void update_account_list_status_bar(account_t *account) { if (!account || !account_list_status_bar) return; /* Update status bar about current registration state */ gtk_statusbar_pop(GTK_STATUSBAR(account_list_status_bar), CONTEXT_ID_REGISTRATION); const gchar *state_name = account_state_name(account->state); if (account->protocol_state_description != NULL && account->protocol_state_code != 0) { gchar * response = g_strdup_printf(_("Server returned \"%s\" (%d)"), account->protocol_state_description, account->protocol_state_code); gchar * message = g_strconcat(state_name, ". ", response, NULL); gtk_statusbar_push(GTK_STATUSBAR(account_list_status_bar), CONTEXT_ID_REGISTRATION, message); g_free(response); g_free(message); } else { gtk_statusbar_push(GTK_STATUSBAR(account_list_status_bar), CONTEXT_ID_REGISTRATION, state_name); } GtkTreeModel *model = GTK_TREE_MODEL(account_store); GtkTreeIter iter; if (find_account_in_account_store(account->accountID, model, &iter)) gtk_list_store_set(account_store, &iter, COLUMN_ACCOUNT_STATUS, state_name, -1); }
/* * Send a message to the status bar * - with_timer: if TRUE, the message will be displayed during 4s * if FALSE, the message will be displayed up to the next posted message */ void et_status_bar_message (EtStatusBar *self, const gchar *message, gboolean with_timer) { EtStatusBarPrivate *priv; gchar *msg_temp; g_return_if_fail (ET_STATUS_BAR (self)); priv = et_status_bar_get_instance_private (self); msg_temp = Try_To_Validate_Utf8_String (message); /* Push the given message */ if (with_timer) { et_status_bar_start_timer (self); gtk_statusbar_push (GTK_STATUSBAR (self), priv->timer_context, msg_temp); } else { gtk_statusbar_pop (GTK_STATUSBAR (self), priv->message_context); gtk_statusbar_push (GTK_STATUSBAR (self), priv->message_context, msg_temp); } g_free (msg_temp); }
void show_account_list_config_dialog(SFLPhoneClient *client) { account_list_dialog = GTK_DIALOG(gtk_dialog_new_with_buttons(_("Accounts"), GTK_WINDOW(client->win), GTK_DIALOG_DESTROY_WITH_PARENT, NULL, NULL)); /* Set window properties */ gtk_container_set_border_width(GTK_CONTAINER(account_list_dialog), 0); gtk_window_set_resizable(GTK_WINDOW(account_list_dialog), FALSE); GtkWidget *accountFrame = gnome_main_section_new(_("Configured Accounts")); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(account_list_dialog)), accountFrame, TRUE, TRUE, 0); gtk_widget_show(accountFrame); g_signal_connect(G_OBJECT(account_list_dialog), "destroy", G_CALLBACK(dialog_destroy_cb), NULL); /* Accounts tab */ GtkWidget *tab = create_account_list(client); gtk_widget_show(tab); gtk_container_add(GTK_CONTAINER(accountFrame), tab); /* Status bar for the account list */ account_list_status_bar = gtk_statusbar_new(); gtk_widget_show(account_list_status_bar); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(account_list_dialog)), account_list_status_bar, TRUE, TRUE, 0); const gint num_accounts = account_list_get_registered_accounts(); if (num_accounts) { gchar * message = g_strdup_printf(n_("There is %d active account", "There are %d active accounts", num_accounts), num_accounts); gtk_statusbar_push(GTK_STATUSBAR(account_list_status_bar), CONTEXT_ID_REGISTRATION, message); g_free(message); } else { gtk_statusbar_push(GTK_STATUSBAR(account_list_status_bar), CONTEXT_ID_REGISTRATION, _("You have no active accounts")); } gtk_dialog_run(account_list_dialog); status_bar_display_account(); gtk_widget_destroy(GTK_WIDGET(account_list_dialog)); /* Invalidate static pointers */ account_list_dialog = NULL; account_list_status_bar = NULL; edit_button = NULL; delete_button = NULL; move_down_button = NULL; move_up_button = NULL; account_store = NULL; update_actions(client); }
/* Widget behaviour */ void netinfo_toggle_state (Netinfo * netinfo, gboolean state, gpointer user_data) { GdkCursor *cursor; PangoFontDescription *font_desc; g_assert (netinfo != NULL); g_return_if_fail (netinfo != NULL); if (! netinfo->toggle) { netinfo->running = !state; return; } if (GTK_IS_WIDGET (netinfo->sensitive)) { gtk_widget_set_sensitive (GTK_WIDGET (netinfo->sensitive), state); } font_desc = pango_font_description_new (); if (state) { pango_font_description_set_weight (font_desc, PANGO_WEIGHT_NORMAL); netinfo_progress_indicator_stop (netinfo); gdk_window_set_cursor (gtk_widget_get_window(netinfo->output), NULL); netinfo->child_pid = 0; gtk_statusbar_pop (GTK_STATUSBAR (netinfo->status_bar), 0); gtk_statusbar_push (GTK_STATUSBAR (netinfo->status_bar), 0, _("Idle")); } else { pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD); netinfo_progress_indicator_start (netinfo); cursor = gdk_cursor_new (GDK_WATCH); if (!gtk_widget_get_realized (netinfo->output)) gtk_widget_realize (GTK_WIDGET (netinfo->output)); gdk_window_set_cursor (gtk_widget_get_window(netinfo->output), cursor); gdk_cursor_unref (cursor); if (netinfo->stbar_text) { gtk_statusbar_pop (GTK_STATUSBAR (netinfo->status_bar), 0); gtk_statusbar_push (GTK_STATUSBAR (netinfo->status_bar), 0, netinfo->stbar_text); } } gtk_widget_modify_font (netinfo->page_label, font_desc); pango_font_description_free (font_desc); netinfo->running = !state; netinfo_toggle_button (netinfo); }
gboolean restart_game_menu_event_handler(GtkWidget *widget, gpointer data) { free(head); head = (Frame *) calloc(1, sizeof (Frame)); frameInitializeFlag = false; buttonPressCount = BoxOfPlayer1 = BoxOfPlayer2 = 0; gtk_statusbar_push(GTK_STATUSBAR(status_bar), status_context_id, player2Name); gtk_statusbar_push(GTK_STATUSBAR(status_bar), status_context_id, player1Name); gtk_widget_queue_draw(GTK_WIDGET(data)); return FALSE; }
GtkWidget * gtk_create_status_bar(int *context_id, const gchar *context_str, char *msg1, char *msg2) { GtkWidget *status_bar = gtk_statusbar_new(); *context_id = gtk_statusbar_get_context_id(GTK_STATUSBAR(status_bar), context_str); gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(status_bar), TRUE); gtk_statusbar_push(GTK_STATUSBAR(status_bar), *context_id, msg2); gtk_statusbar_push(GTK_STATUSBAR(status_bar), *context_id, msg1); return status_bar; }
void gtk_c_on_menu_options_edit_toggle (GtkWidget *menu, gpointer userdata) { GtkWidget *notebook, *toolbar_edit, *widget, *warning; struct gtk_s_helper *helper; u_int8_t i, j, mode; struct commands_param *param; char tmp_name[5], *text; helper = (struct gtk_s_helper *)userdata; notebook = lookup_widget(GTK_WIDGET(menu), "main_vhv2_notebook"); toolbar_edit = lookup_widget(GTK_WIDGET(menu), "toolbar_edit"); mode = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)); if (helper->edit_mode) { for(i = 0; i < MAX_PROTOCOLS; i++) { if (protocols[i].visible) { param = (struct commands_param *)protocols[i].parameters; for (j = 0; j < protocols[i].nparams; j++) { if ((param[j].type != FIELD_DEFAULT) && (param[j].type != FIELD_IFACE) && (param[j].type != FIELD_EXTRA)) { snprintf(tmp_name, 5, "%02d%02d", i, j); widget = lookup_widget(GTK_WIDGET(notebook), tmp_name); text = (char *) gtk_entry_get_text(GTK_ENTRY(widget)); if (parser_filter_param(param[j].type, helper->node->protocol[i].commands_param[j], text, param[j].size_print, param[j].size) < 0) { warning = gtk_i_create_warningdialog("Bad Parameter %s with wrong value %s in protocol %s!", param[j].ldesc, text, protocols[i].namep); gtk_widget_show(warning); //break; } gtk_entry_set_editable(GTK_ENTRY(widget), FALSE); } } } } helper->edit_mode = 0; gtk_statusbar_push(GTK_STATUSBAR(helper->statusbar), 0, "Edit mode disabled"); } else { helper->edit_mode = 1; for (i = 0; i < MAX_PROTOCOLS; i++) { if (protocols[i].visible) { param = (struct commands_param *)protocols[i].parameters; for (j = 0; j < protocols[i].nparams; j++) { if ((param[j].type != FIELD_DEFAULT) && (param[j].type != FIELD_IFACE) && (param[j].type != FIELD_EXTRA)) { snprintf(tmp_name, 5, "%02d%02d", i, j); widget = lookup_widget(GTK_WIDGET(notebook), tmp_name); gtk_entry_set_editable(GTK_ENTRY(widget), TRUE); } } } } gtk_statusbar_push(GTK_STATUSBAR(helper->statusbar), 0, "Edit mode enabled"); } }
/* * Edit functions. */ static void edit_book_status_show( gchar *msg ) { if( addrbookedit_dlg.statusbar != NULL ) { gtk_statusbar_pop( GTK_STATUSBAR(addrbookedit_dlg.statusbar), addrbookedit_dlg.status_cid ); if( msg ) { gtk_statusbar_push( GTK_STATUSBAR(addrbookedit_dlg.statusbar), addrbookedit_dlg.status_cid, msg ); } else { gtk_statusbar_push( GTK_STATUSBAR(addrbookedit_dlg.statusbar), addrbookedit_dlg.status_cid, "" ); } } }
void termit_set_statusbar_message(guint page) { TERMIT_GET_TAB_BY_INDEX(pTab, page); TRACE("%s page=%d get_statusbar_callback=%d", __FUNCTION__, page, configs.get_statusbar_callback); if (configs.get_statusbar_callback) { gchar* statusbarMessage = termit_lua_getStatusbarCallback(configs.get_statusbar_callback, page); TRACE("statusbarMessage=[%s]", statusbarMessage); gtk_statusbar_push(GTK_STATUSBAR(termit.statusbar), 0, statusbarMessage); g_free(statusbarMessage); } else { gtk_statusbar_push(GTK_STATUSBAR(termit.statusbar), 0, vte_terminal_get_encoding(VTE_TERMINAL(pTab->vte))); } }
void main_window_set_status_text( main_window_t win, const char *text ) { gtk_statusbar_pop( GTK_STATUSBAR(win->statusbar), 1 ); if( win->is_grabbed ) { char buf[128]; #ifdef HAVE_GTK_OSX snprintf( buf, sizeof(buf), "%s %s", text, _("(Press <command> to release grab)") ); #else snprintf( buf, sizeof(buf), "%s %s", text, _("(Press <ctrl><alt> to release grab)") ); #endif gtk_statusbar_push( GTK_STATUSBAR(win->statusbar), 1, buf ); } else { gtk_statusbar_push( GTK_STATUSBAR(win->statusbar), 1, text ); } }
gint gw_status_bar_put_messages ( GtkWindow *w, gchar *first_msg, gchar *second_msg) { GtkStatusbar *status = NULL; guint context_id; gint result = -1; /* They are static in order to remove last messages before put new messages. */ static guint message_id1 = 0; static guint message_id2 = 0; gchar *text_utf8 = NULL; #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s() : (%s;%s)\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, first_msg, second_msg); #endif if ( w != NULL ) { if ( first_msg != NULL ) { status = gw_status_bar_get_first_status ( w); context_id = gtk_statusbar_get_context_id ( status, "Working"); if ( message_id1 != 0 ) { gtk_statusbar_remove ( status, context_id, message_id1); } g_strdup_to_gtk_text ( first_msg, text_utf8); message_id1 = gtk_statusbar_push ( status, context_id, text_utf8); g_free ( text_utf8); } if ( second_msg != NULL ) { status = gw_status_bar_get_second_status ( w); context_id = gtk_statusbar_get_context_id ( status, "Working"); if ( message_id2 != 0 ) { gtk_statusbar_remove ( status, context_id, message_id2); } g_strdup_to_gtk_text ( second_msg, text_utf8); message_id2 = gtk_statusbar_push ( status, context_id, text_utf8); g_free ( text_utf8); } result = 0; } return result; }
static void on_SendButton_clicked (GtkButton *button, gpointer user_data) { GtkWidget *dialog = GTK_WIDGET(user_data); GtkWidget *wid = lookup_widget(dialog, "LineEntry"); const char *line = gtk_entry_get_text(GTK_ENTRY(wid)); if (AVFlow->GetTextSource() == NULL) { error_message("no text source"); return; } AVFlow->GetTextSource()->SourceString(line); char buffer[60]; snprintf(buffer, sizeof(buffer),"Wrote: %.25s...", line); wid = lookup_widget(dialog, "statusbar2"); gtk_statusbar_pop(GTK_STATUSBAR(wid), 0); gtk_statusbar_push(GTK_STATUSBAR(wid), 0, buffer); if (timer_id != 0) { gtk_timeout_remove(timer_id); } timer_id = gtk_timeout_add(3 * 1000, on_TextDialog_timeout, user_data); text_file_data_t *tptr = GetTextFileDataFromUserData(user_data); if (tptr != NULL) { ReadNextLine(tptr); DisplayLineInBuffer(user_data, tptr); } }
static void update_statusbar (GtkTextBuffer *buffer, GtkStatusbar *statusbar) { gchar *msg; gint row, col; gint count; GtkTextIter iter; /* clear any previous message, underflow is allowed */ gtk_statusbar_pop (statusbar, 0); count = gtk_text_buffer_get_char_count (buffer); gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer)); row = gtk_text_iter_get_line (&iter); col = gtk_text_iter_get_line_offset (&iter); msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document", row, col, count); gtk_statusbar_push (statusbar, 0, msg); g_free (msg); }
void browser_select_dir (gchar * path) { gchar *title; char buf[PATH_MAX]; if (!strcmp (browser->last_path->str, path)) return; #ifdef ENABLE_MOVIE videoplay_clear (); #endif comment_view_clear (commentview); thumbview_stop (); imageview_stop (); viewtype_set (VIEWTYPE_IMAGEVIEW); g_string_assign (browser->last_path, path); g_string_assign (browser->current_path, path); thumbview_clear (); file_list_create (browser->filelist, path); title = g_strconcat ("PornView - ", g_basename (path), NULL); gtk_window_set_title (GTK_WINDOW (browser->window), title); g_free (title); snprintf (buf, PATH_MAX, " %d", browser->filelist->num); gtk_statusbar_pop (GTK_STATUSBAR (BROWSER_STATUS_DIR), 1); gtk_statusbar_push (GTK_STATUSBAR (BROWSER_STATUS_DIR), 1, buf); thumbview_add (browser->filelist); }
static void on_query_changed (MugQueryBar * bar, const char *query, MugData * mugdata) { int count; /* clear the old message */ mug_msg_view_set_msg (MUG_MSG_VIEW (mugdata->msgview), NULL); count = mug_msg_list_view_query (MUG_MSG_LIST_VIEW (mugdata->mlist), query); if (count >= 0) { gchar *msg = g_strdup_printf ("%d message%s found matching '%s'", count, count > 1 ? "s" : "", mug_msg_list_view_get_query (MUG_MSG_LIST_VIEW (mugdata->mlist))); gtk_statusbar_push (GTK_STATUSBAR (mugdata->statusbar), 0, msg); g_free (msg); mug_msg_list_view_move_first (MUG_MSG_LIST_VIEW (mugdata->mlist)); gtk_widget_grab_focus (GTK_WIDGET (mugdata->mlist)); } if (count == 0) /* nothing found */ mug_query_bar_grab_focus (MUG_QUERY_BAR (bar)); }
void list_row_activated(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *col, gpointer userdata) { GtkTreeModel *model; GtkTreeIter iter; model = gtk_tree_view_get_model(treeview); if (gtk_tree_model_get_iter(model, &iter, path)) { gchar *name; gtk_tree_model_get(model, &iter, COLUMN, &name, -1); if(strcmp(name, "在线好友") != 0) { talk_window_create(cli->name, name); } gtk_statusbar_push(GTK_STATUSBAR(userdata), gtk_statusbar_get_context_id(GTK_STATUSBAR(userdata), name), name); g_print ("Double-clicked row contains name %s\n", name); g_free(name); } }
void print_status (GtkWidget *sbar, char *fmt, ...) { unsigned context_id; char buf[1024]; va_list ap; if (sbar) { buf[0] = ' '; /* indent */ buf[1] = '\0'; if (fmt) { va_start (ap, fmt); g_vsnprintf (buf + 1, 1024 - 1, fmt, ap); va_end (ap); } #ifdef DEBUG fprintf (stderr, "Status: %s\n", buf); #endif context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (sbar), "XQF"); gtk_statusbar_pop (GTK_STATUSBAR (sbar), context_id); gtk_statusbar_push (GTK_STATUSBAR (sbar), context_id, buf); if (default_show_tray_icon) tray_icon_set_tooltip(buf); } }
static void statusbar_push_nick(GtkStatusbar *statusbar, Nick *nick) { unsigned int id; GString *str; char *text; id = gtk_statusbar_get_context_id(statusbar, STATUSBAR_CONTEXT); str = g_string_new(NULL); g_string_sprintfa(str, "Nick: %s", nick->nick); if (nick->host != NULL) g_string_sprintfa(str, " - Host: %s", nick->host); if (nick->realname != NULL) g_string_sprintfa(str, " - Name: %s", nick->realname); /* this really should be done separately to all the nick->* values, at least when we add i18n support to strings above.. */ text = g_locale_to_utf8(str->str, -1, NULL, NULL, NULL); if (text == NULL) { text = g_convert(str->str, str->len, "UTF-8", "CP1252", NULL, NULL, NULL); } gtk_statusbar_pop(statusbar, id); gtk_statusbar_push(statusbar, id, text != NULL ? text : str->str); g_free(text); g_string_free(str, TRUE); }
/* ***************************************************************************** * create a new POI of type "waypoint.route" * and append it to the current route */ void add_quickpoint_to_route () { gchar t_name[100], t_cmt[100]; gdouble t_lat, t_lon; glong t_id; gint t_x, t_y; GdkModifierType state; g_snprintf (t_name, sizeof (t_name), "%s %d", _("Routepoint"), route.items+1); g_snprintf (t_cmt, sizeof (t_cmt), _("Quicksaved Routepoint")); gdk_window_get_pointer (GTK_LAYOUT (map_drawingarea)->bin_window, &t_x, &t_y, &state); calcxytopos (t_x, t_y, &t_lat, &t_lon, current.zoom); if ( mydebug > 0 ) printf ("Add Routepoint: %s lat:%f,lon:%f (x:%d,y:%d)\n", t_name, t_lat, t_lon, t_x, t_y); t_id = addwaypoint (t_name, "waypoint.route", t_cmt, t_lat, t_lon, TRUE); add_routepoint (t_id, t_name, t_cmt, "waypoint.route", t_lon, t_lat); gtk_statusbar_push (GTK_STATUSBAR (frame_statusbar), current.statusbar_id, _("Routepoint added.")); gtk_widget_set_sensitive (menuitem_saveroute, TRUE); }
void gtk_c_opendialog_open(GtkWidget *button, gpointer userdata) { GtkWidget *dialog; struct gtk_s_helper *helper; char *filename; u_int8_t i; helper = (struct gtk_s_helper *)userdata; dialog = lookup_widget(GTK_WIDGET(button), "opendialog"); filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); if (strlen(filename)) { strncpy(tty_tmp->config_file, filename, FILENAME_MAX); if (parser_read_config_file(tty_tmp, helper->node) < 0) { gtk_i_create_warningdialog("%s", "Error reading config file"); } /* When parsing the configuration file, everything is updated in protocol[i].default_values, so * now we need to copy it to the current node */ for (i = 0; i < MAX_PROTOCOLS; i++) if (protocols[i].visible) memcpy((void *)helper->node->protocol[i].tmp_data, (void *)protocols[i].default_values, protocols[i].size); g_free(filename); } gtk_statusbar_push(GTK_STATUSBAR(helper->statusbar), 0, "Configuration file read"); gtk_widget_destroy(GTK_WIDGET(dialog)); }
int update_statusbar() { int i, j; char *options[128]; guint context_id; GtkStatusbar *statusbar; extern guint message_id; GString *statustext = g_string_new("hydra "); i = hydra_get_options(options); for (j = 1; j < i; j++) { statustext = g_string_append(statustext, options[j]); statustext = g_string_append_c(statustext, ' '); } statusbar = (GtkStatusbar *) lookup_widget(GTK_WIDGET(wndMain), "statusbar"); context_id = gtk_statusbar_get_context_id(statusbar, "status"); /* an old message in stack? */ if (message_id != 0) { gtk_statusbar_remove(statusbar, context_id, message_id); } message_id = gtk_statusbar_push(statusbar, context_id, (gchar *) statustext->str); (void) g_string_free(statustext, TRUE); return TRUE; }
void gtk_c_savedialog_save(GtkWidget *button, gpointer userdata) { GtkWidget *dialog; struct gtk_s_helper *helper; char *filename; u_int8_t i; helper = (struct gtk_s_helper *)userdata; dialog = lookup_widget(GTK_WIDGET(button), "savedialog"); filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); if (strlen(filename)) { strncpy(tty_tmp->config_file, filename, FILENAME_MAX); for (i = 0; i < MAX_PROTOCOLS; i++) if (protocols[i].visible) memcpy((void *)protocols[i].default_values, (void *)helper->node->protocol[i].tmp_data, protocols[i].size); strncpy(tty_tmp->config_file, filename, FILENAME_MAX); if (parser_write_config_file(tty_tmp) < 0) { gtk_i_create_warningdialog("%s", "Error writing config file"); } g_free(filename); } gtk_statusbar_push(GTK_STATUSBAR(helper->statusbar), 0, "Configuration file written"); gtk_widget_destroy(GTK_WIDGET(dialog)); }
/** * operation: The operation to process * message: The message that will be pushed to the status bar * fract: The fraction of the progress bar to fill * swidget: The SeahorseWidget to extract the gtk widgets from * * This gets called whenever an operation updates it's progress status thingy. * We update the appbar as appropriate. If operation != NULL then we only * display the latest operation in our special list * **/ static void operation_progress (SeahorseOperation *operation, const gchar *message, gdouble fract, SeahorseWidget *swidget) { GtkProgressBar *progress; GtkStatusbar *status; guint id; progress = GTK_PROGRESS_BAR (seahorse_widget_get_widget (swidget, "progress")); status = GTK_STATUSBAR (seahorse_widget_get_widget (swidget, "status")); if (!seahorse_operation_is_running (operation)) fract = 0.0; if (message != NULL && status) { g_return_if_fail (GTK_IS_STATUSBAR (status)); id = gtk_statusbar_get_context_id (status, "operation-progress"); gtk_statusbar_pop (status, id); if (message[0]) gtk_statusbar_push (status, id, message); } if(progress) { g_return_if_fail (GTK_IS_PROGRESS_BAR (progress)); if (fract >= 0.0) { stop_pulse (progress); gtk_progress_bar_set_fraction (progress, fract); } else { start_pulse (progress); } } }
/** * Put a message on the statusbar. The message will be displayed for * the number of seconds given by timeout. If timeout is 0 the message * will not be automatically removed. * * @returns message id of the added message */ statusbar_msgid_t statusbar_gui_push_v(sb_types_t type, guint scid, guint timeout, const gchar *format, va_list args) { static gchar buf[1024]; statusbar_msgid_t id = zero_msgid; if (format != NULL) { switch (type) { case SB_WARNING: gdk_beep(); /* FALL THRU */ case SB_MESSAGE: str_vbprintf(buf, sizeof(buf), format, args); break; } } else { buf[0] = '\0'; } id.scid = scid; id.msgid = gtk_statusbar_push(statusbar_get(), scid, buf); if (timeout != 0) statusbar_gui_add_timeout(id, timeout); return id; }
void juniper_ui_status_bar_update(const gchar *text) { juniper_ui_status_bar_clear(); if (text != NULL) gtk_statusbar_push(status_bar, status_bar_context_id, text); }
/* callback for updating titlebar, statusbar and playlist on song change event */ static gboolean titlebar_updater(gpointer data) { if(MpdWin.window_creation_finished == 1) { gtk_window_set_title(GTK_WINDOW(MpdWin.win), title_text); if(mpd_info.mps.update) { is_updating_db = TRUE; gtk_statusbar_push(GTK_STATUSBAR(StatusBar), sb_push_num++, "mpd: updating database"); } else { if(is_updating_db) { is_updating_db = FALSE; gtk_statusbar_pop(GTK_STATUSBAR(StatusBar), --sb_push_num); } update_statusbar(sb_text, StatusBar); } } if(update_pl_tree == FALSE) { update_pl_tree = TRUE; } if(MpdWin.window_creation_finished == 1) { if(mpd_has_current_song_changed()) playlist_update_tree(); } if((int)data != mpd_info.update_interval) return FALSE; return TRUE; }