[gthumb] headerbar: added 'go up' and 'go home'



commit 5157687ad77edaae3fec80f1d459b3d4bc6dfa20
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Oct 18 18:42:31 2013 +0200

    headerbar: added 'go up' and 'go home'

 gthumb/gth-browser-actions-callbacks.c |   18 ++++++++++++++++++
 gthumb/gth-browser-actions-callbacks.h |    2 ++
 gthumb/gth-browser-actions-entries.h   |    2 ++
 gthumb/gth-browser.c                   |   13 +++++++++++++
 4 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/gthumb/gth-browser-actions-callbacks.c b/gthumb/gth-browser-actions-callbacks.c
index a43a6d0..5cc445a 100644
--- a/gthumb/gth-browser-actions-callbacks.c
+++ b/gthumb/gth-browser-actions-callbacks.c
@@ -515,6 +515,24 @@ gth_browser_activate_go_to_history_pos (GSimpleAction *action,
 
 
 void
+gth_browser_activate_go_home (GSimpleAction *action,
+                             GVariant      *parameter,
+                             gpointer       user_data)
+{
+       gth_browser_go_home (GTH_BROWSER (user_data));
+}
+
+
+void
+gth_browser_activate_go_up (GSimpleAction *action,
+                           GVariant      *parameter,
+                           gpointer       user_data)
+{
+       gth_browser_go_up (GTH_BROWSER (user_data), 1);
+}
+
+
+void
 gth_browser_activate_quit (GSimpleAction *action,
                           GVariant      *parameter,
                           gpointer       user_data)
diff --git a/gthumb/gth-browser-actions-callbacks.h b/gthumb/gth-browser-actions-callbacks.h
index 93e415d..24a06e6 100644
--- a/gthumb/gth-browser-actions-callbacks.h
+++ b/gthumb/gth-browser-actions-callbacks.h
@@ -72,6 +72,8 @@ DEF_ACTION_CALLBACK (gth_browser_activate_fullscreen)
 DEF_ACTION_CALLBACK (gth_browser_activate_go_back)
 DEF_ACTION_CALLBACK (gth_browser_activate_go_forward)
 DEF_ACTION_CALLBACK (gth_browser_activate_go_to_history_pos)
+DEF_ACTION_CALLBACK (gth_browser_activate_go_home)
+DEF_ACTION_CALLBACK (gth_browser_activate_go_up)
 DEF_ACTION_CALLBACK (gth_browser_activate_quit)
 DEF_ACTION_CALLBACK (gth_browser_activate_revert_to_saved)
 DEF_ACTION_CALLBACK (gth_browser_activate_save)
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index 8c6cebd..d1bc844 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -34,7 +34,9 @@ static const GActionEntry gth_browser_actions[] = {
        { "fullscreen", gth_browser_activate_fullscreen },
        { "go-back", gth_browser_activate_go_back },
        { "go-forward", gth_browser_activate_go_forward },
+       { "go-home", gth_browser_activate_go_home },
        { "go-to-history-position", gth_browser_activate_go_to_history_pos, "s", "''", NULL },
+       { "go-up", gth_browser_activate_go_up },
        { "quit", gth_browser_activate_quit },
        { "revert-to-saved", gth_browser_activate_revert_to_saved },
        { "save", gth_browser_activate_save },
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 0814a98..eac52cf 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -647,6 +647,7 @@ gth_browser_update_sensitivity (GthBrowser *browser)
        _gth_browser_enable_action (browser, "save-as", viewer_can_save);
        _gth_browser_enable_action (browser, "revert-to-saved", viewer_can_save && modified);
        _gth_browser_enable_action (browser, "clear-history", browser->priv->history != NULL);
+       _gth_browser_enable_action (browser, "go-up", parent_available);
 
        gth_sidebar_update_sensitivity (GTH_SIDEBAR (browser->priv->file_properties));
 
@@ -4553,6 +4554,18 @@ gth_browser_init (GthBrowser *browser)
                                                   _("Go to the next visited location"),
                                                   "win.go-forward",
                                                   "<alt>Right");
+               gth_browser_add_header_bar_button (browser,
+                                                  GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION,
+                                                  "go-up-symbolic",
+                                                  _("Go up one level"),
+                                                  "win.go-up",
+                                                  "<alt>Up");
+               gth_browser_add_header_bar_button (browser,
+                                                  GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION,
+                                                  "user-home-symbolic",
+                                                  NULL,
+                                                  "win.go-home",
+                                                  "<alt>Home");
 
                button = _gtk_menu_button_new_for_header_bar ();
                gtk_widget_set_tooltip_text (button, _("Visited Locations"));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]