summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-03-10 12:23:43 +0100
committerGravatar waker <wakeroid@gmail.com>2011-03-10 12:23:43 +0100
commitaeb68a9fa25bdce10e4d6974fca4bb4f8c4a35b8 (patch)
tree6062d7b82b02c96083f6befb43e5e8019e2b25a4
parentf03869a1d76f9428b367d6c7301ca073f38fc36d (diff)
save/restore preferences window geometry
-rw-r--r--plugins/gtkui/callbacks.c4
-rw-r--r--plugins/gtkui/callbacks.h19
-rw-r--r--plugins/gtkui/deadbeef.glade7
-rw-r--r--plugins/gtkui/interface.c11
-rw-r--r--plugins/gtkui/prefwin.c29
-rw-r--r--plugins/gtkui/wingeom.c4
6 files changed, 64 insertions, 10 deletions
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c
index e3038584..71ad353f 100644
--- a/plugins/gtkui/callbacks.c
+++ b/plugins/gtkui/callbacks.c
@@ -1170,7 +1170,3 @@ create_plugin_weblink (gchar *widget_name, gchar *string1, gchar *string2,
gtk_widget_set_sensitive (link, FALSE);
return link;
}
-
-
-
-
diff --git a/plugins/gtkui/callbacks.h b/plugins/gtkui/callbacks.h
index 80a8e5c6..2e4c8ce6 100644
--- a/plugins/gtkui/callbacks.h
+++ b/plugins/gtkui/callbacks.h
@@ -1078,5 +1078,24 @@ on_trackproperties_state_changed (GtkWidget *widget,
gboolean
on_trackproperties_window_state_event (GtkWidget *widget,
+ GdkEventWindowState *event,
+ gpointer user_data);
+
+gboolean
+on_prefwin_configure_event (GtkWidget *widget,
+ GdkEventConfigure *event,
+ gpointer user_data);
+
+gboolean
+on_prefwin_window_state_event (GtkWidget *widget,
+ GdkEventWindowState *event,
+ gpointer user_data);
+
+void
+on_prefwin_realize (GtkWidget *widget,
+ gpointer user_data);
+
+gboolean
+on_prefwin_map_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade
index c84d3527..bcbcd487 100644
--- a/plugins/gtkui/deadbeef.glade
+++ b/plugins/gtkui/deadbeef.glade
@@ -2367,10 +2367,8 @@ Right</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Preferences</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
<property name="modal">False</property>
- <property name="default_width">630</property>
- <property name="default_height">400</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
@@ -2381,6 +2379,9 @@ Right</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">True</property>
+ <signal name="configure_event" handler="on_prefwin_configure_event" last_modification_time="Thu, 10 Mar 2011 11:14:37 GMT"/>
+ <signal name="window_state_event" handler="on_prefwin_window_state_event" last_modification_time="Thu, 10 Mar 2011 11:14:42 GMT"/>
+ <signal name="realize" handler="on_prefwin_realize" last_modification_time="Thu, 10 Mar 2011 11:20:24 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox2">
diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c
index c7f40d25..9df16523 100644
--- a/plugins/gtkui/interface.c
+++ b/plugins/gtkui/interface.c
@@ -1774,7 +1774,7 @@ create_prefwin (void)
gtk_widget_set_size_request (prefwin, 630, 400);
gtk_container_set_border_width (GTK_CONTAINER (prefwin), 12);
gtk_window_set_title (GTK_WINDOW (prefwin), _("Preferences"));
- gtk_window_set_default_size (GTK_WINDOW (prefwin), 630, 400);
+ gtk_window_set_position (GTK_WINDOW (prefwin), GTK_WIN_POS_CENTER);
gtk_window_set_type_hint (GTK_WINDOW (prefwin), GDK_WINDOW_TYPE_HINT_DIALOG);
dialog_vbox2 = GTK_DIALOG (prefwin)->vbox;
@@ -2408,6 +2408,15 @@ create_prefwin (void)
gtk_dialog_add_action_widget (GTK_DIALOG (prefwin), closebutton1, GTK_RESPONSE_CLOSE);
GTK_WIDGET_SET_FLAGS (closebutton1, GTK_CAN_DEFAULT);
+ g_signal_connect ((gpointer) prefwin, "configure_event",
+ G_CALLBACK (on_prefwin_configure_event),
+ NULL);
+ g_signal_connect ((gpointer) prefwin, "window_state_event",
+ G_CALLBACK (on_prefwin_window_state_event),
+ NULL);
+ g_signal_connect ((gpointer) prefwin, "realize",
+ G_CALLBACK (on_prefwin_realize),
+ NULL);
g_signal_connect ((gpointer) pref_replaygain_mode, "changed",
G_CALLBACK (on_pref_replaygain_mode_changed),
NULL);
diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c
index 5ff6c919..45467eff 100644
--- a/plugins/gtkui/prefwin.c
+++ b/plugins/gtkui/prefwin.c
@@ -36,6 +36,7 @@
#include "ddblistview.h"
#include "pluginconf.h"
#include "dspconfig.h"
+#include "wingeom.h"
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
g_object_set_data_full (G_OBJECT (component), name, \
@@ -602,7 +603,6 @@ on_preferences_activate (GtkMenuItem *menuitem,
gtk_tree_view_set_model (tree, GTK_TREE_MODEL (store));
gtk_widget_set_sensitive (lookup_widget (prefwin, "configure_plugin"), FALSE);
-// gtk_widget_show (w);
// hotkeys
DB_plugin_t *hotkeys = deadbeef->plug_get_for_id ("hotkeys");
@@ -1226,3 +1226,30 @@ on_plug_copyright_clicked (GtkButton *button,
}
}
+gboolean
+on_prefwin_configure_event (GtkWidget *widget,
+ GdkEventConfigure *event,
+ gpointer user_data)
+{
+ wingeom_save (widget, "prefwin");
+ return FALSE;
+}
+
+
+gboolean
+on_prefwin_window_state_event (GtkWidget *widget,
+ GdkEventWindowState *event,
+ gpointer user_data)
+{
+ wingeom_save_max (event, widget, "prefwin");
+ return FALSE;
+}
+
+
+void
+on_prefwin_realize (GtkWidget *widget,
+ gpointer user_data)
+{
+ wingeom_restore (widget, "prefwin", -1, -1, -1, -1, 0);
+}
+
diff --git a/plugins/gtkui/wingeom.c b/plugins/gtkui/wingeom.c
index d47743c3..8591a5c6 100644
--- a/plugins/gtkui/wingeom.c
+++ b/plugins/gtkui/wingeom.c
@@ -91,7 +91,9 @@ wingeom_restore (GtkWidget *win, const char *name, int dx, int dy, int dw, int d
if (x != -1 && y != -1) {
gtk_window_move (GTK_WINDOW (win), x, y);
}
- gtk_window_resize (GTK_WINDOW (win), w, h);
+ if (w != -1 && h != -1) {
+ gtk_window_resize (GTK_WINDOW (win), w, h);
+ }
snprintf (key, sizeof (key), "%s.geometry.maximized", name);
if (deadbeef->conf_get_int (key, dmax)) {
gtk_window_maximize (GTK_WINDOW (win));