Index: src/main_window.c =================================================================== --- src/main_window.c (revision 6365) +++ src/main_window.c (working copy) @@ -66,6 +66,7 @@ gboolean slideshow_hide_thumbnail; const GdkColor *bg_color; gboolean scale_to_100; + gboolean load_folder_on_file; RsttoDesktop desktop; gboolean start_fullscreen; gboolean start_slideshow; @@ -312,6 +313,7 @@ window->priv->icon_theme = gtk_icon_theme_get_default(); window->priv->settings.scale_to_100 = TRUE; + window->priv->settings.load_folder_on_file = FALSE; GtkAccelGroup *accel_group = gtk_accel_group_new(); @@ -1118,6 +1120,18 @@ return window->priv->settings.scale_to_100; } +void +rstto_main_window_set_load_folder_on_file (RsttoMainWindow *window, gboolean load_folder_on_file) +{ + window->priv->settings.load_folder_on_file = load_folder_on_file; +} + +gboolean +rstto_main_window_get_load_folder_on_file (RsttoMainWindow *window) +{ + return window->priv->settings.load_folder_on_file; +} + /* CALLBACK FUNCTIONS */ static void @@ -1378,9 +1392,15 @@ GtkWidget *behaviour_main_vbox; GtkWidget *behaviour_main_lbl; + GtkWidget *extras_main_vbox; + GtkWidget *extras_main_lbl; + GtkWidget *resize_to_content_vbox, *resize_to_content_frame; GtkWidget *resize_on_maximize_check; + GtkWidget *load_folder_on_file_vbox, *load_folder_on_file_frame; + GtkWidget *load_folder_on_file_check; + GtkWidget *bg_color_vbox; GtkWidget *bg_color_hbox; GtkWidget *bg_color_frame; @@ -1425,6 +1445,10 @@ behaviour_main_lbl = gtk_label_new(_("Behaviour")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), behaviour_main_vbox, behaviour_main_lbl); + extras_main_vbox = gtk_vbox_new(FALSE, 0); + extras_main_lbl = gtk_label_new(_("Extras")); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), extras_main_vbox, extras_main_lbl); + /** Add content for behaviour page */ resize_to_content_vbox = gtk_vbox_new(FALSE, 0); resize_to_content_frame = xfce_create_framebox_with_content(_("Scaling"), resize_to_content_vbox); @@ -1437,6 +1461,19 @@ gtk_container_set_border_width (GTK_CONTAINER (resize_to_content_frame), 8); gtk_box_pack_start(GTK_BOX(behaviour_main_vbox), resize_to_content_frame, FALSE, TRUE, 0); +/** Add content for extras page */ + load_folder_on_file_vbox = gtk_vbox_new(FALSE, 0); + load_folder_on_file_frame = xfce_create_framebox_with_content(_("Loading"), load_folder_on_file_vbox); + + load_folder_on_file_check = gtk_check_button_new_with_mnemonic(_("Load entire folder when opening a single file during startup.")); + gtk_box_pack_start(GTK_BOX(load_folder_on_file_vbox), load_folder_on_file_check, FALSE, TRUE, 0); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(load_folder_on_file_check), window->priv->settings.load_folder_on_file); + + gtk_container_set_border_width (GTK_CONTAINER (load_folder_on_file_frame), 8); + gtk_box_pack_start(GTK_BOX(extras_main_vbox), load_folder_on_file_frame, FALSE, TRUE, 0); + + /** Add content for display page */ bg_color_vbox = gtk_vbox_new(FALSE, 0); bg_color_frame = xfce_create_framebox_with_content (_("Background Color"), bg_color_vbox); @@ -1546,6 +1583,7 @@ rstto_main_window_set_max_cache_size(window, (guint)GTK_ADJUSTMENT(cache_adjustment)->value); window->priv->settings.scale_to_100 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resize_on_maximize_check)); + window->priv->settings.load_folder_on_file = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(load_folder_on_file_check)); default: break; Index: src/main_window.h =================================================================== --- src/main_window.h (revision 6365) +++ src/main_window.h (working copy) @@ -120,6 +120,11 @@ gboolean rstto_main_window_get_scale_to_100 (RsttoMainWindow *window); +void +rstto_main_window_set_load_folder_on_file (RsttoMainWindow *window, gboolean load_folder_on_file); +gboolean +rstto_main_window_get_load_folder_on_file (RsttoMainWindow *window); + GtkStatusbar * rstto_main_window_get_statusbar(RsttoMainWindow *window); gint Index: src/main.c =================================================================== --- src/main.c (revision 6365) +++ src/main.c (working copy) @@ -275,6 +275,7 @@ gboolean preload_imgs = xfce_rc_read_bool_entry (xfce_rc, "PreloadImgs", FALSE); gboolean override_bg_color = xfce_rc_read_bool_entry (xfce_rc, "OverrideBgColor", FALSE); gboolean scale_to_100 = xfce_rc_read_bool_entry (xfce_rc, "ScaleTo100", FALSE); + gboolean load_folder_on_file = xfce_rc_read_bool_entry (xfce_rc, "LoadFolderOnFile", FALSE); if (override_bg_color) { @@ -297,6 +298,7 @@ rstto_main_window_set_slideshow_timeout(RSTTO_MAIN_WINDOW(window), (gdouble)slideshow_timeout); rstto_main_window_set_hide_thumbnail(RSTTO_MAIN_WINDOW(window), slideshow_hide_thumbnail); rstto_main_window_set_scale_to_100(RSTTO_MAIN_WINDOW(window), scale_to_100); + rstto_main_window_set_load_folder_on_file(RSTTO_MAIN_WINDOW(window), load_folder_on_file); rstto_navigator_set_timeout(navigator, slideshow_timeout); rstto_main_window_set_start_fullscreen(RSTTO_MAIN_WINDOW(window), start_fullscreen); rstto_main_window_set_start_slideshow(RSTTO_MAIN_WINDOW(window), start_slideshow); @@ -353,6 +355,7 @@ xfce_rc_write_bool_entry(xfce_rc, "ShowToolBar", rstto_main_window_get_show_toolbar(RSTTO_MAIN_WINDOW(window))); xfce_rc_write_bool_entry(xfce_rc, "ScaleTo100", rstto_main_window_get_scale_to_100(RSTTO_MAIN_WINDOW(window))); + xfce_rc_write_bool_entry(xfce_rc, "LoadFolderOnFile", rstto_main_window_get_load_folder_on_file(RSTTO_MAIN_WINDOW(window))); xfce_rc_write_bool_entry(xfce_rc, "PreloadImgs", navigator->preload); xfce_rc_write_bool_entry(xfce_rc, "ShowThumbnailViewer", rstto_main_window_get_show_thumbnail_viewer(RSTTO_MAIN_WINDOW(window))); if (bg_color) @@ -448,6 +451,7 @@ RsttoMainWindow *window = rof->main_window; GtkStatusbar *bar = rstto_main_window_get_statusbar(window); + gboolean load_folder_on_file = rstto_main_window_get_load_folder_on_file(RSTTO_MAIN_WINDOW(window)); guint context_id = gtk_statusbar_get_context_id(bar, "StatusMessages"); guint message_id = gtk_statusbar_push(bar, context_id, N_("Opening file(s)...")); @@ -484,13 +488,14 @@ } } + else if ( (load_folder_on_file) && (g_slist_length(rof->files) == 1) ) + { + rstto_navigator_open_file (navigator, path_dir, TRUE, NULL); + gtk_statusbar_remove(bar, context_id, message_id); + } else { - if (g_slist_length(rof->files) == 1) - rstto_navigator_open_file (navigator, path_dir, TRUE, NULL); - else - rstto_navigator_open_file (navigator, path_dir, FALSE, NULL); - + rstto_navigator_open_file (navigator, path_dir, FALSE, NULL); gtk_statusbar_remove(bar, context_id, message_id); } }