diff options
author | Milan Crha <mcrha@redhat.com> | 2009-08-06 02:03:51 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2009-08-06 02:03:51 +0800 |
commit | 91b219eac4e53c0f5440f0d08c77fc692b2ac02c (patch) | |
tree | 27a6fa16480fd5321f1c9408aa473b4b0d0c55ba /plugins | |
parent | af049df0c5451734101ff53c6dd1f6e11716bf58 (diff) | |
download | gsoc2013-evolution-91b219eac4e53c0f5440f0d08c77fc692b2ac02c.tar gsoc2013-evolution-91b219eac4e53c0f5440f0d08c77fc692b2ac02c.tar.gz gsoc2013-evolution-91b219eac4e53c0f5440f0d08c77fc692b2ac02c.tar.bz2 gsoc2013-evolution-91b219eac4e53c0f5440f0d08c77fc692b2ac02c.tar.lz gsoc2013-evolution-91b219eac4e53c0f5440f0d08c77fc692b2ac02c.tar.xz gsoc2013-evolution-91b219eac4e53c0f5440f0d08c77fc692b2ac02c.tar.zst gsoc2013-evolution-91b219eac4e53c0f5440f0d08c77fc692b2ac02c.zip |
Bug #401530 - [imap-features] imap-headers.glade issues
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/imap-features/imap-headers.c | 36 | ||||
-rw-r--r-- | plugins/imap-features/imap-headers.glade | 2 |
2 files changed, 25 insertions, 13 deletions
diff --git a/plugins/imap-features/imap-headers.c b/plugins/imap-features/imap-headers.c index 8ce7f3ec60..0154074498 100644 --- a/plugins/imap-features/imap-headers.c +++ b/plugins/imap-features/imap-headers.c @@ -186,32 +186,41 @@ static void epif_add_header (GtkButton *button, EPImapFeaturesData *ui) { GtkTreeModel *model; - GtkTreeIter iter, first; + GtkTreeIter iter; + GtkTreeSelection *selection; model = gtk_tree_view_get_model (ui->custom_headers_tree); gtk_tree_store_append (GTK_TREE_STORE(model), &iter, NULL); gtk_tree_store_set (GTK_TREE_STORE(model), &iter, 0, gtk_entry_get_text (ui->entry_header), -1); - if (gtk_tree_model_get_iter_first (model, &first)!=FALSE) - gtk_widget_set_sensitive (GTK_WIDGET (ui->remove_header), TRUE); + selection = gtk_tree_view_get_selection (ui->custom_headers_tree); + gtk_tree_selection_select_iter (selection, &iter); gtk_entry_set_text (ui->entry_header, ""); epif_add_sensitivity (ui); } static void +epif_tv_selection_changed (GtkTreeSelection *selection, GtkWidget *button) +{ + g_return_if_fail (selection != NULL); + g_return_if_fail (button != NULL); + + gtk_widget_set_sensitive (button, gtk_tree_selection_get_selected (selection, NULL, NULL)); +} + +static void epif_remove_header_clicked (GtkButton *button, EPImapFeaturesData *ui) { GtkTreeSelection *select; GtkTreeModel *model; - GtkTreeIter iter, first; + GtkTreeIter iter; GtkTreePath *path; gboolean valid = TRUE; select = gtk_tree_view_get_selection (ui->custom_headers_tree); - if (gtk_tree_selection_get_selected (select, &model, &iter)) - { + if (gtk_tree_selection_get_selected (select, &model, &iter)) { path = gtk_tree_model_get_path (model, &iter); gtk_tree_store_remove(GTK_TREE_STORE(model), &iter); @@ -225,9 +234,6 @@ epif_remove_header_clicked (GtkButton *button, EPImapFeaturesData *ui) gtk_tree_selection_select_iter (select, &iter); } - if (gtk_tree_model_get_iter_first (model, &first)==FALSE) - gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); - epif_add_sensitivity (ui); } @@ -258,7 +264,8 @@ org_gnome_imap_headers (EPlugin *epl, EConfigHookItemFactoryData *data) GladeXML *gladexml; GtkCellRenderer *renderer; GtkTreeViewColumn *column; - GtkTreeIter first, iter; + GtkTreeIter iter; + GtkTreeSelection *selection; gboolean use_imap = g_getenv ("USE_IMAP") != NULL; ui = g_new0 (EPImapFeaturesData, 1); @@ -288,6 +295,8 @@ org_gnome_imap_headers (EPlugin *epl, EConfigHookItemFactoryData *data) ui->store = gtk_tree_store_new (1, G_TYPE_STRING); gtk_tree_view_set_model (ui->custom_headers_tree, GTK_TREE_MODEL(ui->store)); + selection = gtk_tree_view_get_selection (ui->custom_headers_tree); + if (url) { gchar *custom_headers; @@ -300,6 +309,9 @@ org_gnome_imap_headers (EPlugin *epl, EConfigHookItemFactoryData *data) if (strlen(g_strstrip(ui->custom_headers_array[i]))) { gtk_tree_store_append (ui->store, &iter, NULL); gtk_tree_store_set (ui->store, &iter, 0, ui->custom_headers_array[i], -1); + + if (i == 0) + gtk_tree_selection_select_iter (selection, &iter); } i++; } @@ -321,14 +333,14 @@ org_gnome_imap_headers (EPlugin *epl, EConfigHookItemFactoryData *data) gtk_tree_view_append_column (ui->custom_headers_tree , column); gtk_widget_set_sensitive (GTK_WIDGET (ui->add_header), FALSE); - if (gtk_tree_model_get_iter_first (gtk_tree_view_get_model (ui->custom_headers_tree), &first)==FALSE) - gtk_widget_set_sensitive (GTK_WIDGET (ui->remove_header), FALSE); + epif_tv_selection_changed (selection, GTK_WIDGET (ui->remove_header)); g_signal_connect (ui->all_headers, "toggled", G_CALLBACK (epif_fetch_all_headers_toggled), ui); g_signal_connect (ui->add_header, "clicked", G_CALLBACK (epif_add_header), ui); g_signal_connect (ui->remove_header, "clicked", G_CALLBACK (epif_remove_header_clicked), ui); g_signal_connect (ui->entry_header, "changed", G_CALLBACK (epif_entry_changed), ui); g_signal_connect (ui->entry_header, "activate", G_CALLBACK (epif_add_header), ui); + g_signal_connect (selection, "changed", G_CALLBACK (epif_tv_selection_changed), ui->remove_header); gtk_notebook_append_page ((GtkNotebook *)(data->parent), vbox, gtk_label_new(_("IMAP Headers"))); gtk_widget_show_all (vbox); diff --git a/plugins/imap-features/imap-headers.glade b/plugins/imap-features/imap-headers.glade index 3a8810147e..85ca962a9c 100644 --- a/plugins/imap-features/imap-headers.glade +++ b/plugins/imap-features/imap-headers.glade @@ -83,7 +83,7 @@ The more headers you have the more time it will take to download.</property> <widget class="GtkRadioButton" id="allHeaders"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Fetch A_ll Headers</property> + <property name="label" translatable="yes">_Fetch All Headers</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> |