evolution r35982 - in branches/kill-bonobo: e-util shell ui



Author: mbarnes
Date: Wed Aug 13 20:31:08 2008
New Revision: 35982
URL: http://svn.gnome.org/viewvc/evolution?rev=35982&view=rev

Log:
Get a basic shell window working.


Added:
   branches/kill-bonobo/ui/evolution-shell.ui
Modified:
   branches/kill-bonobo/e-util/e-util.c
   branches/kill-bonobo/e-util/e-util.h
   branches/kill-bonobo/shell/e-shell-window-actions.c
   branches/kill-bonobo/shell/e-shell-window-actions.h
   branches/kill-bonobo/shell/e-shell-window-private.c
   branches/kill-bonobo/shell/e-sidebar.c
   branches/kill-bonobo/shell/e-sidebar.h
   branches/kill-bonobo/ui/Makefile.am

Modified: branches/kill-bonobo/e-util/e-util.c
==============================================================================
--- branches/kill-bonobo/e-util/e-util.c	(original)
+++ branches/kill-bonobo/e-util/e-util.c	Wed Aug 13 20:31:08 2008
@@ -70,6 +70,39 @@
 }
 
 /**
+ * e_load_ui_definition:
+ * @manager: a #GtkUIManager
+ * @basename: basename of the UI definition file
+ *
+ * Loads a UI definition into @manager from Evolution's UI directory.
+ * Failure here is fatal, since the application can't function without
+ * its UI definitions.
+ *
+ * Returns: The merge ID for the merged UI.  The merge ID can be used to
+ *          unmerge the UI with gtk_ui_manager_remove_ui().
+ **/
+guint
+e_load_ui_definition (GtkUIManager *manager,
+                      const gchar *basename)
+{
+	gchar *filename;
+	guint merge_id;
+	GError *error = NULL;
+
+	g_return_val_if_fail (GTK_IS_UI_MANAGER (manager), 0);
+	g_return_val_if_fail (basename != NULL, 0);
+
+	filename = g_build_filename (EVOLUTION_UIDIR, basename, NULL);
+	merge_id = gtk_ui_manager_add_ui_from_file (manager, filename, &error);
+	g_free (filename);
+
+	if (error != NULL)
+		g_error ("%s", error->message);  /* does not return */
+
+	return merge_id;
+}
+
+/**
  * e_str_without_underscores:
  * @s: the string to strip underscores from.
  *

Modified: branches/kill-bonobo/e-util/e-util.h
==============================================================================
--- branches/kill-bonobo/e-util/e-util.h	(original)
+++ branches/kill-bonobo/e-util/e-util.h	Wed Aug 13 20:31:08 2008
@@ -25,18 +25,15 @@
 #define _E_UTIL_H_
 
 #include <sys/types.h>
-#include <glib-object.h>
+#include <gtk/gtk.h>
 #include <limits.h>
 #include <gconf/gconf-client.h>
 #include <cairo.h>
 
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
 #include <e-util/e-util-marshal.h>
 
+G_BEGIN_DECLS
+
 typedef enum {
 	E_FOCUS_NONE,
 	E_FOCUS_CURRENT,
@@ -45,6 +42,8 @@
 } EFocus;
 
 const gchar *	e_get_user_data_dir		(void);
+guint		e_load_ui_definition		(GtkUIManager *manager,
+						 const gchar *basename);
 
 char *		e_str_without_underscores	(const char *s);
 gint		e_str_compare			(gconstpointer x,
@@ -104,27 +103,30 @@
 
 /* Alternating char * and int arguments with a NULL char * to end.
    Less than 0 for the int means copy the whole string. */
-gchar    *	e_strdup_append_strings		(gchar *first_string,
+gchar *		e_strdup_append_strings		(gchar *first_string,
 						 ...);
 
-cairo_font_options_t * get_font_options		(void);
+cairo_font_options_t *
+		get_font_options		(void);
 
 void		e_file_update_save_path		(gchar *uri,
 						 gboolean free);
 gchar *		e_file_get_save_path		(void);
 
-gboolean	e_file_lock_create (void);
-void		e_file_lock_destroy (void);
-gboolean 	e_file_lock_exists (void);
-
-char *e_util_guess_mime_type (const char *filename);
-char *e_util_filename_to_uri (const char *filename);
-char *e_util_uri_to_filename (const char *uri);
-
-gboolean e_util_read_file  (const char *filename, gboolean filename_is_uri, char **buffer, gsize *read,  GError **error);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+gboolean	e_file_lock_create		(void);
+void		e_file_lock_destroy		(void);
+gboolean 	e_file_lock_exists		(void);
+
+gchar *		e_util_guess_mime_type		(const gchar *filename);
+gchar *		e_util_filename_to_uri		(const gchar *filename);
+gchar *		e_util_uri_to_filename		(const gchar *uri);
+
+gboolean	e_util_read_file		(const gchar *filename,
+						 gboolean filename_is_uri,
+						 gchar **buffer,
+						 gsize *read,
+						 GError **error);
+
+G_END_DECLS
 
 #endif /* _E_UTIL_H_ */

Modified: branches/kill-bonobo/shell/e-shell-window-actions.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window-actions.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window-actions.c	Wed Aug 13 20:31:08 2008
@@ -668,6 +668,13 @@
 }
 
 static void
+action_contents_cb (GtkAction *action,
+                    EShellWindow *window)
+{
+	/* FIXME  Unfinished. */
+}
+
+static void
 action_faq_cb (GtkAction *action,
                EShellWindow *window)
 {
@@ -801,18 +808,6 @@
 }
 
 static void
-action_show_buttons_cb (GtkToggleAction *action,
-                        EShellWindow *window)
-{
-	ESidebar *sidebar;
-	gboolean active;
-
-	sidebar = E_SIDEBAR (window->priv->sidebar);
-	active = gtk_toggle_action_get_active (action);
-	e_sidebar_set_actions_visible (sidebar, active);
-}
-
-static void
 action_show_sidebar_cb (GtkToggleAction *action,
                         EShellWindow *window)
 {
@@ -837,6 +832,18 @@
 }
 
 static void
+action_show_switcher_cb (GtkToggleAction *action,
+                         EShellWindow *window)
+{
+	ESidebar *sidebar;
+	gboolean active;
+
+	sidebar = E_SIDEBAR (window->priv->sidebar);
+	active = gtk_toggle_action_get_active (action);
+	e_sidebar_set_actions_visible (sidebar, active);
+}
+
+static void
 action_show_toolbar_cb (GtkToggleAction *action,
                         EShellWindow *window)
 {
@@ -873,6 +880,14 @@
 }
 
 static void
+action_switcher_style_cb (GtkRadioAction *action,
+                          GtkRadioAction *current,
+                          EShellWindow *window)
+{
+	/* FIXME  Unfinished. */
+}
+
+static void
 action_sync_options_cb (GtkAction *action,
                         EShellWindow *window)
 {
@@ -914,7 +929,7 @@
 
 	{ "about",
 	  GTK_STOCK_ABOUT,
-	  N_("_About"),
+	  NULL,
 	  NULL,
 	  N_("Show information about Evolution"),
 	  G_CALLBACK (action_about_cb) },
@@ -926,6 +941,13 @@
 	  N_("Close this window"),
 	  G_CALLBACK (action_close_cb) },
 
+	{ "contents",
+	  GTK_STOCK_HELP,
+	  N_("_Contents"),
+	  NULL,
+	  N_("Open the Evolution User Guide"),
+	  G_CALLBACK (action_contents_cb) },
+
 	{ "faq",
 	  GTK_STOCK_DIALOG_INFO,
 	  N_("Evolution _FAQ"),
@@ -956,14 +978,14 @@
 
 	{ "page-setup",
 	  GTK_STOCK_PAGE_SETUP,
-	  N_("Page Set_up..."),
+	  NULL,
 	  NULL,
 	  N_("Change the page settings for your current printer"),
 	  G_CALLBACK (action_page_setup_cb) },
 
 	{ "preferences",
 	  GTK_STOCK_PREFERENCES,
-	  N_("Prefere_nces"),
+	  NULL,
 	  "<Control><Shift>s",
 	  N_("Configure Evolution"),
 	  G_CALLBACK (action_preferences_cb) },
@@ -977,8 +999,8 @@
 
 	{ "quit",
 	  GTK_STOCK_QUIT,
-	  N_("_Quit"),
-	  "<Control>q",
+	  NULL,
+	  NULL,
 	  N_("Exit the program"),
 	  G_CALLBACK (action_quit_cb) },
 
@@ -1040,6 +1062,13 @@
 	  NULL,
 	  NULL },
 
+	{ "layout-menu",
+	  NULL,
+	  N_("Lay_out"),
+	  NULL,
+	  NULL,
+	  NULL },
+
 	{ "new-menu",
 	  GTK_STOCK_NEW,
 	  N_("_New"),
@@ -1054,6 +1083,13 @@
 	  NULL,
 	  NULL },
 
+	{ "switcher-menu",
+	  NULL,
+	  N_("_Switcher Appearance"),
+	  NULL,
+	  NULL,
+	  NULL },
+
 	{ "view-menu",
 	  NULL,
 	  N_("_View"),
@@ -1071,14 +1107,6 @@
 
 static GtkToggleActionEntry shell_toggle_entries[] = {
 
-	{ "show-buttons",
-	  NULL,
-	  N_("Show _Buttons"),
-	  NULL,
-	  N_("Show the switcher buttons"),
-	  G_CALLBACK (action_show_buttons_cb),
-	  TRUE },
-
 	{ "show-sidebar",
 	  NULL,
 	  N_("Show Side _Bar"),
@@ -1095,6 +1123,14 @@
 	  G_CALLBACK (action_show_statusbar_cb),
 	  TRUE },
 
+	{ "show-switcher",
+	  NULL,
+	  N_("Show _Buttons"),
+	  NULL,
+	  N_("Show the switcher buttons"),
+	  G_CALLBACK (action_show_switcher_cb),
+	  TRUE },
+
 	{ "show-toolbar",
 	  NULL,
 	  N_("Show _Toolbar"),
@@ -1104,6 +1140,37 @@
 	  TRUE }
 };
 
+static GtkRadioActionEntry shell_switcher_style_entries[] = {
+
+	{ "switcher-style-icons",
+	  NULL,
+	  N_("_Icons Only"),
+	  NULL,
+	  N_("Display window buttons with icons only"),
+	  E_SWITCHER_ICONS },
+
+	{ "switcher-style-text",
+	  NULL,
+	  N_("_Text Only"),
+	  NULL,
+	  N_("Display window buttons with text only"),
+	  E_SWITCHER_TEXT },
+
+	{ "switcher-style-both",
+	  NULL,
+	  N_("Icons _and Text"),
+	  NULL,
+	  N_("Display window buttons with icons and text"),
+	  E_SWITCHER_BOTH },
+
+	{ "switcher-style-user",
+	  NULL,
+	  N_("Tool_bar Style"),
+	  NULL,
+	  N_("Display window buttons using the desktop toolbar setting"),
+	  E_SWITCHER_USER }
+};
+
 void
 e_shell_window_actions_init (EShellWindow *window)
 {
@@ -1125,6 +1192,11 @@
 	gtk_action_group_add_toggle_actions (
 		action_group, shell_toggle_entries,
 		G_N_ELEMENTS (shell_toggle_entries), window);
+	gtk_action_group_add_radio_actions (
+		action_group, shell_switcher_style_entries,
+		G_N_ELEMENTS (shell_switcher_style_entries),
+		E_SWITCHER_USER,
+		G_CALLBACK (action_switcher_style_cb),  window);
 	gtk_ui_manager_insert_action_group (manager, action_group, 0);
 
 	/* New Item Actions (empty) */

Modified: branches/kill-bonobo/shell/e-shell-window-actions.h
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window-actions.h	(original)
+++ branches/kill-bonobo/shell/e-shell-window-actions.h	Wed Aug 13 20:31:08 2008
@@ -50,12 +50,12 @@
 	E_SHELL_WINDOW_ACTION ((window), "quit")
 #define E_SHELL_WINDOW_ACTION_SEND_RECEIVE(window) \
 	E_SHELL_WINDOW_ACTION ((window), "send-receive")
-#define E_SHELL_WINDOW_ACTION_SHOW_BUTTONS(window) \
-	E_SHELL_WINDOW_ACTION ((window), "show-buttons")
 #define E_SHELL_WINDOW_ACTION_SHOW_SIDEBAR(window) \
 	E_SHELL_WINDOW_ACTION ((window), "show-sidebar")
 #define E_SHELL_WINDOW_ACTION_SHOW_STATUSBAR(window) \
 	E_SHELL_WINDOW_ACTION ((window), "show-statusbar")
+#define E_SHELL_WINDOW_ACTION_SHOW_SWITCHER(window) \
+	E_SHELL_WINDOW_ACTION ((window), "show-switcher")
 #define E_SHELL_WINDOW_ACTION_SHOW_TOOLBAR(window) \
 	E_SHELL_WINDOW_ACTION ((window), "show-toolbar")
 #define E_SHELL_WINDOW_ACTION_SUBMIT_BUG(window) \

Modified: branches/kill-bonobo/shell/e-shell-window-private.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window-private.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window-private.c	Wed Aug 13 20:31:08 2008
@@ -20,6 +20,7 @@
 
 #include "e-shell-window-private.h"
 
+#include "e-util/e-util.h"
 #include "e-util/gconf-bridge.h"
 
 #ifdef NM_SUPPORT_GLIB
@@ -70,7 +71,8 @@
 		return;
 
 	g_object_set_data_full (
-		G_OBJECT (proxy), "action", action,
+		G_OBJECT (proxy),
+		"action", g_object_ref (action),
 		(GDestroyNotify) g_object_unref);
 
 	g_signal_connect_swapped (
@@ -112,7 +114,7 @@
 
 	priv->shell_views = g_ptr_array_new ();
 
-	/* XXX Load UI file. */
+	e_load_ui_definition (priv->manager, "evolution-shell.ui");
 
 	e_shell_window_actions_init (window);
 
@@ -128,6 +130,7 @@
 
 	widget = gtk_vbox_new (FALSE, 0);
 	gtk_container_add (GTK_CONTAINER (window), widget);
+	gtk_widget_show (widget);
 
 	container = widget;
 
@@ -142,7 +145,7 @@
 	gtk_widget_show (widget);
 
 	widget = gtk_hpaned_new ();
-	gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
 	priv->content_pane = g_object_ref (widget);
 	gtk_widget_show (widget);
 
@@ -213,18 +216,18 @@
 	key = "/apps/evolution/shell/view_defaults/folder_bar/width";
 	gconf_bridge_bind_property_delayed (bridge, key, object, "position");
 
-	object = G_OBJECT (ACTION (SHOW_BUTTONS));
-	key = "/apps/evolution/shell/view-defaults/buttons_visible";
-	gconf_bridge_bind_property (bridge, key, object, "active");
-
 	object = G_OBJECT (ACTION (SHOW_SIDEBAR));
-	key = "/apps/evolution/shell/view-defaults/sidebar_visible";
+	key = "/apps/evolution/shell/view_defaults/sidebar_visible";
 	gconf_bridge_bind_property (bridge, key, object, "active");
 
 	object = G_OBJECT (ACTION (SHOW_STATUSBAR));
 	key = "/apps/evolution/shell/view_defaults/statusbar_visible";
 	gconf_bridge_bind_property (bridge, key, object, "active");
 
+	object = G_OBJECT (ACTION (SHOW_SWITCHER));
+	key = "/apps/evolution/shell/view_defaults/buttons_visible";
+	gconf_bridge_bind_property (bridge, key, object, "active");
+
 	object = G_OBJECT (ACTION (SHOW_TOOLBAR));
 	key = "/apps/evolution/shell/view_defaults/toolbar_visible";
 	gconf_bridge_bind_property (bridge, key, object, "active");

Modified: branches/kill-bonobo/shell/e-sidebar.c
==============================================================================
--- branches/kill-bonobo/shell/e-sidebar.c	(original)
+++ branches/kill-bonobo/shell/e-sidebar.c	Wed Aug 13 20:31:08 2008
@@ -336,7 +336,6 @@
 static GtkReliefStyle
 sidebar_get_relief_style (GtkToolShell *shell)
 {
-	g_debug ("%s", G_STRFUNC);
 	return GTK_RELIEF_NORMAL;
 }
 
@@ -459,12 +458,11 @@
 	gtk_tool_item_set_is_important (GTK_TOOL_ITEM (widget), TRUE);
 	gtk_widget_show (widget);
 
-	sidebar->priv->proxies = g_list_append (sidebar->priv->proxies, widget);
+	sidebar->priv->proxies = g_list_append (
+		sidebar->priv->proxies, widget);
 
 	gtk_widget_set_parent (widget, GTK_WIDGET (sidebar));
 	gtk_widget_queue_resize (GTK_WIDGET (sidebar));
-
-	g_debug ("Relief Style: %d", gtk_tool_item_get_relief_style (GTK_TOOL_ITEM (widget)));
 }
 
 gboolean

Modified: branches/kill-bonobo/shell/e-sidebar.h
==============================================================================
--- branches/kill-bonobo/shell/e-sidebar.h	(original)
+++ branches/kill-bonobo/shell/e-sidebar.h	Wed Aug 13 20:31:08 2008
@@ -44,6 +44,13 @@
 
 G_BEGIN_DECLS
 
+typedef enum {
+	E_SWITCHER_ICONS,
+	E_SWITCHER_TEXT,
+	E_SWITCHER_BOTH,
+	E_SWITCHER_USER
+} ESwitcherStyle;
+
 typedef struct _ESidebar ESidebar;
 typedef struct _ESidebarClass ESidebarClass;
 typedef struct _ESidebarPrivate ESidebarPrivate;

Modified: branches/kill-bonobo/ui/Makefile.am
==============================================================================
--- branches/kill-bonobo/ui/Makefile.am	(original)
+++ branches/kill-bonobo/ui/Makefile.am	Wed Aug 13 20:31:08 2008
@@ -9,8 +9,12 @@
 	evolution-memos.xml			\
 	evolution-tasks.xml
 
-evolutionui_DATA = $(XML_FILES)
+UI_FILES =					\
+	evolution-shell.ui
+
+evolutionui_DATA = $(UI_FILES) $(XML_FILES)
 
 EXTRA_DIST =					\
+	$(UI_FILES)				\
 	$(XML_FILES)				\
 	ChangeLog.pre-1-4

Added: branches/kill-bonobo/ui/evolution-shell.ui
==============================================================================
--- (empty file)
+++ branches/kill-bonobo/ui/evolution-shell.ui	Wed Aug 13 20:31:08 2008
@@ -0,0 +1,57 @@
+<ui>
+  <menubar name='main-menu'>
+    <menu action='file-menu'>
+      <menu action='new-menu'/>
+      <menuitem action='new-window'/>
+      <separator/>
+      <menuitem action='send-receive'/>
+      <separator/>
+      <menuitem action='import'/>
+      <separator/>
+      <menuitem action='page-setup'/>
+      <placeholder name='print-actions'/>
+      <separator/>
+      <menuitem action='forget-passwords'/>
+      <menuitem action='work-online'/>
+      <menuitem action='work-offline'/>
+      <menuitem action='close'/>
+      <menuitem action='quit'/>
+    </menu>
+    <menu action='edit-menu'>
+      <menuitem action='sync-options'/>
+      <menuitem action='preferences'/>
+    </menu>
+    <menu action='view-menu'>
+      <menu action='window-menu'/>
+      <menu action='layout-menu'>
+        <menuitem action='show-toolbar'/>
+	<menuitem action='show-statusbar'/>
+	<menuitem action='show-sidebar'/>
+      </menu>
+      <menu action='switcher-menu'>
+        <menuitem action='switcher-style-both'/>
+	<menuitem action='switcher-style-icons'/>
+	<menuitem action='switcher-style-text'/>
+	<menuitem action='switcher-style-user'/>
+	<separator/>
+	<menuitem action='show-switcher'/>
+      </menu>
+    </menu>
+    <placeholder name='custom-menus'/>
+    <menu action='search-menu'/>
+    <menu action='help-menu'>
+      <menuitem action='contents'/>
+      <menuitem action='quick-reference'/>
+      <separator/>
+      <menuitem action='faq'/>
+      <menuitem action='submit-bug'/>
+      <separator/>
+      <menuitem action='about'/>
+    </menu>
+  </menubar>
+  <toolbar name='main-toolbar'>
+    <separator/>
+    <toolitem action='send-receive'/>
+    <separator/>
+  </toolbar>
+</ui>



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