aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-window.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-10-25 12:46:18 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-10-25 12:46:18 +0800
commit0ea79651b85c4acdb49ddd6b5c9bc0c021e977e3 (patch)
tree30a5b6551fd0ad8b732bd1b266bda20bc26ad408 /shell/e-shell-window.c
parent47f9f8c3e78916409320a7fcdd0fe05ab83bd352 (diff)
downloadgsoc2013-evolution-0ea79651b85c4acdb49ddd6b5c9bc0c021e977e3.tar.gz
gsoc2013-evolution-0ea79651b85c4acdb49ddd6b5c9bc0c021e977e3.tar.zst
gsoc2013-evolution-0ea79651b85c4acdb49ddd6b5c9bc0c021e977e3.zip
register event hook.
2004-10-25 Not Zed <NotZed@Ximian.com> * main.c (main): register event hook. * e-shell.c (offline_procedure_finished_cb, e_shell_go_online): emit new state changed event. * main.c (main): register the menu hook. (): only define DEVELOPMENT if not already. * e-shell-window.c (init): setup menu manager. (e_shell_window_new): activate menu manager. (update_offline_toggle_status): update the menu manager when the offline state changes (currently only state which requires it) * es-menu.[ch]: Shell plugin menu manager. svn path=/trunk/; revision=27712
Diffstat (limited to 'shell/e-shell-window.c')
-rw-r--r--shell/e-shell-window.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 1d9c4f5202..05e4384c95 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -30,6 +30,7 @@
#include "e-shell-window-commands.h"
#include "e-shell-marshal.h"
#include "e-sidebar.h"
+#include "es-menu.h"
#include <gal/util/e-util.h>
@@ -79,6 +80,9 @@ typedef struct _ComponentView ComponentView;
struct _EShellWindowPrivate {
EShell *shell;
+ /* plugin menu manager */
+ ESMenu *menu;
+
/* All the ComponentViews. */
GSList *component_views;
@@ -326,6 +330,8 @@ update_offline_toggle_status (EShellWindow *window)
GdkBitmap *icon_mask;
const char *tooltip;
gboolean sensitive;
+ guint32 flags = 0;
+ ESMenuTargetShell *t;
priv = window->priv;
@@ -336,12 +342,14 @@ update_offline_toggle_status (EShellWindow *window)
sensitive = TRUE;
tooltip = _("Evolution is currently online. "
"Click on this button to work offline.");
+ flags = ES_MENU_SHELL_ONLINE;
break;
case E_SHELL_LINE_STATUS_GOING_OFFLINE:
icon_pixmap = online_pixmap;
icon_mask = online_mask;
sensitive = FALSE;
tooltip = _("Evolution is in the process of going offline.");
+ flags = ES_MENU_SHELL_OFFLINE;
break;
case E_SHELL_LINE_STATUS_OFFLINE:
icon_pixmap = offline_pixmap;
@@ -349,6 +357,7 @@ update_offline_toggle_status (EShellWindow *window)
sensitive = TRUE;
tooltip = _("Evolution is currently offline. "
"Click on this button to work online.");
+ flags = ES_MENU_SHELL_OFFLINE;
break;
default:
g_assert_not_reached ();
@@ -358,6 +367,11 @@ update_offline_toggle_status (EShellWindow *window)
gtk_image_set_from_pixmap (GTK_IMAGE (priv->offline_toggle_image), icon_pixmap, icon_mask);
gtk_widget_set_sensitive (priv->offline_toggle, sensitive);
gtk_tooltips_set_tip (priv->tooltips, priv->offline_toggle, tooltip, NULL);
+
+ /* TODO: If we get more shell flags, this should be centralised */
+ t = es_menu_target_new_shell(priv->menu, flags);
+ t->target.widget = (GtkWidget *)window;
+ e_menu_update_target((EMenu *)priv->menu, t);
}
static void
@@ -701,6 +715,8 @@ impl_finalize (GObject *object)
g_slist_foreach (priv->component_views, (GFunc) component_view_free, NULL);
g_slist_free (priv->component_views);
+ g_object_unref(priv->menu);
+
g_free (priv);
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
@@ -738,6 +754,17 @@ init (EShellWindow *shell_window)
priv->tooltips = gtk_tooltips_new ();
shell_window->priv = priv;
+
+ /** @HookPoint: Shell Main Menu
+ * @Id: org.gnome.evolution.shell
+ * @Type: ESMenu
+ * @Target: ESMenuTargetShell
+ *
+ * This hook point is used to add bonobo menu's to the main
+ * evolution shell window, used for global commands not
+ * requiring a specific component.
+ */
+ priv->menu = es_menu_new("org.gnome.evolution.shell");
}
@@ -780,6 +807,7 @@ e_shell_window_new (EShell *shell,
"evolution-" BASE_VERSION, NULL);
e_shell_window_commands_setup (window);
+ e_menu_activate((EMenu *)priv->menu, priv->ui_component, TRUE);
setup_widgets (window);