aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/gui/component/e-book-shell-view-private.c14
-rw-r--r--addressbook/gui/component/e-book-shell-view.c24
-rw-r--r--shell/e-shell-content.c22
-rw-r--r--shell/e-shell-sidebar.c16
-rw-r--r--shell/e-shell-view.c35
-rw-r--r--shell/e-shell-window-actions.c12
-rw-r--r--shell/e-shell-window-private.h1
-rw-r--r--shell/e-shell-window.c5
-rw-r--r--shell/main.c3
-rw-r--r--shell/test/e-test-shell-view.c45
10 files changed, 82 insertions, 95 deletions
diff --git a/addressbook/gui/component/e-book-shell-view-private.c b/addressbook/gui/component/e-book-shell-view-private.c
index e2f23e8324..e8dca482a3 100644
--- a/addressbook/gui/component/e-book-shell-view-private.c
+++ b/addressbook/gui/component/e-book-shell-view-private.c
@@ -284,6 +284,9 @@ void
e_book_shell_view_private_init (EBookShellView *book_shell_view)
{
EBookShellViewPrivate *priv = book_shell_view->priv;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellTaskbar *shell_taskbar;
EShellView *shell_view;
GHashTable *uid_to_view;
GHashTable *uid_to_editor;
@@ -312,20 +315,27 @@ e_book_shell_view_private_init (EBookShellView *book_shell_view)
/* Construct view widgets. */
widget = gtk_notebook_new ();
+ shell_content = e_shell_view_get_content (shell_view);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
- priv->notebook = g_object_ref_sink (widget);
+ gtk_container_add (GTK_CONTAINER (shell_content), widget);
+ priv->notebook = g_object_ref (widget);
gtk_widget_show (widget);
widget = gtk_scrolled_window_new (NULL, NULL);
+ shell_sidebar = e_shell_view_get_sidebar (shell_view);
gtk_scrolled_window_set_policy (
GTK_SCROLLED_WINDOW (widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (
GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
- priv->scrolled_window = g_object_ref_sink (widget);
+ gtk_container_add (GTK_CONTAINER (shell_sidebar), widget);
gtk_widget_show (widget);
+ shell_taskbar = e_shell_view_get_taskbar (shell_view);
+ e_activity_handler_attach_task_bar (
+ priv->activity_handler, shell_taskbar);
+
container = widget;
widget = e_addressbook_selector_new (priv->source_list);
diff --git a/addressbook/gui/component/e-book-shell-view.c b/addressbook/gui/component/e-book-shell-view.c
index e383e8bb7b..218a0e9929 100644
--- a/addressbook/gui/component/e-book-shell-view.c
+++ b/addressbook/gui/component/e-book-shell-view.c
@@ -172,32 +172,14 @@ static void
book_shell_view_constructed (GObject *object)
{
EBookShellView *book_shell_view;
- EShellContent *shell_content;
- EShellSidebar *shell_sidebar;
- EShellTaskbar *shell_taskbar;
- EShellView *shell_view;
- GtkWidget *widget;
- /* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
-
- shell_view = E_SHELL_VIEW (object);
book_shell_view = E_BOOK_SHELL_VIEW (object);
- widget = book_shell_view->priv->notebook;
- shell_content = e_shell_view_get_content (shell_view);
- gtk_container_add (GTK_CONTAINER (shell_content), widget);
-
- widget = book_shell_view->priv->scrolled_window;
- shell_sidebar = e_shell_view_get_sidebar (shell_view);
- gtk_container_add (GTK_CONTAINER (shell_sidebar), widget);
-
- shell_taskbar = e_shell_view_get_taskbar (shell_view);
- e_activity_handler_attach_task_bar (
- book_shell_view->priv->activity_handler, shell_taskbar);
-
e_book_shell_view_actions_init (book_shell_view);
e_book_shell_view_update_search_filter (book_shell_view);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
}
static void
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index 7ee7711b7e..c1c175d692 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -194,7 +194,8 @@ shell_content_init_search_context (EShellContent *shell_content)
rule_context_add_rule, rule_context_next_rule);
rule_context_load (context, system_filename, user_filename);
- /* XXX Not sure why this is necessary. */
+ /* Ownership of the strings is passed to the rule context.
+ * XXX Not sure why this is necessary. */
g_object_set_data_full (
G_OBJECT (context), "system", system_filename, g_free);
g_object_set_data_full (
@@ -210,9 +211,6 @@ shell_content_init_search_context (EShellContent *shell_content)
else
filter_rule_add_part (rule, filter_part_clone (part));
- g_free (system_filename);
- g_free (user_filename);
-
shell_content->priv->search_context = context;
}
@@ -447,12 +445,22 @@ shell_content_dispose (GObject *object)
}
static void
-shell_content_constructed (GObject *object)
+shell_content_realize (GtkWidget *widget)
{
EShellContent *shell_content;
- shell_content = E_SHELL_CONTENT (object);
+ /* We can't call this during object construction because the
+ * shell view is still in its instance initialization phase,
+ * and so its GET_CLASS() macro won't work correctly. So we
+ * delay the bits of our own initialization that require the
+ * E_SHELL_VIEW_GET_CLASS() macro until after the shell view
+ * is fully constructed. */
+
+ shell_content = E_SHELL_CONTENT (widget);
shell_content_init_search_context (shell_content);
+
+ /* Chain up to parent's realize() method. */
+ GTK_WIDGET_CLASS (parent_class)->realize (widget);
}
static void
@@ -561,9 +569,9 @@ shell_content_class_init (EShellContentClass *class)
object_class->set_property = shell_content_set_property;
object_class->get_property = shell_content_get_property;
object_class->dispose = shell_content_dispose;
- object_class->constructed = shell_content_constructed;
widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->realize = shell_content_realize;
widget_class->size_request = shell_content_size_request;
widget_class->size_allocate = shell_content_size_allocate;
diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c
index 4a83b3462a..560c20c278 100644
--- a/shell/e-shell-sidebar.c
+++ b/shell/e-shell-sidebar.c
@@ -201,12 +201,22 @@ shell_sidebar_finalize (GObject *object)
}
static void
-shell_sidebar_constructed (GObject *object)
+shell_sidebar_realize (GtkWidget *widget)
{
EShellSidebar *shell_sidebar;
- shell_sidebar = E_SHELL_SIDEBAR (object);
+ /* We can't call this during object construction because the
+ * shell view is still in its instance initialization phase,
+ * and so its GET_CLASS() macro won't work correctly. So we
+ * delay the bits of our own initialization that require the
+ * E_SHELL_VIEW_GET_CLASS() macro until after the shell view
+ * is fully constructed. */
+
+ shell_sidebar = E_SHELL_SIDEBAR (widget);
shell_sidebar_init_icon_and_text (shell_sidebar);
+
+ /* Chain up to parent's realize() method. */
+ GTK_WIDGET_CLASS (parent_class)->realize (widget);
}
static void
@@ -316,9 +326,9 @@ shell_sidebar_class_init (EShellSidebarClass *class)
object_class->get_property = shell_sidebar_get_property;
object_class->dispose = shell_sidebar_dispose;
object_class->finalize = shell_sidebar_finalize;
- object_class->constructed = shell_sidebar_constructed;
widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->realize = shell_sidebar_realize;
widget_class->size_request = shell_sidebar_size_request;
widget_class->size_allocate = shell_sidebar_size_allocate;
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index f069a33567..4b388e3c93 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -206,26 +206,6 @@ shell_view_finalize (GObject *object)
static void
shell_view_constructed (GObject *object)
{
- EShellView *shell_view;
- GtkWidget *widget;
-
- shell_view = E_SHELL_VIEW (object);
-
- /* We do this AFTER instance initialization so the
- * E_SHELL_VIEW_GET_CLASS() macro works properly. */
-
- widget = e_shell_content_new (shell_view);
- shell_view->priv->content = g_object_ref_sink (widget);
- gtk_widget_show (widget);
-
- widget = e_shell_sidebar_new (shell_view);
- shell_view->priv->sidebar = g_object_ref_sink (widget);
- gtk_widget_show (widget);
-
- widget = e_shell_taskbar_new (shell_view);
- shell_view->priv->taskbar = g_object_ref_sink (widget);
- gtk_widget_show (widget);
-
/* XXX GObjectClass doesn't implement constructed(), so we will.
* Then subclasses won't have to check the function pointer
* before chaining up.
@@ -306,7 +286,22 @@ shell_view_class_init (EShellViewClass *class)
static void
shell_view_init (EShellView *shell_view)
{
+ GtkWidget *widget;
+
shell_view->priv = E_SHELL_VIEW_GET_PRIVATE (shell_view);
+
+ widget = e_shell_content_new (shell_view);
+ shell_view->priv->content = g_object_ref_sink (widget);
+ gtk_widget_show (widget);
+
+ widget = e_shell_sidebar_new (shell_view);
+ shell_view->priv->sidebar = g_object_ref_sink (widget);
+ gtk_widget_show (widget);
+
+ widget = e_shell_taskbar_new (shell_view);
+ shell_view->priv->taskbar = g_object_ref_sink (widget);
+ gtk_widget_show (widget);
+
}
GType
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index aa14ec44eb..c785b9bc92 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -1716,21 +1716,15 @@ e_shell_window_create_shell_view_actions (EShellWindow *shell_window)
list = gtk_action_group_list_actions (action_group);
if (list != NULL) {
- GObject *object = list->data;
- const gchar *view_name;
-
- /* First view is the default. */
- view_name = g_object_get_data (object, "view-name");
- shell_window->priv->default_view = view_name;
+ GtkRadioAction *action = list->data;
g_signal_connect (
- object, "changed",
+ action, "changed",
G_CALLBACK (action_shell_view_cb),
shell_window);
/* Sync up with the current shell view. */
- gtk_radio_action_set_current_value (
- GTK_RADIO_ACTION (object), current_value);
+ gtk_radio_action_set_current_value (action, current_value);
}
g_list_free (list);
diff --git a/shell/e-shell-window-private.h b/shell/e-shell-window-private.h
index 161bb17e0b..ef4fa2a728 100644
--- a/shell/e-shell-window-private.h
+++ b/shell/e-shell-window-private.h
@@ -73,7 +73,6 @@ struct _EShellWindowPrivate {
GHashTable *loaded_views;
const gchar *current_view;
- const gchar *default_view;
/*** Widgetry ***/
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 218f4f599d..ce144da5fa 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -472,12 +472,13 @@ e_shell_window_set_current_view (EShellWindow *shell_window,
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
view_name = name_or_alias;
+ list = e_shell_registry_list_modules ();
if (view_name != NULL)
view_name = e_shell_registry_get_canonical_name (view_name);
- if (view_name == NULL)
- view_name = shell_window->priv->default_view;
+ if (view_name == NULL && list != NULL)
+ view_name = G_TYPE_MODULE (list->data)->name;
g_return_if_fail (view_name != NULL);
diff --git a/shell/main.c b/shell/main.c
index 1ed06c611a..4b7c3cce3d 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -302,8 +302,7 @@ idle_cb (gchar **uris)
client = gconf_client_get_default ();
key = "/apps/evolution/shell/view_defaults/component_id";
- requested_view = gconf_client_set_string (
- client, key, initial_view, NULL);
+ gconf_client_set_string (client, key, initial_view, NULL);
g_object_unref (client);
}
diff --git a/shell/test/e-test-shell-view.c b/shell/test/e-test-shell-view.c
index be2a747354..ea771e0982 100644
--- a/shell/test/e-test-shell-view.c
+++ b/shell/test/e-test-shell-view.c
@@ -43,42 +43,14 @@ test_shell_view_changed (EShellView *shell_view)
}
static void
-test_shell_view_constructed (GObject *object)
-{
- EShellContent *shell_content;
- EShellSidebar *shell_sidebar;
- EShellView *shell_view;
- GtkWidget *widget;
-
- /* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
-
- shell_view = E_SHELL_VIEW (object);
- shell_content = e_shell_view_get_content (shell_view);
- shell_sidebar = e_shell_view_get_sidebar (shell_view);
-
- widget = gtk_label_new ("Content Widget");
- gtk_container_add (GTK_CONTAINER (shell_content), widget);
- gtk_widget_show (widget);
-
- widget = gtk_label_new ("Sidebar Widget");
- gtk_container_add (GTK_CONTAINER (shell_sidebar), widget);
- gtk_widget_show (widget);
-}
-
-static void
test_shell_view_class_init (ETestShellViewClass *class,
GTypeModule *type_module)
{
- GObjectClass *object_class;
EShellViewClass *shell_view_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (ETestShellViewPrivate));
- object_class = G_OBJECT_CLASS (class);
- object_class->constructed = test_shell_view_constructed;
-
shell_view_class = E_SHELL_VIEW_CLASS (class);
shell_view_class->label = "Test";
shell_view_class->icon_name = "face-monkey";
@@ -89,8 +61,25 @@ test_shell_view_class_init (ETestShellViewClass *class,
static void
test_shell_view_init (ETestShellView *test_shell_view)
{
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellView *shell_view;
+ GtkWidget *widget;
+
test_shell_view->priv =
E_TEST_SHELL_VIEW_GET_PRIVATE (test_shell_view);
+
+ shell_view = E_SHELL_VIEW (test_shell_view);
+ shell_content = e_shell_view_get_content (shell_view);
+ shell_sidebar = e_shell_view_get_sidebar (shell_view);
+
+ widget = gtk_label_new ("Content Widget");
+ gtk_container_add (GTK_CONTAINER (shell_content), widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_label_new ("Sidebar Widget");
+ gtk_container_add (GTK_CONTAINER (shell_sidebar), widget);
+ gtk_widget_show (widget);
}
GType