evolution r37093 - in branches/kill-bonobo: . addressbook/gui/component calendar/modules mail plugins/calendar-weather plugins/mail-account-disable shell ui widgets/misc



Author: mbarnes
Date: Sat Jan 17 20:06:17 2009
New Revision: 37093
URL: http://svn.gnome.org/viewvc/evolution?rev=37093&view=rev

Log:
Hack GtkIconTheme so we can reference category icons as named icons.
Necessary for EActionComboBox, since GtkActions can only handle named
or stock icons.  Hopefully this is just a temporary hack.  Eventually
we should make the category icons themeable.

Kill the "mail-account-disable" plugin and integrate it properly.
More dead plugins to follow...

Don't show disabled menu items in pop-up context menus.  It does the
user no good to see things he CAN'T do with the object he clicked on.


Removed:
   branches/kill-bonobo/plugins/calendar-weather/category_weather_cloudy_16.png
   branches/kill-bonobo/plugins/calendar-weather/category_weather_fog_16.png
   branches/kill-bonobo/plugins/calendar-weather/category_weather_partly_cloudy_16.png
   branches/kill-bonobo/plugins/calendar-weather/category_weather_rain_16.png
   branches/kill-bonobo/plugins/calendar-weather/category_weather_snow_16.png
   branches/kill-bonobo/plugins/calendar-weather/category_weather_sun_16.png
   branches/kill-bonobo/plugins/calendar-weather/category_weather_tstorm_16.png
   branches/kill-bonobo/plugins/mail-account-disable/
Modified:
   branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-actions.c
   branches/kill-bonobo/calendar/modules/e-cal-shell-view-actions.c
   branches/kill-bonobo/calendar/modules/e-memo-shell-view-actions.c
   branches/kill-bonobo/calendar/modules/e-task-shell-view-actions.c
   branches/kill-bonobo/configure.in
   branches/kill-bonobo/mail/e-mail-shell-view-actions.c
   branches/kill-bonobo/mail/e-mail-shell-view-actions.h
   branches/kill-bonobo/mail/e-mail-shell-view-private.c
   branches/kill-bonobo/mail/e-mail-shell-view-private.h
   branches/kill-bonobo/mail/e-mail-shell-view.c
   branches/kill-bonobo/plugins/calendar-weather/Makefile.am
   branches/kill-bonobo/plugins/calendar-weather/calendar-weather.c
   branches/kill-bonobo/shell/main.c
   branches/kill-bonobo/ui/evolution-mail.ui
   branches/kill-bonobo/widgets/misc/e-action-combo-box.c

Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-actions.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-actions.c	(original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-actions.c	Sat Jan 17 20:06:17 2009
@@ -884,6 +884,7 @@
 	list = e_categories_get_list ();
 	for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
 		const gchar *category_name = iter->data;
+		const gchar *filename;
 		GtkAction *action;
 		gchar *action_name;
 
@@ -893,6 +894,24 @@
 			action_name, category_name, NULL, NULL, ii);
 		g_free (action_name);
 
+		/* Convert the category icon file to a themed icon name. */
+		filename = e_categories_get_icon_file_for (category_name);
+		if (filename != NULL && *filename != '\0') {
+			gchar *basename;
+			gchar *cp;
+
+			basename = g_path_get_basename (filename);
+
+			/* Lose the file extension. */
+			if ((cp = strrchr (basename, '.')) != NULL)
+				*cp = '\0';
+
+			g_object_set (
+				radio_action, "icon-name", basename, NULL);
+
+			g_free (basename);
+		}
+
 		gtk_radio_action_set_group (radio_action, group);
 		group = gtk_radio_action_get_group (radio_action);
 

Modified: branches/kill-bonobo/calendar/modules/e-cal-shell-view-actions.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-cal-shell-view-actions.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-cal-shell-view-actions.c	Sat Jan 17 20:06:17 2009
@@ -1006,6 +1006,7 @@
 	list = e_categories_get_list ();
 	for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
 		const gchar *category_name = iter->data;
+		const gchar *filename;
 		GtkAction *action;
 		gchar *action_name;
 
@@ -1015,6 +1016,24 @@
 			action_name, category_name, NULL, NULL, ii);
 		g_free (action_name);
 
+		/* Convert the category icon file to a themed icon name. */
+		filename = e_categories_get_icon_file_for (category_name);
+		if (filename != NULL && *filename != '\0') {
+			gchar *basename;
+			gchar *cp;
+
+			basename = g_path_get_basename (filename);
+
+			/* Lose the file extension. */
+			if ((cp = strrchr (basename, '.')) != NULL)
+				*cp = '\0';
+
+			g_object_set (
+				radio_action, "icon-name", basename, NULL);
+
+			g_free (basename);
+		}
+
 		gtk_radio_action_set_group (radio_action, group);
 		group = gtk_radio_action_get_group (radio_action);
 

Modified: branches/kill-bonobo/calendar/modules/e-memo-shell-view-actions.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-memo-shell-view-actions.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-memo-shell-view-actions.c	Sat Jan 17 20:06:17 2009
@@ -790,6 +790,7 @@
 	list = e_categories_get_list ();
 	for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
 		const gchar *category_name = iter->data;
+		const gchar *filename;
 		GtkAction *action;
 		gchar *action_name;
 
@@ -799,6 +800,24 @@
 			action_name, category_name, NULL, NULL, ii);
 		g_free (action_name);
 
+		/* Convert the category icon file to a themed icon name. */
+		filename = e_categories_get_icon_file_for (category_name);
+		if (filename != NULL && *filename != '\0') {
+			gchar *basename;
+			gchar *cp;
+
+			basename = g_path_get_basename (filename);
+
+			/* Lose the file extension. */
+			if ((cp = strrchr (basename, '.')) != NULL)
+				*cp = '\0';
+
+			g_object_set (
+				radio_action, "icon-name", basename, NULL);
+
+			g_free (basename);
+		}
+
 		gtk_radio_action_set_group (radio_action, group);
 		group = gtk_radio_action_get_group (radio_action);
 

Modified: branches/kill-bonobo/calendar/modules/e-task-shell-view-actions.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-task-shell-view-actions.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-task-shell-view-actions.c	Sat Jan 17 20:06:17 2009
@@ -980,6 +980,7 @@
 	list = e_categories_get_list ();
 	for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
 		const gchar *category_name = iter->data;
+		const gchar *filename;
 		GtkAction *action;
 		gchar *action_name;
 
@@ -989,6 +990,24 @@
 			action_name, category_name, NULL, NULL, ii);
 		g_free (action_name);
 
+		/* Convert the category icon file to a themed icon name. */
+		filename = e_categories_get_icon_file_for (category_name);
+		if (filename != NULL && *filename != '\0') {
+			gchar *basename;
+			gchar *cp;
+
+			basename = g_path_get_basename (filename);
+
+			/* Lose the file extension. */
+			if ((cp = strrchr (basename, '.')) != NULL)
+				*cp = '\0';
+
+			g_object_set (
+				radio_action, "icon-name", basename, NULL);
+
+			g_free (basename);
+		}
+
 		gtk_radio_action_set_group (radio_action, group);
 		group = gtk_radio_action_get_group (radio_action);
 

Modified: branches/kill-bonobo/configure.in
==============================================================================
--- branches/kill-bonobo/configure.in	(original)
+++ branches/kill-bonobo/configure.in	Sat Jan 17 20:06:17 2009
@@ -1758,7 +1758,7 @@
 	      [enable_plugins="$enableval"],[enable_plugins=all])
 
 dnl Add any new plugins here
-plugins_base_always="calendar-file calendar-http $CALENDAR_WEATHER itip-formatter plugin-manager default-source addressbook-file startup-wizard mark-all-read groupwise-features groupwise-account-setup mail-account-disable publish-calendar caldav imap-features google-account-setup webdav-account-setup"
+plugins_base_always="calendar-file calendar-http $CALENDAR_WEATHER itip-formatter plugin-manager default-source addressbook-file startup-wizard mark-all-read groupwise-features groupwise-account-setup publish-calendar caldav imap-features google-account-setup webdav-account-setup"
 
 plugins_base="$plugins_base_always $SA_JUNK_PLUGIN $BF_JUNK_PLUGIN $EXCHANGE_PLUGIN $MONO_PLUGIN " 
 all_plugins_base="$plugins_base_always sa-junk-plugin bogo-junk-plugin exchange-operations mono"
@@ -1789,7 +1789,6 @@
 dnl import-ics-attachments
 dnl ipod-sync
 dnl itip-formatter
-dnl mail-account-disable
 dnl mailing-list-actions
 dnl mail-to-task
 dnl mark-all-read
@@ -2102,7 +2101,6 @@
 plugins/groupwise-account-setup/Makefile
 plugins/hula-account-setup/Makefile
 plugins/groupwise-features/Makefile
-plugins/mail-account-disable/Makefile
 plugins/sa-junk-plugin/Makefile
 plugins/bogo-junk-plugin/Makefile
 plugins/ipod-sync/Makefile

Modified: branches/kill-bonobo/mail/e-mail-shell-view-actions.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-view-actions.c	(original)
+++ branches/kill-bonobo/mail/e-mail-shell-view-actions.c	Sat Jan 17 20:06:17 2009
@@ -22,6 +22,45 @@
 #include "e-mail-shell-view-private.h"
 
 static void
+action_mail_account_disable_cb (GtkAction *action,
+                                EMailShellView *mail_shell_view)
+{
+	EMailShellSidebar *mail_shell_sidebar;
+	EShellModule *shell_module;
+	EShellView *shell_view;
+	EMFolderTree *folder_tree;
+	EAccountList *account_list;
+	EAccount *account;
+	gchar *folder_uri;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_module = e_shell_view_get_shell_module (shell_view);
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+	folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+	g_return_if_fail (folder_uri != NULL);
+
+	account = mail_config_get_account_by_source_url (folder_uri);
+	g_return_if_fail (account != NULL);
+
+	if (mail_config_has_proxies (account))
+		mail_config_remove_account_proxies (account);
+
+	account->enabled = !account->enabled;
+	account_list = mail_config_get_accounts ();
+	e_account_list_change (account_list, account);
+	e_mail_shell_module_remove_store_by_uri (shell_module, folder_uri);
+
+	if (account->parent_uid != NULL)
+		mail_config_remove_account (account);
+
+	mail_config_save_accounts ();
+
+	g_free (folder_uri);
+}
+
+static void
 action_mail_create_search_folder_cb (GtkAction *action,
                                      EMailShellView *mail_shell_view)
 {
@@ -504,6 +543,13 @@
 
 static GtkActionEntry mail_entries[] = {
 
+	{ "mail-account-disable",
+	  NULL,
+	  N_("_Disable Account"),
+	  NULL,
+	  N_("Disable this account"),
+	  G_CALLBACK (action_mail_account_disable_cb) },
+
 	{ "mail-create-search-folder",
 	  NULL,
 	  N_("C_reate Search Folder From Search..."),
@@ -679,6 +725,57 @@
 	  N_("Subscribe or unsubscribe to folders on remote servers"),
 	  G_CALLBACK (action_mail_tools_subscriptions_cb) },
 
+	/*** Popup Menu Variations ***/
+
+	{ "mail-popup-folder-copy",
+	  "folder-copy",
+	  N_("_Copy Folder To..."),
+	  NULL,
+	  N_("Copy the selected folder into another folder"),
+	  G_CALLBACK (action_mail_folder_copy_cb) },
+
+	{ "mail-popup-folder-delete",
+	  GTK_STOCK_DELETE,
+	  NULL,
+	  NULL,
+	  N_("Permanently remove this folder"),
+	  G_CALLBACK (action_mail_folder_delete_cb) },
+
+	{ "mail-popup-folder-move",
+	  "folder-move",
+	  N_("_Move Folder To..."),
+	  NULL,
+	  N_("Move the selected folder into another folder"),
+	  G_CALLBACK (action_mail_folder_move_cb) },
+
+	{ "mail-popup-folder-new",
+	  "folder-new",
+	  N_("_New Folder..."),
+	  NULL,
+	  N_("Create a new folder for storing mail"),
+	  G_CALLBACK (action_mail_folder_new_cb) },
+
+	{ "mail-popup-folder-properties",
+	  GTK_STOCK_PROPERTIES,
+	  NULL,
+	  NULL,
+	  N_("Change the properties of this folder"),
+	  G_CALLBACK (action_mail_folder_properties_cb) },
+
+	{ "mail-popup-folder-refresh",
+	  GTK_STOCK_REFRESH,
+	  NULL,
+	  NULL,
+	  N_("Refresh the folder"),
+	  G_CALLBACK (action_mail_folder_refresh_cb) },
+
+	{ "mail-popup-folder-rename",
+	  NULL,
+	  N_("_Rename..."),
+	  NULL,
+	  N_("Change the name of this folder"),
+	  G_CALLBACK (action_mail_folder_rename_cb) },
+
 	/*** Menus ***/
 
 	{ "mail-folder-menu",
@@ -991,4 +1088,34 @@
 	object = G_OBJECT (ACTION (MAIL_VIEW_VERTICAL));
 	key = "/apps/evolution/mail/display/layout";
 	gconf_bridge_bind_property (bridge, key, object, "current-value");
+
+	/* Fine tuning. */
+
+	e_binding_new (
+		G_OBJECT (ACTION (MAIL_FOLDER_COPY)), "sensitive",
+		G_OBJECT (ACTION (MAIL_POPUP_FOLDER_COPY)), "visible");
+
+	e_binding_new (
+		G_OBJECT (ACTION (MAIL_FOLDER_DELETE)), "sensitive",
+		G_OBJECT (ACTION (MAIL_POPUP_FOLDER_DELETE)), "visible");
+
+	e_binding_new (
+		G_OBJECT (ACTION (MAIL_FOLDER_MOVE)), "sensitive",
+		G_OBJECT (ACTION (MAIL_POPUP_FOLDER_MOVE)), "visible");
+
+	e_binding_new (
+		G_OBJECT (ACTION (MAIL_FOLDER_NEW)), "sensitive",
+		G_OBJECT (ACTION (MAIL_POPUP_FOLDER_NEW)), "visible");
+
+	e_binding_new (
+		G_OBJECT (ACTION (MAIL_FOLDER_PROPERTIES)), "sensitive",
+		G_OBJECT (ACTION (MAIL_POPUP_FOLDER_PROPERTIES)), "visible");
+
+	e_binding_new (
+		G_OBJECT (ACTION (MAIL_FOLDER_REFRESH)), "sensitive",
+		G_OBJECT (ACTION (MAIL_POPUP_FOLDER_REFRESH)), "visible");
+
+	e_binding_new (
+		G_OBJECT (ACTION (MAIL_FOLDER_RENAME)), "sensitive",
+		G_OBJECT (ACTION (MAIL_POPUP_FOLDER_RENAME)), "visible");
 }

Modified: branches/kill-bonobo/mail/e-mail-shell-view-actions.h
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-view-actions.h	(original)
+++ branches/kill-bonobo/mail/e-mail-shell-view-actions.h	Sat Jan 17 20:06:17 2009
@@ -25,6 +25,8 @@
 #include <shell/e-shell-window-actions.h>
 
 /* Mail Actions */
+#define E_SHELL_WINDOW_ACTION_MAIL_ACCOUNT_DISABLE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-account-disable")
 #define E_SHELL_WINDOW_ACTION_MAIL_ADD_SENDER(window) \
 	E_SHELL_WINDOW_ACTION ((window), "mail-add-sender")
 #define E_SHELL_WINDOW_ACTION_MAIL_CARET_MODE(window) \
@@ -133,6 +135,20 @@
 	E_SHELL_WINDOW_ACTION ((window), "mail-next-thread")
 #define E_SHELL_WINDOW_ACTION_MAIL_NEXT_UNREAD(window) \
 	E_SHELL_WINDOW_ACTION ((window), "mail-next-unread")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_COPY(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-copy")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_DELETE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-delete")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_MOVE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-move")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_NEW(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-new")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_PROPERTIES(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-properties")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_REFRESH(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-refresh")
+#define E_SHELL_WINDOW_ACTION_MAIL_POPUP_FOLDER_RENAME(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-popup-folder-rename")
 #define E_SHELL_WINDOW_ACTION_MAIL_PREVIEW(window) \
 	E_SHELL_WINDOW_ACTION ((window), "mail-preview")
 #define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS(window) \

Modified: branches/kill-bonobo/mail/e-mail-shell-view-private.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-view-private.c	(original)
+++ branches/kill-bonobo/mail/e-mail-shell-view-private.c	Sat Jan 17 20:06:17 2009
@@ -34,7 +34,7 @@
 
 	reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
 
-	if ((flags & CAMEL_FOLDER_NOSELECT) || full_name == NULL)
+	if ((flags & CAMEL_FOLDER_NOSELECT) || uri == NULL)
 		e_mail_reader_set_folder (reader, NULL, NULL);
 	else {
 		EMFolderTreeModel *model;
@@ -45,6 +45,8 @@
 
 		e_mail_reader_set_folder_uri (reader, uri);
 	}
+
+	e_shell_view_update_actions (E_SHELL_VIEW (mail_shell_view));
 }
 
 static void

Modified: branches/kill-bonobo/mail/e-mail-shell-view-private.h
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-view-private.h	(original)
+++ branches/kill-bonobo/mail/e-mail-shell-view-private.h	Sat Jan 17 20:06:17 2009
@@ -29,6 +29,7 @@
 #include <camel/camel-vtrash-folder.h>
 
 #include "e-util/e-util.h"
+#include "e-util/e-binding.h"
 #include "e-util/gconf-bridge.h"
 #include "widgets/menus/gal-view-instance.h"
 
@@ -40,6 +41,7 @@
 #include "em-subscribe-editor.h"
 #include "em-utils.h"
 #include "mail-autofilter.h"
+#include "mail-config.h"
 #include "mail-ops.h"
 #include "mail-send-recv.h"
 #include "mail-vfolder.h"

Modified: branches/kill-bonobo/mail/e-mail-shell-view.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-view.c	(original)
+++ branches/kill-bonobo/mail/e-mail-shell-view.c	Sat Jan 17 20:06:17 2009
@@ -91,14 +91,17 @@
 	EShellSidebar *shell_sidebar;
 	EShellWindow *shell_window;
 	EMFolderTree *folder_tree;
+	EAccount *account;
 	GtkAction *action;
 	CamelURL *camel_url;
+	const gchar *label;
 	gchar *uri;
 	gboolean sensitive;
 	gboolean visible;
 	guint32 state;
 
 	/* Be descriptive. */
+	gboolean account_is_groupwise;
 	gboolean folder_allows_children;
 	gboolean folder_can_be_deleted;
 	gboolean folder_is_junk;
@@ -130,9 +133,25 @@
 		(state & E_MAIL_SHELL_SIDEBAR_FOLDER_IS_TRASH);
 
 	uri = em_folder_tree_get_selected_uri (folder_tree);
+	account = mail_config_get_account_by_source_url (uri);
 	camel_url = camel_url_new (uri, NULL);
+
+	/* FIXME This belongs in a GroupWise plugin. */
+	account_is_groupwise =
+		(g_strrstr (uri, "groupwise://") != NULL) &&
+		account != NULL && account->parent_uid != NULL;
+
 	g_free (uri);
 
+	action = ACTION (MAIL_ACCOUNT_DISABLE);
+	visible = (account != NULL) && folder_is_store;
+	if (account_is_groupwise)
+		label = _("Proxy _Logout");
+	else
+		label = _("_Disable Account");
+	gtk_action_set_visible (action, visible);
+	g_object_set (action, "label", label, NULL);
+
 	action = ACTION (MAIL_EMPTY_TRASH);
 	visible = folder_is_trash;
 	gtk_action_set_visible (action, visible);

Modified: branches/kill-bonobo/plugins/calendar-weather/Makefile.am
==============================================================================
--- branches/kill-bonobo/plugins/calendar-weather/Makefile.am	(original)
+++ branches/kill-bonobo/plugins/calendar-weather/Makefile.am	Sat Jan 17 20:06:17 2009
@@ -1,5 +1,4 @@
 eds_datadir = `pkg-config --variable=privdatadir evolution-data-server-1.2`
-weatherdatadir = $(datadir)/evolution/$(BASE_VERSION)/weather
 
 INCLUDES =									\
 	-I$(top_srcdir)								\
@@ -12,15 +11,6 @@
 
 @EVO_PLUGIN_RULE@
 
-weatherdata_DATA = \
-	category_weather_cloudy_16.png		\
-	category_weather_fog_16.png		\
-	category_weather_partly_cloudy_16.png	\
-	category_weather_rain_16.png		\
-	category_weather_snow_16.png		\
-	category_weather_sun_16.png		\
-	category_weather_tstorm_16.png
-
 plugin_DATA = org-gnome-calendar-weather.eplug
 plugin_LTLIBRARIES = liborg-gnome-calendar-weather.la
 

Modified: branches/kill-bonobo/plugins/calendar-weather/calendar-weather.c
==============================================================================
--- branches/kill-bonobo/plugins/calendar-weather/calendar-weather.c	(original)
+++ branches/kill-bonobo/plugins/calendar-weather/calendar-weather.c	Sat Jan 17 20:06:17 2009
@@ -51,8 +51,8 @@
 e_plugin_lib_enable (EPluginLib *epl, int enable)
 {
 	GList *l;
-	gboolean found = FALSE;
-	const char *tmp;
+	const gchar *tmp;
+	gint ii;
 
 	static struct {
 		const char *description;
@@ -74,24 +74,21 @@
 
 	/* Add the categories icons if we don't have them. */
 	for (l = e_categories_get_list (); l; l = g_list_next (l)) {
-		if (!strcmp ((const char *)l->data, tmp)) {
-			found = TRUE;
-			break;
-		}
+		if (!strcmp ((const char *)l->data, tmp))
+			goto exit;
 	}
 
-	if (!found) {
-		int i;
-
-		for (i = 0; categories[i].description; i++) {
-			char *filename;
+	for (ii = 0; categories[ii].description; ii++) {
+		char *filename;
 
-			filename = e_icon_factory_get_icon_filename (categories[i].icon_name, E_ICON_SIZE_MENU);
-			e_categories_add (_(categories[i].description), NULL, filename, FALSE);
-			g_free (filename);
-		}
+		filename = e_icon_factory_get_icon_filename (
+			categories[ii].icon_name, E_ICON_SIZE_MENU);
+		e_categories_add (
+			_(categories[ii].description), NULL, filename, FALSE);
+		g_free (filename);
 	}
 
+exit:
 	return 0;
 }
 

Modified: branches/kill-bonobo/shell/main.c
==============================================================================
--- branches/kill-bonobo/shell/main.c	(original)
+++ branches/kill-bonobo/shell/main.c	Sat Jan 17 20:06:17 2009
@@ -57,6 +57,7 @@
 
 #include <bonobo-activation/bonobo-activation.h>
 
+#include <libedataserver/e-categories.h>
 #include <libedataserverui/e-passwords.h>
 
 #include <glade/glade.h>
@@ -166,6 +167,37 @@
 }
 #endif
 
+static void
+categories_icon_theme_hack (void)
+{
+	GtkIconTheme *icon_theme;
+	const gchar *category_name;
+	const gchar *filename;
+	gchar *dirname;
+
+	/* XXX Allow the category icons to be referenced as named
+	 *     icons, since GtkAction does not support GdkPixbufs. */
+
+	/* Get the icon file for some default category.  Doesn't matter
+	 * which, so long as it has an icon.  We're just interested in
+	 * the directory components. */
+	category_name = _("Birthday");
+	filename = e_categories_get_icon_file_for (category_name);
+	g_return_if_fail (filename != NULL && *filename != '\0');
+
+	/* Extract the directory components. */
+	dirname = g_path_get_dirname (filename);
+	g_debug ("Category Icon Path: %s", dirname);
+
+	/* Add it to the icon theme's search path.  This relies on
+	 * GtkIconTheme's legacy feature of using image files found
+	 * directly in the search path. */
+	icon_theme = gtk_icon_theme_get_default ();
+	gtk_icon_theme_append_search_path (icon_theme, dirname);
+
+	g_free (dirname);
+}
+
 
 #ifdef DEVELOPMENT
 
@@ -650,6 +682,7 @@
 	if (setup_only)
 		exit (0);
 
+	categories_icon_theme_hack ();
 	gnome_sound_init ("localhost");
 	gtk_accel_map_load (e_get_accels_filename ());
 

Modified: branches/kill-bonobo/ui/evolution-mail.ui
==============================================================================
--- branches/kill-bonobo/ui/evolution-mail.ui	(original)
+++ branches/kill-bonobo/ui/evolution-mail.ui	Sat Jan 17 20:06:17 2009
@@ -67,18 +67,19 @@
     <placeholder name='mail-toolbar-navigation'/>
   </toolbar>
   <popup name='mail-folder-popup'>
-    <menuitem action='mail-folder-new'/>
-    <menuitem action='mail-folder-copy'/>
-    <menuitem action='mail-folder-move'/>
+    <menuitem action='mail-popup-folder-new'/>
+    <menuitem action='mail-popup-folder-copy'/>
+    <menuitem action='mail-popup-folder-move'/>
     <separator/>
-    <menuitem action='mail-folder-delete'/>
+    <menuitem action='mail-popup-folder-delete'/>
     <separator/>
-    <menuitem action='mail-folder-rename'/>
-    <menuitem action='mail-folder-refresh'/>
+    <menuitem action='mail-popup-folder-rename'/>
+    <menuitem action='mail-popup-folder-refresh'/>
     <menuitem action='mail-flush-outbox'/>
     <menuitem action='mail-empty-trash'/>
+    <menuitem action='mail-account-disable'/>
     <separator/>
-    <menuitem action='mail-folder-properties'/>
+    <menuitem action='mail-popup-folder-properties'/>
   </popup>
   <popup name='mail-search-options'>
     <menuitem action='mail-search-subject-or-sender-contains'/>

Modified: branches/kill-bonobo/widgets/misc/e-action-combo-box.c
==============================================================================
--- branches/kill-bonobo/widgets/misc/e-action-combo-box.c	(original)
+++ branches/kill-bonobo/widgets/misc/e-action-combo-box.c	Sat Jan 17 20:06:17 2009
@@ -43,6 +43,7 @@
 	guint changed_handler_id;		/* action::changed */
 	guint group_sensitive_handler_id;	/* action-group::sensitive */
 	guint group_visible_handler_id;		/* action-group::visible */
+	gboolean group_has_icons : 1;
 };
 
 static gpointer parent_class;
@@ -95,9 +96,14 @@
 	gchar *stock_id;
 	gboolean sensitive;
 	gboolean visible;
+	gint width;
 
 	gtk_tree_model_get (model, iter, COLUMN_ACTION, &action, -1);
 
+	/* Do any of the actions have an icon? */
+	if (!combo_box->priv->group_has_icons)
+		return;
+
 	/* A NULL action means the row is a separator. */
 	if (action == NULL)
 		return;
@@ -110,14 +116,31 @@
 		"visible", &visible,
 		NULL);
 
-	g_object_set (
-		G_OBJECT (renderer),
-		"icon-name", icon_name,
-		"sensitive", sensitive,
-		"stock-id", stock_id,
-		"stock-size", GTK_ICON_SIZE_MENU,
-		"visible", visible,
-		NULL);
+	/* Keep the pixbuf renderer a fixed size for proper alignment. */
+	gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, NULL);
+
+	/* We can't set both "icon-name" and "stock-id" because setting
+	 * one unsets the other.  So pick the one that has a non-NULL
+	 * value.  If both are non-NULL, "stock-id" wins. */
+
+	if (stock_id != NULL)
+		g_object_set (
+			G_OBJECT (renderer),
+			"sensitive", sensitive,
+			"stock-id", stock_id,
+			"stock-size", GTK_ICON_SIZE_MENU,
+			"visible", visible,
+			"width", width,
+			NULL);
+	else
+		g_object_set (
+			G_OBJECT (renderer),
+			"icon-name", icon_name,
+			"sensitive", sensitive,
+			"stock-size", GTK_ICON_SIZE_MENU,
+			"visible", visible,
+			"width", width,
+			NULL);
 
 	g_free (icon_name);
 	g_free (stock_id);
@@ -135,6 +158,7 @@
 	gchar *label;
 	gboolean sensitive;
 	gboolean visible;
+	gint xpad;
 
 	gtk_tree_model_get (model, iter, COLUMN_ACTION, &action, -1);
 
@@ -155,11 +179,14 @@
 	label = g_strjoinv (NULL, strv);
 	g_strfreev (strv);
 
+	xpad = combo_box->priv->group_has_icons ? 3 : 0;
+
 	g_object_set (
 		G_OBJECT (renderer),
 		"sensitive", sensitive,
 		"text", label,
 		"visible", visible,
+		"xpad", xpad,
 		NULL);
 
 	g_free (label);
@@ -201,14 +228,25 @@
 		2, GTK_TYPE_RADIO_ACTION, G_TYPE_FLOAT);
 
 	list = gtk_radio_action_get_group (combo_box->priv->action);
+	combo_box->priv->group_has_icons = FALSE;
 
 	while (list != NULL) {
 		GtkTreeRowReference *reference;
 		GtkRadioAction *action = list->data;
 		GtkTreePath *path;
 		GtkTreeIter iter;
+		gchar *icon_name;
+		gchar *stock_id;
 		gint value;
 
+		g_object_get (
+			action, "icon-name", &icon_name,
+			"stock-id", &stock_id, NULL);
+		combo_box->priv->group_has_icons |=
+			(icon_name != NULL || stock_id != NULL);
+		g_free (icon_name);
+		g_free (stock_id);
+
 		gtk_list_store_append (list_store, &iter);
 		g_object_get (G_OBJECT (action), "value", &value, NULL);
 		gtk_list_store_set (



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