[file-roller/wip/gtk4] window: added a go-up-one-level button to the location bar



commit 58c699501a8e9ae0f3082f7ab4e4084cfda52e12
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Oct 15 17:12:44 2022 +0200

    window: added a go-up-one-level button to the location bar

 src/fr-window-actions-callbacks.c | 8 ++++++++
 src/fr-window-actions-callbacks.h | 1 +
 src/fr-window-actions-entries.h   | 4 ++++
 src/fr-window.c                   | 3 +++
 4 files changed, 16 insertions(+)
---
diff --git a/src/fr-window-actions-callbacks.c b/src/fr-window-actions-callbacks.c
index 1bab4617..a3b6bec5 100644
--- a/src/fr-window-actions-callbacks.c
+++ b/src/fr-window-actions-callbacks.c
@@ -180,6 +180,14 @@ fr_window_activate_go_home (GSimpleAction *action,
 }
 
 
+void
+fr_window_activate_go_up_one_level (GSimpleAction *action,
+                                   GVariant      *parameter,
+                                   gpointer       user_data)
+{
+       fr_window_go_up_one_level (FR_WINDOW (user_data));
+}
+
 void
 fr_window_activate_open_folder (GSimpleAction *action,
                                GVariant      *parameter,
diff --git a/src/fr-window-actions-callbacks.h b/src/fr-window-actions-callbacks.h
index 27885bfe..6a575e52 100644
--- a/src/fr-window-actions-callbacks.h
+++ b/src/fr-window-actions-callbacks.h
@@ -41,6 +41,7 @@ DEF_ACTION_CALLBACK (fr_window_activate_find)
 DEF_ACTION_CALLBACK (fr_window_activate_go_back)
 DEF_ACTION_CALLBACK (fr_window_activate_go_forward)
 DEF_ACTION_CALLBACK (fr_window_activate_go_home)
+DEF_ACTION_CALLBACK (fr_window_activate_go_up_one_level)
 DEF_ACTION_CALLBACK (fr_window_activate_navigate_to)
 DEF_ACTION_CALLBACK (fr_window_activate_new)
 DEF_ACTION_CALLBACK (fr_window_activate_open)
diff --git a/src/fr-window-actions-entries.h b/src/fr-window-actions-entries.h
index e98dbe9e..c85887f7 100644
--- a/src/fr-window-actions-entries.h
+++ b/src/fr-window-actions-entries.h
@@ -82,6 +82,10 @@ static const GActionEntry fr_window_actions[] = {
                .name = "go-home",
                .activate = fr_window_activate_go_home,
        },
+       {
+               .name = "go-up-one-level",
+               .activate = fr_window_activate_go_up_one_level,
+       },
        {
                .name = "navigate-to",
                .activate = fr_window_activate_navigate_to,
diff --git a/src/fr-window.c b/src/fr-window.c
index 0f022799..d8184fed 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -1626,6 +1626,7 @@ fr_window_update_current_location (FrWindow *window)
        fr_window_enable_action (window, "go-back", private->archive_present && (current_dir != NULL) && 
(private->history_current != NULL) && (private->history_current->next != NULL));
        fr_window_enable_action (window, "go-forward", private->archive_present && (current_dir != NULL) && 
(private->history_current != NULL) && (private->history_current->prev != NULL));
        fr_window_enable_action (window, "go-home", private->archive_present);
+       fr_window_enable_action (window, "go-up-one-level", private->archive_present && (current_dir != NULL) 
&& (g_strcmp0 (current_dir, "/") != 0));
 
        gtk_widget_set_sensitive (private->location_entry, private->archive_present);
        gtk_widget_set_sensitive (private->location_label, private->archive_present);
@@ -5205,6 +5206,8 @@ fr_window_construct (FrWindow *window)
        gtk_style_context_add_class (gtk_widget_get_style_context (navigation_commands), "raised");
        gtk_style_context_add_class (gtk_widget_get_style_context (navigation_commands), "linked");
        gtk_box_append (GTK_BOX (private->location_bar), navigation_commands);
+       gtk_box_append (GTK_BOX (private->location_bar),
+                       _gtk_header_bar_create_image_button ("go-up-symbolic", _("Go to the parent 
location"), "win.go-up-one-level"));
        gtk_box_append (GTK_BOX (private->location_bar),
                        _gtk_header_bar_create_image_button ("user-home-symbolic", _("Go to the home 
location"), "win.go-home"));
 


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