[easytag/wip/gsettings: 11/25] Store scanner window location in GSettings



commit 86efb3d1893d95f71ee0067750bd44925ecca63c
Author: David King <amigadave amigadave com>
Date:   Sun Mar 3 09:35:50 2013 +0000

    Store scanner window location in GSettings

 src/scan.c    |   22 +++++++++++++---------
 src/setting.c |    6 +-----
 src/setting.h |    2 --
 3 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/src/scan.c b/src/scan.c
index 45105bd..e7c4aad 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -3147,20 +3147,20 @@ void ScannerWindow_Apply_Changes (void)
 {
     if (ScannerWindow)
     {
-        gint x, y;//, width, height;
         GdkWindow *window;
 
         window = gtk_widget_get_window(ScannerWindow);
 
         if ( window && gdk_window_is_visible(window) && 
gdk_window_get_state(window)!=GDK_WINDOW_STATE_MAXIMIZED )
         {
-            // Position and Origin of the scanner window
-            gdk_window_get_root_origin(window,&x,&y);
-            SCANNER_WINDOW_X = x;
-            SCANNER_WINDOW_Y = y;
-            //gdk_window_get_size(window,&width,&height);
-            //SCANNER_WINDOW_WIDTH  = width;
-            //SCANNER_WINDOW_HEIGHT = height;
+            gint x, y, width, height;
+
+            /* Position and Origin of the scanner 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, "scan-location", "(iiii)", x, y, width,
+                            height);
         }
 
         // The scanner selected
@@ -4109,7 +4109,11 @@ Scan_Set_Scanner_Window_Init_Position (void)
     if (ScannerWindow && g_settings_get_boolean (ETSettings,
                                                  "scan-remember-location"))
     {
+        gint x, y;
+
         gtk_widget_realize(ScannerWindow);
-        gtk_window_move(GTK_WINDOW(ScannerWindow),SCANNER_WINDOW_X,SCANNER_WINDOW_Y);
+        g_settings_get (ETSettings, "scan-location", "(iiii)", &x, &y, NULL,
+                        NULL);
+        gtk_window_move (GTK_WINDOW (ScannerWindow), x, y);
     }
 }
diff --git a/src/setting.c b/src/setting.c
index 2c3ddf8..b8c1467 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -141,9 +141,6 @@ tConfigVariable Config_Variables[] =
     {"rfs_convert_underscore_and_p20_into_space",CV_TYPE_BOOL,&RFS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE },
     {"rfs_convert_space_into_underscore",        CV_TYPE_BOOL,&RFS_CONVERT_SPACE_INTO_UNDERSCORE         },
     {"rfs_remove_spaces",                        CV_TYPE_BOOL,&RFS_REMOVE_SPACES                         },
-    {"scanner_window_x",                        CV_TYPE_INT,     &SCANNER_WINDOW_X                       },
-    {"scanner_window_y",                        CV_TYPE_INT,     &SCANNER_WINDOW_Y                       },
-
     {"process_filename_field",                  CV_TYPE_BOOL,    &PROCESS_FILENAME_FIELD                 },
     {"process_title_field",                     CV_TYPE_BOOL,    &PROCESS_TITLE_FIELD                    },
     {"process_artist_field",                    CV_TYPE_BOOL,    &PROCESS_ARTIST_FIELD                   },
@@ -302,8 +299,7 @@ void Init_Config_Variables (void)
     FTS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE = 1;
     FTS_CONVERT_SPACE_INTO_UNDERSCORE         = 0;
     RFS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE = 1;
-    SCANNER_WINDOW_X                          = -1;
-    SCANNER_WINDOW_Y                          = -1;
+    RFS_CONVERT_SPACE_INTO_UNDERSCORE         = 0;
 
     /*
      * Scanner window
diff --git a/src/setting.h b/src/setting.h
index 4ba69e6..ad6492b 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -91,8 +91,6 @@ gint    FTS_CONVERT_SPACE_INTO_UNDERSCORE;
 gint    RFS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE;
 gint    RFS_CONVERT_SPACE_INTO_UNDERSCORE;
 gint    RFS_REMOVE_SPACES;
-gint    SCANNER_WINDOW_X;
-gint    SCANNER_WINDOW_Y;
 
 /* Scanner window */
 gint    PROCESS_FILENAME_FIELD;


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