[easytag/wip/gsettings: 18/21] Store preferences window location in GSettings
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/gsettings: 18/21] Store preferences window location in GSettings
- Date: Sun, 3 Mar 2013 18:35:05 +0000 (UTC)
commit 2687de81bd843d82368b22fcc75e3ce98b9071ec
Author: David King <amigadave amigadave com>
Date: Sun Mar 3 13:51:17 2013 +0000
Store preferences window location in GSettings
src/prefs.c | 27 ++++++++++++++++-----------
src/setting.c | 11 -----------
src/setting.h | 6 ------
3 files changed, 16 insertions(+), 28 deletions(-)
---
diff --git a/src/prefs.c b/src/prefs.c
index f346b93..7800bc6 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -108,7 +108,14 @@ void Open_OptionsWindow (void)
gtk_window_set_position(GTK_WINDOW(OptionsWindow),GTK_WIN_POS_CENTER);
gtk_window_set_transient_for(GTK_WINDOW(OptionsWindow),GTK_WINDOW(MainWindow));
gtk_container_set_border_width(GTK_CONTAINER(OptionsWindow), 5);
- gtk_window_set_default_size(GTK_WINDOW(OptionsWindow),OPTIONS_WINDOW_WIDTH,OPTIONS_WINDOW_HEIGHT);
+ {
+ gint width, height;
+
+ g_settings_get (ETSettings, "preferences-location", "(iiii)", NULL,
+ NULL, &width, &height);
+ gtk_window_set_default_size (GTK_WINDOW (OptionsWindow), width,
+ height);
+ }
/* Title */
gtk_window_set_title(GTK_WINDOW(OptionsWindow),_("Preferences…"));
@@ -1762,22 +1769,20 @@ void OptionsWindow_Apply_Changes (void)
{
if (OptionsWindow)
{
- //gint x, y;
- gint width, height;
GdkWindow *window;
window = gtk_widget_get_window(OptionsWindow);
if ( window && gdk_window_is_visible(window) &&
gdk_window_get_state(window)!=GDK_WINDOW_STATE_MAXIMIZED )
{
- // Position and Origin of the preferences window
- //gdk_window_get_root_origin(OptionsWindow->window,&x,&y);
- //OPTIONS_WINDOW_X = x;
- //OPTIONS_WINDOW_Y = y;
- width = gdk_window_get_width(window);
- height = gdk_window_get_height(window);
- OPTIONS_WINDOW_WIDTH = width;
- OPTIONS_WINDOW_HEIGHT = height;
+ gint x, y, width, height;
+
+ /* Position and Origin of the preferences window. */
+ gdk_window_get_root_origin(window, &x, &y);
+ width = gdk_window_get_width (window);
+ height = gdk_window_get_height (window);
+ g_settings_set (ETSettings, "preferences-location", "(iiii)", x, y,
+ width, height);
}
/* Save combobox history lists before exit */
diff --git a/src/setting.c b/src/setting.c
index 1795308..345dd12 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -201,10 +201,6 @@ tConfigVariable Config_Variables[] =
{"scan_tag_default_mask", CV_TYPE_STRING, &SCAN_TAG_DEFAULT_MASK },
{"rename_file_default_mask", CV_TYPE_STRING, &RENAME_FILE_DEFAULT_MASK },
{"rename_directory_default_mask", CV_TYPE_STRING, &RENAME_DIRECTORY_DEFAULT_MASK },
-
- {"options_window_height", CV_TYPE_INT, &OPTIONS_WINDOW_HEIGHT },
- {"options_window_width", CV_TYPE_INT, &OPTIONS_WINDOW_WIDTH }
-
};
@@ -360,13 +356,6 @@ void Init_Config_Variables (void)
SCAN_TAG_DEFAULT_MASK = NULL;
RENAME_FILE_DEFAULT_MASK = NULL;
RENAME_DIRECTORY_DEFAULT_MASK = NULL;
-
- /*
- * Other parameters
- */
- OPTIONS_WINDOW_HEIGHT = 300;
- OPTIONS_WINDOW_WIDTH = 400;
-
}
diff --git a/src/setting.h b/src/setting.h
index 547cc74..7e7345e 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -157,12 +157,6 @@ gchar *RENAME_FILE_DEFAULT_MASK;
gchar *RENAME_DIRECTORY_DEFAULT_MASK;
-/* Other parameters */
-gint OPTIONS_WINDOW_HEIGHT;
-gint OPTIONS_WINDOW_WIDTH;
-
-
-
/**************
* Prototypes *
**************/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]