Revision: 1075
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1075&view=rev
Author:   zas_
Date:     2008-08-22 21:52:13 +0000 (Fri, 22 Aug 2008)

Log Message:
-----------
Add an option named layout.home_path which modifies the behavior of the Home 
button.
By default, pressing this button goes to the user's home directory.
When this option is set to a path, this path is used instead.
One can change the option value through Preferences > Advanced > Navigation
or directly in .geeqierc.
Feature proposed by Colin Clark.

Modified Paths:
--------------
    trunk/src/layout_util.c
    trunk/src/options.c
    trunk/src/options.h
    trunk/src/preferences.c
    trunk/src/rcfile.c

Modified: trunk/src/layout_util.c
===================================================================
--- trunk/src/layout_util.c     2008-08-21 22:49:30 UTC (rev 1074)
+++ trunk/src/layout_util.c     2008-08-22 21:52:13 UTC (rev 1075)
@@ -1458,10 +1458,16 @@
 
 static void layout_button_home_cb(GtkWidget *widget, gpointer data)
 {
-       LayoutWindow *lw = data;
-       const gchar *path = homedir();
+       const gchar *path;
+       
+       if (options->layout.home_path && *options->layout.home_path)
+               path = options->layout.home_path;
+       else
+               path = homedir();
+
        if (path)
                {
+               LayoutWindow *lw = data;
                FileData *dir_fd = file_data_new_simple(path);
                layout_set_fd(lw, dir_fd);
                file_data_unref(dir_fd);

Modified: trunk/src/options.c
===================================================================
--- trunk/src/options.c 2008-08-21 22:49:30 UTC (rev 1074)
+++ trunk/src/options.c 2008-08-22 21:52:13 UTC (rev 1075)
@@ -97,6 +97,7 @@
        options->layout.float_window.w = 260;
        options->layout.float_window.x = 0;
        options->layout.float_window.y = 0;
+       options->layout.home_path = NULL;
        options->layout.main_window.h = 400;
        options->layout.main_window.hdivider_pos = -1;
        options->layout.main_window.maximized = FALSE;

Modified: trunk/src/options.h
===================================================================
--- trunk/src/options.h 2008-08-21 22:49:30 UTC (rev 1074)
+++ trunk/src/options.h 2008-08-22 21:52:13 UTC (rev 1075)
@@ -198,7 +198,8 @@
                gboolean tools_restore_state;
 
                gboolean toolbar_hidden;
-
+               
+               gchar *home_path;
        } layout;
 
        /* panels */

Modified: trunk/src/preferences.c
===================================================================
--- trunk/src/preferences.c     2008-08-21 22:49:30 UTC (rev 1074)
+++ trunk/src/preferences.c     2008-08-22 21:52:13 UTC (rev 1075)
@@ -85,6 +85,7 @@
 
 static GtkWidget *configwindow = NULL;
 static GtkWidget *startup_path_entry;
+static GtkWidget *home_path_entry;
 static GtkListStore *filter_store = NULL;
 static GtkWidget *editor_name_entry[GQ_EDITOR_SLOTS];
 static GtkWidget *editor_command_entry[GQ_EDITOR_SLOTS];
@@ -114,6 +115,11 @@
        gtk_entry_set_text(GTK_ENTRY(startup_path_entry), 
layout_get_path(NULL));
 }
 
+static void home_path_set_current(GtkWidget *widget, gpointer data)
+{
+       gtk_entry_set_text(GTK_ENTRY(home_path_entry), layout_get_path(NULL));
+}
+
 static void zoom_mode_original_cb(GtkWidget *widget, gpointer data)
 {
        if (GTK_TOGGLE_BUTTON (widget)->active)
@@ -218,6 +224,11 @@
        buf = gtk_entry_get_text(GTK_ENTRY(startup_path_entry));
        if (buf && strlen(buf) > 0) options->startup.path = 
remove_trailing_slash(buf);
 
+       g_free(options->layout.home_path);
+       options->layout.home_path = NULL;
+       buf = gtk_entry_get_text(GTK_ENTRY(home_path_entry));
+       if (buf && strlen(buf) > 0) options->layout.home_path = 
remove_trailing_slash(buf);
+
        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;
@@ -1494,6 +1505,18 @@
        pref_checkbox_new_int(group, _("Mouse wheel scrolls image"),
                              options->mousewheel_scrolls, 
&c_options->mousewheel_scrolls);
 
+       pref_label_new(group, _("Home button path (empty to use your home 
directory)"));
+       hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, 
PREF_PAD_SPACE);
+
+       tabcomp = tab_completion_new(&home_path_entry, 
options->layout.home_path, NULL, NULL);
+       tab_completion_add_select_button(home_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(home_path_set_current), NULL);
+
+
        group = pref_group_new(vbox, FALSE, _("Miscellaneous"), 
GTK_ORIENTATION_VERTICAL);
 
        pref_checkbox_new_int(group, _("Store metadata and cache files in 
source image's directory"),

Modified: trunk/src/rcfile.c
===================================================================
--- trunk/src/rcfile.c  2008-08-21 22:49:30 UTC (rev 1074)
+++ trunk/src/rcfile.c  2008-08-22 21:52:13 UTC (rev 1075)
@@ -389,6 +389,7 @@
        WRITE_BOOL(layout.show_marks);
        WRITE_BOOL(layout.show_thumbnails);
        WRITE_BOOL(layout.show_directory_date);
+       WRITE_CHAR(layout.home_path);
        WRITE_SEPARATOR();
 
        WRITE_BOOL(layout.save_window_positions);
@@ -773,6 +774,7 @@
                READ_BOOL(layout.show_marks);
                READ_BOOL(layout.show_thumbnails);
                READ_BOOL(layout.show_directory_date);
+               READ_CHAR(layout.home_path);
 
                /* window positions */
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to