Save full OSD state to rc file and restore it on startup.
authorLaurent Monin <geeqie@norz.org>
Sat, 10 May 2008 09:00:14 +0000 (09:00 +0000)
committerLaurent Monin <geeqie@norz.org>
Sat, 10 May 2008 09:00:14 +0000 (09:00 +0000)
It allows to restore OSD with or without histogram depending
on previous state.

src/image-overlay.c
src/main.c
src/options.h
src/rcfile.c

index 6deebf2..a7ac914 100644 (file)
@@ -829,7 +829,11 @@ gint image_osd_get(ImageWindow *imd, OsdShowFlags *show)
 {
        OverlayStateData *osd = image_get_osd_data(imd);
 
-       if (!osd) return FALSE;
+       if (!osd)
+               {
+               if (show) *show = OSD_SHOW_NOTHING;
+               return FALSE;
+               }
 
        if (show) *show = osd->show;
 
index 9dd042c..dd22385 100644 (file)
@@ -1208,7 +1208,8 @@ static void exit_program_final(void)
                        layout_geometry_get(NULL, &options->layout.main_window.x, &options->layout.main_window.y,
                                            &options->layout.main_window.w, &options->layout.main_window.h);
                        }
-               options->image_overlay.common.enabled = image_osd_get(lw->image, NULL);
+
+               image_osd_get(lw->image, &options->image_overlay.common.enabled);
                }
 
        layout_geometry_get_dividers(NULL, &options->layout.main_window.hdivider_pos, &options->layout.main_window.vdivider_pos);
@@ -1480,7 +1481,7 @@ int main (int argc, char *argv[])
                        }
                }
 
-       image_osd_set(lw->image, (options->image_overlay.common.show_at_startup || options->image_overlay.common.enabled) ? OSD_SHOW_INFO : OSD_SHOW_NOTHING);
+       image_osd_set(lw->image, options->image_overlay.common.enabled | (options->image_overlay.common.show_at_startup ? OSD_SHOW_INFO : OSD_SHOW_NOTHING));
 
        g_free(geometry);
        g_free(cmd_path);
index 72b632b..2d498ef 100644 (file)
@@ -138,7 +138,7 @@ struct _ConfOptions
        /* image overlay */
        struct {
                struct {
-                       gint enabled;
+                       guint enabled;
                        gint show_at_startup;
                        gchar *template_string;
                } common;
index e53b131..51703ed 100644 (file)
@@ -448,7 +448,7 @@ void save_options(void)
 
 
        WRITE_SUBTITLE("Image Overlay Options");
-       WRITE_BOOL(image_overlay.common.enabled);
+       WRITE_UINT(image_overlay.common.enabled);
        WRITE_BOOL(image_overlay.common.show_at_startup);
        WRITE_CHAR(image_overlay.common.template_string);
 
@@ -752,7 +752,7 @@ void load_options(void)
                /* image overlay */
                COMPAT_READ_BOOL(fullscreen.show_info, image_overlay.common.show_at_startup);
                COMPAT_READ_CHAR(fullscreen.info, image_overlay.common.template_string);
-               READ_BOOL(image_overlay.common.enabled);
+               READ_UINT(image_overlay.common.enabled);
                READ_BOOL(image_overlay.common.show_at_startup);
                READ_CHAR(image_overlay.common.template_string);