void file_progress_show_target (FileOpContext * ctx, const vfs_path_t * s_vpath) { FileOpContextUI *ui; g_return_if_fail (ctx != NULL); g_return_if_fail (ctx->ui != NULL); ui = ctx->ui; if (s_vpath != NULL) { char *s; s = vfs_path_to_str (s_vpath); label_set_text (ui->file_label[1], _("Target")); label_set_text (ui->file_string[1], truncFileStringSecure (ui, s)); g_free (s); } else { label_set_text (ui->file_label[1], ""); label_set_text (ui->file_string[1], ""); } }
void file_progress_show_source (FileOpContext * ctx, const char *s) { FileOpContextUI *ui; g_return_if_fail (ctx != NULL); g_return_if_fail (ctx->ui != NULL); ui = ctx->ui; if (s != NULL) { #ifdef WITH_FULL_PATHS size_t i; i = strlen (current_panel->cwd); /* We remove the full path we have added before */ if (strncmp (s, current_panel->cwd, i) == 0) if (s[i] == PATH_SEP) s += i + 1; #endif /* WITH_FULL_PATHS */ label_set_text (ui->file_label[0], _("Source")); label_set_text (ui->file_string[0], truncFileString (ui, s)); } else { label_set_text (ui->file_label[0], ""); label_set_text (ui->file_string[0], ""); } }
void file_progress_show_source (file_op_context_t * ctx, const vfs_path_t * s_vpath) { file_op_context_ui_t *ui; if (ctx == NULL || ctx->ui == NULL) return; ui = ctx->ui; if (s_vpath != NULL) { char *s; s = vfs_path_tokens_get (s_vpath, -1, 1); label_set_text (ui->src_file_label, _("Source")); label_set_text (ui->src_file, truncFileString (ui->op_dlg, s)); g_free (s); } else { label_set_text (ui->src_file_label, ""); label_set_text (ui->src_file, ""); } }
static void show_replaygain(void) { /* known limitation: If only one of gain and peak is set, neither will be shown. This is true for * both track and album replaygain tags. Written so it will be easy to fix, with some trouble. */ gtk_label_set_text(GTK_LABEL(replaygain_reference), ""); gtk_label_set_text(GTK_LABEL(replaygain_track_gain), ""); gtk_label_set_text(GTK_LABEL(replaygain_album_gain), ""); gtk_label_set_text(GTK_LABEL(replaygain_track_peak), ""); gtk_label_set_text(GTK_LABEL(replaygain_album_peak), ""); double reference, track_gain, track_peak, album_gain, album_peak; FLAC__bool reference_set, track_gain_set, track_peak_set, album_gain_set, album_peak_set; if(!FLAC_plugin__replaygain_get_from_file( current_filename, &reference, &reference_set, &track_gain, &track_gain_set, &album_gain, &album_gain_set, &track_peak, &track_peak_set, &album_peak, &album_peak_set )) return; if(reference_set) label_set_text(replaygain_reference, _("ReplayGain Reference Loudness: %2.1f dB"), reference); if(track_gain_set) label_set_text(replaygain_track_gain, _("ReplayGain Track Gain: %+2.2f dB"), track_gain); if(album_gain_set) label_set_text(replaygain_album_gain, _("ReplayGain Album Gain: %+2.2f dB"), album_gain); if(track_peak_set) label_set_text(replaygain_track_peak, _("ReplayGain Track Peak: %1.8f"), track_peak); if(album_peak_set) label_set_text(replaygain_album_peak, _("ReplayGain Album Peak: %1.8f"), album_peak); }
void file_progress_show_source (FileOpContext * ctx, const vfs_path_t * s_vpath) { FileOpContextUI *ui; g_return_if_fail (ctx != NULL); g_return_if_fail (ctx->ui != NULL); ui = ctx->ui; if (s_vpath != NULL) { char *s; s = vfs_path_tokens_get (s_vpath, -1, 1); label_set_text (ui->file_label[0], _("Source")); label_set_text (ui->file_string[0], truncFileString (ui, s)); g_free (s); } else { label_set_text (ui->file_label[0], ""); label_set_text (ui->file_string[0], ""); } }
FileProgressStatus file_progress_show_deleting (char *s) { label_set_text (FileLabel [0], _("Deleting")); label_set_text (FileString [0], truncFileString (s)); return file_progress_check_buttons (); }
void file_progress_show_deleting (FileOpContext * ctx, const char *s) { FileOpContextUI *ui; g_return_if_fail (ctx != NULL); g_return_if_fail (ctx->ui != NULL); ui = ctx->ui; label_set_text (ui->file_label[0], _("Deleting")); label_set_text (ui->file_label[0], truncFileStringSecure (ui, s)); }
FileProgressStatus file_progress_show_target (char *s) { if (s != NULL){ label_set_text (FileLabel [1], _("Target")); label_set_text (FileString [1], truncFileString (s)); return file_progress_check_buttons (); } else { label_set_text (FileLabel [1], ""); label_set_text (FileString [1], ""); return file_progress_check_buttons (); } }
void set_hintbar (const char *str) { label_set_text (the_hint, str); if (ok_to_refresh > 0) mc_refresh (); }
static cb_ret_t chmod_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data) { char buffer[BUF_TINY]; int id; id = dlg_get_current_widget_id (h) - (chmod_but_num - (single_set ? 4 : 0)) - 1; switch (msg) { case DLG_ACTION: /* close dialog due to SIGINT (ctrl-g) */ if (sender == NULL && parm == CK_Cancel) return MSG_NOT_HANDLED; /* handle checkboxes */ if (id >= 0) { gboolean sender_is_checkbox = FALSE; unsigned int i; /* whether action was sent by checkbox? */ for (i = 0; i < check_perm_num; i++) if (sender == (Widget *) check_perm[i].check) { sender_is_checkbox = TRUE; break; } if (sender_is_checkbox) { c_stat ^= check_perm[id].mode; g_snprintf (buffer, sizeof (buffer), "%o", (unsigned int) c_stat); label_set_text (statl, buffer); chmod_toggle_select (h, id); mode_change = TRUE; return MSG_HANDLED; } } return MSG_NOT_HANDLED; case DLG_KEY: if ((parm == 'T' || parm == 't' || parm == KEY_IC) && id > 0) { chmod_toggle_select (h, id); if (parm == KEY_IC) dlg_one_down (h); return MSG_HANDLED; } return MSG_NOT_HANDLED; case DLG_DRAW: chmod_refresh (h); return MSG_HANDLED; default: return default_dlg_callback (h, sender, msg, parm, data); } }
static cb_ret_t chmod_callback (Dlg_head *h, dlg_msg_t msg, int parm) { char buffer[BUF_TINY]; int id = h->current->dlg_id - BUTTONS + single_set * 2; switch (msg) { case DLG_ACTION: if (id >= 0) { c_stat ^= check_perm[id].mode; g_snprintf (buffer, sizeof (buffer), "%o", c_stat); label_set_text (statl, buffer); chmod_toggle_select (h, id); mode_change = 1; } return MSG_HANDLED; case DLG_KEY: if ((parm == 'T' || parm == 't' || parm == KEY_IC) && id > 0) { chmod_toggle_select (h, id); if (parm == KEY_IC) dlg_one_down (h); return MSG_HANDLED; } return MSG_NOT_HANDLED; case DLG_DRAW: chmod_refresh (h); return MSG_HANDLED; default: return default_dlg_callback (h, msg, parm); } }
static int sel_charset_button (WButton * button, int action) { int new_dcp; (void) button; (void) action; new_dcp = select_charset (-1, -1, new_display_codepage, TRUE); if (new_dcp != SELECT_CHARSET_CANCEL) { const char *cpname; char buf[BUF_TINY]; new_display_codepage = new_dcp; cpname = (new_display_codepage == SELECT_CHARSET_OTHER_8BIT) ? _("Other 8 bit") : ((codepage_desc *) g_ptr_array_index (codepages, new_display_codepage))->name; if (cpname != NULL) utf8_display = str_isutf8 (cpname); /* avoid strange bug with label repainting */ g_snprintf (buf, sizeof (buf), "%-27s", cpname); label_set_text (cplabel, buf); } return 0; }
static gboolean learn_check_key (int c) { int i; for (i = 0; i < learn_total; i++) { if (key_name_conv_tab[i].code != c || learnkeys[i].ok) continue; dlg_select_widget (learnkeys[i].button); /* TRANSLATORS: This label appears near learned keys. Keep it short. */ label_set_text (LABEL (learnkeys[i].label), _("OK")); learnkeys[i].ok = TRUE; learnok++; if (learnok >= learn_total) { learn_dlg->ret_value = B_CANCEL; if (learnchanged) { if (query_dialog (learn_title, _ ("It seems that all your keys already\n" "work fine. That's great."), D_ERROR, 2, _("&Save"), _("&Discard")) == 0) learn_dlg->ret_value = B_ENTER; } else { message (D_ERROR, learn_title, _ ("Great! You have a complete terminal database!\n" "All your keys work well.")); } dlg_stop (learn_dlg); } return TRUE; } switch (c) { case KEY_LEFT: case 'h': return learn_move (FALSE); case KEY_RIGHT: case 'l': return learn_move (TRUE); case 'j': dlg_one_down (learn_dlg); return TRUE; case 'k': dlg_one_up (learn_dlg); return TRUE; } /* Prevent from disappearing if a non-defined sequence is pressed and contains a button hotkey. Only recognize hotkeys with ALT. */ return (c < 255 && g_ascii_isalnum (c)); }
static int learn_check_key (int c) { int i; for (i = 0; i < learn_total; i++) { if (key_name_conv_tab [i].code == c) { if (!learnkeys [i].ok) { dlg_select_widget (learn_dlg, learnkeys [i].button); label_set_text ((WLabel *) learnkeys [i].label, _("OK")); learnkeys [i].ok = 1; learnok++; if (learnok >= learn_total) { learn_dlg->ret_value = B_CANCEL; if (learnchanged) { if (query_dialog (learn_title, _("It seems that all your keys already\n" "work fine. That's great."), 1, 2, _("&Save"), _("&Discard")) == 0) learn_dlg->ret_value = B_ENTER; } else { message (1, learn_title, _("Great! You have a complete terminal database!\n" "All your keys work well.")); } dlg_stop (learn_dlg); } return 1; } } } switch (c) { case KEY_LEFT: case 'h': return learn_move (0); case KEY_RIGHT: case 'l': return learn_move (1); case 'j': dlg_one_down (learn_dlg); return 1; case 'k': dlg_one_up (learn_dlg); return 1; } /* Prevent from disappearing if a non-defined sequence is pressed and contains s or c. Use ALT('s') or ALT('c'). */ if (c < 255 && isalpha(c)) { c = toupper(c); for (i = 0; i < BUTTONS; i++) if (c == learn_but [i].hotkey) return 1; } return 0; }
int gui_choose_search_type(game *g, int who) { //GtkWidget *combo; char buf[1024]; int i; /* Activate action button */ //gtk_widget_set_sensitive(action_button, TRUE); /* Reset displayed cards */ reset_cards(g, true, true); /* Redraw everything */ redraw_everything(); /* Set prompt */ //gtk_label_set_text(GTK_LABEL(action_prompt), "Choose Search category"); label_set_text("Choose Search category"); /* Create simple combo box */ //combo = gtk_combo_box_new_text(); /* Loop over search categories */ for (i = 0; i < MAX_SEARCH; i++) { /* Skip takeover category if disabled */ if (real_game.takeover_disabled && i == SEARCH_TAKEOVER) continue; /* Copy search name */ strcpy(buf, search_name[i]); /* Capitalize search name */ buf[0] = toupper(buf[0]); /* Append option to combo box */ //gtk_combo_box_append_text(GTK_COMBO_BOX(combo), buf); } /* Set first choice */ //gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0); /* Add combo box to action box */ //gtk_box_pack_end(GTK_BOX(action_box), combo, FALSE, TRUE, 0); /* Show everything */ //gtk_widget_show_all(combo); /* Process events */ //gtk_main(); /* Get selection */ //i = gtk_combo_box_get_active(GTK_COMBO_BOX(combo)); /* Destroy combo box */ //gtk_widget_destroy(combo); /* Return choice */ return i; }
static FileProgressStatus show_no_bar (int n) { if (n >= 0) { label_set_text (ProgressLabel [n], ""); gauge_show (ProgressGauge [n], 0); } return file_progress_check_buttons (); }
void file_progress_show_deleting (file_op_context_t * ctx, const char *s, size_t * count) { file_op_context_ui_t *ui; if (ctx == NULL || ctx->ui == NULL) return; ui = ctx->ui; if (ui->src_file_label != NULL) label_set_text (ui->src_file_label, _("Deleting")); label_set_text (ui->src_file, truncFileStringSecure (ui->op_dlg, s)); if (count != NULL) (*count)++; }
void display_popup_win (INPUT_POPUP *ipu, const char* label) { widget_list *wok; widget_list *wno; if(ipu->popup_win < 0) { Uint32 flags = ELW_WIN_DEFAULT & ~ELW_CLOSE_BOX; ipu->popup_win = create_window (win_prompt, ipu->parent, 0, ipu->x, ipu->y, ipu->popup_x_len, ipu->popup_y_len, flags); // clear the buffer init_text_message (&ipu->popup_text, ipu->maxlen); set_text_message_color (&ipu->popup_text, 0.77f, 0.57f, 0.39f); // Label ipu->popup_label = label_add (ipu->popup_win, NULL, label, 5, 5); widget_set_color (ipu->popup_win, ipu->popup_label, 0.77f, 0.57f, 0.39f); // Input ipu->popup_field = text_field_add_extended (ipu->popup_win, 101, NULL, 5, 28, ipu->popup_x_len - 10, 28*ipu->rows, ipu->text_flags, 1.0f, 0.77f, 0.57f, 0.39f, &ipu->popup_text, 1, FILTER_ALL, 5, 5); widget_set_color (ipu->popup_win, ipu->popup_field, 0.77f, 0.57f, 0.39f); // Accept ipu->popup_ok = button_add (ipu->popup_win, NULL, button_okay, 0, 0); widget_set_OnClick (ipu->popup_win, ipu->popup_ok, popup_ok_button_handler); widget_set_color (ipu->popup_win, ipu->popup_ok, 0.77f, 0.57f, 0.39f); // Reject ipu->popup_no = button_add (ipu->popup_win, NULL, button_cancel, 0, 0); widget_set_OnClick (ipu->popup_win, ipu->popup_no, popup_cancel_button_handler); widget_set_color (ipu->popup_win, ipu->popup_no, 0.77f, 0.57f, 0.39f); // align the buttons wok = widget_find(ipu->popup_win, ipu->popup_ok); wno = widget_find(ipu->popup_win, ipu->popup_no); widget_move(ipu->popup_win, ipu->popup_ok, (ipu->popup_x_len - wok->len_x - wno->len_x)/3, ipu->popup_y_len - (wok->len_y + 5)); widget_move(ipu->popup_win, ipu->popup_no, wok->len_x + 2*(ipu->popup_x_len - wok->len_x - wno->len_x)/3, ipu->popup_y_len - (wno->len_y + 5)); set_window_handler (ipu->popup_win, ELW_HANDLER_KEYPRESS, popup_keypress_handler); if ((ipu->popup_win > -1) && (ipu->popup_win < windows_list.num_windows)) windows_list.window[ipu->popup_win].data = ipu; } else { if ((ipu->parent > -1) && (ipu->parent < windows_list.num_windows)) { window_info *win = &windows_list.window[ipu->parent]; move_window(ipu->popup_win, ipu->parent, 0, win->pos_x+ipu->x, win->pos_y+ipu->y); } text_field_clear(ipu->popup_win, ipu->popup_field); label_set_text (ipu->popup_win, ipu->popup_label, label); show_window (ipu->popup_win); select_window (ipu->popup_win); } }
void file_progress_show_total (FileOpTotalContext * tctx, FileOpContext * ctx, uintmax_t copyed_bytes, gboolean show_summary) { char buffer[BUF_TINY]; char buffer2[BUF_TINY]; char buffer3[BUF_TINY]; char buffer4[BUF_TINY]; struct timeval tv_current; FileOpContextUI *ui; g_return_if_fail (ctx != NULL); g_return_if_fail (ctx->ui != NULL); ui = ctx->ui; if (ctx->progress_bytes != 0) { gauge_set_value (ui->progress_total_gauge, 1024, (int) (1024 * copyed_bytes / ctx->progress_bytes)); gauge_show (ui->progress_total_gauge, 1); } else gauge_show (ui->progress_total_gauge, 0); if (!show_summary && tctx->bps == 0) return; gettimeofday (&tv_current, NULL); file_frmt_time (buffer2, tv_current.tv_sec - tctx->transfer_start.tv_sec); file_eta_prepare_for_show (buffer3, tctx->eta_secs, TRUE); file_bps_prepare_for_show (buffer4, (long) tctx->bps); g_snprintf (buffer, BUF_TINY, _("Time: %s %s (%s)"), buffer2, buffer3, buffer4); label_set_text (ui->time_label, buffer); size_trunc_len (buffer2, 5, tctx->copyed_bytes, 0, panels_options.kilobyte_si); size_trunc_len (buffer3, 5, ctx->progress_bytes, 0, panels_options.kilobyte_si); g_snprintf (buffer, BUF_TINY, _("Total: %s of %s"), buffer2, buffer3); label_set_text (ui->total_bytes_label, buffer); }
void file_progress_show (file_op_context_t * ctx, off_t done, off_t total, const char *stalled_msg, gboolean force_update) { file_op_context_ui_t *ui; char buffer[BUF_TINY]; if (!verbose || ctx == NULL || ctx->ui == NULL) return; ui = ctx->ui; if (total == 0) { if (!speedchart_progress) gauge_show (ui->progress_file_gauge, 0); else speedchart_show(ui->progress_file_speedchart, 0); //ctx->bps return; } if (!speedchart_progress) { gauge_set_value (ui->progress_file_gauge, 1024, (int) (1024 * done / total)); gauge_show (ui->progress_file_gauge, 1); } else { speedchart_set_value (ui->progress_file_speedchart, 1024, (int) (1024 * done / total)); speedchart_show (ui->progress_file_speedchart, 1); } if (!force_update) return; if (ui->showing_eta && ctx->eta_secs > 0.5) { char buffer2[BUF_TINY]; file_eta_prepare_for_show (buffer2, ctx->eta_secs, FALSE); if (ctx->bps == 0) g_snprintf (buffer, BUF_TINY, "%s %s", buffer2, stalled_msg); else { char buffer3[BUF_TINY]; file_bps_prepare_for_show (buffer3, ctx->bps); g_snprintf (buffer, BUF_TINY, "%s (%s) %s", buffer2, buffer3, stalled_msg); } } else { g_snprintf (buffer, BUF_TINY, "%s", stalled_msg); } label_set_text (ui->progress_file_label, buffer); }
FileProgressStatus file_progress_show_count (long done, long total) { if (!verbose) return file_progress_check_buttons (); if (total > 0){ label_set_text (ProgressLabel [1], _("Count")); return show_bar (1, done, total); } else return show_no_bar (1); }
FileProgressStatus file_progress_show_bytes (double done, double total) { if (!verbose) return file_progress_check_buttons (); if (total > 0){ label_set_text (ProgressLabel [2], _("Bytes")); return show_bar (2, done, total); } else return show_no_bar (2); }
void file_progress_show_target (FileOpContext * ctx, const char *s) { FileOpContextUI *ui; g_return_if_fail (ctx != NULL); g_return_if_fail (ctx->ui != NULL); ui = ctx->ui; if (s != NULL) { label_set_text (ui->file_label[1], _("Target")); label_set_text (ui->file_string[1], truncFileStringSecure (ui, s)); } else { label_set_text (ui->file_label[1], ""); label_set_text (ui->file_string[1], ""); } }
static void char_button_clicked(button_event_t* event) { if (event->id == EVT_BUTTON_CLICK) { widget_t* w = widget_get_parent(event->widget); textentry_screen_t* screen = widget_get_instance_data(w); const char* btn_text = button_get_text(event->widget); strncat(screen->text, btn_text, sizeof(screen->text)); label_set_text(screen->text_label, screen->text); } }
static void chown_info_update (void) { char buffer[BUF_SMALL]; /* mode */ g_snprintf (buffer, sizeof (buffer), "Permissions (octal): %o", get_mode ()); label_set_text (l_mode, buffer); /* permissions */ update_permissions (); }
FileProgressStatus file_progress_show (long done, long total) { if (!verbose) return file_progress_check_buttons (); if (total > 0){ label_set_text (ProgressLabel [0], _("File")); file_eta_show (); file_bps_show (); return show_bar (0, done, total); } else return show_no_bar (0); }
void file_progress_show_count (FileOpContext * ctx, size_t done, size_t total) { char buffer[BUF_TINY]; FileOpContextUI *ui; g_return_if_fail (ctx != NULL); g_return_if_fail (ctx->ui != NULL); ui = ctx->ui; g_snprintf (buffer, BUF_TINY, _("Files processed: %zu of %zu"), done, total); label_set_text (ui->total_files_processed_label, buffer); }
void set_hintbar(char *str) { #ifndef HAVE_X if (xterm_flag && xterm_hintbar) { fprintf (stderr, "\33]0;mc - %s\7", str); } else #endif { label_set_text (the_hint, str); if (ok_to_refresh > 0) refresh(); } }
void file_progress_show_target (file_op_context_t * ctx, const vfs_path_t * s_vpath) { file_op_context_ui_t *ui; if (ctx == NULL || ctx->ui == NULL) return; ui = ctx->ui; if (s_vpath != NULL) { label_set_text (ui->tgt_file_label, _("Target")); label_set_text (ui->tgt_file, truncFileStringSecure (ui->op_dlg, vfs_path_as_str (s_vpath))); } else { label_set_text (ui->tgt_file_label, ""); label_set_text (ui->tgt_file, ""); } }
static void show_file_info(void) { FLAC__StreamMetadata streaminfo; struct stat _stat; gtk_label_set_text(GTK_LABEL(flac_samplerate), ""); gtk_label_set_text(GTK_LABEL(flac_channels), ""); gtk_label_set_text(GTK_LABEL(flac_bits_per_sample), ""); gtk_label_set_text(GTK_LABEL(flac_blocksize), ""); gtk_label_set_text(GTK_LABEL(flac_filesize), ""); gtk_label_set_text(GTK_LABEL(flac_samples), ""); gtk_label_set_text(GTK_LABEL(flac_bitrate), ""); if(!FLAC__metadata_get_streaminfo(current_filename, &streaminfo)) { return; } label_set_text(flac_samplerate, _("Samplerate: %d Hz"), streaminfo.data.stream_info.sample_rate); label_set_text(flac_channels, _("Channels: %d"), streaminfo.data.stream_info.channels); label_set_text(flac_bits_per_sample, _("Bits/Sample: %d"), streaminfo.data.stream_info.bits_per_sample); if(streaminfo.data.stream_info.min_blocksize == streaminfo.data.stream_info.max_blocksize) label_set_text(flac_blocksize, _("Blocksize: %d"), streaminfo.data.stream_info.min_blocksize); else label_set_text(flac_blocksize, _("Blocksize: variable\n min/max: %d/%d"), streaminfo.data.stream_info.min_blocksize, streaminfo.data.stream_info.max_blocksize); if (streaminfo.data.stream_info.total_samples) label_set_text(flac_samples, _("Samples: %llu\nLength: %d:%.2d"), streaminfo.data.stream_info.total_samples, (int)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate / 60), (int)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate % 60)); if(!stat(current_filename, &_stat) && S_ISREG(_stat.st_mode)) { #if _FILE_OFFSET_BITS == 64 label_set_text(flac_filesize, _("Filesize: %lld B"), _stat.st_size); #else label_set_text(flac_filesize, _("Filesize: %ld B"), _stat.st_size); #endif if (streaminfo.data.stream_info.total_samples) label_set_text(flac_bitrate, _("Avg. bitrate: %.1f kb/s\nCompression ratio: %.1f%%"), 8.0 * (float)(_stat.st_size) / (1000.0 * (float)streaminfo.data.stream_info.total_samples / (float)streaminfo.data.stream_info.sample_rate), 100.0 * (float)_stat.st_size / (float)(streaminfo.data.stream_info.bits_per_sample / 8 * streaminfo.data.stream_info.channels * streaminfo.data.stream_info.total_samples)); } }