[evolution] Bug 613038 - Preview pane size not remembered



commit 732e7096a18a2e2bb9074bdf8026af037d9f8685
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri May 28 15:57:44 2010 -0400

    Bug 613038 - Preview pane size not remembered
    
    Converted size restoration of all preview panes to be triggered by
    EShellWindow::shell-view-created signal.  The signal is emitted when
    the view is fully initialized and visible.  Shell views can use that
    as a trigger for restoring pane sizes from GConf.

 modules/addressbook/e-book-shell-content.c |   44 ++++++++++++++++++-------
 modules/calendar/e-memo-shell-content.c    |   46 +++++++++++++++++++-------
 modules/calendar/e-task-shell-content.c    |   44 ++++++++++++++++++-------
 modules/mail/e-mail-shell-content.c        |   48 +++++++++++++++++++--------
 4 files changed, 129 insertions(+), 53 deletions(-)
---
diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c
index 4a48677..66cd6a4 100644
--- a/modules/addressbook/e-book-shell-content.c
+++ b/modules/addressbook/e-book-shell-content.c
@@ -66,6 +66,31 @@ book_shell_content_send_message_cb (EBookShellContent *book_shell_content,
 	eab_send_as_to (&node);
 }
 
+static void
+book_shell_content_restore_state_cb (EShellWindow *shell_window,
+                                     EShellView *shell_view,
+                                     EShellContent *shell_content)
+{
+	EBookShellContentPrivate *priv;
+	GConfBridge *bridge;
+	GObject *object;
+	const gchar *key;
+
+	priv = E_BOOK_SHELL_CONTENT_GET_PRIVATE (shell_content);
+
+	/* Bind GObject properties to GConf keys. */
+
+	bridge = gconf_bridge_get ();
+
+	object = G_OBJECT (priv->paned);
+	key = "/apps/evolution/addressbook/display/hpane_position";
+	gconf_bridge_bind_property_delayed (bridge, key, object, "hposition");
+
+	object = G_OBJECT (priv->paned);
+	key = "/apps/evolution/addressbook/display/vpane_position";
+	gconf_bridge_bind_property_delayed (bridge, key, object, "vposition");
+}
+
 static GtkOrientation
 book_shell_content_get_orientation (EBookShellContent *book_shell_content)
 {
@@ -190,10 +215,8 @@ book_shell_content_constructed (GObject *object)
 	EShellWindow *shell_window;
 	EShellContent *shell_content;
 	EShellTaskbar *shell_taskbar;
-	GConfBridge *bridge;
 	GtkWidget *container;
 	GtkWidget *widget;
-	const gchar *key;
 
 	priv = E_BOOK_SHELL_CONTENT_GET_PRIVATE (object);
 
@@ -247,17 +270,12 @@ book_shell_content_constructed (GObject *object)
 
 	e_binding_new (object, "preview-visible", widget, "visible");
 
-	/* Bind GObject properties to GConf keys. */
-
-	bridge = gconf_bridge_get ();
-
-	object = G_OBJECT (priv->paned);
-	key = "/apps/evolution/addressbook/display/hpane_position";
-	gconf_bridge_bind_property_delayed (bridge, key, object, "hposition");
-
-	object = G_OBJECT (priv->paned);
-	key = "/apps/evolution/addressbook/display/vpane_position";
-	gconf_bridge_bind_property_delayed (bridge, key, object, "vposition");
+	/* Restore pane positions from the last session once
+	 * the shell view is fully initialized and visible. */
+	g_signal_connect (
+		shell_window, "shell-view-created::addressbook",
+		G_CALLBACK (book_shell_content_restore_state_cb),
+		shell_content);
 }
 
 static void
diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c
index 279f063..f9188de 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-shell-content.c
@@ -266,6 +266,31 @@ memo_shell_content_model_row_changed_cb (EMemoShellContent *memo_shell_content,
 		memo_shell_content, 0, E_TABLE (memo_table));
 }
 
+static void
+memo_shell_content_restore_state_cb (EShellWindow *shell_window,
+                                     EShellView *shell_view,
+                                     EShellContent *shell_content)
+{
+	EMemoShellContentPrivate *priv;
+	GConfBridge *bridge;
+	GObject *object;
+	const gchar *key;
+
+	priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (shell_content);
+
+	/* Bind GObject properties to GConf keys. */
+
+	bridge = gconf_bridge_get ();
+
+	object = G_OBJECT (priv->paned);
+	key = "/apps/evolution/calendar/display/memo_hpane_position";
+	gconf_bridge_bind_property_delayed (bridge, key, object, "hposition");
+
+	object = G_OBJECT (priv->paned);
+	key = "/apps/evolution/calendar/display/memo_vpane_position";
+	gconf_bridge_bind_property_delayed (bridge, key, object, "vposition");
+}
+
 static GtkOrientation
 memo_shell_content_get_orientation (EMemoShellContent *memo_shell_content)
 {
@@ -395,14 +420,13 @@ memo_shell_content_constructed (GObject *object)
 	EShellBackend *shell_backend;
 	EShellContent *shell_content;
 	EShellTaskbar *shell_taskbar;
+	EShellWindow *shell_window;
 	GalViewInstance *view_instance;
 	icaltimezone *timezone;
-	GConfBridge *bridge;
 	GtkTargetList *target_list;
 	GtkTargetEntry *targets;
 	GtkWidget *container;
 	GtkWidget *widget;
-	const gchar *key;
 	gint n_targets;
 
 	priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object);
@@ -414,6 +438,7 @@ memo_shell_content_constructed (GObject *object)
 	shell_view = e_shell_content_get_shell_view (shell_content);
 	shell_backend = e_shell_view_get_shell_backend (shell_view);
 	shell_taskbar = e_shell_view_get_shell_taskbar (shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
 
 	shell = e_shell_backend_get_shell (shell_backend);
 	shell_settings = e_shell_get_shell_settings (shell);
@@ -524,17 +549,12 @@ memo_shell_content_constructed (GObject *object)
 	gal_view_instance_load (view_instance);
 	priv->view_instance = view_instance;
 
-	/* Bind GObject properties to GConf keys. */
-
-	bridge = gconf_bridge_get ();
-
-	object = G_OBJECT (priv->paned);
-	key = "/apps/evolution/calendar/display/memo_hpane_position";
-	gconf_bridge_bind_property_delayed (bridge, key, object, "hposition");
-
-	object = G_OBJECT (priv->paned);
-	key = "/apps/evolution/calendar/display/memo_vpane_position";
-	gconf_bridge_bind_property_delayed (bridge, key, object, "vposition");
+	/* Restore pane positions from the last session once
+	 * the shell view is fully initialized and visible. */
+	g_signal_connect (
+		shell_window, "shell-view-created::memos",
+		G_CALLBACK (memo_shell_content_restore_state_cb),
+		shell_content);
 }
 
 static guint32
diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c
index fdbfa75..b2744a8 100644
--- a/modules/calendar/e-task-shell-content.c
+++ b/modules/calendar/e-task-shell-content.c
@@ -264,6 +264,31 @@ task_shell_content_model_row_changed_cb (ETaskShellContent *task_shell_content,
 		task_shell_content, 0, E_TABLE (task_table));
 }
 
+static void
+task_shell_content_restore_state_cb (EShellWindow *shell_window,
+                                     EShellView *shell_view,
+                                     EShellContent *shell_content)
+{
+	ETaskShellContentPrivate *priv;
+	GConfBridge *bridge;
+	GObject *object;
+	const gchar *key;
+
+	priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (shell_content);
+
+	/* Bind GObject properties to GConf keys. */
+
+	bridge = gconf_bridge_get ();
+
+	object = G_OBJECT (priv->paned);
+	key = "/apps/evolution/calendar/display/task_hpane_position";
+	gconf_bridge_bind_property_delayed (bridge, key, object, "hposition");
+
+	object = G_OBJECT (priv->paned);
+	key = "/apps/evolution/calendar/display/task_vpane_position";
+	gconf_bridge_bind_property_delayed (bridge, key, object, "vposition");
+}
+
 static GtkOrientation
 task_shell_content_get_orientation (ETaskShellContent *task_shell_content)
 {
@@ -395,12 +420,10 @@ task_shell_content_constructed (GObject *object)
 	EShellView *shell_view;
 	GalViewInstance *view_instance;
 	icaltimezone *timezone;
-	GConfBridge *bridge;
 	GtkTargetList *target_list;
 	GtkTargetEntry *targets;
 	GtkWidget *container;
 	GtkWidget *widget;
-	const gchar *key;
 	gint n_targets;
 
 	priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object);
@@ -521,17 +544,12 @@ task_shell_content_constructed (GObject *object)
 	gal_view_instance_load (view_instance);
 	priv->view_instance = view_instance;
 
-	/* Bind GObject properties to GConf keys. */
-
-	bridge = gconf_bridge_get ();
-
-	object = G_OBJECT (priv->paned);
-	key = "/apps/evolution/calendar/display/task_hpane_position";
-	gconf_bridge_bind_property_delayed (bridge, key, object, "hposition");
-
-	object = G_OBJECT (priv->paned);
-	key = "/apps/evolution/calendar/display/task_vpane_position";
-	gconf_bridge_bind_property_delayed (bridge, key, object, "vposition");
+	/* Restore pane positions from the last session once
+	 * the shell view is fully initialized and visible. */
+	g_signal_connect (
+		shell_window, "shell-view-created::tasks",
+		G_CALLBACK (task_shell_content_restore_state_cb),
+		shell_content);
 }
 
 static guint32
diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c
index ecd592f..d029b46 100644
--- a/modules/mail/e-mail-shell-content.c
+++ b/modules/mail/e-mail-shell-content.c
@@ -227,6 +227,31 @@ mail_shell_content_message_selected_cb (EMailShellContent *mail_shell_content,
 	g_free (group_name);
 }
 
+static void
+mail_shell_content_restore_state_cb (EShellWindow *shell_window,
+                                     EShellView *shell_view,
+                                     EShellContent *shell_content)
+{
+	EMailShellContentPrivate *priv;
+	GConfBridge *bridge;
+	GObject *object;
+	const gchar *key;
+
+	priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (shell_content);
+
+	/* Bind GObject properties to GConf keys. */
+
+	bridge = gconf_bridge_get ();
+
+	object = G_OBJECT (priv->paned);
+	key = "/apps/evolution/mail/display/hpaned_size";
+	gconf_bridge_bind_property (bridge, key, object, "hposition");
+
+	object = G_OBJECT (priv->paned);
+	key = "/apps/evolution/mail/display/paned_size";
+	gconf_bridge_bind_property (bridge, key, object, "vposition");
+}
+
 static GtkOrientation
 mail_shell_content_get_orientation (EMailShellContent *mail_shell_content)
 {
@@ -365,15 +390,14 @@ mail_shell_content_constructed (GObject *object)
 	EMailShellContentPrivate *priv;
 	EShellContent *shell_content;
 	EShellBackend *shell_backend;
+	EShellWindow *shell_window;
 	EShellView *shell_view;
 	ESearchBar *search_bar;
 	EMailReader *reader;
 	GtkWidget *message_list;
-	GConfBridge *bridge;
 	GtkWidget *container;
 	GtkWidget *widget;
 	EWebView *web_view;
-	const gchar *key;
 
 	priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object);
 	priv->html_display = em_format_html_display_new ();
@@ -383,6 +407,7 @@ mail_shell_content_constructed (GObject *object)
 
 	shell_content = E_SHELL_CONTENT (object);
 	shell_view = e_shell_content_get_shell_view (shell_content);
+	shell_window = e_shell_view_get_shell_window (shell_view);
 	shell_backend = e_shell_view_get_shell_backend (shell_view);
 
 	web_view = E_WEB_VIEW (EM_FORMAT_HTML (priv->html_display)->html);
@@ -439,18 +464,6 @@ mail_shell_content_constructed (GObject *object)
 	e_mail_shell_content_update_view_instance (
 		E_MAIL_SHELL_CONTENT (shell_content));
 
-	/* Bind GObject properties to GConf keys. */
-
-	bridge = gconf_bridge_get ();
-
-	object = G_OBJECT (priv->paned);
-	key = "/apps/evolution/mail/display/hpaned_size";
-	gconf_bridge_bind_property (bridge, key, object, "hposition");
-
-	object = G_OBJECT (priv->paned);
-	key = "/apps/evolution/mail/display/paned_size";
-	gconf_bridge_bind_property (bridge, key, object, "vposition");
-
 	/* Message list customizations. */
 
 	reader = E_MAIL_READER (shell_content);
@@ -461,6 +474,13 @@ mail_shell_content_constructed (GObject *object)
 		G_CALLBACK (mail_shell_content_message_selected_cb),
 		shell_content);
 
+	/* Restore pane positions from the last session once
+	 * the shell view is fully initialized and visible. */
+	g_signal_connect (
+		shell_window, "shell-view-created::mail",
+		G_CALLBACK (mail_shell_content_restore_state_cb),
+		shell_content);
+
 	e_mail_reader_connect_headers (reader);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]