static int show_switch (CT ct, int serial, int alternate) { switch (ct->c_type) { case CT_MULTIPART: return show_multi (ct, serial, alternate); case CT_MESSAGE: switch (ct->c_subtype) { case MESSAGE_PARTIAL: return show_partial (ct, serial, alternate); case MESSAGE_EXTERNAL: return show_external (ct, serial, alternate); case MESSAGE_RFC822: default: return show_message_rfc822 (ct, serial, alternate); } case CT_TEXT: return show_text (ct, serial, alternate); case CT_AUDIO: case CT_IMAGE: case CT_VIDEO: case CT_APPLICATION: return show_content (ct, serial, alternate); default: adios (NULL, "unknown content type %d", ct->c_type); } return 0; /* NOT REACHED */ }
static void dict_toggled(GtkWidget *widget, gpointer data) { gboolean active; gboolean button_active; int i; gint idx = GPOINTER_TO_INT(data); GtkTreeIter parent_iter; GtkTreeIter child_iter; LOG(LOG_DEBUG, "IN : dict_toggled(idx=%d)", idx); button_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); if(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(dict_store), &parent_iter) == TRUE){ do { gchar *title; gtk_tree_model_get(GTK_TREE_MODEL(dict_store), &parent_iter, DICT_TITLE_COLUMN, &title, DICT_ACTIVE_COLUMN, &active, -1); if(active == TRUE){ i = 0; if(gtk_tree_model_iter_children(GTK_TREE_MODEL(dict_store), &child_iter, &parent_iter) == TRUE){ do { if(i == idx) { gtk_tree_store_set(dict_store, &child_iter, DICT_ACTIVE_COLUMN, button_active, -1); goto END; } i ++; } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(dict_store), &child_iter) == TRUE); } } g_free(title); } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(dict_store), &parent_iter) == TRUE); } END: if(ebook_search_method() == SEARCH_METHOD_MULTI) show_multi(); save_dictgroup(); LOG(LOG_DEBUG, "OUT : dict_toggled()"); }
static gint group_changed (GtkWidget *combo){ const gchar *text; GtkTreeIter iter; LOG(LOG_DEBUG, "IN : group_changed()"); text = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo_group)->entry)); if(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(dict_store), &iter) == TRUE){ do { gchar *title; gtk_tree_model_get (GTK_TREE_MODEL(dict_store), &iter, DICT_TITLE_COLUMN, &title, -1); if(strcmp(title, text) == 0){ gtk_tree_store_set (dict_store, &iter, DICT_ACTIVE_COLUMN, TRUE, -1); } else { gtk_tree_store_set (dict_store, &iter, DICT_ACTIVE_COLUMN, FALSE, -1); } } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(dict_store), &iter) == TRUE); } update_dict_button(); save_dictgroup(); if(ebook_search_method() == SEARCH_METHOD_MULTI) show_multi(); LOG(LOG_DEBUG, "OUT : group_changed()"); return(FALSE); }