summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-04-19 15:18:59 +0200
committerraveit65 <[email protected]>2017-05-12 10:56:41 +0200
commit5bed2111c37a1d39eaf7cdad489bd954b5f06227 (patch)
tree132993b013cde958cb2449b80ab60bf7ed94ba95
parentc271f003e7e24728bde3df9acff1d57e8f590dcb (diff)
downloadpluma-5bed2111c37a1d39eaf7cdad489bd954b5f06227.tar.bz2
pluma-5bed2111c37a1d39eaf7cdad489bd954b5f06227.tar.xz
double click to the right of the last open tab to open a new tab
New feature Fixes #185
-rw-r--r--pluma/pluma-notebook.c22
-rw-r--r--pluma/pluma-view.c4
-rw-r--r--pluma/pluma-window.c19
3 files changed, 37 insertions, 8 deletions
diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c
index d2b35d25..591b6220 100644
--- a/pluma/pluma-notebook.c
+++ b/pluma/pluma-notebook.c
@@ -591,6 +591,9 @@ button_press_cb (PlumaNotebook *notebook,
GdkEventButton *event,
gpointer data)
{
+ static gboolean newfile = FALSE;
+ static gint tab1click = -1;
+
gint tab_clicked;
if (notebook->priv->drag_in_progress)
@@ -599,7 +602,7 @@ button_press_cb (PlumaNotebook *notebook,
tab_clicked = find_tab_num_at_pos (notebook,
event->x_root,
event->y_root);
-
+
if ((event->button == 1) &&
(event->type == GDK_BUTTON_PRESS) &&
(tab_clicked >= 0))
@@ -633,6 +636,23 @@ button_press_cb (PlumaNotebook *notebook,
}
}
+ if (event->button == 1)
+ {
+ if (event->type == GDK_BUTTON_PRESS)
+ {
+ tab1click = gtk_notebook_get_current_page (notebook);
+ newfile = (tab_clicked == -1);
+ }
+ else if (event->type == GDK_2BUTTON_PRESS)
+ {
+ if ((tab1click != gtk_notebook_get_current_page (notebook)) ||
+ (tab_clicked >= 0) || ((tab_clicked == -1) && (!newfile)))
+ return TRUE;
+
+ newfile = FALSE;
+ }
+ }
+
return FALSE;
}
diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c
index 707656a3..7dd258df 100644
--- a/pluma/pluma-view.c
+++ b/pluma/pluma-view.c
@@ -2000,6 +2000,10 @@ pluma_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
return TRUE;
}
+ if ((event->type == GDK_2BUTTON_PRESS) && (event->button == 1) &&
+ (event->window == gtk_text_view_get_window (GTK_TEXT_VIEW (widget), GTK_TEXT_WINDOW_TEXT)))
+ return TRUE;
+
return GTK_WIDGET_CLASS (pluma_view_parent_class)->button_press_event (widget, event);
}
diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c
index 8bff1509..b24434df 100644
--- a/pluma/pluma-window.c
+++ b/pluma/pluma-window.c
@@ -3419,16 +3419,21 @@ notebook_button_press_event (GtkNotebook *notebook,
GdkEventButton *event,
PlumaWindow *window)
{
- if (GDK_BUTTON_PRESS == event->type && 3 == event->button)
+ if (event->type == GDK_BUTTON_PRESS)
{
- return show_notebook_popup_menu (notebook, window, event);
+ if (event->button == 3)
+ return show_notebook_popup_menu (notebook, window, event);
+
+ else if (event->button == 2)
+ {
+ PlumaTab *tab;
+ tab = pluma_window_get_active_tab (window);
+ notebook_tab_close_request (PLUMA_NOTEBOOK (notebook), tab, GTK_WINDOW (window));
+ }
}
- else if (GDK_BUTTON_PRESS == event->type && 2 == event->button)
+ else if ((event->type == GDK_2BUTTON_PRESS) && (event->button == 1))
{
- PlumaTab *tab;
- tab = pluma_window_get_active_tab (window);
- notebook_tab_close_request (PLUMA_NOTEBOOK (notebook), tab, GTK_WINDOW (window));
- return FALSE;
+ pluma_window_create_tab (window, TRUE);
}
return FALSE;