aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog25
-rw-r--r--shell/e-component-registry.c34
-rw-r--r--shell/e-component-registry.h3
-rw-r--r--shell/e-shell-window.c45
4 files changed, 101 insertions, 6 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index dcaae8add6..86d3b8c326 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,28 @@
+2004-05-19 Not Zed <NotZed@Ximian.com>
+
+ * e-shell-window.c (setup_widgets): use the menu icon not the
+ button icon for the menus.
+ (setup_widgets): fixed some i18n stuff with the menu xml. no use
+ putting _x stuff here, it also needs a source. And a memleak.
+ Yucko.
+
+ * e-component-registry.c (component_info_new): take menu icon.
+ (query_components): setup the menu icon, not a large toolbar sized
+ icon.
+
+ * e-shell-window.c (menu_component_selected): just use '-' as
+ ascii, its always going to be hte same in utf8. simplifies the
+ code somewhat.
+
+2004-05-05 William Jon McCann <mccann@jhu.edu>
+
+ * e-shell-window.c (menu_component_selected, setup_widgets):
+ Add components to View menu.
+
+ * e-component-registry.[ch] (component_info_new)
+ (component_info_free, query_components): Add menu_label and
+ menu_accelerator fields.
+
2004-05-18 Not Zed <NotZed@Ximian.com>
* shell-errors.xml: added noshell and noshell-reason error
diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c
index f53768983e..e023872257 100644
--- a/shell/e-component-registry.c
+++ b/shell/e-component-registry.c
@@ -54,20 +54,29 @@ static EComponentInfo *
component_info_new (const char *id,
const char *alias,
const char *button_label,
+ const char *menu_label,
+ const char *menu_accelerator,
int sort_order,
- GdkPixbuf *button_icon)
+ GdkPixbuf *button_icon,
+ GdkPixbuf *menu_icon)
{
EComponentInfo *info = g_new0 (EComponentInfo, 1);
info->id = g_strdup (id);
info->alias = g_strdup (alias);
info->button_label = g_strdup (button_label);
+ info->menu_label = g_strdup (menu_label);
+ info->menu_accelerator = g_strdup (menu_accelerator);
info->sort_order = sort_order;
info->button_icon = button_icon;
if (info->button_icon)
g_object_ref (info->button_icon);
+ info->menu_icon = menu_icon;
+ if (info->menu_icon)
+ g_object_ref (info->menu_icon);
+
return info;
}
@@ -77,10 +86,15 @@ component_info_free (EComponentInfo *info)
g_free (info->id);
g_free (info->alias);
g_free (info->button_label);
+ g_free (info->menu_label);
+ g_free (info->menu_accelerator);
if (info->button_icon)
g_object_unref (info->button_icon);
+ if (info->menu_icon)
+ g_object_unref (info->menu_icon);
+
if (info->iface != NULL)
bonobo_object_release_unref (info->iface, NULL);
@@ -157,10 +171,12 @@ query_components (EComponentRegistry *registry)
for (i = 0; i < info_list->_length; i++) {
const char *id;
const char *label;
+ const char *menu_label;
+ const char *menu_accelerator;
const char *alias;
const char *icon_name;
const char *sort_order_string;
- GdkPixbuf *icon;
+ GdkPixbuf *icon = NULL, *menuicon = NULL;
EComponentInfo *info;
int sort_order;
@@ -169,13 +185,18 @@ query_components (EComponentRegistry *registry)
if (label == NULL)
label = g_strdup (_("Unknown"));
+ menu_label = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:menu_label", language_list);
+ if (menu_label == NULL)
+ menu_label = g_strdup (_("Unknown"));
+
+ menu_accelerator = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:menu_accelerator", language_list);
+
alias = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:component_alias", NULL);
icon_name = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_icon", NULL);
- if (icon_name == NULL) {
- icon = NULL;
- } else {
+ if (icon_name) {
icon = e_icon_factory_get_icon (icon_name, E_ICON_SIZE_LARGE_TOOLBAR);
+ menuicon = e_icon_factory_get_icon (icon_name, E_ICON_SIZE_MENU);
}
sort_order_string = bonobo_server_info_prop_lookup (& info_list->_buffer[i],
@@ -185,7 +206,8 @@ query_components (EComponentRegistry *registry)
else
sort_order = atoi (sort_order_string);
- info = component_info_new (id, alias, label, sort_order, icon);
+ info = component_info_new (id, alias, label, menu_label,
+ menu_accelerator, sort_order, icon, menuicon);
set_schemas (info, & info_list->_buffer [i]);
registry->priv->infos = g_slist_prepend (registry->priv->infos, info);
diff --git a/shell/e-component-registry.h b/shell/e-component-registry.h
index 76fbc778de..470fee289d 100644
--- a/shell/e-component-registry.h
+++ b/shell/e-component-registry.h
@@ -68,6 +68,9 @@ struct _EComponentInfo {
char *button_label;
GdkPixbuf *button_icon;
+ char *menu_label;
+ char *menu_accelerator;
+ GdkPixbuf *menu_icon;
int sort_order;
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 04d096334f..3811c136b2 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -552,6 +552,18 @@ setup_status_bar (EShellWindow *window)
}
static void
+menu_component_selected (BonoboUIComponent *uic,
+ EShellWindow *window,
+ const char *path)
+{
+ char *component_id;
+
+ component_id = strchr(path, '-');
+ if (component_id)
+ e_shell_window_switch_to_component (window, component_id+1);
+}
+
+static void
setup_widgets (EShellWindow *window)
{
EShellWindowPrivate *priv = window->priv;
@@ -559,6 +571,7 @@ setup_widgets (EShellWindow *window)
GConfClient *gconf_client = gconf_client_get_default ();
GtkWidget *contents_vbox;
GSList *p;
+ GString *xml;
int button_id;
priv->paned = gtk_hpaned_new ();
@@ -582,15 +595,47 @@ setup_widgets (EShellWindow *window)
gconf_client_get_int (gconf_client, "/apps/evolution/shell/view_defaults/folder_bar/width", NULL));
button_id = 0;
+ xml = g_string_new("");
for (p = e_component_registry_peek_list (registry); p != NULL; p = p->next) {
+ char *tmp;
EComponentInfo *info = p->data;
ComponentView *view = component_view_new (info->id, info->alias, button_id);
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);
+ g_string_printf(xml, "SwitchComponent-%s", info->alias);
+ bonobo_ui_component_add_verb (e_shell_window_peek_bonobo_ui_component (window),
+ xml->str,
+ (BonoboUIVerbFn)menu_component_selected,
+ window);
+
+ g_string_printf(xml, "<submenu name=\"View\">"
+ "<submenu name=\"Window\">"
+ "<placeholder name=\"WindowComponent\">"
+ "<menuitem name=\"SwitchComponent-%s\" "
+ "verb=\"\" label=\"%s\" accel=\"%s\" tip=\"",
+ info->alias,
+ info->menu_label,
+ info->menu_accelerator);
+ g_string_append_printf(xml, _("Switch to %s"), info->button_label);
+ tmp = bonobo_ui_util_pixbuf_to_xml (info->menu_icon),
+ g_string_append_printf(xml, "\" pixtype=\"pixbuf\" pixname=\"%s\"/>"
+ "</placeholder></submenu></submenu>\n",
+ tmp);
+ g_free(tmp);
+ bonobo_ui_component_set_translate (e_shell_window_peek_bonobo_ui_component (window),
+ "/menu",
+ xml->str,
+ NULL);
+ g_string_printf(xml, "<cmd name=\"SwitchComponent-%s\"/>\n", info->alias);
+ bonobo_ui_component_set_translate (e_shell_window_peek_bonobo_ui_component (window),
+ "/commands",
+ xml->str,
+ NULL);
button_id ++;
}
+ g_string_free(xml, TRUE);
setup_status_bar (window);