[easytag/wip/gsettings: 16/18] Store search window location in GSettings
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/gsettings: 16/18] Store search window location in GSettings
- Date: Sun, 3 Mar 2013 16:07:55 +0000 (UTC)
commit 5f3fc5430cfc05378d539e9ec14f891666e6666d
Author: David King <amigadave amigadave com>
Date: Sun Mar 3 12:32:08 2013 +0000
Store search window location in GSettings
src/misc.c | 36 +++++++++++++++++++++++-------------
src/setting.c | 13 -------------
src/setting.h | 6 ------
3 files changed, 23 insertions(+), 32 deletions(-)
---
diff --git a/src/misc.c b/src/misc.c
index f8fecaf..255ecca 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1973,7 +1973,14 @@ void Open_Search_File_Window (void)
g_signal_connect(G_OBJECT(SearchFileWindow),"destroy", G_CALLBACK(Destroy_Search_File_Window),NULL);
g_signal_connect(G_OBJECT(SearchFileWindow),"delete_event", G_CALLBACK(Destroy_Search_File_Window),NULL);
g_signal_connect(G_OBJECT(SearchFileWindow),"key_press_event",
G_CALLBACK(Search_File_Window_Key_Press),NULL);
- gtk_window_set_default_size(GTK_WINDOW(SearchFileWindow),SEARCH_WINDOW_WIDTH,SEARCH_WINDOW_HEIGHT);
+ {
+ gint width, height;
+
+ g_settings_get (ETSettings, "search-location", "(iiii)", NULL, NULL,
+ &width, &height);
+ gtk_window_set_default_size (GTK_WINDOW (SearchFileWindow), width,
+ height);
+ }
VBox = gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
gtk_container_add(GTK_CONTAINER(SearchFileWindow),VBox);
@@ -2269,9 +2276,13 @@ void Open_Search_File_Window (void)
gtk_widget_show_all(SearchFileWindow);
if (g_settings_get_boolean (ETSettings, "search-remember-location"))
- gtk_window_move(GTK_WINDOW(SearchFileWindow), SEARCH_WINDOW_X, SEARCH_WINDOW_Y);
- //else
- // gtk_window_set_position(GTK_WINDOW(SearchFileWindow), GTK_WIN_POS_CENTER_ON_PARENT); // Must use
gtk_window_set_transient_for to work
+ {
+ gint x, y;
+
+ g_settings_get (ETSettings, "search-location", "(iiii)", &x, &y, NULL,
+ NULL);
+ gtk_window_move (GTK_WINDOW (SearchFileWindow), x, y);
+ }
}
static void
@@ -2296,21 +2307,20 @@ void Search_File_Window_Apply_Changes (void)
{
if (SearchFileWindow)
{
- gint x, y, width, height;
GdkWindow *window;
window = gtk_widget_get_window(SearchFileWindow);
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);
- SEARCH_WINDOW_X = x;
- SEARCH_WINDOW_Y = y;
- width = gdk_window_get_width(window);
- height = gdk_window_get_height(window);
- SEARCH_WINDOW_WIDTH = width;
- SEARCH_WINDOW_HEIGHT = height;
+ gint x, y, width, height;
+
+ /* Position and Origin of the search 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, "search-location", "(iiii)", x, y,
+ width, height);
}
}
}
diff --git a/src/setting.c b/src/setting.c
index aff34d4..1795308 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -198,11 +198,6 @@ tConfigVariable Config_Variables[] =
{"cddb_set_to_genre", CV_TYPE_BOOL, &CDDB_SET_TO_GENRE },
{"cddb_set_to_file_name", CV_TYPE_BOOL, &CDDB_SET_TO_FILE_NAME },
- {"search_window_x", CV_TYPE_INT, &SEARCH_WINDOW_X },
- {"search_window_y", CV_TYPE_INT, &SEARCH_WINDOW_Y },
- {"search_window_height", CV_TYPE_INT, &SEARCH_WINDOW_HEIGHT },
- {"search_window_width", CV_TYPE_INT, &SEARCH_WINDOW_WIDTH },
-
{"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 },
@@ -360,14 +355,6 @@ void Init_Config_Variables (void)
CDDB_SET_TO_FILE_NAME = 1;
/*
- * Search window
- */
- SEARCH_WINDOW_X = -1;
- SEARCH_WINDOW_Y = -1;
- SEARCH_WINDOW_HEIGHT = 350;
- SEARCH_WINDOW_WIDTH = 650;
-
- /*
* Masks
*/
SCAN_TAG_DEFAULT_MASK = NULL;
diff --git a/src/setting.h b/src/setting.h
index 3b3d4ee..547cc74 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -151,12 +151,6 @@ gint CDDB_SET_TO_TRACK_TOTAL;
gint CDDB_SET_TO_GENRE;
gint CDDB_SET_TO_FILE_NAME;
-/* Search Window */
-gint SEARCH_WINDOW_X;
-gint SEARCH_WINDOW_Y;
-gint SEARCH_WINDOW_HEIGHT;
-gint SEARCH_WINDOW_WIDTH;
-
/* Default mask */
gchar *SCAN_TAG_DEFAULT_MASK;
gchar *RENAME_FILE_DEFAULT_MASK;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]