summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann <sandmann@redhat.com>2008-06-19 23:46:50 -0400
committerSøren Sandmann <sandmann@redhat.com>2008-06-19 23:46:50 -0400
commitf95f8fa32ec5cb2ecf4d2aaf7499dc1756090e8a (patch)
treee20b2c79697838e660a6f1843a6005790f3e1d59
parent5a5f9f4917240b77ca329ef93f863a72434bd0c4 (diff)
Remember position when no file is loaded
-rw-r--r--window.c72
1 files changed, 37 insertions, 35 deletions
diff --git a/window.c b/window.c
index e52e423..f1fd7f2 100644
--- a/window.c
+++ b/window.c
@@ -302,42 +302,45 @@ static void
save_meta_data (SivWindow *window)
{
int x, y, width, height;
-
- if (window->filename)
- {
- BackgroundType bg;
- gboolean smooth;
+ const char *filename;
+ BackgroundType bg;
+ gboolean smooth;
- gtk_window_get_position (get_widget (window, "main_window"), &x, &y);
- gtk_window_get_size (get_widget (window, "main_window"), &width, &height);
- if (gtk_check_menu_item_get_active (get_widget (window, "menu_no")))
- {
- bg = BG_NONE;
- }
- else if (gtk_check_menu_item_get_active (get_widget (window, "menu_white")))
- {
- bg = BG_WHITE;
- }
- else if (gtk_check_menu_item_get_active (get_widget (window, "menu_checkerboard")))
- {
- bg = BG_CHECKERBOARD;
- }
- else
- {
- bg = BG_NONE;
- }
-
- smooth = gtk_check_menu_item_get_active (get_widget (window, "menu_smooth_image"));
+ if (window->filename)
+ filename = window->filename;
+ else
+ filename = "no file";
- app_set_meta_data (window->app,
- window->filename,
- x, y, width, height,
- smooth, bg,
- window->zoom_level,
- get_vadj (window)->value,
- get_hadj (window)->value);
+ gtk_window_get_position (get_widget (window, "main_window"), &x, &y);
+ gtk_window_get_size (get_widget (window, "main_window"), &width, &height);
+
+ if (gtk_check_menu_item_get_active (get_widget (window, "menu_no")))
+ {
+ bg = BG_NONE;
+ }
+ else if (gtk_check_menu_item_get_active (get_widget (window, "menu_white")))
+ {
+ bg = BG_WHITE;
+ }
+ else if (gtk_check_menu_item_get_active (get_widget (window, "menu_checkerboard")))
+ {
+ bg = BG_CHECKERBOARD;
+ }
+ else
+ {
+ bg = BG_NONE;
}
+
+ smooth = gtk_check_menu_item_get_active (get_widget (window, "menu_smooth_image"));
+
+ app_set_meta_data (window->app,
+ filename,
+ x, y, width, height,
+ smooth, bg,
+ window->zoom_level,
+ get_vadj (window)->value,
+ get_hadj (window)->value);
}
static void
@@ -1087,7 +1090,7 @@ window_new (App *app)
window->zoom_level = 0;
window->first = TRUE;
- set_defaults (window);
+ apply_meta_data (window, "no file");
rebuild (window);
@@ -1099,8 +1102,7 @@ window_new (App *app)
void
window_free (SivWindow *window)
{
- if (window->filename)
- save_meta_data (window);
+ save_meta_data (window);
app_unregister_window (window->app, window);