Updating branch refs/heads/master to d309a6949b751002b33ed432f88fd47a1384db0e (commit) from 6583a1a632779e72ba6ecfa32a10f30980081876 (commit)
commit d309a6949b751002b33ed432f88fd47a1384db0e Author: Harald Judt <h.j...@gmx.at> Date: Sat Feb 22 14:58:41 2014 +0100 Remember the window size of the settings dialog. Signed-off-by: Eric Koegel <eric.koe...@gmail.com> settings/main.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/settings/main.c b/settings/main.c index 9170ef0..a34256e 100644 --- a/settings/main.c +++ b/settings/main.c @@ -62,6 +62,9 @@ #define PREVIEW_WIDTH (PREVIEW_HEIGHT * MAX_ASPECT_RATIO) +#define SETTINGS_WINDOW_LAST_WIDTH "/last/window-width" +#define SETTINGS_WINDOW_LAST_HEIGHT "/last/window-height" + #define SHOW_DESKTOP_MENU_PROP "/desktop-menu/show" #define DESKTOP_MENU_SHOW_ICONS_PROP "/desktop-menu/show-icons" @@ -1931,12 +1934,27 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder *main_gxml, } static void -xfdesktop_settings_response(GtkWidget *dialog, gint response_id) +xfdesktop_settings_response(GtkWidget *dialog, gint response_id, gpointer user_data) { if(response_id == GTK_RESPONSE_HELP) xfce_dialog_show_help(GTK_WINDOW(dialog), "xfdesktop", "preferences", NULL); - else + else { + XfconfChannel *channel = (XfconfChannel*) user_data; + GdkWindowState state; + gint width, height; + + /* don't save the state for full-screen windows */ + state = gdk_window_get_state(GTK_WIDGET(dialog)->window); + + if ((state & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)) == 0) { + /* save window size */ + gtk_window_get_size(GTK_WINDOW(dialog), &width, &height); + xfconf_channel_set_int(channel, SETTINGS_WINDOW_LAST_WIDTH, width); + xfconf_channel_set_int(channel, SETTINGS_WINDOW_LAST_HEIGHT, height); + } + gtk_main_quit(); + } } static GdkNativeWindow opt_socket_id = 0; @@ -2017,7 +2035,12 @@ main(int argc, char **argv) GtkWidget *dialog; dialog = GTK_WIDGET(gtk_builder_get_object(gxml, "prefs_dialog")); g_signal_connect(dialog, "response", - G_CALLBACK(xfdesktop_settings_response), NULL); + G_CALLBACK(xfdesktop_settings_response), + channel); + gtk_window_set_default_size + (GTK_WINDOW(dialog), + xfconf_channel_get_int(channel, SETTINGS_WINDOW_LAST_WIDTH, -1), + xfconf_channel_get_int(channel, SETTINGS_WINDOW_LAST_HEIGHT, -1)); gtk_window_present(GTK_WINDOW (dialog)); screen = gtk_widget_get_screen(dialog); _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits