[easytag/wip/gsettings: 17/27] Store playlist window location in GSettings
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/gsettings: 17/27] Store playlist window location in GSettings
- Date: Wed, 6 Mar 2013 21:51:21 +0000 (UTC)
commit 89341b8f84dc35c7f2206e5e7b91b0bd91c85c93
Author: David King <amigadave amigadave com>
Date: Sun Mar 3 10:50:18 2013 +0000
Store playlist window location in GSettings
src/misc.c | 38 ++++++++++++++++++++++++++------------
src/setting.c | 9 ---------
src/setting.h | 5 -----
3 files changed, 26 insertions(+), 26 deletions(-)
---
diff --git a/src/misc.c b/src/misc.c
index 5507a38..92a6d16 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1261,7 +1261,14 @@ void Open_Write_Playlist_Window (void)
// Just center on mainwindow
gtk_window_set_position(GTK_WINDOW(WritePlaylistWindow), GTK_WIN_POS_CENTER_ON_PARENT);
-
gtk_window_set_default_size(GTK_WINDOW(WritePlaylistWindow),PLAYLIST_WINDOW_WIDTH,PLAYLIST_WINDOW_HEIGHT);
+ {
+ gint width, height;
+
+ g_settings_get (ETSettings, "playlist-location", "(iiii)", NULL, NULL,
+ &width, &height);
+ gtk_window_set_default_size (GTK_WINDOW (WritePlaylistWindow), width,
+ height);
+ }
Frame = gtk_frame_new(NULL);
gtk_container_add(GTK_CONTAINER(WritePlaylistWindow),Frame);
@@ -1454,8 +1461,16 @@ void Open_Write_Playlist_Window (void)
g_signal_connect_swapped(G_OBJECT(Button),"clicked",G_CALLBACK(Playlist_Write_Button_Pressed),NULL);
gtk_widget_show_all(WritePlaylistWindow);
- if (PLAYLIST_WINDOW_X > 0 && PLAYLIST_WINDOW_Y > 0)
- gtk_window_move(GTK_WINDOW(WritePlaylistWindow),PLAYLIST_WINDOW_X,PLAYLIST_WINDOW_Y);
+ {
+ gint x, y;
+
+ g_settings_get (ETSettings, "playlist-location", "(iiii)", &x, &y, NULL,
+ NULL);
+ if (x > 0 && y > 0)
+ {
+ gtk_window_move (GTK_WINDOW (WritePlaylistWindow), x, y);
+ }
+ }
/* To initialize the mask status icon and visibility */
g_signal_emit_by_name(G_OBJECT(gtk_bin_get_child(GTK_BIN(PlayListNameMaskCombo))),"changed");
@@ -1481,21 +1496,20 @@ void Write_Playlist_Window_Apply_Changes (void)
{
if (WritePlaylistWindow)
{
- gint x, y, width, height;
GdkWindow *window;
window = gtk_widget_get_window (WritePlaylistWindow);
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);
- PLAYLIST_WINDOW_X = x;
- PLAYLIST_WINDOW_Y = y;
- width = gdk_window_get_width(window);
- height = gdk_window_get_height(window);
- PLAYLIST_WINDOW_WIDTH = width;
- PLAYLIST_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, "playlist-location", "(iiii)", x, y,
+ width, height);
}
/* List of variables also set in the function 'Playlist_Write_Button_Pressed' */
diff --git a/src/setting.c b/src/setting.c
index 10f0689..f19f2a2 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -169,10 +169,6 @@ tConfigVariable Config_Variables[] =
{"playlist_content_filename", CV_TYPE_BOOL, &PLAYLIST_CONTENT_FILENAME },
{"playlist_content_mask", CV_TYPE_BOOL, &PLAYLIST_CONTENT_MASK },
{"playlist_content_mask_value", CV_TYPE_STRING, &PLAYLIST_CONTENT_MASK_VALUE },
- {"playlist_window_x", CV_TYPE_INT, &PLAYLIST_WINDOW_X },
- {"playlist_window_y", CV_TYPE_INT, &PLAYLIST_WINDOW_Y },
- {"playlist_window_width", CV_TYPE_INT, &PLAYLIST_WINDOW_WIDTH },
- {"playlist_window_height", CV_TYPE_INT, &PLAYLIST_WINDOW_HEIGHT },
{"load_file_window_x", CV_TYPE_INT, &LOAD_FILE_WINDOW_X },
{"load_file_window_y", CV_TYPE_INT, &LOAD_FILE_WINDOW_Y },
@@ -337,11 +333,6 @@ void Init_Config_Variables (void)
PLAYLIST_CONTENT_MASK = 0;
PLAYLIST_CONTENT_MASK_VALUE = g_strdup("%n/%l - %a - %b - %t");
- PLAYLIST_WINDOW_X = -1;
- PLAYLIST_WINDOW_Y = -1;
- PLAYLIST_WINDOW_WIDTH = -1;
- PLAYLIST_WINDOW_HEIGHT = -1;
-
/*
* Load File window
*/
diff --git a/src/setting.h b/src/setting.h
index 4ffa061..e80d31f 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -121,11 +121,6 @@ gint PLAYLIST_CONTENT_FILENAME;
gint PLAYLIST_CONTENT_MASK;
gchar *PLAYLIST_CONTENT_MASK_VALUE;
-gint PLAYLIST_WINDOW_X;
-gint PLAYLIST_WINDOW_Y;
-gint PLAYLIST_WINDOW_WIDTH;
-gint PLAYLIST_WINDOW_HEIGHT;
-
/* "Load filenames from txt" window */
gint LOAD_FILE_WINDOW_X;
gint LOAD_FILE_WINDOW_Y;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]