aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-window.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-08-27 09:54:22 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-08-27 09:54:22 +0800
commit244ab98402af2d384fe63c46fd15541f1c9f79bf (patch)
tree5fcc178bc3f0fa7d147cd0a82604c8e0a9ced7de /shell/e-shell-window.c
parentcf3b01017162cbba568ee4317eee2efe5f6fdc10 (diff)
downloadgsoc2013-evolution-244ab98402af2d384fe63c46fd15541f1c9f79bf.tar
gsoc2013-evolution-244ab98402af2d384fe63c46fd15541f1c9f79bf.tar.gz
gsoc2013-evolution-244ab98402af2d384fe63c46fd15541f1c9f79bf.tar.bz2
gsoc2013-evolution-244ab98402af2d384fe63c46fd15541f1c9f79bf.tar.lz
gsoc2013-evolution-244ab98402af2d384fe63c46fd15541f1c9f79bf.tar.xz
gsoc2013-evolution-244ab98402af2d384fe63c46fd15541f1c9f79bf.tar.zst
gsoc2013-evolution-244ab98402af2d384fe63c46fd15541f1c9f79bf.zip
Progress update:
- Get the test module to demonstrate populating the shell window (particularly, the various notebooks) with some stupid widgets. svn path=/branches/kill-bonobo/; revision=36094
Diffstat (limited to 'shell/e-shell-window.c')
-rw-r--r--shell/e-shell-window.c78
1 files changed, 68 insertions, 10 deletions
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index ed1e731922..063b0ff8e8 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -41,6 +41,47 @@ enum {
static gpointer parent_class;
+static EShellView *
+shell_window_new_view (EShellWindow *shell_window,
+ GType shell_view_type,
+ const gchar *title)
+{
+ GHashTable *loaded_views;
+ EShellView *shell_view;
+ GtkNotebook *notebook;
+ GtkWidget *widget;
+ const gchar *name;
+ gint page_num;
+
+ /* Determine the page number for the new shell view. */
+ notebook = GTK_NOTEBOOK (shell_window->priv->content_notebook);
+ page_num = gtk_notebook_get_n_pages (notebook);
+
+ shell_view = g_object_new (
+ shell_view_type, "page-num", page_num,
+ "title", title, "window", shell_window, NULL);
+
+ name = e_shell_view_get_name (shell_view);
+ loaded_views = shell_window->priv->loaded_views;
+ g_hash_table_insert (loaded_views, g_strdup (name), shell_view);
+
+ /* Add pages to the various shell window notebooks. */
+
+ notebook = GTK_NOTEBOOK (shell_window->priv->content_notebook);
+ widget = e_shell_view_get_content_widget (shell_view);
+ gtk_notebook_append_page (notebook, widget, NULL);
+
+ notebook = GTK_NOTEBOOK (shell_window->priv->sidebar_notebook);
+ widget = e_shell_view_get_sidebar_widget (shell_view);
+ gtk_notebook_append_page (notebook, widget, NULL);
+
+ notebook = GTK_NOTEBOOK (shell_window->priv->status_notebook);
+ widget = e_shell_view_get_status_widget (shell_view);
+ gtk_notebook_append_page (notebook, widget, NULL);
+
+ return shell_view;
+}
+
static void
shell_window_online_mode_notify_cb (EShell *shell,
GParamSpec *pspec,
@@ -286,14 +327,11 @@ e_shell_window_get_view (EShellWindow *shell_window,
continue;
}
- if (strcmp (view_name, class->type_module->name) == 0) {
- shell_view = g_object_new (
- shell_view_type, "title", class->label,
- "window", shell_window, NULL);
- g_hash_table_insert (
- loaded_views,
- g_strdup (view_name), shell_view);
- }
+ g_debug ("Comparing %s to %s (%s)", view_name, class->type_module->name, g_type_name (shell_view_type));
+
+ if (strcmp (view_name, class->type_module->name) == 0)
+ shell_view = shell_window_new_view (
+ shell_window, shell_view_type, class->label);
g_type_class_unref (class);
}
@@ -404,17 +442,37 @@ void
e_shell_window_set_current_view (EShellWindow *shell_window,
const gchar *name_or_alias)
{
+ GtkNotebook *notebook;
+ EShellView *shell_view;
const gchar *current_view;
+ gint page_num;
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
- if (name_or_alias != NULL)
+ current_view = name_or_alias;
+
+ if (current_view != NULL)
current_view =
- e_shell_registry_get_canonical_name (name_or_alias);
+ e_shell_registry_get_canonical_name (current_view);
if (current_view == NULL)
current_view = shell_window->priv->default_view;
+ g_return_if_fail (current_view != NULL);
+
+ shell_view = e_shell_window_get_view (shell_window, current_view);
+ page_num = e_shell_view_get_page_num (shell_view);
+ g_return_if_fail (page_num >= 0);
+
+ notebook = GTK_NOTEBOOK (shell_window->priv->content_notebook);
+ gtk_notebook_set_current_page (notebook, page_num);
+
+ notebook = GTK_NOTEBOOK (shell_window->priv->sidebar_notebook);
+ gtk_notebook_set_current_page (notebook, page_num);
+
+ notebook = GTK_NOTEBOOK (shell_window->priv->status_notebook);
+ gtk_notebook_set_current_page (notebook, page_num);
+
shell_window->priv->current_view = current_view;
g_object_notify (G_OBJECT (shell_window), "current-view");