[evolution/anjal-evo-2-30] Fix hide/show things. Still should be bettered later on.



commit 801de2c1bb76b23f4bdb1d099485673801d5aa36
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Wed Dec 9 10:58:54 2009 +0530

    Fix hide/show things. Still should be bettered later on.

 composer/e-composer-header-table.c |    4 +-
 composer/e-composer-header.c       |   38 ++++++++++++++++++++++++++---------
 2 files changed, 30 insertions(+), 12 deletions(-)
---
diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c
index 401da07..999a0e7 100644
--- a/composer/e-composer-header-table.c
+++ b/composer/e-composer-header-table.c
@@ -966,13 +966,13 @@ composer_header_table_init (EComposerHeaderTable *table)
 	table->priv->headers[E_COMPOSER_HEADER_TO] = header;
 
 	header = e_composer_name_header_new_with_action (
-		_("_Cc:"), _("Show CC"), name_selector);
+		_("_Cc:"), _("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:"), _("Show BCC"), name_selector);
+		_("_Bcc:"), _("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;
diff --git a/composer/e-composer-header.c b/composer/e-composer-header.c
index 36d0ffb..594d474 100644
--- a/composer/e-composer-header.c
+++ b/composer/e-composer-header.c
@@ -21,6 +21,7 @@
  */
 
 #include "e-composer-header.h"
+#include <glib/gi18n.h>
 
 #define E_COMPOSER_HEADER_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -48,6 +49,11 @@ struct _EComposerHeaderPrivate {
 	gchar *addaction_text;
 	gboolean addaction; /*For Add button.*/
 	GtkWidget *action_label;
+	
+	GtkWidget *add_icon;
+	GtkWidget *remove_icon;
+	GtkWidget *show_label;
+	GtkWidget *hide_label;
 
 	guint sensitive : 1;
 	guint visible   : 1;
@@ -109,12 +115,25 @@ composer_header_constructor (GType type,
 		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-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-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 foreground='blue' underline='single' underline_color='blue'  >%s</span>", header->priv->addaction_text);
+		str = g_strdup_printf ("<span>%s %s</span>", _("Show"),header->priv->addaction_text);
 		gtk_label_set_markup((GtkLabel *)tmp, 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 (
@@ -426,20 +445,19 @@ e_composer_header_set_visible (EComposerHeader *header,
 
 	header->priv->visible = visible;
 
-#if 0  /* FIXME This is horrible.  Needs completely rethought. */
 	if (header->priv->action_label) {
 		if (!visible) {
-			gtk_label_set_markup ((GtkLabel *)header->priv->action_label, g_object_get_data ((GObject *)header->priv->action_label, "show"));
-			gtk_widget_show (g_object_get_data((GObject *) header->priv->action_label, "add"));
-			gtk_widget_hide (g_object_get_data((GObject *) header->priv->action_label, "remove"));
-
+			gtk_widget_show (header->priv->add_icon);
+			gtk_widget_show (header->priv->show_label);
+			gtk_widget_hide (header->priv->remove_icon);
+			gtk_widget_hide (header->priv->hide_label);
 		}else {
-			gtk_label_set_markup ((GtkLabel *)header->priv->action_label, g_object_get_data ((GObject *)header->priv->action_label, "hide"));
-			gtk_widget_hide (g_object_get_data((GObject *) header->priv->action_label, "add"));
-			gtk_widget_show (g_object_get_data((GObject *) header->priv->action_label, "remove"));
+			gtk_widget_hide (header->priv->add_icon);
+			gtk_widget_hide (header->priv->show_label);
+			gtk_widget_show (header->priv->remove_icon);
+			gtk_widget_show (header->priv->hide_label);
 		}
 	}
-#endif
 
 	g_object_notify (G_OBJECT (header), "visible");
 }



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