Skip to content
Permalink
Browse files

pluma-notebook: avoid new file with double click in forward arrow button

Fixes #331
  • Loading branch information...
sc0w committed May 29, 2018
1 parent f6f9fdc commit 3742ba44a1cc6d8180517576f53e4050598dbe30
Showing with 34 additions and 1 deletion.
  1. +34 −1 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);

0 comments on commit 3742ba4

Please sign in to comment.
You can’t perform that action at this time.