aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-window.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-08-30 06:32:46 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-08-30 06:32:46 +0800
commite0c501b7018f12d37b10e32923f95b7a01c7982c (patch)
tree0114cbe9529000ec06dbe4ebe927e8c6cafbf0ba /shell/e-shell-window.c
parent02a9eb68308537fe712e757017ae4bb372863a8c (diff)
downloadgsoc2013-evolution-e0c501b7018f12d37b10e32923f95b7a01c7982c.tar
gsoc2013-evolution-e0c501b7018f12d37b10e32923f95b7a01c7982c.tar.gz
gsoc2013-evolution-e0c501b7018f12d37b10e32923f95b7a01c7982c.tar.bz2
gsoc2013-evolution-e0c501b7018f12d37b10e32923f95b7a01c7982c.tar.lz
gsoc2013-evolution-e0c501b7018f12d37b10e32923f95b7a01c7982c.tar.xz
gsoc2013-evolution-e0c501b7018f12d37b10e32923f95b7a01c7982c.tar.zst
gsoc2013-evolution-e0c501b7018f12d37b10e32923f95b7a01c7982c.zip
Progress update:
- Contacts module partially working! - Implement UI merging. Also merge EInfoLabel into ESidebar. The shell window now manages the icon and labels and keeps them up-to-date via EShellView properties. svn path=/branches/kill-bonobo/; revision=36214
Diffstat (limited to 'shell/e-shell-window.c')
-rw-r--r--shell/e-shell-window.c74
1 files changed, 61 insertions, 13 deletions
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 063b0ff8e8..312307c2f7 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -41,6 +41,31 @@ enum {
static gpointer parent_class;
+static void
+shell_window_update_sidebar (EShellWindow *shell_window)
+{
+ ESidebar *sidebar;
+ EShellView *shell_view;
+ const gchar *view_name;
+ const gchar *icon_name;
+ const gchar *primary_text;
+ const gchar *secondary_text;
+
+ sidebar = E_SIDEBAR (shell_window->priv->sidebar);
+ view_name = e_shell_window_get_current_view (shell_window);
+ shell_view = e_shell_window_get_view (shell_window, view_name);
+
+ /* Update the sidebar header. */
+
+ icon_name = e_shell_view_get_icon_name (shell_view);
+ primary_text = e_shell_view_get_primary_text (shell_view);
+ secondary_text = e_shell_view_get_secondary_text (shell_view);
+
+ e_sidebar_set_icon_name (sidebar, icon_name);
+ e_sidebar_set_primary_text (sidebar, primary_text);
+ e_sidebar_set_secondary_text (sidebar, secondary_text);
+}
+
static EShellView *
shell_window_new_view (EShellWindow *shell_window,
GType shell_view_type,
@@ -51,6 +76,7 @@ shell_window_new_view (EShellWindow *shell_window,
GtkNotebook *notebook;
GtkWidget *widget;
const gchar *name;
+ gulong handler_id;
gint page_num;
/* Determine the page number for the new shell view. */
@@ -79,6 +105,13 @@ shell_window_new_view (EShellWindow *shell_window,
widget = e_shell_view_get_status_widget (shell_view);
gtk_notebook_append_page (notebook, widget, NULL);
+ handler_id = g_signal_connect_swapped (
+ shell_view, "notify",
+ G_CALLBACK (shell_window_update_sidebar), shell_window);
+
+ /* This will be unblocked when the shell view is selected. */
+ g_signal_handler_block (shell_view, handler_id);
+
return shell_view;
}
@@ -327,8 +360,6 @@ e_shell_window_get_view (EShellWindow *shell_window,
continue;
}
- 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);
@@ -444,23 +475,31 @@ e_shell_window_set_current_view (EShellWindow *shell_window,
{
GtkNotebook *notebook;
EShellView *shell_view;
- const gchar *current_view;
+ GList *list;
+ const gchar *view_name;
gint page_num;
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
- current_view = name_or_alias;
+ if (shell_window->priv->current_view != NULL) {
+ view_name = e_shell_window_get_current_view (shell_window);
+ shell_view = e_shell_window_get_view (shell_window, view_name);
+
+ g_signal_handlers_block_by_func (
+ shell_view, shell_window_update_sidebar, shell_window);
+ }
+
+ view_name = name_or_alias;
- if (current_view != NULL)
- current_view =
- e_shell_registry_get_canonical_name (current_view);
+ if (view_name != NULL)
+ view_name = e_shell_registry_get_canonical_name (view_name);
- if (current_view == NULL)
- current_view = shell_window->priv->default_view;
+ if (view_name == NULL)
+ view_name = shell_window->priv->default_view;
- g_return_if_fail (current_view != NULL);
+ g_return_if_fail (view_name != NULL);
- shell_view = e_shell_window_get_view (shell_window, current_view);
+ shell_view = e_shell_window_get_view (shell_window, view_name);
page_num = e_shell_view_get_page_num (shell_view);
g_return_if_fail (page_num >= 0);
@@ -473,9 +512,18 @@ e_shell_window_set_current_view (EShellWindow *shell_window,
notebook = GTK_NOTEBOOK (shell_window->priv->status_notebook);
gtk_notebook_set_current_page (notebook, page_num);
- shell_window->priv->current_view = current_view;
-
+ shell_window->priv->current_view = view_name;
g_object_notify (G_OBJECT (shell_window), "current-view");
+
+ g_signal_handlers_unblock_by_func (
+ shell_view, shell_window_update_sidebar, shell_window);
+
+ shell_window_update_sidebar (shell_window);
+
+ /* Notify all loaded views. */
+ list = g_hash_table_get_values (shell_window->priv->loaded_views);
+ g_list_foreach (list, (GFunc) e_shell_view_changed, NULL);
+ g_list_free (list);
}
gboolean