diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-06-21 05:34:27 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-06-21 05:34:27 +0800 |
commit | 402166be5496cfaf5ac5908702d74f02fce4c1e7 (patch) | |
tree | 845be52f9cf34df15d20510083e0d2041da1be44 /composer | |
parent | b1ec17309b2aafb9b8aa2e1e39be9748fbe89030 (diff) | |
download | gsoc2013-evolution-402166be5496cfaf5ac5908702d74f02fce4c1e7.tar.gz gsoc2013-evolution-402166be5496cfaf5ac5908702d74f02fce4c1e7.tar.zst gsoc2013-evolution-402166be5496cfaf5ac5908702d74f02fce4c1e7.zip |
Composer: Only hide single From account in express mode.
At least until we have another way to insert signatures.
Obvious solution: Insert -> Signature -> (list of your signatures)
Diffstat (limited to 'composer')
-rw-r--r-- | composer/e-composer-header-table.c | 88 | ||||
-rw-r--r-- | composer/e-composer-header-table.h | 9 | ||||
-rw-r--r-- | composer/e-composer-private.c | 5 |
3 files changed, 82 insertions, 20 deletions
diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c index 7a5d485933..4e1d5232a8 100644 --- a/composer/e-composer-header-table.c +++ b/composer/e-composer-header-table.c @@ -21,9 +21,10 @@ #include <glib/gi18n-lib.h> #include <libedataserverui/e-name-selector.h> -#include "e-util/e-binding.h" -#include "e-util/gconf-bridge.h" -#include "widgets/misc/e-signature-combo-box.h" +#include <shell/e-shell.h> +#include <e-util/e-binding.h> +#include <e-util/gconf-bridge.h> +#include <misc/e-signature-combo-box.h> #include "e-msg-composer.h" #include "e-composer-private.h" @@ -56,6 +57,7 @@ enum { PROP_DESTINATIONS_TO, PROP_POST_TO, PROP_REPLY_TO, + PROP_SHELL, PROP_SIGNATURE, PROP_SIGNATURE_LIST, PROP_SUBJECT @@ -67,6 +69,7 @@ struct _EComposerHeaderTablePrivate { GtkWidget *signature_label; GtkWidget *signature_combo_box; ENameSelector *name_selector; + EShell *shell; }; static gpointer parent_class; @@ -275,25 +278,25 @@ skip_custom: return new_destinations; } -static gint -count_from_accounts (EComposerHeaderTable *table) +static gboolean +from_header_should_be_visible (EComposerHeaderTable *table) { + EShell *shell; EComposerHeader *header; + EComposerHeaderType type; EAccountComboBox *combo_box; - header = e_composer_header_table_get_header (table, E_COMPOSER_HEADER_FROM); - combo_box = E_ACCOUNT_COMBO_BOX (header->input_widget); + shell = e_composer_header_table_get_shell (table); - return e_account_combo_box_count_displayed_accounts (combo_box); -} + /* Always display From in standard mode. */ + if (!e_shell_get_express_mode (shell)) + return TRUE; -static gboolean -from_header_should_be_visible (EComposerHeaderTable *table) -{ - gint num_accounts; + type = E_COMPOSER_HEADER_FROM; + header = e_composer_header_table_get_header (table, type); + combo_box = E_ACCOUNT_COMBO_BOX (header->input_widget); - num_accounts = count_from_accounts (table); - return (num_accounts > 1); + return (e_account_combo_box_count_displayed_accounts (combo_box) > 1); } static void @@ -501,6 +504,16 @@ composer_header_table_from_changed_cb (EComposerHeaderTable *table) composer_header_table_setup_mail_headers (table); } +static void +composer_header_table_set_shell (EComposerHeaderTable *table, + EShell *shell) +{ + g_return_if_fail (E_IS_SHELL (shell)); + g_return_if_fail (table->priv->shell == NULL); + + table->priv->shell = g_object_ref (shell); +} + static gint get_row_padding (void) { @@ -657,6 +670,12 @@ composer_header_table_set_property (GObject *object, g_value_get_string (value)); return; + case PROP_SHELL: + composer_header_table_set_shell ( + E_COMPOSER_HEADER_TABLE (object), + g_value_get_object (value)); + return; + case PROP_SIGNATURE: e_composer_header_table_set_signature ( E_COMPOSER_HEADER_TABLE (object), @@ -749,6 +768,13 @@ composer_header_table_get_property (GObject *object, E_COMPOSER_HEADER_TABLE (object))); return; + case PROP_SHELL: + g_value_set_object ( + value, + e_composer_header_table_get_shell ( + E_COMPOSER_HEADER_TABLE (object))); + return; + case PROP_SIGNATURE: g_value_set_object ( value, @@ -799,6 +825,11 @@ composer_header_table_dispose (GObject *object) priv->name_selector = NULL; } + if (priv->shell != NULL) { + g_object_unref (priv->shell); + priv->shell = NULL; + } + /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -916,6 +947,17 @@ composer_header_table_class_init (EComposerHeaderTableClass *class) g_object_class_install_property ( object_class, + PROP_SHELL, + g_param_spec_object ( + "shell", + NULL, + NULL, + E_TYPE_SHELL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property ( + object_class, PROP_SIGNATURE, g_param_spec_object ( "signature", @@ -1044,9 +1086,21 @@ e_composer_header_table_get_type (void) } GtkWidget * -e_composer_header_table_new (void) +e_composer_header_table_new (EShell *shell) +{ + g_return_val_if_fail (E_IS_SHELL (shell), NULL); + + return g_object_new ( + E_TYPE_COMPOSER_HEADER_TABLE, + "shell", shell, NULL); +} + +EShell * +e_composer_header_table_get_shell (EComposerHeaderTable *table) { - return g_object_new (E_TYPE_COMPOSER_HEADER_TABLE, NULL); + g_return_val_if_fail (E_IS_COMPOSER_HEADER_TABLE (table), NULL); + + return table->priv->shell; } EComposerHeader * diff --git a/composer/e-composer-header-table.h b/composer/e-composer-header-table.h index 9fe9f5bd23..856a8e2158 100644 --- a/composer/e-composer-header-table.h +++ b/composer/e-composer-header-table.h @@ -23,6 +23,8 @@ #include <libedataserver/e-account.h> #include <libedataserver/e-account-list.h> #include <libebook/e-destination.h> + +#include <shell/e-shell.h> #include <e-util/e-signature.h> #include <e-util/e-signature-list.h> @@ -75,8 +77,11 @@ struct _EComposerHeaderTableClass { }; GType e_composer_header_table_get_type (void); -GtkWidget * e_composer_header_table_new (void); -EComposerHeader * e_composer_header_table_get_header +GtkWidget * e_composer_header_table_new (EShell *shell); +EShell * e_composer_header_table_get_shell + (EComposerHeaderTable *table); +EComposerHeader * + e_composer_header_table_get_header (EComposerHeaderTable *table, EComposerHeaderType type); EAccount * e_composer_header_table_get_account diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c index 22b4565f4b..df29267805 100644 --- a/composer/e-composer-private.c +++ b/composer/e-composer-private.c @@ -127,6 +127,7 @@ void e_composer_private_constructed (EMsgComposer *composer) { EMsgComposerPrivate *priv = composer->priv; + EShell *shell; EFocusTracker *focus_tracker; GtkhtmlEditor *editor; GtkUIManager *ui_manager; @@ -145,6 +146,8 @@ e_composer_private_constructed (EMsgComposer *composer) html = gtkhtml_editor_get_html (editor); ui_manager = gtkhtml_editor_get_ui_manager (editor); + shell = e_shell_get_default (); + if (e_msg_composer_get_lite ()) { #if 0 /* In the lite composer, for small screens, we are not ready yet @@ -249,7 +252,7 @@ e_composer_private_constructed (EMsgComposer *composer) container = editor->vbox; - widget = e_composer_header_table_new (); + widget = e_composer_header_table_new (shell); gtk_container_set_border_width (GTK_CONTAINER (widget), 6); gtk_box_pack_start (GTK_BOX (editor->vbox), widget, FALSE, FALSE, 0); if (e_msg_composer_get_lite ()) |