[easytag/wip/gsettings: 8/25] Store GtkPaned positions in GSettings
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/gsettings: 8/25] Store GtkPaned positions in GSettings
- Date: Sat, 16 Mar 2013 21:06:58 +0000 (UTC)
commit cdac47d63358990691a2baceca21feecde739d82
Author: David King <amigadave amigadave com>
Date: Sat Mar 2 23:32:24 2013 +0000
Store GtkPaned positions in GSettings
src/browser.c | 16 ++++++++++++++--
src/easytag.c | 29 +++++++++++++++++++++--------
src/setting.c | 10 ----------
src/setting.h | 5 -----
4 files changed, 35 insertions(+), 25 deletions(-)
---
diff --git a/src/browser.c b/src/browser.c
index a961e04..dee8544 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -3312,7 +3312,13 @@ GtkWidget *Create_Browser_Items (GtkWidget *parent)
gtk_paned_pack1(GTK_PANED(ArtistAlbumVPaned),ScrollWindowArtistList,TRUE,TRUE); // Top side
gtk_paned_pack2(GTK_PANED(ArtistAlbumVPaned),ScrollWindowAlbumList,TRUE,TRUE); // Bottom side
- gtk_paned_set_position(GTK_PANED(ArtistAlbumVPaned),PANE_HANDLE_POSITION3);
+ {
+ gint pos3;
+
+ g_settings_get (ETSettings, "pane-positions", "(uuuu)", NULL, NULL,
+ &pos3, NULL);
+ gtk_paned_set_position (GTK_PANED (ArtistAlbumVPaned), pos3);
+ }
/*
@@ -3597,7 +3603,13 @@ GtkWidget *Create_Browser_Items (GtkWidget *parent)
gtk_box_pack_start(GTK_BOX(VerticalBox),BrowserHPaned,TRUE,TRUE,0);
gtk_paned_pack1(GTK_PANED(BrowserHPaned),BrowserNoteBook,TRUE,TRUE); // Left side
gtk_paned_pack2(GTK_PANED(BrowserHPaned),ScrollWindowFileList,TRUE,TRUE); // Right side
- gtk_paned_set_position(GTK_PANED(BrowserHPaned),PANE_HANDLE_POSITION2);
+ {
+ gint pos2;
+
+ g_settings_get (ETSettings, "pane-positions", "(uuuu)", NULL, &pos2,
+ NULL, NULL);
+ gtk_paned_set_position (GTK_PANED (BrowserHPaned), pos2);
+ }
gtk_widget_show_all(VerticalBox);
diff --git a/src/easytag.c b/src/easytag.c
index b9618f1..2b205b2 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -390,7 +390,13 @@ activate (GApplication *application, gpointer user_data)
/* The two panes: BrowserArea on the left, FileArea+TagArea on the right */
MainWindowHPaned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
//gtk_box_pack_start(GTK_BOX(MainVBox),MainWindowHPaned,TRUE,TRUE,0);
- gtk_paned_set_position(GTK_PANED(MainWindowHPaned),PANE_HANDLE_POSITION1);
+ {
+ gint pos1;
+
+ g_settings_get (ETSettings, "pane-positions", "(uuuu)", &pos1, NULL,
+ NULL, NULL);
+ gtk_paned_set_position (GTK_PANED (MainWindowHPaned), pos1);
+ }
gtk_widget_show(MainWindowHPaned);
/* Browser (Tree + File list + Entry) */
@@ -414,7 +420,12 @@ activate (GApplication *application, gpointer user_data)
MainWindowVPaned = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
gtk_box_pack_start(GTK_BOX(MainVBox),MainWindowVPaned,TRUE,TRUE,0);
gtk_paned_pack1(GTK_PANED(MainWindowVPaned),MainWindowHPaned,TRUE,FALSE);
- gtk_paned_set_position(GTK_PANED(MainWindowVPaned),PANE_HANDLE_POSITION4);
+ {
+ gint pos4;
+ g_settings_get (ETSettings, "pane-positions", "(uuuu)", NULL, NULL,
+ NULL, &pos4);
+ gtk_paned_set_position (GTK_PANED (MainWindowVPaned), pos4);
+ }
gtk_widget_show(MainWindowVPaned);
@@ -5103,6 +5114,7 @@ void MainWindow_Apply_Changes (void)
if ( window && gdk_window_is_visible(window) && gdk_window_get_state(window)!=GDK_WINDOW_STATE_MAXIMIZED
)
{
gint x, y, width, height;
+ gint pos1, pos2, pos3, pos4;
/* Position and Origin of the window. */
gdk_window_get_root_origin(window,&x,&y);
@@ -5111,11 +5123,12 @@ void MainWindow_Apply_Changes (void)
g_settings_set (ETSettings, "window-location", "(iiii)", x, y, width,
height);
- // Handle panes position
- PANE_HANDLE_POSITION1 = gtk_paned_get_position(GTK_PANED(MainWindowHPaned));
- PANE_HANDLE_POSITION2 = gtk_paned_get_position(GTK_PANED(BrowserHPaned));
- PANE_HANDLE_POSITION3 = gtk_paned_get_position(GTK_PANED(ArtistAlbumVPaned));
- PANE_HANDLE_POSITION4 = gtk_paned_get_position(GTK_PANED(MainWindowVPaned));
+ /* Handle panes position. */
+ pos1 = gtk_paned_get_position (GTK_PANED (MainWindowHPaned));
+ pos2 = gtk_paned_get_position (GTK_PANED (BrowserHPaned));
+ pos3 = gtk_paned_get_position (GTK_PANED (ArtistAlbumVPaned));
+ pos4 = gtk_paned_get_position (GTK_PANED (MainWindowVPaned));
+ g_settings_set (ETSettings, "pane-positions", "(uuuu)", pos1, pos2,
+ pos3, pos4);
}
-
}
diff --git a/src/setting.c b/src/setting.c
index 63d5391..fae82aa 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -111,11 +111,6 @@ tConfigVariable Config_Variables[] =
{
{"default_path_to_mp3", CV_TYPE_STRING, &DEFAULT_PATH_TO_MP3 },
- {"pane_handle_position1", CV_TYPE_INT, &PANE_HANDLE_POSITION1 },
- {"pane_handle_position2", CV_TYPE_INT, &PANE_HANDLE_POSITION2 },
- {"pane_handle_position3", CV_TYPE_INT, &PANE_HANDLE_POSITION3 },
- {"pane_handle_position4", CV_TYPE_INT, &PANE_HANDLE_POSITION4 },
-
{"sorting_file_mode", CV_TYPE_INT, &SORTING_FILE_MODE },
{"sorting_file_case_sensitive", CV_TYPE_BOOL, &SORTING_FILE_CASE_SENSITIVE },
@@ -259,11 +254,6 @@ void Init_Config_Variables (void)
/*
* Misc
*/
- PANE_HANDLE_POSITION1 = 660;
- PANE_HANDLE_POSITION2 = 360;
- PANE_HANDLE_POSITION3 = 300;
- PANE_HANDLE_POSITION4 = 300;
-
SORTING_FILE_MODE = SORTING_BY_ASCENDING_FILENAME;
#ifdef G_OS_WIN32
SORTING_FILE_CASE_SENSITIVE = 1;
diff --git a/src/setting.h b/src/setting.h
index 2ad0436..300891e 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -55,11 +55,6 @@ gchar *DEFAULT_PATH_TO_MP3;
/* Misc */
/* User Interface. */
-gint PANE_HANDLE_POSITION1;
-gint PANE_HANDLE_POSITION2;
-gint PANE_HANDLE_POSITION3;
-gint PANE_HANDLE_POSITION4;
-
gint SORTING_FILE_MODE;
gint SORTING_FILE_CASE_SENSITIVE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]