[easytag/wip/gsettings: 27/42] Store playlist window location in GSettings
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/gsettings: 27/42] Store playlist window location in GSettings
- Date: Fri, 26 Apr 2013 23:10:31 +0000 (UTC)
commit 74193921bbf980c1b6e70fd4b4d1d428d2b4d30f
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 69aad0d..baeb4ec 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1257,7 +1257,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);
@@ -1450,8 +1457,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");
@@ -1477,21 +1492,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 abeedb8..dfafc71 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -162,10 +162,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 },
@@ -324,11 +320,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 d4b3cf6..bd7affe 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -115,11 +115,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]