[nautilus] Implement "Go to same location as other pane" menu item.
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus] Implement "Go to same location as other pane" menu item.
- Date: Thu, 10 Dec 2009 17:16:13 +0000 (UTC)
commit 09359fd13b52c5f5cebe55a9efae21c0290fe86f
Author: Holger Berndt <berndth gmx de>
Date: Sat Jun 13 16:03:18 2009 +0200
Implement "Go to same location as other pane" menu item.
src/nautilus-navigation-window-menus.c | 33 ++++++++++++++++++++++++++++++-
src/nautilus-navigation-window-ui.xml | 1 +
2 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index c766913..37f5a75 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -147,13 +147,31 @@ action_clear_history_callback (GtkAction *action,
}
static void
-action_split_view_switch_next_pane_callback(GtkAction *action,
+action_split_view_switch_next_pane_callback(GtkAction *action,
gpointer user_data)
{
nautilus_window_pane_switch_to (nautilus_window_get_next_pane (NAUTILUS_WINDOW (user_data)));
}
static void
+action_split_view_same_location_callback (GtkAction *action,
+ gpointer user_data)
+{
+ NautilusWindow *window;
+ NautilusWindowPane *next_pane;
+ GFile *location;
+
+ window = NAUTILUS_WINDOW (user_data);
+ next_pane = nautilus_window_get_next_pane (window);
+
+ location = nautilus_window_slot_get_location (next_pane->active_slot);
+ if (location) {
+ nautilus_window_slot_go_to (window->details->active_pane->active_slot, location, FALSE);
+ g_object_unref (location);
+ }
+}
+
+static void
action_show_hide_toolbar_callback (GtkAction *action,
gpointer user_data)
{
@@ -522,6 +540,10 @@ nautilus_navigation_window_update_split_view_actions_sensitivity (NautilusNaviga
action = gtk_action_group_get_action (action_group, "SplitViewNextPane");
gtk_action_set_sensitive (action, have_multiple_panes);
+ /* same location */
+ action = gtk_action_group_get_action (action_group, "SplitViewSameLocation");
+ gtk_action_set_sensitive (action, have_multiple_panes && !next_pane_is_in_same_location);
+
/* clean up */
if (active_pane_location) {
g_object_unref (active_pane_location);
@@ -965,6 +987,9 @@ static const GtkActionEntry navigation_entries[] = {
/* name, stock id, label */ { "SplitViewNextPane", NULL, N_("Switch to other pane"),
NULL, N_("Move focus to the other pane in a split view window"),
G_CALLBACK (action_split_view_switch_next_pane_callback) },
+ /* name, stock id, label */ { "SplitViewSameLocation", NULL, N_("Go to same location as other pane"),
+ NULL, N_("Go to the same location in the other pane of a split view window"),
+ G_CALLBACK (action_split_view_same_location_callback) },
/* name, stock id, label */ { "Add Bookmark", GTK_STOCK_ADD, N_("_Add Bookmark"),
"<control>d", N_("Add a bookmark for the current location to this menu"),
G_CALLBACK (action_add_bookmark_callback) },
@@ -1106,7 +1131,11 @@ nautilus_navigation_window_initialize_actions (NautilusNavigationWindow *window)
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
g_object_unref (action_group); /* owned by ui_manager */
- /* hhb: updates for split view needed here */
+ g_signal_connect (window, "loading_uri",
+ G_CALLBACK (nautilus_navigation_window_update_split_view_actions_sensitivity),
+ NULL);
+
+ nautilus_navigation_window_update_split_view_actions_sensitivity (window);
}
diff --git a/src/nautilus-navigation-window-ui.xml b/src/nautilus-navigation-window-ui.xml
index a77f509..23c46ae 100644
--- a/src/nautilus-navigation-window-ui.xml
+++ b/src/nautilus-navigation-window-ui.xml
@@ -41,6 +41,7 @@
<menuitem name="Clear History" action="Clear History"/>
<separator/>
<menuitem name="SplitViewNextPaneMenu" action="SplitViewNextPane"/>
+ <menuitem name="SplitViewSameLocationMenu" action="SplitViewSameLocation"/>
<separator/>
<placeholder name="History Placeholder"/>
</menu>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]