[easytag/wip/application-window: 64/64] WIP Save application window paned state
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/application-window: 64/64] WIP Save application window paned state
- Date: Thu, 17 Jul 2014 07:42:35 +0000 (UTC)
commit 3b88a6015e11cd998c842b4a30e4259c0c0edeea
Author: David King <amigadave amigadave com>
Date: Thu Jul 17 08:31:19 2014 +0100
WIP Save application window paned state
TODO Does not seem to restore state correctly, is the paned position set
too early?
Browser paned should be managed by EtBrowser.
src/application_window.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/application_window.c b/src/application_window.c
index dde830e..b346a2b 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -147,6 +147,9 @@ save_state (EtApplicationWindow *self)
priv->height);
g_key_file_set_boolean (keyfile, "EtApplicationWindow", "is_maximized",
priv->is_maximized);
+ g_key_file_set_integer (keyfile, "EtApplicationWindow", "paned_position",
+ gtk_paned_get_position (GTK_PANED (priv->hpaned)));
+
/* TODO; Use g_key_file_save_to_file() in GLib 2.40. */
buffer = g_key_file_to_data (keyfile, &length, NULL);
@@ -170,6 +173,7 @@ restore_state (EtApplicationWindow *self)
GKeyFile *keyfile;
gchar *path;
GError *error = NULL;
+ gint paned_position;
priv = et_application_window_get_instance_private (self);
window = GTK_WINDOW (self);
@@ -198,6 +202,8 @@ restore_state (EtApplicationWindow *self)
priv->is_maximized = g_key_file_get_boolean (keyfile,
"EtApplicationWindow",
"is_maximized", NULL);
+ paned_position = g_key_file_get_integer (keyfile, "EtApplicationWindow",
+ "paned_position", NULL);
gtk_window_set_default_size (window, priv->width, priv->height);
@@ -205,6 +211,11 @@ restore_state (EtApplicationWindow *self)
{
gtk_window_maximize (window);
}
+
+ if (paned_position > 0)
+ {
+ gtk_paned_set_position (GTK_PANED (priv->hpaned), paned_position);
+ }
}
static gboolean
@@ -3180,9 +3191,6 @@ et_application_window_init (EtApplicationWindow *self)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_paned_pack2 (GTK_PANED (priv->hpaned), vbox, FALSE, FALSE);
- /* TODO: Set a sensible default size for both widgets in the paned. */
- gtk_paned_set_position (GTK_PANED (priv->hpaned), 600);
-
/* File */
priv->file_area = create_file_area ();
gtk_box_pack_start (GTK_BOX (vbox), priv->file_area, FALSE, FALSE, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]