aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-10-14 01:57:46 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-10-14 01:57:46 +0800
commit79aa45cfed7e87150de85869795ef0dd3be06db0 (patch)
tree422b9e6c3840747ffb243d596d4459514ec3a457 /shell
parent1bed00795bf092ad6e9e076eccf7cc2a8c20cb27 (diff)
downloadgsoc2013-evolution-79aa45cfed7e87150de85869795ef0dd3be06db0.tar.gz
gsoc2013-evolution-79aa45cfed7e87150de85869795ef0dd3be06db0.tar.zst
gsoc2013-evolution-79aa45cfed7e87150de85869795ef0dd3be06db0.zip
Progress update:
- Calendar is kind of a mess at the moment. Doesn't compile. - Roughed in the Mail module, including all the actions. That _does_ compile. Runs, even. svn path=/branches/kill-bonobo/; revision=36611
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-module.c24
-rw-r--r--shell/e-shell-module.h5
-rw-r--r--shell/e-shell-window-actions.c38
-rw-r--r--shell/e-shell-window-private.c18
-rw-r--r--shell/e-shell-window-private.h2
-rw-r--r--shell/e-shell-window.c7
-rw-r--r--shell/shell.error.xml5
-rw-r--r--shell/test/e-test-shell-module.c5
8 files changed, 79 insertions, 25 deletions
diff --git a/shell/e-shell-module.c b/shell/e-shell-module.c
index 64d5efc41e..1fff07ee97 100644
--- a/shell/e-shell-module.c
+++ b/shell/e-shell-module.c
@@ -48,6 +48,8 @@ struct _EShellModulePrivate {
gchar *config_dir;
gchar *data_dir;
+ GType shell_view_type;
+
/* Initializes the loaded type module. */
void (*init) (GTypeModule *type_module);
};
@@ -421,6 +423,22 @@ e_shell_module_get_shell (EShellModule *shell_module)
}
/**
+ * e_shell_module_get_shell_view_type:
+ * @shell_module: an #EShellModule
+ *
+ * Returns the #GType of the #EShellView subclass for @shell_module.
+ *
+ * Returns: the #GType of an #EShellView subclass
+ **/
+GType
+e_shell_module_get_shell_view_type (EShellModule *shell_module)
+{
+ g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), 0);
+
+ return shell_module->priv->shell_view_type;
+}
+
+/**
* e_shell_module_add_activity:
* @shell_module: an #EShellModule
* @activity: an #EActivity
@@ -536,6 +554,7 @@ e_shell_module_migrate (EShellModule *shell_module,
* e_shell_module_set_info:
* @shell_module: an #EShellModule
* @info: an #EShellModuleInfo
+ * @shell_view_type: the #GType of a #EShellView subclass
*
* Registers basic configuration information about @shell_module that
* the #EShell can use for processing command-line arguments.
@@ -546,7 +565,8 @@ e_shell_module_migrate (EShellModule *shell_module,
**/
void
e_shell_module_set_info (EShellModule *shell_module,
- const EShellModuleInfo *info)
+ const EShellModuleInfo *info,
+ GType shell_view_type)
{
GTypeModule *type_module;
EShellModuleInfo *module_info;
@@ -588,4 +608,6 @@ e_shell_module_set_info (EShellModule *shell_module,
g_critical (
"Cannot create directory %s: %s",
pathname, g_strerror (errno));
+
+ shell_module->priv->shell_view_type = shell_view_type;
}
diff --git a/shell/e-shell-module.h b/shell/e-shell-module.h
index 8dff5a1425..24bc690533 100644
--- a/shell/e-shell-module.h
+++ b/shell/e-shell-module.h
@@ -125,6 +125,8 @@ const gchar * e_shell_module_get_config_dir (EShellModule *shell_module);
const gchar * e_shell_module_get_data_dir (EShellModule *shell_module);
const gchar * e_shell_module_get_filename (EShellModule *shell_module);
struct _EShell *e_shell_module_get_shell (EShellModule *shell_module);
+GType e_shell_module_get_shell_view_type
+ (EShellModule *shell_module);
void e_shell_module_add_activity (EShellModule *shell_module,
EActivity *activity);
gboolean e_shell_module_is_busy (EShellModule *shell_module);
@@ -135,7 +137,8 @@ gboolean e_shell_module_migrate (EShellModule *shell_module,
gint micro,
GError **error);
void e_shell_module_set_info (EShellModule *shell_module,
- const EShellModuleInfo *info);
+ const EShellModuleInfo *info,
+ GType shell_view_type);
G_END_DECLS
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index 2e80ab6bf6..a5ca5b310d 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -1435,7 +1435,7 @@ static GtkActionEntry shell_entries[] = {
{ "contents",
GTK_STOCK_HELP,
N_("_Contents"),
- NULL,
+ "F1",
N_("Open the Evolution User Guide"),
G_CALLBACK (action_contents_cb) },
@@ -1889,6 +1889,10 @@ e_shell_window_actions_init (EShellWindow *shell_window)
G_N_ELEMENTS (shell_switcher_entries),
-1, G_CALLBACK (action_switcher_cb), shell_window);
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+
+ /* Fine tuning. */
+
+ g_object_set (ACTION (SEND_RECEIVE), "is-important", TRUE, NULL);
}
GtkWidget *
@@ -1967,22 +1971,24 @@ e_shell_window_create_new_menu (EShellWindow *shell_window)
void
e_shell_window_create_switcher_actions (EShellWindow *shell_window)
{
- GType *children;
GSList *group = NULL;
GtkRadioAction *action;
GtkActionGroup *action_group;
GtkUIManager *ui_manager;
EShellSwitcher *switcher;
- guint n_children, ii;
+ EShell *shell;
+ GList *list, *iter;
guint merge_id;
+ guint ii = 0;
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
action_group = shell_window->priv->switcher_actions;
- children = g_type_children (E_TYPE_SHELL_VIEW, &n_children);
switcher = E_SHELL_SWITCHER (shell_window->priv->switcher);
ui_manager = e_shell_window_get_ui_manager (shell_window);
merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ shell = e_shell_window_get_shell (shell_window);
+ list = e_shell_list_modules (shell);
/* Construct a group of radio actions from the various EShellView
* subclasses and register them with the EShellSwitcher. These
@@ -1993,14 +1999,26 @@ e_shell_window_create_switcher_actions (EShellWindow *shell_window)
gtk_radio_action_set_group (action, group);
group = gtk_radio_action_get_group (action);
- for (ii = 0; ii < n_children; ii++) {
+ for (iter = list; iter != NULL; iter = iter->next) {
+ EShellModule *shell_module = iter->data;
EShellViewClass *class;
+ GType type;
const gchar *view_name;
gchar *accelerator;
gchar *action_name;
gchar *tooltip;
- class = g_type_class_ref (children[ii]);
+ type = e_shell_module_get_shell_view_type (shell_module);
+
+ if (!g_type_is_a (type, E_TYPE_SHELL_VIEW)) {
+ g_critical (
+ "%s is not a subclass of %s",
+ g_type_name (type),
+ g_type_name (E_TYPE_SHELL_VIEW));
+ continue;
+ }
+
+ class = g_type_class_ref (type);
if (class->label == NULL) {
g_critical (
@@ -2026,7 +2044,7 @@ e_shell_window_create_switcher_actions (EShellWindow *shell_window)
action = gtk_radio_action_new (
action_name, class->label,
- tooltip, NULL, ii);
+ tooltip, NULL, ii++);
g_object_set (
G_OBJECT (action),
@@ -2040,8 +2058,8 @@ e_shell_window_create_switcher_actions (EShellWindow *shell_window)
group = gtk_radio_action_get_group (action);
/* The first nine views have accelerators Ctrl+(1-9). */
- if (ii < 9)
- accelerator = g_strdup_printf ("<Control>%d", ii + 1);
+ if (ii < 10)
+ accelerator = g_strdup_printf ("<Control>%d", ii);
else
accelerator = g_strdup ("");
@@ -2062,8 +2080,6 @@ e_shell_window_create_switcher_actions (EShellWindow *shell_window)
g_type_class_unref (class);
}
-
- g_free (children);
}
void
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index c6283a1481..9432014a88 100644
--- a/shell/e-shell-window-private.c
+++ b/shell/e-shell-window-private.c
@@ -173,12 +173,9 @@ e_shell_window_private_init (EShellWindow *shell_window)
{
EShellWindowPrivate *priv = shell_window->priv;
GHashTable *loaded_views;
- GConfBridge *bridge;
GtkToolItem *item;
GtkWidget *container;
GtkWidget *widget;
- GObject *object;
- const gchar *key;
guint merge_id;
gint height;
@@ -317,6 +314,15 @@ e_shell_window_private_init (EShellWindow *shell_window)
gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
priv->status_notebook = g_object_ref (widget);
gtk_widget_show (widget);
+}
+
+void
+e_shell_window_private_constructed (EShellWindow *shell_window)
+{
+ EShellWindowPrivate *priv = shell_window->priv;
+ GConfBridge *bridge;
+ GObject *object;
+ const gchar *key;
/* Create the switcher actions before we set the initial
* shell view, because the shell view relies on them for
@@ -356,10 +362,6 @@ e_shell_window_private_init (EShellWindow *shell_window)
gconf_bridge_bind_property (bridge, key, object, "active");
shell_window_init_switcher_style (shell_window);
-
- /* Fine tuning. */
-
- g_object_set (ACTION (SEND_RECEIVE), "is-important", TRUE, NULL);
}
void
@@ -435,6 +437,8 @@ e_shell_window_switch_to_view (EShellWindow *shell_window,
e_shell_window_update_new_menu (shell_window);
e_shell_window_update_view_menu (shell_window);
e_shell_window_update_search_menu (shell_window);
+
+ e_shell_view_update_actions (shell_view);
}
void
diff --git a/shell/e-shell-window-private.h b/shell/e-shell-window-private.h
index 98749e1036..a31640d347 100644
--- a/shell/e-shell-window-private.h
+++ b/shell/e-shell-window-private.h
@@ -104,6 +104,8 @@ struct _EShellWindowPrivate {
};
void e_shell_window_private_init (EShellWindow *shell_window);
+void e_shell_window_private_constructed
+ (EShellWindow *shell_window);
void e_shell_window_private_dispose (EShellWindow *shell_window);
void e_shell_window_private_finalize (EShellWindow *shell_window);
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 427e1311a0..0d54b92bd8 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -215,6 +215,12 @@ shell_window_finalize (GObject *object)
}
static void
+shell_window_constructed (GObject *object)
+{
+ e_shell_window_private_constructed (E_SHELL_WINDOW (object));
+}
+
+static void
shell_window_class_init (EShellWindowClass *class)
{
GObjectClass *object_class;
@@ -227,6 +233,7 @@ shell_window_class_init (EShellWindowClass *class)
object_class->get_property = shell_window_get_property;
object_class->dispose = shell_window_dispose;
object_class->finalize = shell_window_finalize;
+ object_class->constructed = shell_window_constructed;
/**
* EShellWindow:active-view
diff --git a/shell/shell.error.xml b/shell/shell.error.xml
index a69adec801..603d5ed955 100644
--- a/shell/shell.error.xml
+++ b/shell/shell.error.xml
@@ -16,9 +16,8 @@ You will need to make more space available in your home directory before you can
</error>
<error id="upgrade-failed" type="error">
- <_primary>Upgrade from previous version failed:
-{0}</_primary>
- <_secondary xml:space="preserve">{1}
+ <_primary>Upgrade from previous version failed:</_primary>
+ <_secondary xml:space="preserve">{0}
If you choose to continue, you may not have access to some of your old data.
</_secondary>
diff --git a/shell/test/e-test-shell-module.c b/shell/test/e-test-shell-module.c
index 19b5d3bd96..2668396a12 100644
--- a/shell/test/e-test-shell-module.c
+++ b/shell/test/e-test-shell-module.c
@@ -161,8 +161,9 @@ e_shell_module_init (GTypeModule *type_module)
shell_module = E_SHELL_MODULE (type_module);
shell = e_shell_module_get_shell (shell_module);
- e_test_shell_view_get_type (type_module);
- e_shell_module_set_info (shell_module, &module_info);
+ e_shell_module_set_info (
+ shell_module, &module_info,
+ e_test_shell_view_get_type (type_module));
g_signal_connect_swapped (
shell, "handle-uri",