Revision: 1607
http://geeqie.svn.sourceforge.net/geeqie/?rev=1607&view=rev
Author: nadvornik
Date: 2009-04-04 21:14:34 +0000 (Sat, 04 Apr 2009)
Log Message:
-----------
startup path options simplified and moved to layout options
Modified Paths:
--------------
trunk/src/layout.c
trunk/src/options.c
trunk/src/options.h
trunk/src/preferences.c
trunk/src/rcfile.c
trunk/src/typedefs.h
Modified: trunk/src/layout.c
===================================================================
--- trunk/src/layout.c 2009-04-04 20:20:17 UTC (rev 1606)
+++ trunk/src/layout.c 2009-04-04 21:14:34 UTC (rev 1607)
@@ -2032,6 +2032,25 @@
gtk_entry_set_text(GTK_ENTRY(lc->home_path_entry),
layout_get_path(lc->lw));
}
+static void startup_path_set_current_cb(GtkWidget *widget, gpointer data)
+{
+ LayoutConfig *lc = data;
+ lc->options.startup_path = STARTUP_PATH_CURRENT;
+}
+
+static void startup_path_set_last_cb(GtkWidget *widget, gpointer data)
+{
+ LayoutConfig *lc = data;
+ lc->options.startup_path = STARTUP_PATH_LAST;
+}
+
+static void startup_path_set_home_cb(GtkWidget *widget, gpointer data)
+{
+ LayoutConfig *lc = data;
+ lc->options.startup_path = STARTUP_PATH_HOME;
+}
+
+
/*
static void layout_config_save_cb(GtkWidget *widget, gpointer data)
{
@@ -2115,9 +2134,10 @@
gtk_container_add(GTK_CONTAINER(frame), vbox);
gtk_widget_show(vbox);
+
group = pref_group_new(vbox, FALSE, _("General options"),
GTK_ORIENTATION_VERTICAL);
- pref_label_new(group, _("Home button path (empty to use your home
directory)"));
+ pref_label_new(group, _("Home path (empty to use your home
directory)"));
hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL,
PREF_PAD_SPACE);
tabcomp = tab_completion_new(&lc->home_path_entry,
lc->options.home_path, NULL, NULL);
@@ -2128,11 +2148,21 @@
button = pref_button_new(hbox, NULL, _("Use current"), FALSE,
G_CALLBACK(home_path_set_current_cb), lc);
- group = pref_group_new(vbox, FALSE, _("Behavior"),
GTK_ORIENTATION_VERTICAL);
-
pref_checkbox_new_int(group, _("Show date in directories list view"),
lc->options.show_directory_date,
&lc->options.show_directory_date);
+ group = pref_group_new(vbox, FALSE, _("Start-up directory:"),
GTK_ORIENTATION_VERTICAL);
+
+ button = pref_radiobutton_new(group, NULL, _("No change"),
+ (lc->options.startup_path ==
STARTUP_PATH_CURRENT),
+ G_CALLBACK(startup_path_set_current_cb),
lc);
+ button = pref_radiobutton_new(group, button, _("Restore last path"),
+ (lc->options.startup_path ==
STARTUP_PATH_LAST),
+ G_CALLBACK(startup_path_set_last_cb), lc);
+ button = pref_radiobutton_new(group, button, _("Home path"),
+ (lc->options.startup_path ==
STARTUP_PATH_HOME),
+ G_CALLBACK(startup_path_set_home_cb), lc);
+
group = pref_group_new(vbox, FALSE, _("Layout"),
GTK_ORIENTATION_VERTICAL);
lc->layout_widget = layout_config_new();
@@ -2174,11 +2204,8 @@
lw->options.image_overlay.histogram_channel =
histogram->histogram_channel;
lw->options.image_overlay.histogram_mode = histogram->histogram_mode;
-// if (options->startup.restore_path && options->startup.use_last_path)
-// {
-// g_free(options->startup.path);
-// options->startup.path = g_strdup(layout_get_path(NULL));
-// }
+ g_free(lw->options.last_path);
+ lw->options.last_path = g_strdup(layout_get_path(lw));
}
void layout_apply_options(LayoutWindow *lw, LayoutOptions *lop)
@@ -2406,6 +2433,8 @@
WRITE_NL(); WRITE_BOOL(*layout, show_thumbnails);
WRITE_NL(); WRITE_BOOL(*layout, show_directory_date);
WRITE_NL(); WRITE_CHAR(*layout, home_path);
+ WRITE_NL(); WRITE_CHAR(*layout, last_path);
+ WRITE_NL(); WRITE_UINT(*layout, startup_path);
WRITE_SEPARATOR();
WRITE_NL(); WRITE_INT(*layout, main_window.x);
@@ -2477,6 +2506,8 @@
if (READ_BOOL(*layout, show_thumbnails)) continue;
if (READ_BOOL(*layout, show_directory_date)) continue;
if (READ_CHAR(*layout, home_path)) continue;
+ if (READ_CHAR(*layout, last_path)) continue;
+ if (READ_UINT_CLAMP(*layout, startup_path, 0,
STARTUP_PATH_HOME)) continue;
/* window positions */
@@ -2519,6 +2550,23 @@
}
}
+static void layout_config_startup_path(LayoutOptions *lop, gchar **path)
+{
+ switch (lop->startup_path)
+ {
+ case STARTUP_PATH_LAST:
+ *path = (lop->last_path && isdir(lop->last_path)) ?
g_strdup(lop->last_path) : get_current_dir();
+ break;
+ case STARTUP_PATH_HOME:
+ *path = (lop->home_path && isdir(lop->home_path)) ?
g_strdup(lop->home_path) : g_strdup(homedir());
+ break;
+ default:
+ *path = get_current_dir();
+ break;
+ }
+}
+
+
static void layout_config_commandline(LayoutOptions *lop, gchar **path)
{
if (command_line->startup_blank)
@@ -2533,14 +2581,7 @@
{
*path = g_strdup(command_line->path);
}
- else if (options->startup.restore_path && options->startup.path &&
isdir(options->startup.path))
- {
- *path = g_strdup(options->startup.path);
- }
- else
- {
- *path = get_current_dir();
- }
+ else layout_config_startup_path(lop, path);
if (command_line->tools_show)
{
@@ -2567,14 +2608,10 @@
{
layout_config_commandline(&lop, &path);
}
- else if (options->startup.restore_path && options->startup.path &&
isdir(options->startup.path))
+ else
{
- path = g_strdup(options->startup.path);
+ layout_config_startup_path(&lop, &path);
}
- else
- {
- path = get_current_dir();
- }
lw = layout_new_with_geometry(NULL, &lop, use_commandline ?
command_line->geometry : NULL);
layout_sort_set(lw, options->file_sort.method,
options->file_sort.ascending);
Modified: trunk/src/options.c
===================================================================
--- trunk/src/options.c 2009-04-04 20:20:17 UTC (rev 1606)
+++ trunk/src/options.c 2009-04-04 21:14:34 UTC (rev 1607)
@@ -113,10 +113,6 @@
options->slideshow.random = FALSE;
options->slideshow.repeat = FALSE;
- options->startup.path = NULL;
- options->startup.restore_path = FALSE;
- options->startup.use_last_path = FALSE;
-
options->thumbnails.cache_into_dirs = FALSE;
options->thumbnails.enable_caching = TRUE;
options->thumbnails.fast = TRUE;
@@ -173,6 +169,7 @@
dest->id = g_strdup(src->id);
dest->order = g_strdup(src->order);
dest->home_path = g_strdup(src->home_path);
+ dest->last_path = g_strdup(src->last_path);
}
void free_layout_options_content(LayoutOptions *dest)
@@ -180,6 +177,7 @@
g_free(dest->id);
g_free(dest->order);
g_free(dest->home_path);
+ g_free(dest->last_path);
}
LayoutOptions *init_layout_options(LayoutOptions *options)
@@ -230,12 +228,6 @@
&options->color_profile.input_type,
&options->color_profile.screen_type,
&options->color_profile.use_image);
-
- if (options->startup.restore_path &&
options->startup.use_last_path)
- {
- g_free(options->startup.path);
- options->startup.path = g_strdup(layout_get_path(lw));
- }
}
}
Modified: trunk/src/options.h
===================================================================
--- trunk/src/options.h 2009-04-04 20:20:17 UTC (rev 1606)
+++ trunk/src/options.h 2009-04-04 21:14:34 UTC (rev 1607)
@@ -37,13 +37,6 @@
gboolean save_window_positions;
gboolean tools_restore_state;
- /* start up */
- struct {
- gboolean restore_path;
- gboolean use_last_path;
- gchar *path;
- } startup;
-
/* file ops */
struct {
gboolean enable_in_place_rename;
Modified: trunk/src/preferences.c
===================================================================
--- trunk/src/preferences.c 2009-04-04 20:20:17 UTC (rev 1606)
+++ trunk/src/preferences.c 2009-04-04 21:14:34 UTC (rev 1607)
@@ -96,7 +96,6 @@
#endif
static GtkWidget *configwindow = NULL;
-static GtkWidget *startup_path_entry;
static GtkListStore *filter_store = NULL;
static GtkWidget *safe_delete_path_entry;
@@ -117,11 +116,6 @@
*-----------------------------------------------------------------------------
*/
-static void startup_path_set_current(GtkWidget *widget, gpointer data)
-{
- gtk_entry_set_text(GTK_ENTRY(startup_path_entry),
layout_get_path(NULL));
-}
-
static void zoom_mode_cb(GtkWidget *widget, gpointer data)
{
if (GTK_TOGGLE_BUTTON (widget)->active)
@@ -231,10 +225,6 @@
if (options->file_sort.case_sensitive !=
c_options->file_sort.case_sensitive) refresh = TRUE;
if (options->file_filter.disable != c_options->file_filter.disable)
refresh = TRUE;
- options->startup.restore_path = c_options->startup.restore_path;
- options->startup.use_last_path = c_options->startup.use_last_path;
- config_entry_to_option(startup_path_entry, &options->startup.path,
remove_trailing_slash);
-
options->file_ops.confirm_delete = c_options->file_ops.confirm_delete;
options->file_ops.enable_delete_key =
c_options->file_ops.enable_delete_key;
options->file_ops.safe_delete_enable =
c_options->file_ops.safe_delete_enable;
@@ -913,42 +903,16 @@
/* general options tab */
static void config_tab_general(GtkWidget *notebook)
{
- GtkWidget *hbox;
GtkWidget *vbox;
- GtkWidget *subvbox;
GtkWidget *group;
GtkWidget *subgroup;
GtkWidget *button;
- GtkWidget *tabcomp;
GtkWidget *ct_button;
GtkWidget *table;
GtkWidget *spin;
vbox = scrolled_notebook_page(notebook, _("General"));
- group = pref_group_new(vbox, FALSE, _("Startup"),
GTK_ORIENTATION_VERTICAL);
-
- button = pref_checkbox_new_int(group, _("Restore folder on startup"),
- options->startup.restore_path,
&c_options->startup.restore_path);
-
- subvbox = pref_box_new(group, FALSE, GTK_ORIENTATION_VERTICAL,
PREF_PAD_SPACE);
- pref_checkbox_link_sensitivity(button, subvbox);
-
- hbox = pref_box_new(subvbox, FALSE, GTK_ORIENTATION_HORIZONTAL,
PREF_PAD_SPACE);
-
- tabcomp = tab_completion_new(&startup_path_entry,
options->startup.path, NULL, NULL);
- tab_completion_add_select_button(startup_path_entry, NULL, TRUE);
- gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0);
- gtk_widget_show(tabcomp);
-
- button = pref_button_new(hbox, NULL, _("Use current"), FALSE,
- G_CALLBACK(startup_path_set_current), NULL);
-
- button = pref_checkbox_new_int(subvbox, _("Use last path"),
- options->startup.use_last_path,
&c_options->startup.use_last_path);
- pref_checkbox_link_sensitivity_swap(button, hbox);
-
-
group = pref_group_new(vbox, FALSE, _("Thumbnails"),
GTK_ORIENTATION_VERTICAL);
table = pref_table_new(group, 2, 2, FALSE, FALSE);
Modified: trunk/src/rcfile.c
===================================================================
--- trunk/src/rcfile.c 2009-04-04 20:20:17 UTC (rev 1606)
+++ trunk/src/rcfile.c 2009-04-04 21:14:34 UTC (rev 1607)
@@ -283,13 +283,6 @@
WRITE_NL(); WRITE_BOOL(*options, save_window_positions);
WRITE_NL(); WRITE_BOOL(*options, tools_restore_state);
-// WRITE_SUBTITLE("Startup Options");
-
- WRITE_NL(); WRITE_BOOL(*options, startup.restore_path);
- WRITE_NL(); WRITE_BOOL(*options, startup.use_last_path);
- WRITE_NL(); WRITE_CHAR(*options, startup.path);
-
-
// WRITE_SUBTITLE("File operations Options");
WRITE_NL(); WRITE_BOOL(*options, file_ops.enable_in_place_rename);
@@ -601,15 +594,6 @@
if (READ_BOOL(*options, save_window_positions)) continue;
if (READ_BOOL(*options, tools_restore_state)) continue;
- /* startup options */
-
- if (READ_BOOL(*options, startup.restore_path)) continue;
-
- if (READ_BOOL(*options, startup.use_last_path)) continue;
-
- if (READ_CHAR(*options, startup.path)) continue;
-
-
/* properties dialog options */
if (READ_CHAR(*options, properties.tabs_order)) continue;
Modified: trunk/src/typedefs.h
===================================================================
--- trunk/src/typedefs.h 2009-04-04 20:20:17 UTC (rev 1606)
+++ trunk/src/typedefs.h 2009-04-04 21:14:34 UTC (rev 1607)
@@ -174,6 +174,11 @@
METADATA_FORMATTED = 1 /* for display only */
} MetadataFormat;
+typedef enum {
+ STARTUP_PATH_CURRENT = 0,
+ STARTUP_PATH_LAST,
+ STARTUP_PATH_HOME,
+} StartUpPath;
#define MAX_SPLIT_IMAGES 4
@@ -530,6 +535,9 @@
gboolean info_pixel_hidden;
gchar *home_path;
+ gchar *last_path;
+
+ StartUpPath startup_path;
};
struct _LayoutWindow
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn