[nautilus] all: remove nautilus_window_slot_go_to()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] all: remove nautilus_window_slot_go_to()
- Date: Mon, 23 Apr 2012 14:19:15 +0000 (UTC)
commit 6a6a6ca581e2aaf01b0c63302ad0ff3e0babc3ea
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sun Apr 22 16:34:41 2012 -0400
all: remove nautilus_window_slot_go_to()
We don't want to have similar but slightly different code paths;
consolidate use of NautilusWindowOpenFlags everywhere and simplify code.
libnautilus-private/nautilus-ui-utilities.c | 20 -------
libnautilus-private/nautilus-ui-utilities.h | 2 -
src/nautilus-application.c | 13 ++---
src/nautilus-mime-actions.c | 3 +-
src/nautilus-navigation-action.c | 18 +------
src/nautilus-places-sidebar.c | 5 +-
src/nautilus-tree-sidebar.c | 12 ++---
src/nautilus-view.c | 2 +-
src/nautilus-window-bookmarks.c | 5 +-
src/nautilus-window-manage-views.c | 12 ++---
src/nautilus-window-menus.c | 33 +++++------
src/nautilus-window-pane.c | 11 ++--
src/nautilus-window-slot.c | 29 ++---------
src/nautilus-window-slot.h | 23 ++------
src/nautilus-window.c | 76 ++++++++++++++++-----------
src/nautilus-window.h | 10 ++--
16 files changed, 101 insertions(+), 173 deletions(-)
---
diff --git a/libnautilus-private/nautilus-ui-utilities.c b/libnautilus-private/nautilus-ui-utilities.c
index 5403e7f..8b96b69 100644
--- a/libnautilus-private/nautilus-ui-utilities.c
+++ b/libnautilus-private/nautilus-ui-utilities.c
@@ -111,26 +111,6 @@ nautilus_action_from_menu_item (NautilusMenuItem *item)
return action;
}
-gboolean
-nautilus_event_should_open_in_new_tab (void)
-{
- GdkEvent *event;
-
- event = gtk_get_current_event ();
-
- if (event == NULL) {
- return FALSE;
- }
-
- if (event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) {
- return event->button.button == 2;
- }
-
- gdk_event_free (event);
-
- return FALSE;
-}
-
GdkPixbuf *
nautilus_ui_get_menu_icon (const char *icon_name)
{
diff --git a/libnautilus-private/nautilus-ui-utilities.h b/libnautilus-private/nautilus-ui-utilities.h
index bbb6dde..3aeaa09 100644
--- a/libnautilus-private/nautilus-ui-utilities.h
+++ b/libnautilus-private/nautilus-ui-utilities.h
@@ -36,8 +36,6 @@ void nautilus_ui_prepare_merge_ui (GtkUIManager *ui_manage
GtkActionGroup **action_group);
GtkAction * nautilus_action_from_menu_item (NautilusMenuItem *item);
-gboolean nautilus_event_should_open_in_new_tab (void);
-
GdkPixbuf * nautilus_ui_get_menu_icon (const char *icon_name);
#endif /* NAUTILUS_UI_UTILITIES_H */
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index d85d14b..26be4a5 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -484,10 +484,7 @@ nautilus_application_create_window (NautilusApplication *application,
g_return_val_if_fail (NAUTILUS_IS_APPLICATION (application), NULL);
- window = g_object_new (NAUTILUS_TYPE_WINDOW,
- "screen", screen,
- NULL);
-
+ window = nautilus_window_new (screen);
gtk_application_add_window (GTK_APPLICATION (application),
GTK_WINDOW (window));
@@ -635,7 +632,7 @@ mount_removed_callback (GVolumeMonitor *monitor,
nautilus_window_pane_slot_close (slot->pane, slot);
} else {
computer = g_file_new_for_path (g_get_home_dir ());
- nautilus_window_slot_go_to (slot, computer, FALSE);
+ nautilus_window_slot_open_location (slot, computer, 0);
g_object_unref(computer);
}
}
@@ -708,10 +705,8 @@ nautilus_application_open_location (NautilusApplication *application,
sel_list = g_list_prepend (sel_list, nautilus_file_get (selection));
}
- nautilus_window_slot_open_location (nautilus_window_get_active_slot (window),
- location,
- 0,
- sel_list);
+ nautilus_window_slot_open_location_full (nautilus_window_get_active_slot (window), location,
+ 0, sel_list, NULL, NULL);
if (sel_list != NULL) {
nautilus_file_list_free (sel_list);
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index 41f1347..c877b25 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -1748,8 +1748,7 @@ activate_files (ActivateParameters *parameters)
uri = nautilus_file_get_activation_uri (file);
f = g_file_new_for_uri (uri);
- nautilus_window_slot_open_location (parameters->slot,
- f, flags, NULL);
+ nautilus_window_slot_open_location (parameters->slot, f, flags);
g_object_unref (f);
g_free (uri);
}
diff --git a/src/nautilus-navigation-action.c b/src/nautilus-navigation-action.c
index 6b955ec..f284789 100644
--- a/src/nautilus-navigation-action.c
+++ b/src/nautilus-navigation-action.c
@@ -57,22 +57,6 @@ enum
PROP_WINDOW
};
-static gboolean
-should_open_in_new_tab (void)
-{
- /* FIXME this is duplicated */
- GdkEvent *event;
-
- event = gtk_get_current_event ();
- if (event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) {
- return event->button.button == 2;
- }
-
- gdk_event_free (event);
-
- return FALSE;
-}
-
static void
activate_back_or_forward_menu_item (GtkMenuItem *menu_item,
NautilusWindow *window,
@@ -84,7 +68,7 @@ activate_back_or_forward_menu_item (GtkMenuItem *menu_item,
index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "user_data"));
- nautilus_window_back_or_forward (window, back, index, should_open_in_new_tab ());
+ nautilus_window_back_or_forward (window, back, index, nautilus_event_get_window_open_flags ());
}
static void
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index f4b0bf4..5816768 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -1797,7 +1797,7 @@ volume_mounted_cb (GVolume *volume,
if (sidebar->go_to_after_mount_slot != NULL) {
if ((sidebar->go_to_after_mount_flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) == 0) {
nautilus_window_slot_open_location (sidebar->go_to_after_mount_slot, location,
- sidebar->go_to_after_mount_flags, NULL);
+ sidebar->go_to_after_mount_flags);
} else {
NautilusWindow *new, *cur;
@@ -1865,8 +1865,7 @@ open_selected_bookmark (NautilusPlacesSidebar *sidebar,
/* Navigate to the clicked location */
if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) == 0) {
slot = nautilus_window_get_active_slot (sidebar->window);
- nautilus_window_slot_open_location (slot, location,
- flags, NULL);
+ nautilus_window_slot_open_location (slot, location, flags);
} else {
NautilusWindow *cur, *new;
diff --git a/src/nautilus-tree-sidebar.c b/src/nautilus-tree-sidebar.c
index fdefa2d..a93e4aa 100644
--- a/src/nautilus-tree-sidebar.c
+++ b/src/nautilus-tree-sidebar.c
@@ -371,10 +371,8 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
location = g_file_new_for_uri (uri);
nautilus_window_slot_open_location
- (slot,
- location,
- view->details->activation_flags,
- NULL);
+ (slot, location,
+ view->details->activation_flags);
g_object_unref (location);
} else {
DEBUG ("Tree sidebar, launching application for %s", file_uri);
@@ -397,10 +395,8 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
location = g_file_new_for_uri (uri);
nautilus_window_slot_open_location
- (slot,
- location,
- view->details->activation_flags,
- NULL);
+ (slot, location,
+ view->details->activation_flags);
g_object_unref (location);
}
}
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 3457f95..f5c3ddf 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -5666,7 +5666,7 @@ action_open_scripts_folder_callback (GtkAction *action,
}
view = NAUTILUS_VIEW (callback_data);
- nautilus_window_slot_go_to (view->details->slot, location, FALSE);
+ nautilus_window_slot_open_location (view->details->slot, location, 0);
eel_show_info_dialog_with_details
(_("All executable files in this folder will appear in the "
diff --git a/src/nautilus-window-bookmarks.c b/src/nautilus-window-bookmarks.c
index 54d4117..c7aa72c 100644
--- a/src/nautilus-window-bookmarks.c
+++ b/src/nautilus-window-bookmarks.c
@@ -274,9 +274,8 @@ activate_bookmark_in_menu_item (GtkAction *action, gpointer user_data)
} else {
location = nautilus_bookmark_get_location (holder->bookmark);
slot = nautilus_window_get_active_slot (holder->window);
- nautilus_window_slot_go_to (slot,
- location,
- nautilus_event_should_open_in_new_tab ());
+ nautilus_window_slot_open_location (slot, location,
+ nautilus_event_get_window_open_flags ());
g_object_unref (location);
}
}
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 04f04b6..83f1bc5 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -320,7 +320,7 @@ viewed_file_changed_callback (NautilusFile *file,
nautilus_path_bar_clear_buttons (NAUTILUS_PATH_BAR (slot->pane->path_bar));
}
- nautilus_window_slot_go_to (slot, go_to_file, FALSE);
+ nautilus_window_slot_open_location (slot, go_to_file, 0);
g_object_unref (go_to_file);
} else {
nautilus_window_slot_go_home (slot, FALSE);
@@ -902,7 +902,7 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
root = g_file_new_for_path ("/");
/* the last fallback is to go to a known place that can't be deleted! */
- nautilus_window_slot_go_to (slot, location, FALSE);
+ nautilus_window_slot_open_location (slot, location, 0);
g_object_unref (root);
}
} else {
@@ -1751,7 +1751,7 @@ void
nautilus_window_back_or_forward (NautilusWindow *window,
gboolean back,
guint distance,
- gboolean new_tab)
+ NautilusWindowOpenFlags flags)
{
NautilusWindowSlot *slot;
GList *list;
@@ -1777,10 +1777,8 @@ nautilus_window_back_or_forward (NautilusWindow *window,
bookmark = g_list_nth_data (list, distance);
location = nautilus_bookmark_get_location (bookmark);
- if (new_tab) {
- nautilus_window_slot_open_location_full (slot, location,
- NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB,
- NULL, NULL, NULL);
+ if (flags != 0) {
+ nautilus_window_slot_open_location (slot, location, flags);
} else {
char *scroll_pos;
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index fdefb38..b5a5975 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -128,8 +128,8 @@ action_home_callback (GtkAction *action,
window = NAUTILUS_WINDOW (user_data);
slot = nautilus_window_get_active_slot (window);
- nautilus_window_slot_go_home (slot,
- nautilus_event_should_open_in_new_tab ());
+ nautilus_window_slot_go_home (slot,
+ nautilus_event_get_window_open_flags ());
}
static void
@@ -144,9 +144,8 @@ action_go_to_computer_callback (GtkAction *action,
slot = nautilus_window_get_active_slot (window);
computer = g_file_new_for_uri (COMPUTER_URI);
- nautilus_window_slot_go_to (slot,
- computer,
- nautilus_event_should_open_in_new_tab ());
+ nautilus_window_slot_open_location (slot, computer,
+ nautilus_event_get_window_open_flags ());
g_object_unref (computer);
}
@@ -162,9 +161,8 @@ action_go_to_network_callback (GtkAction *action,
slot = nautilus_window_get_active_slot (window);
network = g_file_new_for_uri (NETWORK_URI);
- nautilus_window_slot_go_to (slot,
- network,
- nautilus_event_should_open_in_new_tab ());
+ nautilus_window_slot_open_location (slot, network,
+ nautilus_event_get_window_open_flags ());
g_object_unref (network);
}
@@ -183,9 +181,8 @@ action_go_to_templates_callback (GtkAction *action,
path = nautilus_get_templates_directory ();
location = g_file_new_for_path (path);
g_free (path);
- nautilus_window_slot_go_to (slot,
- location,
- nautilus_event_should_open_in_new_tab ());
+ nautilus_window_slot_open_location (slot, location,
+ nautilus_event_get_window_open_flags ());
g_object_unref (location);
}
@@ -201,9 +198,8 @@ action_go_to_trash_callback (GtkAction *action,
slot = nautilus_window_get_active_slot (window);
trash = g_file_new_for_uri ("trash:///");
- nautilus_window_slot_go_to (slot,
- trash,
- nautilus_event_should_open_in_new_tab ());
+ nautilus_window_slot_open_location (slot, trash,
+ nautilus_event_get_window_open_flags ());
g_object_unref (trash);
}
@@ -414,7 +410,7 @@ action_up_callback (GtkAction *action,
NautilusWindowSlot *slot;
slot = nautilus_window_get_active_slot (window);
- nautilus_window_slot_go_up (slot, FALSE, nautilus_event_should_open_in_new_tab ());
+ nautilus_window_slot_go_up (slot, nautilus_event_get_window_open_flags ());
}
static void
@@ -559,7 +555,7 @@ action_back_callback (GtkAction *action,
gpointer user_data)
{
nautilus_window_back_or_forward (NAUTILUS_WINDOW (user_data),
- TRUE, 0, nautilus_event_should_open_in_new_tab ());
+ TRUE, 0, nautilus_event_get_window_open_flags ());
}
static void
@@ -567,7 +563,7 @@ action_forward_callback (GtkAction *action,
gpointer user_data)
{
nautilus_window_back_or_forward (NAUTILUS_WINDOW (user_data),
- FALSE, 0, nautilus_event_should_open_in_new_tab ());
+ FALSE, 0, nautilus_event_get_window_open_flags ());
}
static void
@@ -593,7 +589,8 @@ action_split_view_same_location_callback (GtkAction *action,
}
location = nautilus_window_slot_get_location (next_pane->active_slot);
if (location) {
- nautilus_window_slot_go_to (nautilus_window_get_active_slot (window), location, FALSE);
+ nautilus_window_slot_open_location (nautilus_window_get_active_slot (window),
+ location, 0);
g_object_unref (location);
}
}
diff --git a/src/nautilus-window-pane.c b/src/nautilus-window-pane.c
index b5658eb..e34dd81 100644
--- a/src/nautilus-window-pane.c
+++ b/src/nautilus-window-pane.c
@@ -179,7 +179,7 @@ search_bar_activate_callback (NautilusSearchBar *bar,
g_object_unref (query);
}
- nautilus_window_slot_go_to (pane->active_slot, location, FALSE);
+ nautilus_window_slot_open_location (pane->active_slot, location, 0);
nautilus_directory_unref (directory);
g_object_unref (location);
@@ -281,7 +281,7 @@ navigation_bar_location_changed_callback (GtkWidget *widget,
restore_focus_widget (pane);
location = g_file_new_for_uri (uri);
- nautilus_window_slot_go_to (pane->active_slot, location, FALSE);
+ nautilus_window_slot_open_location (pane->active_slot, location, 0);
g_object_unref (location);
}
@@ -310,9 +310,9 @@ path_bar_location_changed_callback (GtkWidget *widget,
/* check whether we already visited the target location */
i = bookmark_list_get_uri_index (slot->back_list, location);
if (i >= 0) {
- nautilus_window_back_or_forward (pane->window, TRUE, i, FALSE);
+ nautilus_window_back_or_forward (pane->window, TRUE, i, 0);
} else {
- nautilus_window_slot_go_to (pane->active_slot, location, FALSE);
+ nautilus_window_slot_open_location (pane->active_slot, location, 0);
}
}
@@ -377,8 +377,7 @@ path_bar_button_released_callback (GtkWidget *widget,
if (flags != 0) {
slot = nautilus_window_get_active_slot (pane->window);
- nautilus_window_slot_open_location (slot, location,
- flags, NULL);
+ nautilus_window_slot_open_location (slot, location, flags);
g_object_unref (location);
return TRUE;
}
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 8c31056..c2b3cfc 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -651,32 +651,22 @@ nautilus_window_slot_get_current_view (NautilusWindowSlot *slot)
void
nautilus_window_slot_go_home (NautilusWindowSlot *slot,
- gboolean new_tab)
+ NautilusWindowOpenFlags flags)
{
GFile *home;
- NautilusWindowOpenFlags flags;
g_return_if_fail (NAUTILUS_IS_WINDOW_SLOT (slot));
- if (new_tab) {
- flags = NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
- } else {
- flags = 0;
- }
-
home = g_file_new_for_path (g_get_home_dir ());
- nautilus_window_slot_open_location_full (slot, home,
- flags, NULL, NULL, NULL);
+ nautilus_window_slot_open_location (slot, home, flags);
g_object_unref (home);
}
void
nautilus_window_slot_go_up (NautilusWindowSlot *slot,
- gboolean close_behind,
- gboolean new_tab)
+ NautilusWindowOpenFlags flags)
{
GFile *parent;
- NautilusWindowOpenFlags flags;
if (slot->location == NULL) {
return;
@@ -687,18 +677,7 @@ nautilus_window_slot_go_up (NautilusWindowSlot *slot,
return;
}
- flags = 0;
- if (close_behind) {
- flags |= NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND;
- }
- if (new_tab) {
- flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
- }
-
- nautilus_window_slot_open_location (slot, parent,
- flags,
- NULL);
-
+ nautilus_window_slot_open_location (slot, parent, flags);
g_object_unref (parent);
}
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index a0ca169..cb37c66 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -131,6 +131,10 @@ char * nautilus_window_slot_get_location_uri (NautilusWindowSlot *slot);
void nautilus_window_slot_reload (NautilusWindowSlot *slot);
+/* convenience wrapper without selection and callback/user_data */
+#define nautilus_window_slot_open_location(slot, location, flags)\
+ nautilus_window_slot_open_location_full(slot, location, flags, NULL, NULL, NULL)
+
void nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
GFile *location,
NautilusWindowOpenFlags flags,
@@ -138,20 +142,6 @@ void nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
NautilusWindowGoToCallback callback,
gpointer user_data);
-/* convenience wrapper without callback/user_data */
-#define nautilus_window_slot_open_location(slot, location, flags, new_selection)\
- nautilus_window_slot_open_location_full(slot, location, flags, new_selection, NULL, NULL)
-
-/* these are wrappers that always open according to current mode */
-#define nautilus_window_slot_go_to(slot, location, new_tab) \
- nautilus_window_slot_open_location(slot, location, \
- (new_tab ? NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB : 0), \
- NULL)
-#define nautilus_window_slot_go_to_full(slot, location, new_tab, callback, user_data) \
- nautilus_window_slot_open_location_full(slot, location, \
- (new_tab ? NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB : 0), \
- NULL, callback, user_data)
-
void nautilus_window_slot_stop_loading (NautilusWindowSlot *slot);
void nautilus_window_slot_set_content_view (NautilusWindowSlot *slot,
@@ -161,10 +151,9 @@ gboolean nautilus_window_slot_content_view_matches_iid (NautilusWindowSlot *slo
const char *iid);
void nautilus_window_slot_go_home (NautilusWindowSlot *slot,
- gboolean new_tab);
+ NautilusWindowOpenFlags flags);
void nautilus_window_slot_go_up (NautilusWindowSlot *slot,
- gboolean close_behind,
- gboolean new_tab);
+ NautilusWindowOpenFlags flags);
void nautilus_window_slot_set_content_view_widget (NautilusWindowSlot *slot,
NautilusView *content_view);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index b742684..45c33d7 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -176,8 +176,8 @@ nautilus_window_go_to (NautilusWindow *window, GFile *location)
{
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- nautilus_window_slot_go_to (nautilus_window_get_active_slot (window),
- location, FALSE);
+ nautilus_window_slot_open_location (nautilus_window_get_active_slot (window),
+ location, 0);
}
void
@@ -188,17 +188,14 @@ nautilus_window_go_to_full (NautilusWindow *window,
{
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- nautilus_window_slot_go_to_full (nautilus_window_get_active_slot (window),
- location, FALSE, callback, user_data);
+ nautilus_window_slot_open_location_full (nautilus_window_get_active_slot (window),
+ location, 0, NULL, callback, user_data);
}
-static gboolean
-nautilus_window_go_up_signal (NautilusWindow *window, gboolean close_behind)
+static void
+nautilus_window_go_up_signal (NautilusWindow *window)
{
- nautilus_window_slot_go_up (nautilus_window_get_active_slot (window),
- close_behind, FALSE);
-
- return TRUE;
+ nautilus_window_slot_go_up (nautilus_window_get_active_slot (window), 0);
}
void
@@ -231,7 +228,7 @@ nautilus_window_new_tab (NautilusWindow *window)
new_slot = nautilus_window_pane_open_slot (current_slot->pane, flags);
nautilus_window_set_active_slot (window, new_slot);
- nautilus_window_slot_go_to (new_slot, location, FALSE);
+ nautilus_window_slot_open_location (new_slot, location, 0);
g_object_unref (location);
}
}
@@ -1811,18 +1808,6 @@ nautilus_window_state_event (GtkWidget *widget,
return FALSE;
}
-static void
-nautilus_window_go_back (NautilusWindow *window)
-{
- nautilus_window_back_or_forward (window, TRUE, 0, FALSE);
-}
-
-static void
-nautilus_window_go_forward (NautilusWindow *window)
-{
- nautilus_window_back_or_forward (window, FALSE, 0, FALSE);
-}
-
static gboolean
nautilus_window_button_press_event (GtkWidget *widget,
GdkEventButton *event)
@@ -1834,10 +1819,10 @@ nautilus_window_button_press_event (GtkWidget *widget,
window = NAUTILUS_WINDOW (widget);
if (mouse_extra_buttons && (event->button == mouse_back_button)) {
- nautilus_window_go_back (window);
+ nautilus_window_back_or_forward (window, TRUE, 0, 0);
handled = TRUE;
} else if (mouse_extra_buttons && (event->button == mouse_forward_button)) {
- nautilus_window_go_forward (window);
+ nautilus_window_back_or_forward (window, FALSE, 0, 0);
handled = TRUE;
} else if (GTK_WIDGET_CLASS (nautilus_window_parent_class)->button_press_event) {
handled = GTK_WIDGET_CLASS (nautilus_window_parent_class)->button_press_event (widget, event);
@@ -1952,13 +1937,13 @@ nautilus_window_class_init (NautilusWindowClass *class)
G_PARAM_STATIC_STRINGS);
signals[GO_UP] =
- g_signal_new ("go_up",
+ g_signal_new ("go-up",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (NautilusWindowClass, go_up),
- g_signal_accumulator_true_handled, NULL,
+ NULL, NULL,
g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN);
+ G_TYPE_NONE, 0);
signals[RELOAD] =
g_signal_new ("reload",
G_TYPE_FROM_CLASS (class),
@@ -1995,8 +1980,7 @@ nautilus_window_class_init (NautilusWindowClass *class)
binding_set = gtk_binding_set_by_class (class);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_BackSpace, 0,
- "go_up", 1,
- G_TYPE_BOOLEAN, FALSE);
+ "go-up", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_F5, 0,
"reload", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_slash, 0,
@@ -2026,6 +2010,14 @@ nautilus_window_class_init (NautilusWindowClass *class)
g_type_class_add_private (oclass, sizeof (NautilusWindowDetails));
}
+NautilusWindow *
+nautilus_window_new (GdkScreen *screen)
+{
+ return g_object_new (NAUTILUS_TYPE_WINDOW,
+ "screen", screen,
+ NULL);
+}
+
void
nautilus_window_split_view_on (NautilusWindow *window)
{
@@ -2049,7 +2041,7 @@ nautilus_window_split_view_on (NautilusWindow *window)
location = g_file_new_for_path (g_get_home_dir ());
}
- nautilus_window_slot_go_to (slot, location, FALSE);
+ nautilus_window_slot_open_location (slot, location, 0);
g_object_unref (location);
window_set_search_action_text (window, FALSE);
@@ -2085,3 +2077,25 @@ nautilus_window_split_view_showing (NautilusWindow *window)
{
return g_list_length (NAUTILUS_WINDOW (window)->details->panes) > 1;
}
+
+NautilusWindowOpenFlags
+nautilus_event_get_window_open_flags (void)
+{
+ NautilusWindowOpenFlags flags = 0;
+ GdkEvent *event;
+
+ event = gtk_get_current_event ();
+
+ if (event == NULL) {
+ return flags;
+ }
+
+ if ((event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) &&
+ (event->button.button == 2)) {
+ flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
+ }
+
+ gdk_event_free (event);
+
+ return flags;
+}
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index 862b10e..cbda474 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -86,9 +86,8 @@ typedef struct {
void (* close) (NautilusWindow *window);
/* Signals used only for keybindings */
- gboolean (* go_up) (NautilusWindow *window,
- gboolean close);
- void (* reload) (NautilusWindow *window);
+ void (* go_up) (NautilusWindow *window);
+ void (* reload) (NautilusWindow *window);
} NautilusWindowClass;
struct NautilusWindow {
@@ -98,6 +97,7 @@ struct NautilusWindow {
};
GType nautilus_window_get_type (void);
+NautilusWindow * nautilus_window_new (GdkScreen *screen);
void nautilus_window_close (NautilusWindow *window);
void nautilus_window_connect_content_view (NautilusWindow *window,
@@ -139,7 +139,7 @@ void nautilus_window_show_sidebar (NautilusWindow *window);
void nautilus_window_back_or_forward (NautilusWindow *window,
gboolean back,
guint distance,
- gboolean new_tab);
+ NautilusWindowOpenFlags flags);
void nautilus_window_split_view_on (NautilusWindow *window);
void nautilus_window_split_view_off (NautilusWindow *window);
gboolean nautilus_window_split_view_showing (NautilusWindow *window);
@@ -148,4 +148,6 @@ gboolean nautilus_window_disable_chrome_mapping (GValue *value,
GVariant *variant,
gpointer user_data);
+NautilusWindowOpenFlags nautilus_event_get_window_open_flags (void);
+
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]