diff options
-rw-r--r-- | plugins/imap-features/ChangeLog | 10 | ||||
-rw-r--r-- | plugins/imap-features/imap-headers.c | 20 | ||||
-rw-r--r-- | plugins/imap-features/imap-headers.glade | 464 |
3 files changed, 290 insertions, 204 deletions
diff --git a/plugins/imap-features/ChangeLog b/plugins/imap-features/ChangeLog index 9d0bf7c650..de7e9ec02a 100644 --- a/plugins/imap-features/ChangeLog +++ b/plugins/imap-features/ChangeLog @@ -1,3 +1,13 @@ +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 + 2007-05-14 Sankar P <psankar@novell.com> ** Committed on behalf of Xiurong Simon Zheng <simon.zheng@sun.com> 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); diff --git a/plugins/imap-features/imap-headers.glade b/plugins/imap-features/imap-headers.glade index 38c57cc495..986337e69d 100644 --- a/plugins/imap-features/imap-headers.glade +++ b/plugins/imap-features/imap-headers.glade @@ -20,144 +20,139 @@ <property name="urgency_hint">False</property> <child> - <widget class="GtkAlignment" id="alignment1"> + <widget class="GtkVBox" id="vbox2"> + <property name="border_width">6</property> <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">2</property> - <property name="right_padding">0</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> <child> - <widget class="GtkVBox" id="vbox2"> + <widget class="GtkFrame" id="frame1"> + <property name="border_width">6</property> <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">8</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> <child> - <widget class="GtkLabel" id="label4"> + <widget class="GtkAlignment" id="alignment1"> + <property name="border_width">6</property> <property name="visible">True</property> - <property name="label" translatable="yes"><b>IMAP Headers </b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> + <property name="yalign">0</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Select your IMAP Header Preferences. + <child> + <widget class="GtkVBox" id="vbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="label" translatable="yes">Select your IMAP Header Preferences. The more headers you have the more time it will take to download.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.070000000298</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> - <child> - <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="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> + <child> + <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="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> - <child> - <widget class="GtkRadioButton" id="basicHeaders"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Basic Headers - (Fastest) + <child> + <widget class="GtkRadioButton" id="basicHeaders"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Basic Headers - (Fastest) Use this if you do not have filters based on mailing lists</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">allHeaders</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">allHeaders</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> - <child> - <widget class="GtkRadioButton" id="mailingListHeaders"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Basic and _Mailing List Headers (Default)</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">allHeaders</property> + <child> + <widget class="GtkRadioButton" id="mailingListHeaders"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Basic and _Mailing List Headers (Default)</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">allHeaders</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> </child> <child> - <widget class="GtkLabel" id="label3"> + <widget class="GtkLabel" id="label2"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Custom Headers</b></property> + <property name="label" translatable="yes"><b>IMAP Headers</b></property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> - <property name="xalign">0</property> + <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> @@ -167,127 +162,194 @@ Use this if you do not have filters based on mailing lists</property> <property name="angle">0</property> </widget> <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="type">label_item</property> </packing> </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> - <child> - <widget class="GtkLabel" id="Custom Headers"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Give the extra headers that you need to fetch in addition to the above standard headers. -You can ignore this if you choose "All Headers".</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">True</property> - <property name="xalign">0.0799999982119</property> - <property name="yalign">0</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> + <child> + <widget class="GtkFrame" id="frame2"> + <property name="border_width">6</property> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> <child> - <widget class="GtkHBox" id="custHeaderHbox"> + <widget class="GtkAlignment" id="alignment2"> + <property name="border_width">6</property> <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">5</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTreeView" id="custHeaderTree"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">True</property> - <property name="rules_hint">False</property> - <property name="reorderable">False</property> - <property name="enable_search">True</property> - <property name="fixed_height_mode">False</property> - <property name="hover_selection">False</property> - <property name="hover_expand">False</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> <child> - <widget class="GtkVBox" id="vbox3"> + <widget class="GtkVBox" id="vbox4"> <property name="visible">True</property> <property name="homogeneous">False</property> - <property name="spacing">0</property> + <property name="spacing">6</property> <child> - <widget class="GtkButton" id="addHeader"> + <widget class="GtkLabel" id="Custom Headers"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label">gtk-add</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> + <property name="label" translatable="yes">Give the extra headers that you need to fetch in addition to the above standard headers. +You can ignore this if you choose "All Headers".</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> </widget> <packing> - <property name="padding">4</property> + <property name="padding">0</property> <property name="expand">False</property> - <property name="fill">False</property> + <property name="fill">True</property> </packing> </child> <child> - <widget class="GtkButton" id="removeHeader"> + <widget class="GtkHBox" id="custHeaderHbox"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-remove</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> + <property name="homogeneous">False</property> + <property name="spacing">5</property> + + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <widget class="GtkTreeView" id="custHeaderTree"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="headers_visible">False</property> + <property name="rules_hint">False</property> + <property name="reorderable">False</property> + <property name="enable_search">True</property> + <property name="fixed_height_mode">False</property> + <property name="hover_selection">False</property> + <property name="hover_expand">False</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox3"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkVButtonBox" id="vbuttonbox1"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkButton" id="addHeader"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-add</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + </widget> + </child> + + <child> + <widget class="GtkButton" id="removeHeader"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-remove</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">4</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> </widget> <packing> <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="expand">True</property> + <property name="fill">True</property> </packing> </child> </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> </child> </widget> + </child> + + <child> + <widget class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Custom Headers</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> + <property name="type">label_item</property> </packing> </child> </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> </child> </widget> </child> |