summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pluma/pluma-notebook.c35
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);