Re: [PATCH] Open spatial folder window from browser window
- From: Jürg Billeter <j bitron ch>
- To: Alexander Larsson <alexl redhat com>
- Cc: nautilus-list gnome org
- Subject: Re: [PATCH] Open spatial folder window from browser window
- Date: Mon, 05 Nov 2007 09:45:03 +0000
On Mon, 2007-11-05 at 09:00 +0100, Alexander Larsson wrote:
> On Fri, 2007-11-02 at 22:18 +0100, Jürg Billeter wrote:
> > Hi,
> >
> > currently it's not possible to open a spatial folder window from a
> > browser window, while it's possible the other way round. Drilling down a
> > directory structure in a browser window and then opening a spatial
> > folder window does make sense, though, in my opinion.
> >
> > The attached patch against svn trunk adds a "Open Folder Window" menu
> > item to the File menu and appropriate context menus, it also changes
> > "Open in New Window" to "Browse in New Window" to make the difference
> > between the two menu items more clear. These changes are only visible if
> > "Always open in browser windows" is disabled, as we never want to open
> > spatial folder windows when that option is enabled.
> >
> > I'd also like to add a toolbar button to open a spatial window but that
> > might be too prominent, so I've omitted it from this patch. However it
> > would only be visible for people that already use both, spatial and
> > browser windows, and these users might actually be interested in that
> > feature.
> >
> > If the patch looks essentially fine, I'll port it to the gio-branch.
>
> Yeah, i think so. On thing perhaps:
> "Open a Nautilus folder window for the displayed location"
>
> I dunno if it really makes sense to mention Nautilus in the ui like
> that.
I've removed 'Nautilus' from the description now. The reason I've added
it in the first place was the description of the "New Window" action:
"Open another Nautilus window for the displayed location". We might want
to change it there, too.
Updated patch for trunk and gio-branch is attached, ok to commit?
Jürg
Index: src/nautilus-navigation-window-ui.xml
===================================================================
--- src/nautilus-navigation-window-ui.xml (revision 13404)
+++ src/nautilus-navigation-window-ui.xml (working copy)
@@ -3,6 +3,7 @@
<menu action="File">
<placeholder name="New Items Placeholder">
<menuitem name="New Window" action="New Window"/>
+ <menuitem name="Folder Window" action="Folder Window"/>
</placeholder>
<placeholder name="Close Items Placeholder">
Index: src/nautilus-window-private.h
===================================================================
--- src/nautilus-window-private.h (revision 13404)
+++ src/nautilus-window-private.h (working copy)
@@ -220,6 +220,7 @@
void nautilus_navigation_window_remove_bookmarks_menu_items (NautilusNavigationWindow *window);
void nautilus_navigation_window_update_show_hide_menu_items (NautilusNavigationWindow *window);
+void nautilus_navigation_window_update_spatial_menu_item (NautilusNavigationWindow *window);
void nautilus_navigation_window_remove_go_menu_callback (NautilusNavigationWindow *window);
void nautilus_navigation_window_remove_go_menu_items (NautilusNavigationWindow *window);
Index: src/nautilus-navigation-window-menus.c
===================================================================
--- src/nautilus-navigation-window-menus.c (revision 13404)
+++ src/nautilus-navigation-window-menus.c (working copy)
@@ -56,6 +56,7 @@
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-ops.h>
#include <libnautilus-private/nautilus-file-utilities.h>
+#include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-ui-utilities.h>
#include <libnautilus-private/nautilus-icon-factory.h>
#include <libnautilus-private/nautilus-undo-manager.h>
@@ -234,6 +235,19 @@
nautilus_navigation_window_status_bar_showing (window));
}
+void
+nautilus_navigation_window_update_spatial_menu_item (NautilusNavigationWindow *window)
+{
+ GtkAction *action;
+
+ g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+
+ action = gtk_action_group_get_action (window->details->navigation_action_group,
+ NAUTILUS_ACTION_FOLDER_WINDOW);
+ gtk_action_set_visible (action,
+ !eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER));
+}
+
static void
action_add_bookmark_callback (GtkAction *action,
gpointer user_data)
@@ -421,6 +435,24 @@
}
static void
+action_folder_window_callback (GtkAction *action,
+ gpointer user_data)
+{
+ NautilusWindow *current_window;
+ char *current_location;
+
+ current_window = NAUTILUS_WINDOW (user_data);
+ current_location = nautilus_window_get_location (current_window);
+ nautilus_application_present_spatial_window (
+ current_window->application,
+ current_window,
+ NULL,
+ current_location,
+ gtk_window_get_screen (GTK_WINDOW (current_window)));
+ g_free (current_location);
+}
+
+static void
action_go_to_location_callback (GtkAction *action,
gpointer user_data)
{
@@ -445,9 +477,12 @@
static const GtkActionEntry navigation_entries[] = {
{ "Go", NULL, N_("_Go") }, /* name, stock id, label */
{ "Bookmarks", NULL, N_("_Bookmarks") }, /* name, stock id, label */
- { "New Window", "window-new", N_("Open New _Window"), /* name, stock id, label */
+ { "New Window", "window-new", N_("New _Window"), /* name, stock id, label */
"<control>N", N_("Open another Nautilus window for the displayed location"),
G_CALLBACK (action_new_window_callback) },
+ { "Folder Window", "folder", N_("Open Folder W_indow"), /* name, stock id, label */
+ NULL, N_("Open a folder window for the displayed location"),
+ G_CALLBACK (action_folder_window_callback) },
{ "Close All Windows", NULL, N_("Close _All Windows"), /* name, stock id, label */
"<control><shift>W", N_("Close all Navigation windows"),
G_CALLBACK (action_close_all_windows_callback) },
@@ -572,6 +607,7 @@
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
nautilus_navigation_window_update_show_hide_menu_items (window);
+ nautilus_navigation_window_update_spatial_menu_item (window);
nautilus_navigation_window_initialize_go_menu (window);
}
Index: src/file-manager/nautilus-directory-view-ui.xml
===================================================================
--- src/file-manager/nautilus-directory-view-ui.xml (revision 13404)
+++ src/file-manager/nautilus-directory-view-ui.xml (working copy)
@@ -116,6 +116,7 @@
<placeholder name="Open Placeholder">
<menuitem name="Open" action="Open"/>
<menuitem name="OpenAlternate" action="OpenAlternate"/>
+ <menuitem name="OpenFolderWindow" action="OpenFolderWindow"/>
<separator name="applications separator"/>
<placeholder name="Applications Placeholder"/>
<menu action="Open With">
@@ -167,6 +168,7 @@
<popup name="location">
<placeholder name="Open Placeholder">
<menuitem name="LocationOpenAlternate" action="LocationOpenAlternate"/>
+ <menuitem name="LocationOpenFolderWindow" action="LocationOpenFolderWindow"/>
</placeholder>
<separator/>
<placeholder name="Clipboard Actions">
Index: src/file-manager/fm-actions.h
===================================================================
--- src/file-manager/fm-actions.h (revision 13404)
+++ src/file-manager/fm-actions.h (working copy)
@@ -27,7 +27,9 @@
#define FM_ACTION_OPEN "Open"
#define FM_ACTION_OPEN_ALTERNATE "OpenAlternate"
+#define FM_ACTION_OPEN_FOLDER_WINDOW "OpenFolderWindow"
#define FM_ACTION_LOCATION_OPEN_ALTERNATE "LocationOpenAlternate"
+#define FM_ACTION_LOCATION_OPEN_FOLDER_WINDOW "LocationOpenFolderWindow"
#define FM_ACTION_OTHER_APPLICATION1 "OtherApplication1"
#define FM_ACTION_OTHER_APPLICATION2 "OtherApplication2"
#define FM_ACTION_NEW_FOLDER "New Folder"
Index: src/file-manager/fm-directory-view.c
===================================================================
--- src/file-manager/fm-directory-view.c (revision 13404)
+++ src/file-manager/fm-directory-view.c (working copy)
@@ -354,6 +354,8 @@
FMDirectoryView *view);
static void open_one_in_new_window (gpointer data,
gpointer callback_data);
+static void open_one_in_folder_window (gpointer data,
+ gpointer callback_data);
static void schedule_update_menus (FMDirectoryView *view);
static void schedule_update_menus_callback (gpointer callback_data);
static void remove_update_menus_timeout_callback (FMDirectoryView *view);
@@ -423,6 +425,8 @@
static void action_location_open_alternate_callback (GtkAction *action,
gpointer callback_data);
+static void action_location_open_folder_window_callback (GtkAction *action,
+ gpointer callback_data);
static void action_location_cut_callback (GtkAction *action,
gpointer callback_data);
@@ -767,6 +771,23 @@
}
static void
+action_open_folder_window_callback (GtkAction *action,
+ gpointer callback_data)
+{
+ FMDirectoryView *view;
+ GList *selection;
+
+ view = FM_DIRECTORY_VIEW (callback_data);
+ selection = fm_directory_view_get_selection (view);
+
+ if (fm_directory_view_confirm_multiple_windows (view, g_list_length (selection))) {
+ g_list_foreach (selection, open_one_in_folder_window, view);
+ }
+
+ nautilus_file_list_free (selection);
+}
+
+static void
fm_directory_view_launch_application (GnomeVFSMimeApplication *application,
GList *files,
FMDirectoryView *directory_view)
@@ -4338,6 +4359,18 @@
0);
}
+static void
+open_one_in_folder_window (gpointer data, gpointer callback_data)
+{
+ g_assert (NAUTILUS_IS_FILE (data));
+ g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
+
+ fm_directory_view_activate_file (FM_DIRECTORY_VIEW (callback_data),
+ NAUTILUS_FILE (data),
+ NAUTILUS_WINDOW_OPEN_IN_SPATIAL,
+ 0);
+}
+
NautilusFile *
fm_directory_view_get_directory_as_file (FMDirectoryView *view)
{
@@ -6763,6 +6796,24 @@
}
static void
+action_location_open_folder_window_callback (GtkAction *action,
+ gpointer callback_data)
+{
+ FMDirectoryView *view;
+ NautilusFile *file;
+
+ view = FM_DIRECTORY_VIEW (callback_data);
+
+ file = view->details->directory_as_file;
+ g_return_if_fail (file != NULL);
+
+ fm_directory_view_activate_file (view,
+ file,
+ NAUTILUS_WINDOW_OPEN_IN_SPATIAL,
+ 0);
+}
+
+static void
action_location_cut_callback (GtkAction *action,
gpointer callback_data)
{
@@ -6929,6 +6980,10 @@
N_("Open in Navigation Window"), "<control><shift>o", /* label, accelerator */
N_("Open each selected item in a navigation window"), /* tooltip */
G_CALLBACK (action_open_alternate_callback) },
+ { "OpenFolderWindow", NULL, /* name, stock id */
+ N_("Open in Folder Window"), NULL, /* label, accelerator */
+ N_("Open each selected item in a folder window"), /* tooltip */
+ G_CALLBACK (action_open_folder_window_callback) },
{ "OtherApplication1", NULL, /* name, stock id */
N_("Open with Other _Application..."), NULL, /* label, accelerator */
N_("Choose another application with which to open the selected item"), /* tooltip */
@@ -7054,6 +7109,11 @@
N_("Open this folder in a navigation window"), /* tooltip */
G_CALLBACK (action_location_open_alternate_callback) },
+ { FM_ACTION_LOCATION_OPEN_FOLDER_WINDOW, NULL, /* name, stock id */
+ N_("Open in Folder Window"), "", /* label, accelerator */
+ N_("Open this folder in a folder window"), /* tooltip */
+ G_CALLBACK (action_location_open_folder_window_callback) },
+
{ FM_ACTION_LOCATION_CUT, GTK_STOCK_CUT, /* name, stock id */
NULL, "", /* label, accelerator */
N_("Prepare this folder to be moved with a Paste command"), /* tooltip */
@@ -7619,11 +7679,18 @@
gboolean is_read_only;
gboolean can_delete_file;
gboolean show_separate_delete_command;
+ gboolean show_open_folder_window;
char *label;
char *tip;
+ show_open_folder_window = FALSE;
if (nautilus_window_info_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION) {
- label = _("Open in New Window");
+ if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
+ label = _("Open in New Window");
+ } else {
+ label = _("Browse in New Window");
+ show_open_folder_window = TRUE;
+ }
} else {
label = g_strdup (ngettext ("_Browse Folder",
"_Browse Folders", 1));
@@ -7634,6 +7701,10 @@
"label", label,
NULL);
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_LOCATION_OPEN_FOLDER_WINDOW);
+ gtk_action_set_visible (action, show_open_folder_window);
+
file = view->details->directory_as_file;
is_special_link = NAUTILUS_IS_DESKTOP_ICON_FILE (file);
is_desktop_or_home_dir = nautilus_file_is_home (file)
@@ -7716,6 +7787,7 @@
gboolean show_save_search;
gboolean save_search_sensitive;
gboolean show_save_search_as;
+ gboolean show_open_folder_window;
ActivationAction activation_action;
GtkAction *action;
GnomeVFSMimeApplication *app;
@@ -7804,14 +7876,28 @@
g_free (label_with_underscore);
show_open_alternate = file_list_all_are_folders (selection);
+ show_open_folder_window = FALSE;
if (nautilus_window_info_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION) {
- if (selection_count == 0 || selection_count == 1) {
- label_with_underscore = g_strdup (_("Open in New Window"));
+ if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
+ if (selection_count == 0 || selection_count == 1) {
+ label_with_underscore = g_strdup (_("Open in New Window"));
+ } else {
+ label_with_underscore = g_strdup_printf (ngettext("Open in %d New Window",
+ "Open in %d New Windows",
+ selection_count),
+ selection_count);
+ }
+ gtk_action_set_visible (action, FALSE);
} else {
- label_with_underscore = g_strdup_printf (ngettext("Open in %d New Window",
- "Open in %d New Windows",
- selection_count),
- selection_count);
+ if (selection_count == 0 || selection_count == 1) {
+ label_with_underscore = g_strdup (_("Browse in New Window"));
+ } else {
+ label_with_underscore = g_strdup_printf (ngettext("Browse in %d New Window",
+ "Browse in %d New Windows",
+ selection_count),
+ selection_count);
+ }
+ show_open_folder_window = show_open_alternate;
}
} else {
label_with_underscore = g_strdup (ngettext ("_Browse Folder",
@@ -7825,6 +7911,10 @@
label_with_underscore,
NULL);
g_free (label_with_underscore);
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_OPEN_FOLDER_WINDOW);
+ gtk_action_set_visible (action, show_open_folder_window);
gtk_action_set_sensitive (action, selection_count != 0);
gtk_action_set_visible (action, show_open_alternate);
Index: src/nautilus-navigation-window.c
===================================================================
--- src/nautilus-navigation-window.c (revision 13404)
+++ src/nautilus-navigation-window.c (working copy)
@@ -122,6 +122,7 @@
const char *uri,
NautilusNavigationWindow *window);
static void always_use_location_entry_changed (gpointer callback_data);
+static void always_use_browser_changed (gpointer callback_data);
static void nautilus_navigation_window_set_bar_mode (NautilusNavigationWindow *window,
NautilusBarMode mode);
@@ -358,6 +359,10 @@
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY,
always_use_location_entry_changed,
window, G_OBJECT (window));
+
+ eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER,
+ always_use_browser_changed,
+ window, G_OBJECT (window));
}
static void
@@ -385,6 +390,16 @@
window);
}
+static void
+always_use_browser_changed (gpointer callback_data)
+{
+ NautilusNavigationWindow *window;
+
+ window = NAUTILUS_NAVIGATION_WINDOW (callback_data);
+
+ nautilus_navigation_window_update_spatial_menu_item (window);
+}
+
static int
bookmark_list_get_uri_index (GList *list,
const char *uri)
Index: src/nautilus-actions.h
===================================================================
--- src/nautilus-actions.h (revision 13404)
+++ src/nautilus-actions.h (working copy)
@@ -48,5 +48,6 @@
#define NAUTILUS_ACTION_ZOOM_NORMAL "Zoom Normal"
#define NAUTILUS_ACTION_CLOSE "Close"
#define NAUTILUS_ACTION_SEARCH "Search"
+#define NAUTILUS_ACTION_FOLDER_WINDOW "Folder Window"
#endif /* NAUTILUS_ACTIONS_H */
Index: src/nautilus-navigation-window-ui.xml
===================================================================
--- src/nautilus-navigation-window-ui.xml (revision 13404)
+++ src/nautilus-navigation-window-ui.xml (working copy)
@@ -3,6 +3,7 @@
<menu action="File">
<placeholder name="New Items Placeholder">
<menuitem name="New Window" action="New Window"/>
+ <menuitem name="Folder Window" action="Folder Window"/>
</placeholder>
<placeholder name="Close Items Placeholder">
Index: src/nautilus-window-private.h
===================================================================
--- src/nautilus-window-private.h (revision 13404)
+++ src/nautilus-window-private.h (working copy)
@@ -220,6 +220,7 @@
void nautilus_navigation_window_remove_bookmarks_menu_items (NautilusNavigationWindow *window);
void nautilus_navigation_window_update_show_hide_menu_items (NautilusNavigationWindow *window);
+void nautilus_navigation_window_update_spatial_menu_item (NautilusNavigationWindow *window);
void nautilus_navigation_window_remove_go_menu_callback (NautilusNavigationWindow *window);
void nautilus_navigation_window_remove_go_menu_items (NautilusNavigationWindow *window);
Index: src/nautilus-navigation-window-menus.c
===================================================================
--- src/nautilus-navigation-window-menus.c (revision 13404)
+++ src/nautilus-navigation-window-menus.c (working copy)
@@ -52,6 +52,7 @@
#include <libgnomeui/gnome-about.h>
#include <libgnomeui/gnome-uidefs.h>
#include <libnautilus-private/nautilus-file-utilities.h>
+#include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-ui-utilities.h>
#include <libnautilus-private/nautilus-undo-manager.h>
#include <libnautilus-private/nautilus-search-engine.h>
@@ -229,6 +230,19 @@
nautilus_navigation_window_status_bar_showing (window));
}
+void
+nautilus_navigation_window_update_spatial_menu_item (NautilusNavigationWindow *window)
+{
+ GtkAction *action;
+
+ g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+
+ action = gtk_action_group_get_action (window->details->navigation_action_group,
+ NAUTILUS_ACTION_FOLDER_WINDOW);
+ gtk_action_set_visible (action,
+ !eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER));
+}
+
static void
action_add_bookmark_callback (GtkAction *action,
gpointer user_data)
@@ -413,6 +427,26 @@
}
static void
+action_folder_window_callback (GtkAction *action,
+ gpointer user_data)
+{
+ NautilusWindow *current_window;
+ GFile *current_location;
+
+ current_window = NAUTILUS_WINDOW (user_data);
+ current_location = nautilus_window_get_location (current_window);
+ nautilus_application_present_spatial_window (
+ current_window->application,
+ current_window,
+ NULL,
+ current_location,
+ gtk_window_get_screen (GTK_WINDOW (current_window)));
+ if (current_location != NULL) {
+ g_object_unref (current_location);
+ }
+}
+
+static void
action_go_to_location_callback (GtkAction *action,
gpointer user_data)
{
@@ -437,9 +471,12 @@
static const GtkActionEntry navigation_entries[] = {
{ "Go", NULL, N_("_Go") }, /* name, stock id, label */
{ "Bookmarks", NULL, N_("_Bookmarks") }, /* name, stock id, label */
- { "New Window", "window-new", N_("Open New _Window"), /* name, stock id, label */
+ { "New Window", "window-new", N_("New _Window"), /* name, stock id, label */
"<control>N", N_("Open another Nautilus window for the displayed location"),
G_CALLBACK (action_new_window_callback) },
+ { "Folder Window", "folder", N_("Open Folder W_indow"), /* name, stock id, label */
+ NULL, N_("Open a folder window for the displayed location"),
+ G_CALLBACK (action_folder_window_callback) },
{ "Close All Windows", NULL, N_("Close _All Windows"), /* name, stock id, label */
"<control><shift>W", N_("Close all Navigation windows"),
G_CALLBACK (action_close_all_windows_callback) },
@@ -564,6 +601,7 @@
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
nautilus_navigation_window_update_show_hide_menu_items (window);
+ nautilus_navigation_window_update_spatial_menu_item (window);
nautilus_navigation_window_initialize_go_menu (window);
}
Index: src/nautilus-navigation-window.c
===================================================================
--- src/nautilus-navigation-window.c (revision 13404)
+++ src/nautilus-navigation-window.c (working copy)
@@ -118,6 +118,7 @@
GFile *path,
NautilusNavigationWindow *window);
static void always_use_location_entry_changed (gpointer callback_data);
+static void always_use_browser_changed (gpointer callback_data);
static void nautilus_navigation_window_set_bar_mode (NautilusNavigationWindow *window,
NautilusBarMode mode);
@@ -354,6 +355,10 @@
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY,
always_use_location_entry_changed,
window, G_OBJECT (window));
+
+ eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER,
+ always_use_browser_changed,
+ window, G_OBJECT (window));
}
static void
@@ -381,6 +386,16 @@
window);
}
+static void
+always_use_browser_changed (gpointer callback_data)
+{
+ NautilusNavigationWindow *window;
+
+ window = NAUTILUS_NAVIGATION_WINDOW (callback_data);
+
+ nautilus_navigation_window_update_spatial_menu_item (window);
+}
+
static int
bookmark_list_get_uri_index (GList *list,
GFile *location)
Index: src/file-manager/nautilus-directory-view-ui.xml
===================================================================
--- src/file-manager/nautilus-directory-view-ui.xml (revision 13404)
+++ src/file-manager/nautilus-directory-view-ui.xml (working copy)
@@ -116,6 +116,7 @@
<placeholder name="Open Placeholder">
<menuitem name="Open" action="Open"/>
<menuitem name="OpenAlternate" action="OpenAlternate"/>
+ <menuitem name="OpenFolderWindow" action="OpenFolderWindow"/>
<separator name="applications separator"/>
<placeholder name="Applications Placeholder"/>
<menu action="Open With">
@@ -167,6 +168,7 @@
<popup name="location">
<placeholder name="Open Placeholder">
<menuitem name="LocationOpenAlternate" action="LocationOpenAlternate"/>
+ <menuitem name="LocationOpenFolderWindow" action="LocationOpenFolderWindow"/>
</placeholder>
<separator/>
<placeholder name="Clipboard Actions">
Index: src/file-manager/fm-actions.h
===================================================================
--- src/file-manager/fm-actions.h (revision 13404)
+++ src/file-manager/fm-actions.h (working copy)
@@ -27,7 +27,9 @@
#define FM_ACTION_OPEN "Open"
#define FM_ACTION_OPEN_ALTERNATE "OpenAlternate"
+#define FM_ACTION_OPEN_FOLDER_WINDOW "OpenFolderWindow"
#define FM_ACTION_LOCATION_OPEN_ALTERNATE "LocationOpenAlternate"
+#define FM_ACTION_LOCATION_OPEN_FOLDER_WINDOW "LocationOpenFolderWindow"
#define FM_ACTION_OTHER_APPLICATION1 "OtherApplication1"
#define FM_ACTION_OTHER_APPLICATION2 "OtherApplication2"
#define FM_ACTION_NEW_FOLDER "New Folder"
Index: src/file-manager/fm-directory-view.c
===================================================================
--- src/file-manager/fm-directory-view.c (revision 13404)
+++ src/file-manager/fm-directory-view.c (working copy)
@@ -310,6 +310,8 @@
FMDirectoryView *view);
static void open_one_in_new_window (gpointer data,
gpointer callback_data);
+static void open_one_in_folder_window (gpointer data,
+ gpointer callback_data);
static void schedule_update_menus (FMDirectoryView *view);
static void schedule_update_menus_callback (gpointer callback_data);
static void remove_update_menus_timeout_callback (FMDirectoryView *view);
@@ -364,6 +366,8 @@
static void action_location_open_alternate_callback (GtkAction *action,
gpointer callback_data);
+static void action_location_open_folder_window_callback (GtkAction *action,
+ gpointer callback_data);
static void action_location_cut_callback (GtkAction *action,
gpointer callback_data);
@@ -770,6 +774,26 @@
}
static void
+action_open_folder_window_callback (GtkAction *action,
+ gpointer callback_data)
+{
+ FMDirectoryView *view;
+ GList *selection;
+ GtkWindow *window;
+
+ view = FM_DIRECTORY_VIEW (callback_data);
+ selection = fm_directory_view_get_selection (view);
+
+ window = fm_directory_view_get_containing_window (view);
+
+ if (fm_directory_view_confirm_multiple_windows (window, g_list_length (selection))) {
+ g_list_foreach (selection, open_one_in_folder_window, view);
+ }
+
+ nautilus_file_list_free (selection);
+}
+
+static void
open_location (FMDirectoryView *directory_view,
const char *new_uri,
NautilusWindowOpenMode mode,
@@ -3922,6 +3946,18 @@
0);
}
+static void
+open_one_in_folder_window (gpointer data, gpointer callback_data)
+{
+ g_assert (NAUTILUS_IS_FILE (data));
+ g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
+
+ fm_directory_view_activate_file (FM_DIRECTORY_VIEW (callback_data),
+ NAUTILUS_FILE (data),
+ NAUTILUS_WINDOW_OPEN_IN_SPATIAL,
+ 0);
+}
+
NautilusFile *
fm_directory_view_get_directory_as_file (FMDirectoryView *view)
{
@@ -5959,6 +5995,24 @@
}
static void
+action_location_open_folder_window_callback (GtkAction *action,
+ gpointer callback_data)
+{
+ FMDirectoryView *view;
+ NautilusFile *file;
+
+ view = FM_DIRECTORY_VIEW (callback_data);
+
+ file = view->details->directory_as_file;
+ g_return_if_fail (file != NULL);
+
+ fm_directory_view_activate_file (view,
+ file,
+ NAUTILUS_WINDOW_OPEN_IN_SPATIAL,
+ 0);
+}
+
+static void
action_location_cut_callback (GtkAction *action,
gpointer callback_data)
{
@@ -6122,6 +6176,10 @@
N_("Open in Navigation Window"), "<control><shift>o", /* label, accelerator */
N_("Open each selected item in a navigation window"), /* tooltip */
G_CALLBACK (action_open_alternate_callback) },
+ { "OpenFolderWindow", NULL, /* name, stock id */
+ N_("Open in Folder Window"), NULL, /* label, accelerator */
+ N_("Open each selected item in a folder window"), /* tooltip */
+ G_CALLBACK (action_open_folder_window_callback) },
{ "OtherApplication1", NULL, /* name, stock id */
N_("Open with Other _Application..."), NULL, /* label, accelerator */
N_("Choose another application with which to open the selected item"), /* tooltip */
@@ -6247,6 +6305,11 @@
N_("Open this folder in a navigation window"), /* tooltip */
G_CALLBACK (action_location_open_alternate_callback) },
+ { FM_ACTION_LOCATION_OPEN_FOLDER_WINDOW, NULL, /* name, stock id */
+ N_("Open in Folder Window"), "", /* label, accelerator */
+ N_("Open this folder in a folder window"), /* tooltip */
+ G_CALLBACK (action_location_open_folder_window_callback) },
+
{ FM_ACTION_LOCATION_CUT, GTK_STOCK_CUT, /* name, stock id */
NULL, "", /* label, accelerator */
N_("Prepare this folder to be moved with a Paste command"), /* tooltip */
@@ -6732,11 +6795,18 @@
gboolean is_read_only;
gboolean can_delete_file;
gboolean show_separate_delete_command;
+ gboolean show_open_folder_window;
char *label;
char *tip;
+ show_open_folder_window = FALSE;
if (nautilus_window_info_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION) {
- label = _("Open in New Window");
+ if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
+ label = _("Open in New Window");
+ } else {
+ label = _("Browse in New Window");
+ show_open_folder_window = TRUE;
+ }
} else {
label = g_strdup (ngettext ("_Browse Folder",
"_Browse Folders", 1));
@@ -6747,6 +6817,10 @@
"label", label,
NULL);
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_LOCATION_OPEN_FOLDER_WINDOW);
+ gtk_action_set_visible (action, show_open_folder_window);
+
file = view->details->directory_as_file;
is_special_link = NAUTILUS_IS_DESKTOP_ICON_FILE (file);
is_desktop_or_home_dir = nautilus_file_is_home (file)
@@ -6829,6 +6903,7 @@
gboolean show_save_search;
gboolean save_search_sensitive;
gboolean show_save_search_as;
+ gboolean show_open_folder_window;
GtkAction *action;
GAppInfo *app;
@@ -6906,14 +6981,28 @@
g_free (label_with_underscore);
show_open_alternate = file_list_all_are_folders (selection);
+ show_open_folder_window = FALSE;
if (nautilus_window_info_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION) {
- if (selection_count == 0 || selection_count == 1) {
- label_with_underscore = g_strdup (_("Open in New Window"));
+ if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
+ if (selection_count == 0 || selection_count == 1) {
+ label_with_underscore = g_strdup (_("Open in New Window"));
+ } else {
+ label_with_underscore = g_strdup_printf (ngettext("Open in %d New Window",
+ "Open in %d New Windows",
+ selection_count),
+ selection_count);
+ }
+ gtk_action_set_visible (action, FALSE);
} else {
- label_with_underscore = g_strdup_printf (ngettext("Open in %d New Window",
- "Open in %d New Windows",
- selection_count),
- selection_count);
+ if (selection_count == 0 || selection_count == 1) {
+ label_with_underscore = g_strdup (_("Browse in New Window"));
+ } else {
+ label_with_underscore = g_strdup_printf (ngettext("Browse in %d New Window",
+ "Browse in %d New Windows",
+ selection_count),
+ selection_count);
+ }
+ show_open_folder_window = show_open_alternate;
}
} else {
label_with_underscore = g_strdup (ngettext ("_Browse Folder",
@@ -6927,6 +7016,10 @@
label_with_underscore,
NULL);
g_free (label_with_underscore);
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_OPEN_FOLDER_WINDOW);
+ gtk_action_set_visible (action, show_open_folder_window);
gtk_action_set_sensitive (action, selection_count != 0);
gtk_action_set_visible (action, show_open_alternate);
Index: src/nautilus-actions.h
===================================================================
--- src/nautilus-actions.h (revision 13404)
+++ src/nautilus-actions.h (working copy)
@@ -48,5 +48,6 @@
#define NAUTILUS_ACTION_ZOOM_NORMAL "Zoom Normal"
#define NAUTILUS_ACTION_CLOSE "Close"
#define NAUTILUS_ACTION_SEARCH "Search"
+#define NAUTILUS_ACTION_FOLDER_WINDOW "Folder Window"
#endif /* NAUTILUS_ACTIONS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]