summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/caja-navigation-window-menus.c33
-rw-r--r--src/caja-navigation-window-pane.c20
-rw-r--r--src/caja-window.c35
-rw-r--r--src/caja-window.h1
4 files changed, 57 insertions, 32 deletions
diff --git a/src/caja-navigation-window-menus.c b/src/caja-navigation-window-menus.c
index e6454f85..825bc8a5 100644
--- a/src/caja-navigation-window-menus.c
+++ b/src/caja-navigation-window-menus.c
@@ -620,40 +620,9 @@ action_new_tab_callback (GtkAction *action,
gpointer user_data)
{
CajaWindow *window;
- CajaWindowSlot *current_slot;
- CajaWindowSlot *new_slot;
- CajaWindowOpenFlags flags;
- GFile *location;
- int new_slot_position;
- char *scheme;
window = CAJA_WINDOW (user_data);
- current_slot = window->details->active_pane->active_slot;
- location = caja_window_slot_get_location (current_slot);
-
- if (location != NULL)
- {
- flags = 0;
-
- new_slot_position = g_settings_get_enum (caja_preferences, CAJA_PREFERENCES_NEW_TAB_POSITION);
- if (new_slot_position == CAJA_NEW_TAB_POSITION_END)
- {
- flags = CAJA_WINDOW_OPEN_SLOT_APPEND;
- }
-
- scheme = g_file_get_uri_scheme (location);
- if (!strcmp (scheme, "x-caja-search"))
- {
- g_object_unref (location);
- location = g_file_new_for_path (g_get_home_dir ());
- }
- g_free (scheme);
-
- new_slot = caja_window_open_slot (current_slot->pane, flags);
- caja_window_set_active_slot (window, new_slot);
- caja_window_slot_go_to (new_slot, location, FALSE);
- g_object_unref (location);
- }
+ caja_window_new_tab (window);
}
static void
diff --git a/src/caja-navigation-window-pane.c b/src/caja-navigation-window-pane.c
index b4b6ceaf..da71661b 100644
--- a/src/caja-navigation-window-pane.c
+++ b/src/caja-navigation-window-pane.c
@@ -353,6 +353,16 @@ path_bar_button_drag_begin_callback (GtkWidget *widget,
}
static void
+notebook_popup_menu_new_tab_cb (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ CajaWindowPane *pane;
+
+ pane = CAJA_WINDOW_PANE (user_data);
+ caja_window_new_tab (pane->window);
+}
+
+static void
path_bar_path_set_callback (GtkWidget *widget,
GFile *location,
CajaNavigationWindowPane *pane)
@@ -442,6 +452,16 @@ notebook_popup_menu_show (CajaNavigationWindowPane *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/caja-window.c b/src/caja-window.c
index 29830511..8e9ed5bb 100644
--- a/src/caja-window.c
+++ b/src/caja-window.c
@@ -252,6 +252,41 @@ caja_window_go_up_signal (CajaWindow *window, gboolean close_behind)
}
void
+caja_window_new_tab (CajaWindow *window)
+{
+ CajaWindowSlot *current_slot;
+ CajaWindowSlot *new_slot;
+ CajaWindowOpenFlags flags;
+ GFile *location;
+ int new_slot_position;
+ char *scheme;
+
+ current_slot = window->details->active_pane->active_slot;
+ location = caja_window_slot_get_location (current_slot);
+
+ if (location != NULL) {
+ flags = 0;
+
+ new_slot_position = g_settings_get_enum (caja_preferences, CAJA_PREFERENCES_NEW_TAB_POSITION);
+ if (new_slot_position == CAJA_NEW_TAB_POSITION_END) {
+ flags = CAJA_WINDOW_OPEN_SLOT_APPEND;
+ }
+
+ scheme = g_file_get_uri_scheme (location);
+ if (!strcmp (scheme, "x-caja-search")) {
+ g_object_unref (location);
+ location = g_file_new_for_path (g_get_home_dir ());
+ }
+ g_free (scheme);
+
+ new_slot = caja_window_open_slot (current_slot->pane, flags);
+ caja_window_set_active_slot (window, new_slot);
+ caja_window_slot_go_to (new_slot, location, FALSE);
+ g_object_unref (location);
+ }
+}
+
+void
caja_window_go_up (CajaWindow *window, gboolean close_behind, gboolean new_tab)
{
CajaWindowSlot *slot;
diff --git a/src/caja-window.h b/src/caja-window.h
index 46b0fd44..d13129a7 100644
--- a/src/caja-window.h
+++ b/src/caja-window.h
@@ -141,6 +141,7 @@ void caja_window_go_to_with_selection (CajaWindow *window,
GFile *location,
GList *new_selection);
void caja_window_go_home (CajaWindow *window);
+void caja_window_new_tab (CajaWindow *window);
void caja_window_go_up (CajaWindow *window,
gboolean close_behind,
gboolean new_tab);