Commit 04c606a1 authored by Christian Neumair's avatar Christian Neumair Committed by Christian Neumair

Open new window when control-clicking on a path bar button, open new tab

2008-07-30  Christian Neumair  <cneumair@gnome.org>

	* src/nautilus-navigation-window.c
	(path_bar_button_pressed_callback),
	(path_bar_button_released_callback),
	(path_bar_button_drag_begin_callback),
	(path_bar_path_set_callback):
	Open new window when control-clicking on a path bar button, open new
	tab when middle-clicking on a path bar button. Fixes #545397.

svn path=/trunk/; revision=14427
parent 9e02482e
2008-07-30 Christian Neumair <cneumair@gnome.org>
* src/nautilus-navigation-window.c
(path_bar_button_pressed_callback),
(path_bar_button_released_callback),
(path_bar_button_drag_begin_callback),
(path_bar_path_set_callback):
Open new window when control-clicking on a path bar button, open new
tab when middle-clicking on a path bar button. Fixes #545397.
2008-07-30 Christian Neumair <cneumair@gnome.org>
* nautilus.desktop.in.in:
......
......@@ -1320,6 +1320,9 @@ path_bar_button_pressed_callback (GtkWidget *widget,
GFile *location;
char *uri;
g_object_set_data (G_OBJECT (widget), "handle-button-release",
GINT_TO_POINTER (TRUE));
if (event->button == 3) {
slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (window));
view = slot->content_view;
......@@ -1337,10 +1340,64 @@ path_bar_button_pressed_callback (GtkWidget *widget,
}
}
return FALSE;
}
static gboolean
path_bar_button_released_callback (GtkWidget *widget,
GdkEventButton *event,
NautilusNavigationWindow *window)
{
NautilusWindowSlot *slot;
NautilusWindowOpenFlags flags;
GFile *location;
int mask;
gboolean handle_button_release;
mask = event->state & gtk_accelerator_get_default_mod_mask ();
flags = 0;
handle_button_release = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (widget),
"handle-button-release"));
if (event->type == GDK_BUTTON_RELEASE && handle_button_release) {
location = nautilus_path_bar_get_path_for_button (NAUTILUS_PATH_BAR (window->path_bar), widget);
if (event->button == 2 && mask == 0) {
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ENABLE_TABS)) {
flags = NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
} else {
flags = NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
}
} else if (event->button == 1 && mask == GDK_CONTROL_MASK) {
flags = NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
}
if (flags != 0) {
slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (window));
nautilus_window_slot_info_open_location (slot, location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags, NULL);
g_object_unref (location);
return TRUE;
}
g_object_unref (location);
}
return FALSE;
}
static void
path_bar_button_drag_begin_callback (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
g_object_set_data (G_OBJECT (widget), "handle-button-release",
GINT_TO_POINTER (FALSE));
}
static void
path_bar_path_set_callback (GtkWidget *widget,
GFile *location,
......@@ -1366,6 +1423,12 @@ path_bar_path_set_callback (GtkWidget *widget,
g_signal_connect (child, "button-press-event",
G_CALLBACK (path_bar_button_pressed_callback),
window);
g_signal_connect (child, "button-release-event",
G_CALLBACK (path_bar_button_released_callback),
window);
g_signal_connect (child, "drag-begin",
G_CALLBACK (path_bar_button_drag_begin_callback),
window);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment