Make a middle click open items in a new instance
This commit is contained in:
parent
3e9a388537
commit
75994cd85a
|
@ -413,16 +413,25 @@ static gboolean
|
|||
fastiv_browser_button_press_event(GtkWidget *widget, GdkEventButton *event)
|
||||
{
|
||||
FastivBrowser *self = FASTIV_BROWSER(widget);
|
||||
if (event->type != GDK_BUTTON_PRESS || event->button != 1 ||
|
||||
event->state != 0)
|
||||
if (event->type != GDK_BUTTON_PRESS || event->state != 0)
|
||||
return FALSE;
|
||||
|
||||
const Entry *entry = entry_at(self, event->x, event->y);
|
||||
if (!entry)
|
||||
return FALSE;
|
||||
|
||||
g_signal_emit(widget, browser_signals[ITEM_ACTIVATED], 0, entry->filename);
|
||||
switch (event->button) {
|
||||
case 1:
|
||||
g_signal_emit(widget, browser_signals[ITEM_ACTIVATED], 0,
|
||||
entry->filename, GTK_PLACES_OPEN_NORMAL);
|
||||
return TRUE;
|
||||
case 2:
|
||||
g_signal_emit(widget, browser_signals[ITEM_ACTIVATED], 0,
|
||||
entry->filename, GTK_PLACES_OPEN_NEW_WINDOW);
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -516,9 +525,9 @@ fastiv_browser_class_init(FastivBrowserClass *klass)
|
|||
widget_class->motion_notify_event = fastiv_browser_motion_notify_event;
|
||||
widget_class->style_updated = fastiv_browser_style_updated;
|
||||
|
||||
browser_signals[ITEM_ACTIVATED] =
|
||||
g_signal_new("item-activated", G_TYPE_FROM_CLASS(klass), 0, 0,
|
||||
NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
browser_signals[ITEM_ACTIVATED] = g_signal_new("item-activated",
|
||||
G_TYPE_FROM_CLASS(klass), 0, 0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2, G_TYPE_STRING, GTK_TYPE_PLACES_OPEN_FLAGS);
|
||||
|
||||
// TODO(p): Later override "screen_changed", recreate Pango layouts there,
|
||||
// if we get to have any, or otherwise reflect DPI changes.
|
||||
|
|
17
fastiv.c
17
fastiv.c
|
@ -265,13 +265,6 @@ on_next(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_item_activated(G_GNUC_UNUSED FastivBrowser *browser, const char *path,
|
||||
G_GNUC_UNUSED gpointer data)
|
||||
{
|
||||
open(path);
|
||||
}
|
||||
|
||||
static void
|
||||
spawn_path(const char *path)
|
||||
{
|
||||
|
@ -282,6 +275,16 @@ spawn_path(const char *path)
|
|||
g_clear_error(&error);
|
||||
}
|
||||
|
||||
static void
|
||||
on_item_activated(G_GNUC_UNUSED FastivBrowser *browser, const char *path,
|
||||
GtkPlacesOpenFlags flags, G_GNUC_UNUSED gpointer data)
|
||||
{
|
||||
if (flags == GTK_PLACES_OPEN_NEW_WINDOW)
|
||||
spawn_path(path);
|
||||
else
|
||||
open(path);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
open_any_path(const char *path)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue