[easytag/wip/gsettings: 15/29] Store load filenames window position in GSettings
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/gsettings: 15/29] Store load filenames window position in GSettings
- Date: Sat, 6 Apr 2013 23:11:24 +0000 (UTC)
commit 7e43b9aa9453356e62e8c9b180dc93afe260615b
Author: David King <amigadave amigadave com>
Date: Sun Mar 3 11:22:09 2013 +0000
Store load filenames window position in GSettings
src/misc.c | 38 ++++++++++++++++++++++++++------------
src/setting.c | 13 -------------
src/setting.h | 6 ------
3 files changed, 26 insertions(+), 31 deletions(-)
---
diff --git a/src/misc.c b/src/misc.c
index 220499a..588cf1c 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -2764,7 +2764,14 @@ void Open_Load_Filename_Window (void)
// Just center on mainwindow
gtk_window_set_position(GTK_WINDOW(LoadFilenameWindow), GTK_WIN_POS_CENTER_ON_PARENT);
-
gtk_window_set_default_size(GTK_WINDOW(LoadFilenameWindow),LOAD_FILE_WINDOW_WIDTH,LOAD_FILE_WINDOW_HEIGHT);
+ {
+ gint width, height;
+
+ g_settings_get (ETSettings, "load-filenames-position", "(iiii)", NULL,
+ NULL, &width, &height);
+ gtk_window_set_default_size (GTK_WINDOW (LoadFilenameWindow), width,
+ height);
+ }
Frame = gtk_frame_new(NULL);
gtk_container_add(GTK_CONTAINER(LoadFilenameWindow),Frame);
@@ -3063,8 +3070,16 @@ void Open_Load_Filename_Window (void)
g_signal_emit_by_name(G_OBJECT(gtk_bin_get_child(GTK_BIN(FileToLoadCombo))),"changed");
gtk_widget_show_all(LoadFilenameWindow);
- if (LOAD_FILE_WINDOW_X > 0 && LOAD_FILE_WINDOW_Y > 0)
- gtk_window_move(GTK_WINDOW(LoadFilenameWindow),LOAD_FILE_WINDOW_X,LOAD_FILE_WINDOW_Y);
+ {
+ gint x, y;
+
+ g_settings_get (ETSettings, "load-filenames-position", "(iiii)", &x,
+ &y, NULL, NULL);
+ if (x > 0 && y > 0)
+ {
+ gtk_window_move (GTK_WINDOW (LoadFilenameWindow), x, y);
+ }
+ }
}
static void
@@ -3089,21 +3104,20 @@ void Load_Filename_Window_Apply_Changes (void)
{
if (LoadFilenameWindow)
{
- gint x, y, width, height;
GdkWindow *window;
window = gtk_widget_get_window (LoadFilenameWindow);
if ( window && gdk_window_is_visible(window) &&
gdk_window_get_state(window)!=GDK_WINDOW_STATE_MAXIMIZED )
{
- // Position and Origin of the window
- gdk_window_get_root_origin(window,&x,&y);
- LOAD_FILE_WINDOW_X = x;
- LOAD_FILE_WINDOW_Y = y;
- width = gdk_window_get_width(window);
- height = gdk_window_get_height(window);
- LOAD_FILE_WINDOW_WIDTH = width;
- LOAD_FILE_WINDOW_HEIGHT = height;
+ gint x, y, width, height;
+
+ /* Position and Origin of the 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, "load-filenames-position", "(iiii)", x,
+ y, width, height);
}
}
}
diff --git a/src/setting.c b/src/setting.c
index ebe0261..23f7c28 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -163,11 +163,6 @@ tConfigVariable Config_Variables[] =
{"playlist_content_mask", CV_TYPE_BOOL, &PLAYLIST_CONTENT_MASK },
{"playlist_content_mask_value", CV_TYPE_STRING, &PLAYLIST_CONTENT_MASK_VALUE },
- {"load_file_window_x", CV_TYPE_INT, &LOAD_FILE_WINDOW_X },
- {"load_file_window_y", CV_TYPE_INT, &LOAD_FILE_WINDOW_Y },
- {"load_file_window_width", CV_TYPE_INT, &LOAD_FILE_WINDOW_WIDTH },
- {"load_file_window_height", CV_TYPE_INT, &LOAD_FILE_WINDOW_HEIGHT },
-
{"cddb_local_path", CV_TYPE_STRING, &CDDB_LOCAL_PATH },
{"cddb_search_in_artist_field", CV_TYPE_BOOL, &CDDB_SEARCH_IN_ARTIST_FIELD },
@@ -321,14 +316,6 @@ void Init_Config_Variables (void)
PLAYLIST_CONTENT_MASK_VALUE = g_strdup("%n/%l - %a - %b - %t");
/*
- * Load File window
- */
- LOAD_FILE_WINDOW_X = -1;
- LOAD_FILE_WINDOW_Y = -1;
- LOAD_FILE_WINDOW_WIDTH = -1;
- LOAD_FILE_WINDOW_HEIGHT = -1;
-
- /*
* CDDB window
*/
CDDB_LOCAL_PATH = NULL;
diff --git a/src/setting.h b/src/setting.h
index bd7affe..7620dda 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -115,12 +115,6 @@ gint PLAYLIST_CONTENT_FILENAME;
gint PLAYLIST_CONTENT_MASK;
gchar *PLAYLIST_CONTENT_MASK_VALUE;
-/* "Load filenames from txt" window */
-gint LOAD_FILE_WINDOW_X;
-gint LOAD_FILE_WINDOW_Y;
-gint LOAD_FILE_WINDOW_WIDTH;
-gint LOAD_FILE_WINDOW_HEIGHT;
-
/* CDDB in preferences window */
gchar *CDDB_LOCAL_PATH;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]