static void prefs_display_header_set_dialog(void) { GtkTreeView *list_view = GTK_TREE_VIEW(dispheader.headers_list_view); GtkTreeView *hidden_list_view = GTK_TREE_VIEW(dispheader.hidden_headers_list_view); GSList *cur; GtkTreeModel *model_list, *model_hidden; model_list = gtk_tree_view_get_model(list_view); model_hidden = gtk_tree_view_get_model(hidden_list_view); gtk_list_store_clear(GTK_LIST_STORE(model_list)); gtk_list_store_clear(GTK_LIST_STORE(model_hidden)); for (cur = prefs_common.disphdr_list; cur != NULL; cur = cur->next) { DisplayHeaderProp *dp = (DisplayHeaderProp *)cur->data; if (dp->hidden) prefs_display_header_insert_header(GTK_LIST_STORE (model_hidden), dp->name, dp); else prefs_display_header_insert_header(GTK_LIST_STORE (model_list), dp->name, dp); } gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dispheader.other_headers), prefs_common.show_other_header); }
static void prefs_display_header_list_view_set_row(gboolean hidden) { GtkTreeView *list_view; DisplayHeaderProp *dp; gchar *entry_text; GtkTreeModel *model; #if !GTK_CHECK_VERSION(2, 24, 0) entry_text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(dispheader.hdr_combo)); #else entry_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(dispheader.hdr_combo)); #endif if (!entry_text) entry_text = gtk_editable_get_chars( GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(dispheader.hdr_combo))),0,-1); if (!entry_text || entry_text[0] == '\0') { alertpanel_error(_("Header name is not set.")); return; } if (hidden) list_view = GTK_TREE_VIEW(dispheader.hidden_headers_list_view); else list_view = GTK_TREE_VIEW(dispheader.headers_list_view); if (prefs_display_header_find_header(list_view, entry_text) != -1) { alertpanel_error(_("This header is already in the list.")); return; } dp = g_new0(DisplayHeaderProp, 1); dp->name = g_strdup(entry_text); dp->hidden = hidden; model = gtk_tree_view_get_model(list_view); prefs_display_header_insert_header(GTK_LIST_STORE(model), dp->name, dp); prefs_display_header_set_list(); g_free(entry_text); }