static void on_break_column_edited(G_GNUC_UNUSED GtkCellRendererText *renderer, gchar *path_str, gchar *new_text, gpointer gdata) { gint index = GPOINTER_TO_INT(gdata) - 1; const gchar *set_text = validate_column(new_text, index > 0); GtkTreeIter iter; const char *id; char type; scp_tree_store_get_iter_from_string(store, &iter, path_str); scp_tree_store_get(store, &iter, BREAK_ID, &id, BREAK_TYPE, &type, -1); if (id && (debug_state() & DS_SENDABLE)) { char *locale = utils_get_locale_from_display(new_text, HB_DEFAULT); debug_send_format(F, "022%s-break-%s %s %s", id, break_command(index, type), id, locale ? locale : index ? "" : "0"); g_free(locale); } else if (!id) scp_tree_store_set(store, &iter, index + BREAK_IGNORE, set_text, -1); else plugin_beep(); }
static void on_command_send_button_clicked(G_GNUC_UNUSED GtkButton *button, G_GNUC_UNUSED gpointer gdata) { gchar *text = utils_text_buffer_get_text(command_text, -1); const gchar *start; char *locale; thread_synchronize(); utils_strchrepl(text, '\n', ' '); gtk_text_buffer_set_text(command_text, text, -1); start = utils_skip_spaces(text); locale = gtk_toggle_button_get_active(command_locale) ? utils_get_locale_from_utf8(start) : g_strdup(start); debug_send_command(N, locale); g_free(locale); gtk_widget_hide(command_dialog); if (*start) { GtkTreePath *path; GtkTreeIter iter; gchar *display = g_strdup(start); /* from ui_combo_box_add_to_history() */ if (store_find(command_store, &iter, COMMAND_TEXT, start)) scp_tree_store_remove(command_store, &iter); if (strlen(display) >= 273) strcpy(display + 270, _("\342\200\246")); /* For translators: ellipsis */ scp_tree_store_prepend(command_store, &iter, NULL); scp_tree_store_set(command_store, &iter, COMMAND_DISPLAY, display, COMMAND_TEXT, start, COMMAND_LOCALE, gtk_toggle_button_get_active(command_locale), -1); g_free(display); path = gtk_tree_path_new_from_indices(15, -1); if (scp_tree_store_get_iter(command_store, &iter, path)) scp_tree_store_remove(command_store, &iter); gtk_tree_path_free(path); } g_free(text); }
static void menu_mode_update_iter(ScpTreeStore *store, GtkTreeIter *iter, gint new_mode, gboolean hbit) { gint hb_mode, mr_mode; const char *value; gchar *display; scp_tree_store_get(store, iter, COLUMN_VALUE, &value, COLUMN_HB_MODE, &hb_mode, COLUMN_MR_MODE, &mr_mode, -1); if (hbit) hb_mode = new_mode; else mr_mode = new_mode; display = parse_get_display_from_7bit(value, hb_mode, mr_mode); scp_tree_store_set(store, iter, COLUMN_HB_MODE, hb_mode, COLUMN_MR_MODE, mr_mode, value ? COLUMN_DISPLAY : -1, display, -1); g_free(display); }
static void break_enable(GtkTreeIter *iter, gboolean enable) { break_mark(iter, FALSE); scp_tree_store_set(store, iter, BREAK_ENABLED, enable, -1); break_mark(iter, TRUE); }