diff options
author | Michael Meeks <michael.meeks@novell.com> | 2010-05-10 22:41:28 +0800 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2010-05-10 22:41:28 +0800 |
commit | 8be2a0df7dfa830f9bfeeecfdf5551f1bbe1bd0a (patch) | |
tree | d1a716b433e5ba893e57eb2be2f8e842e6608e12 | |
parent | 476ad289ef964173b4d8d9c7cbc9b737675a5c4e (diff) | |
parent | 20cb61bd444cc8db3c1188b15af99886c84c140e (diff) | |
download | gsoc2013-evolution-8be2a0df7dfa830f9bfeeecfdf5551f1bbe1bd0a.tar.gz gsoc2013-evolution-8be2a0df7dfa830f9bfeeecfdf5551f1bbe1bd0a.tar.zst gsoc2013-evolution-8be2a0df7dfa830f9bfeeecfdf5551f1bbe1bd0a.zip |
Merge commit 'origin/express2' into express2
-rw-r--r-- | composer/e-composer-actions.c | 8 | ||||
-rw-r--r-- | composer/e-composer-actions.h | 2 | ||||
-rw-r--r-- | composer/e-composer-from-header.c | 10 | ||||
-rw-r--r-- | composer/e-composer-from-header.h | 3 | ||||
-rw-r--r-- | composer/e-composer-header-table.c | 134 | ||||
-rw-r--r-- | composer/e-composer-header.c | 107 | ||||
-rw-r--r-- | composer/e-composer-header.h | 3 | ||||
-rw-r--r-- | composer/e-composer-name-header.c | 32 | ||||
-rw-r--r-- | composer/e-composer-name-header.h | 8 | ||||
-rw-r--r-- | composer/e-composer-private.c | 23 | ||||
-rw-r--r-- | composer/e-composer-text-header.c | 22 | ||||
-rw-r--r-- | composer/e-composer-text-header.h | 4 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 34 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 3 | ||||
-rw-r--r-- | composer/evolution-composer.ui | 1 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 34 | ||||
-rw-r--r-- | mail/em-composer-utils.h | 1 | ||||
-rw-r--r-- | mail/evolution-mail.schemas.in | 15 | ||||
-rw-r--r-- | widgets/misc/e-account-combo-box.c | 22 | ||||
-rw-r--r-- | widgets/misc/e-account-combo-box.h | 2 |
20 files changed, 146 insertions, 322 deletions
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c index 0c1a28b130..70f7c44ed9 100644 --- a/composer/e-composer-actions.c +++ b/composer/e-composer-actions.c @@ -420,14 +420,6 @@ static GtkToggleActionEntry toggle_entries[] = { NULL, /* Handled by property bindings */ FALSE }, - { "view-from", - NULL, - N_("_From Field"), - NULL, - N_("Toggles whether the From chooser is displayed"), - NULL, /* Handled by property bindings */ - FALSE }, - { "view-reply-to", NULL, N_("_Reply-To Field"), diff --git a/composer/e-composer-actions.h b/composer/e-composer-actions.h index 18c75eb3be..80147a8f24 100644 --- a/composer/e-composer-actions.h +++ b/composer/e-composer-actions.h @@ -57,8 +57,6 @@ E_COMPOSER_ACTION ((composer), "view-bcc") #define E_COMPOSER_ACTION_VIEW_CC(composer) \ E_COMPOSER_ACTION ((composer), "view-cc") -#define E_COMPOSER_ACTION_VIEW_FROM(composer) \ - E_COMPOSER_ACTION ((composer), "view-from") #define E_COMPOSER_ACTION_VIEW_REPLY_TO(composer) \ E_COMPOSER_ACTION ((composer), "view-reply-to") diff --git a/composer/e-composer-from-header.c b/composer/e-composer-from-header.c index cade5bfed3..4dadfa7ac7 100644 --- a/composer/e-composer-from-header.c +++ b/composer/e-composer-from-header.c @@ -110,16 +110,6 @@ e_composer_from_header_new (const gchar *label) "button", FALSE, NULL); } -EComposerHeader * -e_composer_from_header_new_with_action (const gchar *label, - const gchar *action) -{ - return g_object_new ( - E_TYPE_COMPOSER_FROM_HEADER, "label", label, - "button", FALSE, "addaction_text", action, - "addaction", action != NULL, NULL); -} - EAccountList * e_composer_from_header_get_account_list (EComposerFromHeader *header) { diff --git a/composer/e-composer-from-header.h b/composer/e-composer-from-header.h index 9f9a0e0f82..d2603bd664 100644 --- a/composer/e-composer-from-header.h +++ b/composer/e-composer-from-header.h @@ -63,9 +63,6 @@ struct _EComposerFromHeaderClass { GType e_composer_from_header_get_type (void); EComposerHeader * e_composer_from_header_new (const gchar *label); -EComposerHeader * e_composer_from_header_new_with_action - (const gchar *label, - const gchar *action); EAccountList * e_composer_from_header_get_account_list (EComposerFromHeader *header); void e_composer_from_header_set_account_list diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c index f62dc376fd..b7f2e8e437 100644 --- a/composer/e-composer-header-table.c +++ b/composer/e-composer-header-table.c @@ -26,14 +26,13 @@ #include "e-util/gconf-bridge.h" #include "widgets/misc/e-signature-combo-box.h" +#include "e-msg-composer.h" #include "e-composer-private.h" #include "e-composer-from-header.h" #include "e-composer-name-header.h" #include "e-composer-post-header.h" #include "e-composer-text-header.h" -extern gboolean composer_lite; - #define E_COMPOSER_HEADER_TABLE_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_COMPOSER_HEADER_TABLE, EComposerHeaderTablePrivate)) @@ -69,7 +68,6 @@ struct _EComposerHeaderTablePrivate { GtkWidget *signature_label; GtkWidget *signature_combo_box; ENameSelector *name_selector; - GtkHBox *actions_container; }; static gpointer parent_class; @@ -159,11 +157,7 @@ composer_header_table_notify_header (EComposerHeader *header, { GtkWidget *parent; - if (composer_lite && strcmp (property_name, "destinations-to") == 0) - parent = g_object_get_data ( - G_OBJECT (header->input_widget), "parent"); - else - parent = gtk_widget_get_parent (header->input_widget); + parent = gtk_widget_get_parent (header->input_widget); g_return_if_fail (E_IS_COMPOSER_HEADER_TABLE (parent)); g_object_notify (G_OBJECT (parent), property_name); } @@ -174,7 +168,7 @@ composer_header_table_notify_widget (GtkWidget *widget, { GtkWidget *parent; - if (composer_lite) { + if (e_msg_composer_get_lite ()) { parent = gtk_widget_get_parent (widget); parent = g_object_get_data (G_OBJECT (parent), "pdata"); } else @@ -282,6 +276,27 @@ skip_custom: return new_destinations; } +static int +count_from_accounts (EComposerHeaderTable *table) +{ + EComposerHeader *header; + EAccountComboBox *combo_box; + + header = e_composer_header_table_get_header (table, E_COMPOSER_HEADER_FROM); + combo_box = E_ACCOUNT_COMBO_BOX (header->input_widget); + + return e_account_combo_box_count_displayed_accounts (combo_box); +} + +static gboolean +from_header_should_be_visible (EComposerHeaderTable *table) +{ + int num_accounts; + + num_accounts = count_from_accounts (table); + return (num_accounts > 1); +} + static void composer_header_table_setup_mail_headers (EComposerHeaderTable *table) { @@ -294,6 +309,8 @@ composer_header_table_setup_mail_headers (EComposerHeaderTable *table) EComposerHeader *header; const gchar *key; guint binding_id; + gboolean sensitive; + gboolean visible; binding_id = table->priv->gconf_bindings[ii]; header = e_composer_header_table_get_header (table, ii); @@ -310,10 +327,6 @@ composer_header_table_setup_mail_headers (EComposerHeaderTable *table) key = COMPOSER_GCONF_PREFIX "/show_mail_cc"; break; - case E_COMPOSER_HEADER_FROM: - key = COMPOSER_GCONF_PREFIX "/show_mail_from"; - break; - case E_COMPOSER_HEADER_REPLY_TO: key = COMPOSER_GCONF_PREFIX "/show_mail_reply_to"; break; @@ -324,22 +337,29 @@ composer_header_table_setup_mail_headers (EComposerHeaderTable *table) } switch (ii) { + case E_COMPOSER_HEADER_FROM: + sensitive = TRUE; + visible = from_header_should_be_visible (table); + break; + case E_COMPOSER_HEADER_BCC: case E_COMPOSER_HEADER_CC: - case E_COMPOSER_HEADER_FROM: case E_COMPOSER_HEADER_REPLY_TO: case E_COMPOSER_HEADER_SUBJECT: case E_COMPOSER_HEADER_TO: - e_composer_header_set_sensitive (header, TRUE); - e_composer_header_set_visible (header, TRUE); + sensitive = TRUE; + visible = TRUE; break; default: - e_composer_header_set_sensitive (header, FALSE); - e_composer_header_set_visible (header, FALSE); + sensitive = FALSE; + visible = FALSE; break; } + e_composer_header_set_sensitive (header, sensitive); + e_composer_header_set_visible (header, visible); + if (key != NULL) binding_id = gconf_bridge_bind_property ( bridge, key, G_OBJECT (header), "visible"); @@ -482,6 +502,17 @@ composer_header_table_from_changed_cb (EComposerHeaderTable *table) composer_header_table_setup_mail_headers (table); } +static int +get_row_padding (void) +{ + /* For small screens, make the header-table's rows be packed closely together */ + + if (e_msg_composer_get_lite ()) + return 0; + else + return 3; +} + static GObject * composer_header_table_constructor (GType type, guint n_construct_properties, @@ -490,6 +521,7 @@ composer_header_table_constructor (GType type, GObject *object; EComposerHeaderTablePrivate *priv; guint rows, ii; + int row_padding; /* Chain up to parent's constructor() method. */ object = G_OBJECT_CLASS (parent_class)->constructor ( @@ -505,45 +537,18 @@ composer_header_table_constructor (GType type, /* Use "ypadding" instead of "row-spacing" because some rows may * be invisible and we don't want spacing around them. */ + row_padding = get_row_padding (); + for (ii = 0; ii < rows; ii++) { gtk_table_attach ( GTK_TABLE (object), priv->headers[ii]->title_widget, - 0, 1, ii, ii + 1, GTK_FILL, GTK_FILL, 0, 3); - if (composer_lite && ii == E_COMPOSER_HEADER_TO) { - GtkWidget *box = gtk_hbox_new (FALSE, 0); - g_object_set_data ( - G_OBJECT (priv->headers[ii]->input_widget), - "parent", object); - gtk_box_pack_start ( - GTK_BOX (box), priv->headers[ii]->input_widget, - TRUE, TRUE, 3); - gtk_box_pack_start ( - GTK_BOX (box), - GTK_WIDGET (priv->actions_container), - FALSE, FALSE, 0); - gtk_widget_show (box); - gtk_table_attach ( - GTK_TABLE (object), box, 1, 4, ii, ii + 1, - GTK_FILL | GTK_EXPAND, 0, 0, 3); - - } else { - gtk_table_attach ( - GTK_TABLE (object), - priv->headers[ii]->input_widget, 1, 4, - ii, ii + 1, GTK_FILL | GTK_EXPAND, 0, 0, 3); - } - if (composer_lite && priv->headers[ii]->action_widget) { - /* Pack the widgets to the end. Helps formatting - * when hiding the From field. */ - gtk_box_pack_end ( - GTK_BOX (priv->actions_container), - priv->headers[ii]->action_widget, - FALSE, FALSE, 6); - } + 0, 1, ii, ii + 1, GTK_FILL, GTK_FILL, 0, row_padding); + gtk_table_attach ( + GTK_TABLE (object), + priv->headers[ii]->input_widget, 1, 4, + ii, ii + 1, GTK_FILL | GTK_EXPAND, 0, 0, row_padding); } - if (composer_lite) - gtk_widget_show_all ((GtkWidget *)priv->actions_container); ii = E_COMPOSER_HEADER_FROM; /* Leave room in the "From" row for signature stuff. */ @@ -561,13 +566,13 @@ composer_header_table_constructor (GType type, priv->signature_combo_box, "visible"); /* Now add the signature stuff. */ - if (!composer_lite) { + if (!e_msg_composer_get_lite ()) { gtk_table_attach ( GTK_TABLE (object), priv->signature_label, - 2, 3, ii, ii + 1, 0, 0, 0, 3); + 2, 3, ii, ii + 1, 0, 0, 0, row_padding); gtk_table_attach ( GTK_TABLE (object), priv->signature_combo_box, - 3, 4, ii, ii + 1, composer_lite ? GTK_FILL: 0, 0, 0, 3); + 3, 4, ii, ii + 1, e_msg_composer_get_lite () ? GTK_FILL: 0, 0, 0, row_padding); } else { GtkWidget *box = gtk_hbox_new (FALSE, 0); @@ -580,7 +585,7 @@ composer_header_table_constructor (GType type, g_object_set_data (G_OBJECT (box), "pdata", object); gtk_table_attach ( GTK_TABLE (object), box, - 3, 4, ii, ii + 1, GTK_FILL, 0, 0, 3); + 3, 4, ii, ii + 1, GTK_FILL, 0, 0, row_padding); gtk_widget_hide (box); } @@ -954,9 +959,7 @@ composer_header_table_init (EComposerHeaderTable *table) name_selector = e_name_selector_new (); table->priv->name_selector = name_selector; - table->priv->actions_container = (GtkHBox *)gtk_hbox_new (FALSE, 6); - - header = e_composer_from_header_new_with_action (_("Fr_om:"), _("From")); + header = e_composer_from_header_new (_("Fr_om:")); composer_header_table_bind_header ("account", "changed", header); composer_header_table_bind_header ("account-list", "refreshed", header); composer_header_table_bind_header ("account-name", "changed", header); @@ -965,24 +968,21 @@ composer_header_table_init (EComposerHeaderTable *table) composer_header_table_from_changed_cb), table); table->priv->headers[E_COMPOSER_HEADER_FROM] = header; - header = e_composer_text_header_new_label (_("_Reply-To:"), ""); + header = e_composer_text_header_new_label (_("_Reply-To:")); composer_header_table_bind_header ("reply-to", "changed", header); table->priv->headers[E_COMPOSER_HEADER_REPLY_TO] = header; - header = e_composer_name_header_new_with_label ( - _("_To:"), name_selector); + header = e_composer_name_header_new (_("_To:"), name_selector); e_composer_header_set_input_tooltip (header, HEADER_TOOLTIP_TO); composer_header_table_bind_header ("destinations-to", "changed", header); table->priv->headers[E_COMPOSER_HEADER_TO] = header; - header = e_composer_name_header_new_with_action ( - _("_Cc:"), _("CC"), name_selector); + header = e_composer_name_header_new (_("_Cc:"), name_selector); e_composer_header_set_input_tooltip (header, HEADER_TOOLTIP_CC); composer_header_table_bind_header ("destinations-cc", "changed", header); table->priv->headers[E_COMPOSER_HEADER_CC] = header; - header = e_composer_name_header_new_with_action ( - _("_Bcc:"), _("BCC"), name_selector); + header = e_composer_name_header_new (_("_Bcc:"), name_selector); e_composer_header_set_input_tooltip (header, HEADER_TOOLTIP_BCC); composer_header_table_bind_header ("destinations-bcc", "changed", header); table->priv->headers[E_COMPOSER_HEADER_BCC] = header; @@ -991,7 +991,7 @@ composer_header_table_init (EComposerHeaderTable *table) composer_header_table_bind_header ("post-to", "changed", header); table->priv->headers[E_COMPOSER_HEADER_POST_TO] = header; - header = e_composer_text_header_new_label (_("S_ubject:"), NULL); + header = e_composer_text_header_new_label (_("S_ubject:")); composer_header_table_bind_header ("subject", "changed", header); table->priv->headers[E_COMPOSER_HEADER_SUBJECT] = header; diff --git a/composer/e-composer-header.c b/composer/e-composer-header.c index 2a6942acd8..4c968d43d8 100644 --- a/composer/e-composer-header.c +++ b/composer/e-composer-header.c @@ -32,8 +32,6 @@ enum { PROP_0, PROP_BUTTON, PROP_LABEL, - PROP_ADDACTION, - PROP_ADDACTION_TEXT, PROP_SENSITIVE, PROP_VISIBLE }; @@ -47,8 +45,6 @@ enum { struct _EComposerHeaderPrivate { gchar *label; gboolean button; - gchar *addaction_text; - gboolean addaction; /*For Add button.*/ GtkWidget *action_label; GtkWidget *add_icon; @@ -71,15 +67,6 @@ composer_header_button_clicked_cb (GtkButton *button, g_signal_emit (header, signal_ids[CLICKED], 0); } -static void -composer_header_addaction_clicked_cb (GtkButton *button, - EComposerHeader *header) -{ - gboolean show = !e_composer_header_get_visible(header); - - e_composer_header_set_visible (header, show); -} - static GObject * composer_header_constructor (GType type, guint n_construct_properties, @@ -88,6 +75,7 @@ composer_header_constructor (GType type, GObject *object; GtkWidget *widget; EComposerHeader *header; + GtkWidget *label; /* Chain up to parent's constructor() method. */ object = G_OBJECT_CLASS (parent_class)->constructor ( @@ -102,51 +90,16 @@ composer_header_constructor (GType type, widget, "clicked", G_CALLBACK (composer_header_button_clicked_cb), header); + label = gtk_bin_get_child (GTK_BIN (widget)); } else { widget = gtk_label_new_with_mnemonic (header->priv->label); - gtk_label_set_mnemonic_widget ( - GTK_LABEL (widget), header->input_widget); + gtk_label_set_mnemonic_widget (GTK_LABEL (widget), header->input_widget); + label = widget; } + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + header->priv->action_label = NULL; - if (header->priv->addaction) { - GtkWidget *box, *tmp; - gchar *str; - - header->priv->action_label = gtk_label_new (NULL); - header->action_widget = gtk_button_new (); - box = gtk_hbox_new (FALSE, 0); - tmp = gtk_image_new_from_stock ( - GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON); - header->priv->add_icon = tmp; - gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 3); - tmp = gtk_image_new_from_stock ( - GTK_STOCK_REMOVE, GTK_ICON_SIZE_BUTTON); - header->priv->remove_icon = tmp; - gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 3); - tmp = gtk_label_new (NULL); - str = g_strdup_printf ( - "<span>%s %s</span>", _("Show"), - header->priv->addaction_text); - gtk_label_set_markup((GtkLabel *)tmp, str); - g_free (str); - header->priv->show_label = tmp; - gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 3); - tmp = gtk_label_new (NULL); - str = g_strdup_printf ( - "<span>%s %s</span>", _("Hide"), - header->priv->addaction_text); - gtk_label_set_markup((GtkLabel *)tmp, str); - header->priv->hide_label = tmp; - gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 3); - - gtk_container_add((GtkContainer *)header->action_widget, box); - gtk_widget_show_all(header->action_widget); - g_signal_connect ( - header->action_widget, "clicked", - G_CALLBACK (composer_header_addaction_clicked_cb), - header); - } header->title_widget = g_object_ref_sink (widget); @@ -171,14 +124,6 @@ composer_header_set_property (GObject *object, priv->button = g_value_get_boolean (value); return; - case PROP_ADDACTION: /* construct only */ - priv->addaction = g_value_get_boolean (value); - return; - - case PROP_ADDACTION_TEXT:/* construct only */ - priv->addaction_text = g_value_dup_string (value); - return; - case PROP_LABEL: /* construct only */ priv->label = g_value_dup_string (value); return; @@ -199,15 +144,6 @@ composer_header_set_property (GObject *object, G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } -void -e_composer_header_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - composer_header_set_property (object, property_id, value, pspec); -} - static void composer_header_get_property (GObject *object, guint property_id, @@ -223,15 +159,6 @@ composer_header_get_property (GObject *object, g_value_set_boolean (value, priv->button); return; - case PROP_ADDACTION: /* construct only */ - g_value_set_boolean (value, priv->button); - return; - - case PROP_ADDACTION_TEXT: /* construct only */ - g_value_take_string ( - value, priv->addaction_text); - return; - case PROP_LABEL: /* construct only */ g_value_take_string ( value, e_composer_header_get_label ( @@ -300,28 +227,6 @@ composer_header_class_init (EComposerHeaderClass *class) g_object_class_install_property ( object_class, - PROP_ADDACTION, - g_param_spec_boolean ( - "addaction", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - - g_object_class_install_property ( - object_class, - PROP_ADDACTION_TEXT, - g_param_spec_string ( - "addaction_text", - NULL, - NULL, - NULL, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - - g_object_class_install_property ( - object_class, PROP_LABEL, g_param_spec_string ( "label", diff --git a/composer/e-composer-header.h b/composer/e-composer-header.h index 33600900e9..971b55968c 100644 --- a/composer/e-composer-header.h +++ b/composer/e-composer-header.h @@ -49,7 +49,6 @@ struct _EComposerHeader { GObject parent; GtkWidget *title_widget; GtkWidget *input_widget; - GtkWidget *action_widget; EComposerHeaderPrivate *priv; }; @@ -69,8 +68,6 @@ void e_composer_header_set_sensitive (EComposerHeader *header, gboolean e_composer_header_get_visible (EComposerHeader *header); void e_composer_header_set_visible (EComposerHeader *header, gboolean visible); -void e_composer_header_set_property (GObject *object, guint property_id, - const GValue *value, GParamSpec *pspec); void e_composer_header_set_title_tooltip (EComposerHeader *header, const gchar *tooltip); diff --git a/composer/e-composer-name-header.c b/composer/e-composer-name-header.c index 658e7cc292..39e079a790 100644 --- a/composer/e-composer-name-header.c +++ b/composer/e-composer-name-header.c @@ -292,33 +292,11 @@ e_composer_name_header_new (const gchar *label, { g_return_val_if_fail (E_IS_NAME_SELECTOR (name_selector), NULL); - return g_object_new ( - E_TYPE_COMPOSER_NAME_HEADER, "label", label, - "button", !e_msg_composer_get_lite(), "name-selector", name_selector, NULL); -} - -EComposerHeader * -e_composer_name_header_new_with_label (const gchar *label, - ENameSelector *name_selector) -{ - return g_object_new ( - E_TYPE_COMPOSER_NAME_HEADER, "label", label, - "button", !e_msg_composer_get_lite(), "name-selector", name_selector, - "addaction", FALSE, "visible", TRUE, NULL); -} - -EComposerHeader * -e_composer_name_header_new_with_action (const gchar *label, - const gchar *action_label, - ENameSelector *name_selector) -{ - g_return_val_if_fail (E_IS_NAME_SELECTOR (name_selector), NULL); - - return g_object_new ( - E_TYPE_COMPOSER_NAME_HEADER, "label", label, - "button", !e_msg_composer_get_lite(), "name-selector", name_selector, - "addaction_text", action_label, - "addaction", action_label != NULL, NULL); + return g_object_new (E_TYPE_COMPOSER_NAME_HEADER, + "label", label, + "button", TRUE, + "name-selector", name_selector, + NULL); } ENameSelector * diff --git a/composer/e-composer-name-header.h b/composer/e-composer-name-header.h index 100d6c8980..785f7d11e8 100644 --- a/composer/e-composer-name-header.h +++ b/composer/e-composer-name-header.h @@ -62,14 +62,6 @@ struct _EComposerNameHeaderClass { GType e_composer_name_header_get_type (void); EComposerHeader * e_composer_name_header_new (const gchar *label, ENameSelector *name_selector); -/*No button. Just a label.*/ -EComposerHeader * e_composer_name_header_new_with_label (const gchar *label, - ENameSelector *name_selector); - -/*No button. Label with a Link button for show/hide.*/ -EComposerHeader * e_composer_name_header_new_with_action (const gchar *label, - const gchar *action, - ENameSelector *name_selector); ENameSelector * e_composer_name_header_get_name_selector (EComposerNameHeader *header); diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c index b48f9b6cdf..5fbf7cdb86 100644 --- a/composer/e-composer-private.c +++ b/composer/e-composer-private.c @@ -145,9 +145,18 @@ e_composer_private_constructed (EMsgComposer *composer) html = gtkhtml_editor_get_html (editor); ui_manager = gtkhtml_editor_get_ui_manager (editor); - if (composer->lite) { + if (e_msg_composer_get_lite ()) { +#if 0 + /* In the lite composer, for small screens, we are not ready yet + * to hide the menubar. It still has useful items like the ones + * to show/hide the various header fields, plus the security options. + * + * When we move those options out of the menu and into the composer's + * toplevel, we can probably get rid of the menu. + */ widget = gtkhtml_editor_get_managed_widget (editor, "/main-menu"); gtk_widget_hide (widget); +#endif widget = gtkhtml_editor_get_managed_widget (editor, "/main-toolbar"); gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ); gtk_widget_hide (widget); @@ -243,8 +252,8 @@ e_composer_private_constructed (EMsgComposer *composer) widget = e_composer_header_table_new (); gtk_container_set_border_width (GTK_CONTAINER (widget), 6); gtk_box_pack_start (GTK_BOX (editor->vbox), widget, FALSE, FALSE, 0); - if (composer->lite) - gtk_box_reorder_child (GTK_BOX (editor->vbox), widget, 0); + if (e_msg_composer_get_lite ()) + gtk_box_reorder_child (GTK_BOX (editor->vbox), widget, 1); else gtk_box_reorder_child (GTK_BOX (editor->vbox), widget, 2); @@ -253,7 +262,7 @@ e_composer_private_constructed (EMsgComposer *composer) /* Construct the attachment paned. */ - if (composer->lite) { + if (e_msg_composer_get_lite ()) { e_attachment_paned_set_default_height (75); /* short attachment bar for Anjal */ e_attachment_icon_view_set_default_icon_size (GTK_ICON_SIZE_BUTTON); } @@ -262,7 +271,7 @@ e_composer_private_constructed (EMsgComposer *composer) priv->attachment_paned = g_object_ref (widget); gtk_widget_show (widget); - if (composer->lite) { + if (e_msg_composer_get_lite ()) { GtkWidget *tmp, *tmp1, *tmp_box, *container; GtkWidget *combo; @@ -351,10 +360,6 @@ e_composer_private_constructed (EMsgComposer *composer) action = ACTION (VIEW_CC); break; - case E_COMPOSER_HEADER_FROM: - action = ACTION (VIEW_FROM); - break; - case E_COMPOSER_HEADER_REPLY_TO: action = ACTION (VIEW_REPLY_TO); break; diff --git a/composer/e-composer-text-header.c b/composer/e-composer-text-header.c index e765237a2d..efbf141cea 100644 --- a/composer/e-composer-text-header.c +++ b/composer/e-composer-text-header.c @@ -108,23 +108,21 @@ e_composer_text_header_get_type (void) } EComposerHeader * -e_composer_text_header_new_label (const gchar *label, const gchar *action_label) +e_composer_text_header_new_label (const gchar *label) { - return g_object_new ( - E_TYPE_COMPOSER_TEXT_HEADER, "label", label, - "button", FALSE, "addaction", action_label && *action_label, - "addaction_text", action_label, - "visible", action_label == NULL, NULL); + return g_object_new (E_TYPE_COMPOSER_TEXT_HEADER, + "label", label, + "button", FALSE, + NULL); } EComposerHeader * -e_composer_text_header_new_button (const gchar *label, const gchar *action_label) +e_composer_text_header_new_button (const gchar *label) { - return g_object_new ( - E_TYPE_COMPOSER_TEXT_HEADER, "label", label, - "button", TRUE, "addaction", action_label != NULL, - "addaction_text", action_label, - "visible", action_label == NULL, NULL); + return g_object_new (E_TYPE_COMPOSER_TEXT_HEADER, + "label", label, + "button", TRUE, + NULL); } const gchar * diff --git a/composer/e-composer-text-header.h b/composer/e-composer-text-header.h index 74fb86f9b0..278b2b1116 100644 --- a/composer/e-composer-text-header.h +++ b/composer/e-composer-text-header.h @@ -59,10 +59,10 @@ struct _EComposerTextHeaderClass { GType e_composer_text_header_get_type (void); EComposerHeader * -e_composer_text_header_new_label (const gchar *label, const gchar *action_label); +e_composer_text_header_new_label (const gchar *label); EComposerHeader * -e_composer_text_header_new_button (const gchar *label, const gchar *action_label); +e_composer_text_header_new_button (const gchar *label); const gchar * e_composer_text_header_get_text (EComposerTextHeader *header); void e_composer_text_header_set_text (EComposerTextHeader *header, diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index f8e34718a1..e5d21862f0 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -85,8 +85,6 @@ enum { LAST_SIGNAL }; -gboolean composer_lite = FALSE; - static gpointer parent_class; static guint signals[LAST_SIGNAL]; @@ -2146,7 +2144,7 @@ static void msg_composer_init (EMsgComposer *composer) { EShell *shell = e_shell_get_default (); - composer->lite = composer_lite; + composer->priv = E_MSG_COMPOSER_GET_PRIVATE (composer); if (e_shell_get_express_mode (shell)) { @@ -2198,29 +2196,21 @@ e_msg_composer_new (void) "html", e_web_view_new (), NULL); } -void -e_msg_composer_set_lite (void) -{ - composer_lite = TRUE; -} - +/** + * e_msg_composer_get_lite: + * + * Used within the composer to see if it should be made suitable for small + * screens. + * + * Return value: whether the surrounding #EShell is in small screen mode. + */ gboolean e_msg_composer_get_lite (void) { - return composer_lite; -} - -EMsgComposer * -e_msg_composer_lite_new (void) -{ - EMsgComposer *composer; - - /* Init lite-composer for ever for the session */ - composer_lite = TRUE; - - composer = e_msg_composer_new (); + EShell *shell; - return composer; + shell = e_shell_get_default (); + return e_shell_get_small_screen_mode (shell); } EFocusTracker * diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index c55237ce52..884b077862 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -63,7 +63,6 @@ typedef struct _EMsgComposerPrivate EMsgComposerPrivate; struct _EMsgComposer { GtkhtmlEditor parent; EMsgComposerPrivate *priv; - gboolean lite; }; struct _EMsgComposerClass { @@ -72,9 +71,7 @@ struct _EMsgComposerClass { GType e_msg_composer_get_type (void); EMsgComposer * e_msg_composer_new (void); -void e_msg_composer_set_lite (void); gboolean e_msg_composer_get_lite (void); -EMsgComposer * e_msg_composer_lite_new (void); EMsgComposer * e_msg_composer_new_with_message (CamelMimeMessage *msg); EMsgComposer * e_msg_composer_new_from_url (const gchar *url); EMsgComposer * e_msg_composer_new_redirect (CamelMimeMessage *message, diff --git a/composer/evolution-composer.ui b/composer/evolution-composer.ui index 3b1fee7a72..f283d35dcb 100644 --- a/composer/evolution-composer.ui +++ b/composer/evolution-composer.ui @@ -22,7 +22,6 @@ </placeholder> <placeholder name='pre-insert-menu'> <menu action='view-menu'> - <menuitem action='view-from'/> <menuitem action='view-reply-to'/> <menuitem action='view-cc'/> <menuitem action='view-bcc'/> diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index fc312c8ae4..fd0b56e7da 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -720,16 +720,14 @@ em_utils_composer_print_cb (EMsgComposer *composer, /* Composing messages... */ static EMsgComposer * -create_new_composer (const gchar *subject, const gchar *fromuri, gboolean lite) +create_new_composer (const gchar *subject, const gchar *fromuri) { EMsgComposer *composer; EComposerHeaderTable *table; EAccount *account = NULL; - if (lite) - composer = e_msg_composer_lite_new (); - else - composer = e_msg_composer_new (); + composer = e_msg_composer_new (); + table = e_msg_composer_get_header_table (composer); if (fromuri != NULL) { @@ -759,7 +757,7 @@ em_utils_compose_new_message (const gchar *fromuri) { GtkWidget *composer; - composer = (GtkWidget *) create_new_composer ("", fromuri, FALSE); + composer = (GtkWidget *) create_new_composer ("", fromuri); if (composer == NULL) return; @@ -769,26 +767,6 @@ em_utils_compose_new_message (const gchar *fromuri) } /** - * em_utils_compose_lite_new_message: - * - * Opens a new composer window as a child window of @parent's toplevel - * window. - **/ -EMsgComposer * -em_utils_compose_lite_new_message (const gchar *fromuri) -{ - GtkWidget *composer; - - composer = (GtkWidget *) create_new_composer ("", fromuri, TRUE); - if (composer == NULL) - return NULL; - - composer_set_no_change (E_MSG_COMPOSER (composer), TRUE, TRUE); - - return E_MSG_COMPOSER (composer); -} - -/** * em_utils_compose_new_message_with_mailto: * @url: mailto url * @@ -1146,7 +1124,7 @@ forward_attached (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, Cam { EMsgComposer *composer; - composer = create_new_composer (subject, fromuri, FALSE); + composer = create_new_composer (subject, fromuri); if (composer == NULL) return NULL; @@ -1228,7 +1206,7 @@ forward_non_attached (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, text = em_utils_message_to_html (message, _("-------- Forwarded Message --------"), flags, &len, NULL, NULL, &validity_found); if (text) { - composer = create_new_composer (subject, fromuri, FALSE); + composer = create_new_composer (subject, fromuri); if (composer) { if (CAMEL_IS_MULTIPART(camel_medium_get_content_object((CamelMedium *)message))) diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h index be29a7ae71..92e7e182f4 100644 --- a/mail/em-composer-utils.h +++ b/mail/em-composer-utils.h @@ -33,7 +33,6 @@ G_BEGIN_DECLS void em_utils_compose_new_message (const gchar *fromuri); -EMsgComposer * em_utils_compose_lite_new_message (const gchar *fromuri); /* FIXME: mailto? url? should make up its mind what its called. imho use 'uri' */ EMsgComposer * em_utils_compose_new_message_with_mailto (const gchar *url, const gchar *fromuri); diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in index 09d875a361..294cf75f9a 100644 --- a/mail/evolution-mail.schemas.in +++ b/mail/evolution-mail.schemas.in @@ -160,21 +160,6 @@ </schema> <schema> - <key>/schemas/apps/evolution/mail/composer/show_mail_from</key> - <applyto>/apps/evolution/mail/composer/show_mail_from</applyto> - <owner>evolution-mail</owner> - <type>bool</type> - <default>true</default> - <locale name="C"> - <short>Show "From" field when sending a mail message</short> - <long> - Show the "From" field when sending a mail message. This is - controlled from the View menu when a mail account is chosen. - </long> - </locale> - </schema> - - <schema> <key>/schemas/apps/evolution/mail/composer/show_mail_reply_to</key> <applyto>/apps/evolution/mail/composer/show_mail_reply_to</applyto> <owner>evolution-mail</owner> diff --git a/widgets/misc/e-account-combo-box.c b/widgets/misc/e-account-combo-box.c index 0ded393e72..786478a5e3 100644 --- a/widgets/misc/e-account-combo-box.c +++ b/widgets/misc/e-account-combo-box.c @@ -41,6 +41,7 @@ enum { struct _EAccountComboBoxPrivate { EAccountList *account_list; GHashTable *index; + int num_displayed_accounts; }; static gpointer parent_class; @@ -150,6 +151,8 @@ account_combo_box_refresh_cb (EAccountList *account_list, GList *list = NULL; GList *iter; + combo_box->priv->num_displayed_accounts = 0; + store = gtk_list_store_new (2, G_TYPE_STRING, E_TYPE_ACCOUNT); model = GTK_TREE_MODEL (store); index = combo_box->priv->index; @@ -182,6 +185,7 @@ account_combo_box_refresh_cb (EAccountList *account_list, gchar *string; account = iter->data; + combo_box->priv->num_displayed_accounts++; /* Show the account name for duplicate email addresses. */ if (account_combo_box_has_dupes (list, account->id->address)) @@ -514,3 +518,21 @@ e_account_combo_box_set_active_name (EAccountComboBox *combo_box, return e_account_combo_box_set_active (combo_box, account); } + +/** + * e_account_combo_box_count_displayed_accounts: + * @combo_box: an #EAccountComboBox + * + * Counts the number of accounts that are displayed in the @combo_box. This may not + * be the actual number of accounts that are configured, as some of those accounts + * may be disabled by the user. + * + * Return value: number of active and valid accounts as shown in the @combo_box. + */ +int +e_account_combo_box_count_displayed_accounts (EAccountComboBox *combo_box) +{ + g_return_val_if_fail (E_IS_ACCOUNT_COMBO_BOX (combo_box), -1); + + return combo_box->priv->num_displayed_accounts; +} diff --git a/widgets/misc/e-account-combo-box.h b/widgets/misc/e-account-combo-box.h index 12d4be6c72..60078690e9 100644 --- a/widgets/misc/e-account-combo-box.h +++ b/widgets/misc/e-account-combo-box.h @@ -78,6 +78,8 @@ gboolean e_account_combo_box_set_active_name (EAccountComboBox *combo_box, const gchar *account_name); +int e_account_combo_box_count_displayed_accounts (EAccountComboBox *combo_box); + G_END_DECLS #endif /* E_ACCOUNT_COMBO_BOX_H */ |