[evolution/relayout-composer: 3/3] Don't lay out the headers differently for the lite composer



commit faa40288d4b15950c7df7c324c8afa4ba578b25a
Author: Federico Mena Quintero <federico novell com>
Date:   Fri Apr 30 16:33:26 2010 -0500

    Don't lay out the headers differently for the lite composer
    
    This is basically a selective revert of these commits:
      9b0e9dc0aeffd627ce2bdea049cc7c47bb7418f0
      631da1b6baf2204ebb844a1d3962c2c7d811eb41
      5d4e8994e83c9ab650981c332eaef57f4fab2788
    
    Instead of having buttons to show/hide headers in the same row as the 'To:' header,
    we will have expanders or something prettier, a la googlemail.
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 composer/e-composer-from-header.c  |   10 ----
 composer/e-composer-from-header.h  |    3 -
 composer/e-composer-header-table.c |   61 ++++--------------------
 composer/e-composer-header.c       |   90 ------------------------------------
 composer/e-composer-header.h       |    1 -
 composer/e-composer-name-header.c  |   24 ----------
 composer/e-composer-name-header.h  |    8 ---
 composer/e-composer-text-header.c  |   22 ++++-----
 composer/e-composer-text-header.h  |    4 +-
 9 files changed, 23 insertions(+), 200 deletions(-)
---
diff --git a/composer/e-composer-from-header.c b/composer/e-composer-from-header.c
index cade5bf..4dadfa7 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 9f9a0e0..d2603bd 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 bb2c9e7..f8ea8df 100644
--- a/composer/e-composer-header-table.c
+++ b/composer/e-composer-header-table.c
@@ -68,7 +68,6 @@ struct _EComposerHeaderTablePrivate {
 	GtkWidget *signature_label;
 	GtkWidget *signature_combo_box;
 	ENameSelector *name_selector;
-	GtkHBox *actions_container;
 };
 
 static gpointer parent_class;
@@ -158,11 +157,7 @@ composer_header_table_notify_header (EComposerHeader *header,
 {
 	GtkWidget *parent;
 
-	if (e_msg_composer_get_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);
 }
@@ -508,41 +503,12 @@ composer_header_table_constructor (GType type,
 		gtk_table_attach (
 			GTK_TABLE (object), priv->headers[ii]->title_widget,
 			0, 1, ii, ii + 1, GTK_FILL, GTK_FILL, 0, 3);
-		if (e_msg_composer_get_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 (e_msg_composer_get_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);
-		}
+		gtk_table_attach (
+			GTK_TABLE (object),
+			priv->headers[ii]->input_widget, 1, 4,
+			ii, ii + 1, GTK_FILL | GTK_EXPAND, 0, 0, 3);
 	}
 
-	if (e_msg_composer_get_lite ())
-		gtk_widget_show_all ((GtkWidget *)priv->actions_container);
 	ii = E_COMPOSER_HEADER_FROM;
 
 	/* Leave room in the "From" row for signature stuff. */
@@ -953,9 +919,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 +928,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 +951,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 d61f44a..34c2c0c 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,
@@ -109,44 +96,6 @@ composer_header_constructor (GType type,
 	}
 
 	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 +120,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;
@@ -214,15 +155,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 (
@@ -291,28 +223,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 044425b..971b559 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;
 };
 
diff --git a/composer/e-composer-name-header.c b/composer/e-composer-name-header.c
index 658e7cc..aaa253b 100644
--- a/composer/e-composer-name-header.c
+++ b/composer/e-composer-name-header.c
@@ -297,30 +297,6 @@ e_composer_name_header_new (const gchar *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);
-}
-
 ENameSelector *
 e_composer_name_header_get_name_selector (EComposerNameHeader *header)
 {
diff --git a/composer/e-composer-name-header.h b/composer/e-composer-name-header.h
index 100d6c8..785f7d1 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-text-header.c b/composer/e-composer-text-header.c
index e765237..efbf141 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 74fb86f..278b2b1 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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]