From: Andy Spencer Date: Sat, 4 Feb 2012 07:55:09 +0000 (+0000) Subject: Save and restore window size X-Git-Tag: v0.7~11 X-Git-Url: http://pileus.org/git/?p=aweather;a=commitdiff_plain;h=1e24d7e5d00701735fccd7a325cf00e0312a5b00 Save and restore window size --- diff --git a/data/main.ui.in b/data/main.ui.in index cd9d216..54245ce 100644 --- a/data/main.ui.in +++ b/data/main.ui.in @@ -361,6 +361,7 @@ The hypothetical commands `show w' and `show c' should show the appropriate part AWeather 600 400 + True diff --git a/src/aweather-gui.c b/src/aweather-gui.c index 9c88987..fcaf87c 100644 --- a/src/aweather-gui.c +++ b/src/aweather-gui.c @@ -317,6 +317,14 @@ static void update_time_widget(GritsViewer *viewer, time_t time, AWeatherGui *se //} } +G_MODULE_EXPORT gboolean on_configure(AWeatherGui *self, GdkEventConfigure *config) +{ + g_debug("AWeatherGui: on_configure - %dx%d", config->width, config->height); + grits_prefs_set_integer(self->prefs, "aweather/width", config->width); + grits_prefs_set_integer(self->prefs, "aweather/height", config->height); + return FALSE; +} + /* Prefs callbacks */ G_MODULE_EXPORT void on_offline(GtkToggleAction *action, AWeatherGui *self) { @@ -617,6 +625,12 @@ static void aweather_gui_parser_finished(GtkBuildable *_self, GtkBuilder *builde prefs_setup(self); icons_setup(self); + /* Default size */ + gint width = grits_prefs_get_integer(self->prefs, "aweather/width", NULL); + gint height = grits_prefs_get_integer(self->prefs, "aweather/height", NULL); + if (width && height) + gtk_window_set_default_size(GTK_WINDOW(self), width, height); + /* Connect signals */ gtk_builder_connect_signals(self->builder, self); g_signal_connect(self, "key-press-event",