diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-05-27 01:09:33 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-05-27 01:09:33 +0800 |
commit | c9ec8c3f4dce2b02c91268529977770364ef87fe (patch) | |
tree | d574f2be1b5438407e59e2fead1321766c9bbc83 /composer | |
parent | 6fec6bf39467dd32625847be1b021a7e5bc94d76 (diff) | |
parent | 96538878911586a9e9ca26b81e1916c04e538980 (diff) | |
download | gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.gz gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.bz2 gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.lz gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.xz gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.zst gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.zip |
Merge branch 'express2'
Diffstat (limited to 'composer')
-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 | 41 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 3 | ||||
-rw-r--r-- | composer/evolution-composer.ui | 1 |
15 files changed, 123 insertions, 278 deletions
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c index 98cb9c5e17..e5c9372f59 100644 --- a/composer/e-composer-actions.c +++ b/composer/e-composer-actions.c @@ -422,14 +422,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 26d9202c37..7a5d485933 100644 --- a/composer/e-composer-header-table.c +++ b/composer/e-composer-header-table.c @@ -25,14 +25,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)) @@ -68,7 +67,6 @@ struct _EComposerHeaderTablePrivate { GtkWidget *signature_label; GtkWidget *signature_combo_box; ENameSelector *name_selector; - GtkHBox *actions_container; }; static gpointer parent_class; @@ -158,11 +156,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); } @@ -173,7 +167,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 @@ -281,6 +275,27 @@ skip_custom: return new_destinations; } +static gint +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) +{ + gint num_accounts; + + num_accounts = count_from_accounts (table); + return (num_accounts > 1); +} + static void composer_header_table_setup_mail_headers (EComposerHeaderTable *table) { @@ -293,6 +308,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); @@ -309,10 +326,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; @@ -323,22 +336,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"); @@ -481,6 +501,17 @@ composer_header_table_from_changed_cb (EComposerHeaderTable *table) composer_header_table_setup_mail_headers (table); } +static gint +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, @@ -489,6 +520,7 @@ composer_header_table_constructor (GType type, GObject *object; EComposerHeaderTablePrivate *priv; guint rows, ii; + gint row_padding; /* Chain up to parent's constructor() method. */ object = G_OBJECT_CLASS (parent_class)->constructor ( @@ -504,45 +536,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. */ @@ -560,13 +565,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); @@ -579,7 +584,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); } @@ -953,9 +958,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); @@ -964,24 +967,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; @@ -990,7 +990,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 0d32667bca..0c634175de 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 eadef10910..46121eb7ba 100644 --- a/composer/e-composer-name-header.c +++ b/composer/e-composer-name-header.c @@ -295,33 +295,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 a3d43dcf88..22b4565f4b 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 36100621fe..67a9781395 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]; @@ -1681,6 +1679,7 @@ msg_composer_constructed (GObject *object) g_signal_connect (object, "delete-event", G_CALLBACK (msg_composer_delete_event_cb), NULL); + e_shell_adapt_window_size (shell, GTK_WINDOW (composer)); e_shell_watch_window (shell, GTK_WINDOW (object)); /* Restore Persistent State */ @@ -2170,8 +2169,14 @@ msg_composer_class_init (EMsgComposerClass *class) static void msg_composer_init (EMsgComposer *composer) { - composer->lite = composer_lite; + EShell *shell = e_shell_get_default (); + composer->priv = E_MSG_COMPOSER_GET_PRIVATE (composer); + + if (e_shell_get_express_mode (shell)) { + GtkWindow *window = e_shell_get_active_window(shell); + gtk_window_set_transient_for (GTK_WINDOW(composer), window); + } } GType @@ -2217,29 +2222,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 e2ef459eee..25c78ced03 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -61,7 +61,6 @@ typedef struct _EMsgComposerPrivate EMsgComposerPrivate; struct _EMsgComposer { GtkhtmlEditor parent; EMsgComposerPrivate *priv; - gboolean lite; }; struct _EMsgComposerClass { @@ -70,9 +69,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'/> |