[easytag/wip/gsettings: 9/24] Store scanner window location in GSettings



commit 3ad8e563a77e4e7b11ba5f01740a467dfac73d01
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 |    4 ----
 src/setting.h |    2 --
 3 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/src/scan.c b/src/scan.c
index 7e483fb..fd6f0c9 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -3172,20 +3172,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
@@ -4134,7 +4134,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 fae82aa..f7cd80a 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -147,8 +147,6 @@ tConfigVariable Config_Variables[] =
     {"rfs_convert_space_into_underscore",        CV_TYPE_BOOL,&RFS_CONVERT_SPACE_INTO_UNDERSCORE         },
     {"rfs_remove_spaces",                        CV_TYPE_BOOL,&RFS_REMOVE_SPACES                         },
     {"scanner_window_on_top",                   CV_TYPE_BOOL,    &SCANNER_WINDOW_ON_TOP                  },
-    {"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                    },
@@ -315,8 +313,6 @@ void Init_Config_Variables (void)
     RFS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE = 1;
     RFS_CONVERT_SPACE_INTO_UNDERSCORE         = 0;
     SCANNER_WINDOW_ON_TOP                     = 1;
-    SCANNER_WINDOW_X                          = -1;
-    SCANNER_WINDOW_Y                          = -1;
 
     /*
      * Scanner window
diff --git a/src/setting.h b/src/setting.h
index 300891e..4769a1e 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -97,8 +97,6 @@ gint    RFS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE;
 gint    RFS_CONVERT_SPACE_INTO_UNDERSCORE;
 gint    RFS_REMOVE_SPACES;
 gint    SCANNER_WINDOW_ON_TOP;
-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]