diff options
author | Pablo Barciela <[email protected]> | 2018-05-29 10:51:50 +0200 |
---|---|---|
committer | Pablo Barciela <[email protected]> | 2018-05-29 10:58:52 +0200 |
commit | 3742ba44a1cc6d8180517576f53e4050598dbe30 (patch) | |
tree | 409911ca4b225e56f403af3470cedd6c1cfd8590 | |
parent | f6f9fdc477f1fe5565563db877713e06a94bde74 (diff) | |
download | pluma-3742ba44a1cc6d8180517576f53e4050598dbe30.tar.bz2 pluma-3742ba44a1cc6d8180517576f53e4050598dbe30.tar.xz |
pluma-notebook: avoid new file with double click in forward arrow button
Fixes https://github.com/mate-desktop/pluma/issues/331
-rw-r--r-- | pluma/pluma-notebook.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c index 1b84bdb7..bc5f30e9 100644 --- a/pluma/pluma-notebook.c +++ b/pluma/pluma-notebook.c @@ -84,6 +84,7 @@ static void move_current_tab_to_another_notebook (PlumaNotebook *src, static GdkCursor *cursor = NULL; static gboolean leftdown = FALSE; static gboolean drag_ready = FALSE; +static gboolean newfile_ready = TRUE; /* Signals */ enum @@ -690,7 +691,11 @@ button_press_cb (PlumaNotebook *notebook, if (event->type == GDK_BUTTON_PRESS) { tab1click = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)); - newfile = (tab_clicked == -1); + + if (newfile_ready) + newfile = (tab_clicked == -1); + else + newfile = FALSE; } else if (event->type == GDK_2BUTTON_PRESS) { @@ -714,6 +719,24 @@ grab_focus_cb (PlumaNotebook *notebook, return FALSE; } +static gboolean +focus_in_cb (PlumaNotebook *notebook, + GdkEventButton *event, + gpointer data) +{ + newfile_ready = FALSE; + return FALSE; +} + +static gboolean +focus_out_cb (PlumaNotebook *notebook, + GdkEventButton *event, + gpointer data) +{ + newfile_ready = TRUE; + return FALSE; +} + /** * pluma_notebook_new: * @@ -815,6 +838,16 @@ pluma_notebook_init (PlumaNotebook *notebook) (GCallback)grab_focus_cb, NULL); + g_signal_connect (notebook, + "focus-in-event", + (GCallback)focus_in_cb, + NULL); + + g_signal_connect (notebook, + "focus-out-event", + (GCallback)focus_out_cb, + NULL); + gtk_widget_add_events (GTK_WIDGET (notebook), GDK_BUTTON1_MOTION_MASK); |