aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--e-util/e-util.c33
-rw-r--r--e-util/e-util.h38
-rw-r--r--shell/e-shell-window-actions.c122
-rw-r--r--shell/e-shell-window-actions.h4
-rw-r--r--shell/e-shell-window-private.c19
-rw-r--r--shell/e-sidebar.c6
-rw-r--r--shell/e-sidebar.h7
-rw-r--r--ui/Makefile.am6
-rw-r--r--ui/evolution-shell.ui57
9 files changed, 234 insertions, 58 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 116ebd3f55..5bb42b2afa 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -70,6 +70,39 @@ e_get_user_data_dir (void)
}
/**
+ * 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.
*
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 2beac806de..f44c2a0e13 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -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 @@ typedef enum {
} 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 @@ gchar * e_ascii_dtostr (gchar *buffer,
/* 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);
+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);
+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 char *filename, gboolean filename_is_uri, char **buffer, gsize *read, GError **error);
+gboolean e_util_read_file (const gchar *filename,
+ gboolean filename_is_uri,
+ gchar **buffer,
+ gsize *read,
+ GError **error);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* _E_UTIL_H_ */
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index 0f959fa668..81934a46ea 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -668,6 +668,13 @@ action_close_cb (GtkAction *action,
}
static void
+action_contents_cb (GtkAction *action,
+ EShellWindow *window)
+{
+ /* FIXME Unfinished. */
+}
+
+static void
action_faq_cb (GtkAction *action,
EShellWindow *window)
{
@@ -801,18 +808,6 @@ action_shell_view_cb (GtkRadioAction *action,
}
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 @@ action_show_statusbar_cb (GtkToggleAction *action,
}
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 @@ action_submit_bug_cb (GtkAction *action,
}
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 @@ static GtkActionEntry shell_entries[] = {
{ "about",
GTK_STOCK_ABOUT,
- N_("_About"),
+ NULL,
NULL,
N_("Show information about Evolution"),
G_CALLBACK (action_about_cb) },
@@ -926,6 +941,13 @@ static GtkActionEntry shell_entries[] = {
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 @@ static GtkActionEntry shell_entries[] = {
{ "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 @@ static GtkActionEntry shell_entries[] = {
{ "quit",
GTK_STOCK_QUIT,
- N_("_Quit"),
- "<Control>q",
+ NULL,
+ NULL,
N_("Exit the program"),
G_CALLBACK (action_quit_cb) },
@@ -1040,6 +1062,13 @@ static GtkActionEntry shell_entries[] = {
NULL,
NULL },
+ { "layout-menu",
+ NULL,
+ N_("Lay_out"),
+ NULL,
+ NULL,
+ NULL },
+
{ "new-menu",
GTK_STOCK_NEW,
N_("_New"),
@@ -1054,6 +1083,13 @@ static GtkActionEntry shell_entries[] = {
NULL,
NULL },
+ { "switcher-menu",
+ NULL,
+ N_("_Switcher Appearance"),
+ NULL,
+ NULL,
+ NULL },
+
{ "view-menu",
NULL,
N_("_View"),
@@ -1071,14 +1107,6 @@ static GtkActionEntry shell_entries[] = {
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 @@ static GtkToggleActionEntry shell_toggle_entries[] = {
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 @@ static GtkToggleActionEntry shell_toggle_entries[] = {
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 @@ e_shell_window_actions_init (EShellWindow *window)
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) */
diff --git a/shell/e-shell-window-actions.h b/shell/e-shell-window-actions.h
index a36d91ebb6..a05165cdbd 100644
--- a/shell/e-shell-window-actions.h
+++ b/shell/e-shell-window-actions.h
@@ -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) \
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index 4c278e9b48..be25861c73 100644
--- a/shell/e-shell-window-private.c
+++ b/shell/e-shell-window-private.c
@@ -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 @@ shell_window_connect_proxy_cb (EShellWindow *window,
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 @@ e_shell_window_private_init (EShellWindow *window)
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 @@ e_shell_window_private_init (EShellWindow *window)
widget = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), widget);
+ gtk_widget_show (widget);
container = widget;
@@ -142,7 +145,7 @@ e_shell_window_private_init (EShellWindow *window)
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 @@ e_shell_window_private_init (EShellWindow *window)
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");
diff --git a/shell/e-sidebar.c b/shell/e-sidebar.c
index aa63f00ed4..aca9765e87 100644
--- a/shell/e-sidebar.c
+++ b/shell/e-sidebar.c
@@ -336,7 +336,6 @@ sidebar_get_style (GtkToolShell *shell)
static GtkReliefStyle
sidebar_get_relief_style (GtkToolShell *shell)
{
- g_debug ("%s", G_STRFUNC);
return GTK_RELIEF_NORMAL;
}
@@ -459,12 +458,11 @@ e_sidebar_add_action (ESidebar *sidebar,
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
diff --git a/shell/e-sidebar.h b/shell/e-sidebar.h
index e5f195cbf7..6024b6e229 100644
--- a/shell/e-sidebar.h
+++ b/shell/e-sidebar.h
@@ -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;
diff --git a/ui/Makefile.am b/ui/Makefile.am
index 80193355f9..00b8953101 100644
--- a/ui/Makefile.am
+++ b/ui/Makefile.am
@@ -9,8 +9,12 @@ XML_FILES = \
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
diff --git a/ui/evolution-shell.ui b/ui/evolution-shell.ui
new file mode 100644
index 0000000000..76e635ffe4
--- /dev/null
+++ b/ui/evolution-shell.ui
@@ -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>