diff options
author | Sankar P <psankar@novell.com> | 2007-07-09 13:32:40 +0800 |
---|---|---|
committer | Sankarasivasubramanian Pasupathilingam <psankar@src.gnome.org> | 2007-07-09 13:32:40 +0800 |
commit | 5f751d21a4eceace423ab945fbe0703c1b721d22 (patch) | |
tree | a45b93296fbae457122939d5a576c8bbcfc4230e /plugins/imap-features/imap-headers.c | |
parent | c5d5b30780fd85d6e143acbd170a2bab9d6bd5a9 (diff) | |
download | gsoc2013-evolution-5f751d21a4eceace423ab945fbe0703c1b721d22.tar.gz gsoc2013-evolution-5f751d21a4eceace423ab945fbe0703c1b721d22.tar.zst gsoc2013-evolution-5f751d21a4eceace423ab945fbe0703c1b721d22.zip |
Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr>
2007-07-09 Sankar P <psankar@novell.com>
* Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr>
* imap-headers.c: (add_header_clicked), (remove_header_clicked),
(org_gnome_imap_headers):
* imap-headers.glade:
HIGify. Disable the Delete button when there are no headers.
See bug #437892
svn path=/trunk/; revision=33778
Diffstat (limited to 'plugins/imap-features/imap-headers.c')
-rw-r--r-- | plugins/imap-features/imap-headers.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/plugins/imap-features/imap-headers.c b/plugins/imap-features/imap-headers.c index 54d400fed2..2c190297a2 100644 --- a/plugins/imap-features/imap-headers.c +++ b/plugins/imap-features/imap-headers.c @@ -30,6 +30,7 @@ #include <mail/mail-config.h> #include <gtk/gtkwidget.h> +#include <gtk/gtktreemodel.h> #include <gtk/gtk.h> #include <libedataserver/e-account.h> @@ -127,7 +128,7 @@ add_header_clicked (GtkButton *button) GtkDialog *dialog; GtkEntry *header; GtkTreeModel *model; - GtkTreeIter iter; + GtkTreeIter iter, first; gint result; dialog = GTK_DIALOG (gtk_dialog_new_with_buttons (_("Custom Header"), @@ -143,15 +144,20 @@ add_header_clicked (GtkButton *button) gtk_dialog_set_default_response (dialog, GTK_RESPONSE_ACCEPT); gtk_widget_show_all (GTK_WIDGET(dialog)); result = gtk_dialog_run (GTK_DIALOG (dialog)); + model = gtk_tree_view_get_model (custom_headers_tree); + switch (result) { case GTK_RESPONSE_ACCEPT: - model = gtk_tree_view_get_model (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 (header), -1); break; } + gtk_widget_destroy (GTK_WIDGET(dialog)); + + if (gtk_tree_model_get_iter_first (model, &first)==FALSE) + gtk_widget_set_sensitive (GTK_WIDGET (button), TRUE); } static void @@ -159,7 +165,7 @@ remove_header_clicked (GtkButton *button) { GtkTreeSelection *select; GtkTreeModel *model; - GtkTreeIter iter; + GtkTreeIter iter, first; select = gtk_tree_view_get_selection (custom_headers_tree); @@ -167,6 +173,10 @@ remove_header_clicked (GtkButton *button) { gtk_tree_store_remove(GTK_TREE_STORE(model), &iter); } + + + if (gtk_tree_model_get_iter_first (model, &first)==FALSE) + gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); } static void @@ -191,6 +201,7 @@ org_gnome_imap_headers (EPlugin *epl, EConfigHookItemFactoryData *data) GladeXML *gladexml; GtkCellRenderer *renderer; GtkTreeViewColumn *column; + GtkTreeIter first; target_account = (EMConfigTargetAccount *)data->config->target; account = target_account->account; @@ -245,6 +256,9 @@ org_gnome_imap_headers (EPlugin *epl, EConfigHookItemFactoryData *data) column = gtk_tree_view_column_new_with_attributes (_("Custom Headers"), renderer, "text", 0, NULL); gtk_tree_view_append_column (custom_headers_tree , column); + if (gtk_tree_model_get_iter_first (gtk_tree_view_get_model (custom_headers_tree), &first)==FALSE) + gtk_widget_set_sensitive (GTK_WIDGET (remove_header), FALSE); + g_signal_connect (all_headers, "toggled", G_CALLBACK(fetch_all_headers_toggled), NULL); g_signal_connect (add_header, "clicked", G_CALLBACK(add_header_clicked), NULL); g_signal_connect (remove_header, "clicked", G_CALLBACK(remove_header_clicked), NULL); |