[nautilus] Adds option to open new tab in tab bar context menu (#590714)
- From: Marcus Carlson <mdc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Adds option to open new tab in tab bar context menu (#590714)
- Date: Mon, 9 Aug 2010 21:01:27 +0000 (UTC)
commit 8598d769993843e1e6529a661fea034785ca0091
Author: Marcus Carlson <mdc src gnome org>
Date: Mon Aug 2 23:40:14 2010 +0200
Adds option to open new tab in tab bar context menu (#590714)
src/nautilus-navigation-window-menus.c | 30 +--------------------------
src/nautilus-navigation-window-pane.c | 20 ++++++++++++++++++
src/nautilus-window.c | 35 ++++++++++++++++++++++++++++++++
src/nautilus-window.h | 1 +
4 files changed, 57 insertions(+), 29 deletions(-)
---
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index f0e20c4..f27bf10 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -583,37 +583,9 @@ action_new_tab_callback (GtkAction *action,
gpointer user_data)
{
NautilusWindow *window;
- NautilusWindowSlot *current_slot;
- NautilusWindowSlot *new_slot;
- NautilusWindowOpenFlags flags;
- GFile *location;
- int new_slot_position;
- char *scheme;
window = NAUTILUS_WINDOW (user_data);
- current_slot = window->details->active_pane->active_slot;
- location = nautilus_window_slot_get_location (current_slot);
-
- if (location != NULL) {
- flags = 0;
-
- new_slot_position = g_settings_get_enum (nautilus_preferences, NAUTILUS_PREFERENCES_NEW_TAB_POSITION);
- if (new_slot_position == NAUTILUS_NEW_TAB_POSITION_END) {
- flags = NAUTILUS_WINDOW_OPEN_SLOT_APPEND;
- }
-
- scheme = g_file_get_uri_scheme (location);
- if (!strcmp (scheme, "x-nautilus-search")) {
- g_object_unref (location);
- location = g_file_new_for_path (g_get_home_dir ());
- }
- g_free (scheme);
-
- new_slot = nautilus_window_open_slot (current_slot->pane, flags);
- nautilus_window_set_active_slot (window, new_slot);
- nautilus_window_slot_go_to (new_slot, location, FALSE);
- g_object_unref (location);
- }
+ nautilus_window_new_tab (window);
}
static void
diff --git a/src/nautilus-navigation-window-pane.c b/src/nautilus-navigation-window-pane.c
index 94e0741..d4e7143 100644
--- a/src/nautilus-navigation-window-pane.c
+++ b/src/nautilus-navigation-window-pane.c
@@ -285,6 +285,16 @@ path_bar_button_drag_begin_callback (GtkWidget *widget,
}
static void
+notebook_popup_menu_new_tab_cb (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ NautilusWindowPane *pane;
+
+ pane = NAUTILUS_WINDOW_PANE (user_data);
+ nautilus_window_new_tab (pane->window);
+}
+
+static void
path_bar_path_set_callback (GtkWidget *widget,
GFile *location,
NautilusNavigationWindowPane *pane)
@@ -371,6 +381,16 @@ notebook_popup_menu_show (NautilusNavigationWindowPane *pane,
popup = gtk_menu_new();
+ item = gtk_menu_item_new_with_mnemonic (_("_New Tab"));
+ g_signal_connect (item, "activate",
+ G_CALLBACK (notebook_popup_menu_new_tab_cb),
+ pane);
+ gtk_menu_shell_append (GTK_MENU_SHELL (popup),
+ item);
+
+ gtk_menu_shell_append (GTK_MENU_SHELL (popup),
+ gtk_separator_menu_item_new ());
+
item = gtk_menu_item_new_with_mnemonic (_("Move Tab _Left"));
g_signal_connect (item, "activate",
G_CALLBACK (notebook_popup_menu_move_left_cb),
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index b45adbe..217e76b 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -250,6 +250,41 @@ nautilus_window_go_up_signal (NautilusWindow *window, gboolean close_behind)
}
void
+nautilus_window_new_tab (NautilusWindow *window)
+{
+ NautilusWindowSlot *current_slot;
+ NautilusWindowSlot *new_slot;
+ NautilusWindowOpenFlags flags;
+ GFile *location;
+ int new_slot_position;
+ char *scheme;
+
+ current_slot = window->details->active_pane->active_slot;
+ location = nautilus_window_slot_get_location (current_slot);
+
+ if (location != NULL) {
+ flags = 0;
+
+ new_slot_position = g_settings_get_enum (nautilus_preferences, NAUTILUS_PREFERENCES_NEW_TAB_POSITION);
+ if (new_slot_position == NAUTILUS_NEW_TAB_POSITION_END) {
+ flags = NAUTILUS_WINDOW_OPEN_SLOT_APPEND;
+ }
+
+ scheme = g_file_get_uri_scheme (location);
+ if (!strcmp (scheme, "x-nautilus-search")) {
+ g_object_unref (location);
+ location = g_file_new_for_path (g_get_home_dir ());
+ }
+ g_free (scheme);
+
+ new_slot = nautilus_window_open_slot (current_slot->pane, flags);
+ nautilus_window_set_active_slot (window, new_slot);
+ nautilus_window_slot_go_to (new_slot, location, FALSE);
+ g_object_unref (location);
+ }
+}
+
+void
nautilus_window_go_up (NautilusWindow *window, gboolean close_behind, gboolean new_tab)
{
NautilusWindowSlot *slot;
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index ee21afb..12729b9 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -137,6 +137,7 @@ void nautilus_window_go_to_with_selection (NautilusWindow *window
GFile *location,
GList *new_selection);
void nautilus_window_go_home (NautilusWindow *window);
+void nautilus_window_new_tab (NautilusWindow *window);
void nautilus_window_go_up (NautilusWindow *window,
gboolean close_behind,
gboolean new_tab);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]