[evolution-patches] Re: [Evolution-hackers] Evolution UI Hackfest




Attached is two patches for two items on the list.
- shell component buttons follow gnome setting.  it doesn't follow the text below icons setting, and only uses the large toolbar size since there are no drawn images at the small toolbar size.
- window title stuff (as sent earlier to evolution-hackers but caught by the list server for being too big).

On Tue, 2004-11-23 at 17:47 -0500, JP Rosevear wrote:
On Wednesday Nov 24th, 2004 the Evolution Team is going to have a UI Hackfest on irc in #evolution on gimp net.  We want to focus on getting nice little bits of polish in the UI.

A detailed (but not exhaustive) list of ideas is available at: http://www.gnome.org/projects/evolution/hackfest-ui.shtml

We'll update this list as time goes on.  Information on the last hackfest is at http://www.gnome.org/projects/evolution/hackfest-eplugin.shtml

-JP
--
JP Rosevear <jpr novell com>
Novell, Inc.
--
Michael Zucchi <notzed ximian com>
"Evolution - Mostly Practiced By Dumb People"
Novell's Evolution and Free Software Developer
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1480
diff -u -p -r1.1480 ChangeLog
--- shell/ChangeLog	22 Nov 2004 20:52:04 -0000	1.1480
+++ shell/ChangeLog	24 Nov 2004 08:51:24 -0000
@@ -1,3 +1,23 @@
+2004-11-24  Not Zed  <NotZed Ximian com>
+
+	* e-component-registry.c (component_info_new): add the icon name.
+
+	* e-shell-window.c (setup_widgets): use the small toolbar size for
+	the both button icon.
+
+	* e-sidebar.c (e_sidebar_add_button): add a small icon argument
+	for both mode.
+	(e_sidebar_set_mode): use the both icon for both mode.
+
+2004-08-09  Not Zed  <NotZed Ximian com>
+
+	* e-sidebar.c (init): listen to
+	(style_changed_notify): and process toolbar-style changed events.
+	(e_sidebar_set_mode): handle the sidebar mode of BOTH as well.
+	And uh its kinda non-fatal if we get a non-valid value here.  How
+	ugly.
+	(e_sidebar_add_button): handle BOTH mode.
+
 2004-11-22  Joan Sanfeliu  <joan fibranet com>
 
 	* main.c: Evolution product name spelled with an uppercase E
Index: shell/e-component-registry.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-component-registry.c,v
retrieving revision 1.51
diff -u -p -r1.51 e-component-registry.c
--- shell/e-component-registry.c	24 Jun 2004 08:14:51 -0000	1.51
+++ shell/e-component-registry.c	24 Nov 2004 08:51:24 -0000
@@ -61,7 +61,8 @@ component_info_new (const char *id,
 		    const char *menu_accelerator,
 		    int sort_order,
 		    GdkPixbuf *button_icon,
-		    GdkPixbuf *menu_icon)
+		    GdkPixbuf *menu_icon,
+		    const char *icon_name)
 {
 	EComponentInfo *info = g_new0 (EComponentInfo, 1);
 
@@ -81,6 +82,8 @@ component_info_new (const char *id,
 	if (info->menu_icon)
 		g_object_ref (info->menu_icon);
 
+	info->icon_name = g_strdup(icon_name);
+
 	return info;
 }
 
@@ -92,6 +95,7 @@ component_info_free (EComponentInfo *inf
 	g_free (info->button_label);
 	g_free (info->menu_label);
 	g_free (info->menu_accelerator);
+	g_free(info->icon_name);
 
 	if (info->button_icon)
 		g_object_unref (info->button_icon);
@@ -228,7 +232,7 @@ query_components (EComponentRegistry *re
 			sort_order = atoi (sort_order_string);
 
 		info = component_info_new (id, iface, alias, label, menu_label,
-					   menu_accelerator, sort_order, icon, menuicon);
+					   menu_accelerator, sort_order, icon, menuicon, icon_name);
 		set_schemas (info, & info_list->_buffer [i]);
 
 		registry->priv->infos = g_slist_prepend (registry->priv->infos, info);
Index: shell/e-component-registry.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-component-registry.h,v
retrieving revision 1.16
diff -u -p -r1.16 e-component-registry.h
--- shell/e-component-registry.h	1 Jun 2004 04:16:26 -0000	1.16
+++ shell/e-component-registry.h	24 Nov 2004 08:51:24 -0000
@@ -77,6 +77,8 @@ struct _EComponentInfo {
 	char *menu_accelerator;
 	GdkPixbuf *menu_icon;
 
+	char *icon_name;	/* name of icon used above */
+
 	int sort_order;
 
 	/* List of URI schemas that this component supports.  */
Index: shell/e-shell-window.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.c,v
retrieving revision 1.28
diff -u -p -r1.28 e-shell-window.c
--- shell/e-shell-window.c	25 Oct 2004 04:46:18 -0000	1.28
+++ shell/e-shell-window.c	24 Nov 2004 08:51:24 -0000
@@ -32,6 +32,8 @@
 #include "e-sidebar.h"
 #include "es-menu.h"
 
+#include <e-util/e-icon-factory.h>
+
 #include <gal/util/e-util.h>
 
 #include <gtk/gtkbutton.h>
@@ -630,9 +632,16 @@ setup_widgets (EShellWindow *window)
 		char *tmp;
 		EComponentInfo *info = p->data;
 		ComponentView *view = component_view_new (info->id, info->alias, button_id);
+		/*GdkPixbuf *both_icon = NULL;*/
 
 		window->priv->component_views = g_slist_prepend (window->priv->component_views, view);
-		e_sidebar_add_button (E_SIDEBAR (priv->sidebar), info->button_label, info->button_icon, button_id);
+
+		/* TODO: these images aren't available at small-toolbar size without scaling!
+		   if (info->icon_name)
+		   both_icon = e_icon_factory_get_icon (info->icon_name, E_ICON_SIZE_SMALL_TOOLBAR); */
+		e_sidebar_add_button (E_SIDEBAR (priv->sidebar), info->button_label, info->button_icon, info->button_icon, button_id);
+		/*if (both_icon)
+		  g_object_unref(both_icon);*/
 
 		g_string_printf(xml, "SwitchComponent-%s", info->alias);
 		bonobo_ui_component_add_verb (e_shell_window_peek_bonobo_ui_component (window),
Index: shell/e-sidebar.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-sidebar.c,v
retrieving revision 1.9
diff -u -p -r1.9 e-sidebar.c
--- shell/e-sidebar.c	4 Jun 2004 14:07:10 -0000	1.9
+++ shell/e-sidebar.c	24 Nov 2004 08:51:25 -0000
@@ -33,6 +33,8 @@
 #include <gtk/gtklabel.h>
 #include <gtk/gtktogglebutton.h>
 
+#include <gconf/gconf-client.h>
+#include <libgnome/gnome-gconf.h>
 
 #define PARENT_TYPE gtk_container_get_type ()
 static GtkContainerClass *parent_class = NULL;
@@ -42,6 +44,7 @@ typedef struct {
 	GtkWidget *button_widget;
 	GtkWidget *label;
 	GtkWidget *icon;
+	GtkWidget *icon_both;
 	GtkWidget *hbox;
 	int id;
 } Button;
@@ -52,6 +55,9 @@ struct _ESidebarPrivate {
 	GtkWidget *selection_widget;
 	GSList *buttons;
 
+	guint style_changed_id;
+	guint app_style_changed_id;
+
 	gboolean in_toggle;
 };
 
@@ -71,20 +77,21 @@ static unsigned int signals[NUM_SIGNALS]
 /* Utility functions.  */
 
 static Button *
-button_new (GtkWidget *button_widget, GtkWidget *label, GtkWidget *icon,
-	    GtkWidget *hbox, int id)
+button_new (GtkWidget *button_widget, GtkWidget *label, GtkWidget *icon, GtkWidget *icon_both, GtkWidget *hbox, int id)
 {
 	Button *button = g_new (Button, 1);
 
 	button->button_widget = button_widget;
 	button->label = label;
 	button->icon = icon;
+	button->icon_both = icon_both;
 	button->hbox = hbox;
 	button->id = id;
 
 	g_object_ref (button_widget);
 	g_object_ref (label);
 	g_object_ref (icon);
+	g_object_ref (icon_both);
 	g_object_ref (hbox);
 
 	return button;
@@ -360,10 +367,21 @@ static void
 impl_dispose (GObject *object)
 {
 	ESidebarPrivate *priv = E_SIDEBAR (object)->priv;
+	GConfClient *gconf = gconf_client_get_default();
+
+	if (priv->buttons) {
+		g_slist_foreach (priv->buttons, (GFunc) button_free, NULL);
+		g_slist_free (priv->buttons);
+		priv->buttons = NULL;
+	}
 
-	g_slist_foreach (priv->buttons, (GFunc) button_free, NULL);
-	g_slist_free (priv->buttons);
-	priv->buttons = NULL;
+	if (priv->style_changed_id) {
+		gconf_client_notify_remove(gconf, priv->style_changed_id);
+		gconf_client_notify_remove(gconf, priv->app_style_changed_id);
+		priv->style_changed_id = 0;
+	}
+
+	g_object_unref(gconf);
 
 	(* G_OBJECT_CLASS (parent_class)->dispose) (object);
 }
@@ -411,17 +429,68 @@ class_init (ESidebarClass *class)
 				G_TYPE_INT);
 }
 
+static GConfEnumStringPair toolbar_styles[] = {
+        { E_SIDEBAR_MODE_TEXT, "text" },
+        { E_SIDEBAR_MODE_ICON, "icons" },
+        { E_SIDEBAR_MODE_BOTH, "both" },
+        { E_SIDEBAR_MODE_BOTH, "both-horiz" },
+        { E_SIDEBAR_MODE_BOTH, "both_horiz" },
+	{ -1, NULL }
+};
+
+static void
+style_changed_notify(GConfClient *gconf, guint id, GConfEntry *entry, void *data)
+{
+	ESidebar *sidebar = data;
+	char *key, *val;
+	int mode;
+
+	/* application specific value overrides the global default */
+	key = gnome_gconf_get_gnome_libs_settings_relative("toolbar_style");
+	val = gconf_client_get_string(gconf, key, NULL);
+	g_free(key);
+
+	if (val == NULL
+	    || !gconf_string_to_enum(toolbar_styles, val, &mode)) {
+		g_free(val);
+		val = gconf_client_get_string(gconf, "/desktop/gnome/interface/toolbar_style", NULL);
+		if (val == NULL
+		    || !gconf_string_to_enum(toolbar_styles, val, &mode)) {
+			g_free(val);
+			return;
+		}
+		g_free(val);
+	}
+
+	e_sidebar_set_mode(sidebar, mode);
+}
+
 static void
 init (ESidebar *sidebar)
 {
 	ESidebarPrivate *priv;
+	GConfClient *gconf;
+	char *key;
 
 	GTK_WIDGET_SET_FLAGS (sidebar, GTK_NO_WINDOW);
   
 	priv = g_new0 (ESidebarPrivate, 1);
 	sidebar->priv = priv;
+	priv->mode = -1;
+
+	gconf = gconf_client_get_default();
 
-	priv->mode = E_SIDEBAR_MODE_TEXT;
+	key = gnome_gconf_get_gnome_libs_settings_relative("toolbar_style");
+	priv->style_changed_id = gconf_client_notify_add(gconf,
+							 "/desktop/gnome/interface/toolbar_style",
+							 style_changed_notify, sidebar, NULL, NULL);
+	priv->app_style_changed_id = gconf_client_notify_add(gconf,
+							     key,
+							     style_changed_notify, sidebar, NULL, NULL);
+	g_free(key);
+
+	style_changed_notify(gconf, 0, NULL, sidebar);
+	g_object_unref(gconf);
 }
 
 
@@ -453,11 +522,13 @@ void
 e_sidebar_add_button (ESidebar *sidebar,
 		      const char *label,
 		      GdkPixbuf *icon,
+		      GdkPixbuf *icon_both,
 		      int id)
 {
 	GtkWidget *button_widget;
 	GtkWidget *hbox;
 	GtkWidget *icon_widget;
+	GtkWidget *icon_both_widget;
 	GtkWidget *label_widget;
 
 	button_widget = gtk_toggle_button_new ();
@@ -466,18 +537,29 @@ e_sidebar_add_button (ESidebar *sidebar,
 	hbox = gtk_hbox_new (FALSE, 3);
 	gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
 	icon_widget = gtk_image_new_from_pixbuf (icon);
+	icon_both_widget = gtk_image_new_from_pixbuf (icon_both?icon_both:icon);
 	label_widget = gtk_label_new (label);
 	gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
-	gtk_box_pack_start (GTK_BOX (hbox), icon_widget, sidebar->priv->mode == E_SIDEBAR_MODE_ICON, TRUE, 0);
-	gtk_box_pack_start (GTK_BOX (hbox), label_widget, TRUE, TRUE, 0);
+
+	switch (sidebar->priv->mode) {
+	case E_SIDEBAR_MODE_TEXT:
+		gtk_box_pack_start (GTK_BOX (hbox), label_widget, TRUE, TRUE, 0);
+		break;
+	case E_SIDEBAR_MODE_ICON:
+		gtk_box_pack_start (GTK_BOX (hbox), icon_widget, TRUE, TRUE, 0);
+		break;
+	case E_SIDEBAR_MODE_BOTH:
+	default:
+		gtk_box_pack_start (GTK_BOX (hbox), icon_both_widget, FALSE, TRUE, 0);
+		gtk_box_pack_start (GTK_BOX (hbox), label_widget, TRUE, TRUE, 0);
+		break;
+	}
+
 	gtk_container_add (GTK_CONTAINER (button_widget), hbox);
 
-	sidebar->priv->buttons = g_slist_append (sidebar->priv->buttons, button_new (button_widget, label_widget, icon_widget, hbox, id));
+	sidebar->priv->buttons = g_slist_append (sidebar->priv->buttons, button_new (button_widget, label_widget, icon_widget, icon_both_widget, hbox, id));
 	gtk_widget_set_parent (button_widget, GTK_WIDGET (sidebar));
 
-	if (sidebar->priv->mode == E_SIDEBAR_MODE_ICON)
-		gtk_container_remove (GTK_CONTAINER (hbox), label_widget);
-	
 	gtk_widget_queue_resize (GTK_WIDGET (sidebar));
 }
 
@@ -500,7 +582,7 @@ void
 e_sidebar_set_mode (ESidebar *sidebar, ESidebarMode mode)
 {
 	GSList *p;
-	
+
 	if (sidebar->priv->mode == mode)
 		return;
 	
@@ -509,20 +591,33 @@ e_sidebar_set_mode (ESidebar *sidebar, E
 
 		switch (mode) {
 		case E_SIDEBAR_MODE_TEXT:
-			gtk_box_pack_start (GTK_BOX (button->hbox), button->label, TRUE, TRUE, 0);
-			gtk_container_child_set (GTK_CONTAINER (button->hbox), button->icon,
-						 "expand", FALSE,
-						 NULL);
+			if (sidebar->priv->mode == E_SIDEBAR_MODE_ICON) {
+				gtk_container_remove(GTK_CONTAINER (button->hbox), button->icon);
+				gtk_box_pack_start((GtkBox *)button->hbox, button->label, TRUE, TRUE, 0);
+				gtk_widget_show(button->label);
+			} else {
+				gtk_container_remove(GTK_CONTAINER (button->hbox), button->icon_both);
+			}
 			break;
 		case E_SIDEBAR_MODE_ICON:
-			gtk_container_remove (GTK_CONTAINER (button->hbox), button->label);
-			gtk_container_child_set (GTK_CONTAINER (button->hbox), button->icon,
-						 "expand", TRUE,
-						 NULL);
+			if (sidebar->priv->mode == E_SIDEBAR_MODE_BOTH)
+				gtk_container_remove(GTK_CONTAINER (button->hbox), button->icon_both);
+			gtk_container_remove(GTK_CONTAINER (button->hbox), button->label);
+			gtk_box_pack_start((GtkBox *)button->hbox, button->icon, TRUE, TRUE, 0);
+			gtk_widget_show(button->icon);
 			break;
 		default:
-			g_assert_not_reached ();
-			return;
+			mode = E_SIDEBAR_MODE_BOTH;
+		case E_SIDEBAR_MODE_BOTH:
+			if (sidebar->priv->mode == E_SIDEBAR_MODE_TEXT)
+				gtk_container_remove(GTK_CONTAINER (button->hbox), button->label);
+			else
+				gtk_container_remove(GTK_CONTAINER (button->hbox), button->icon);
+			gtk_box_pack_start((GtkBox *)button->hbox, button->icon_both, FALSE, TRUE, 0);
+			gtk_widget_show(button->icon_both);
+			gtk_box_pack_start((GtkBox *)button->hbox, button->label, TRUE, TRUE, 0);
+			gtk_widget_show(button->label);
+			break;
 		}
 	}
 
Index: shell/e-sidebar.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-sidebar.h,v
retrieving revision 1.3
diff -u -p -r1.3 e-sidebar.h
--- shell/e-sidebar.h	12 Jan 2004 04:08:16 -0000	1.3
+++ shell/e-sidebar.h	24 Nov 2004 08:51:25 -0000
@@ -38,7 +38,8 @@ typedef struct _ESidebarClass   ESidebar
 
 typedef enum {
 	E_SIDEBAR_MODE_TEXT,
-	E_SIDEBAR_MODE_ICON
+	E_SIDEBAR_MODE_ICON,
+	E_SIDEBAR_MODE_BOTH
 } ESidebarMode;
 
 struct _ESidebar {
@@ -63,6 +64,7 @@ void  e_sidebar_set_selection_widget  (E
 void  e_sidebar_add_button  (ESidebar   *sidebar,
 			     const char *label,
 			     GdkPixbuf  *icon,
+			     GdkPixbuf  *both_icon,
 			     int         id);
 
 void  e_sidebar_select_button  (ESidebar *sidebar,


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