summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pluma/pluma-notebook.c14
-rw-r--r--pluma/pluma-tab-label.c22
-rw-r--r--pluma/pluma-window.c25
3 files changed, 60 insertions, 1 deletions
diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c
index 7fc7485a..f0a36d76 100644
--- a/pluma/pluma-notebook.c
+++ b/pluma/pluma-notebook.c
@@ -838,6 +838,16 @@ close_button_clicked_cb (PlumaTabLabel *tab_label, PlumaNotebook *notebook)
g_signal_emit (notebook, signals[TAB_CLOSE_REQUEST], 0, tab);
}
+static gboolean
+tab_label_scroll_cb (PlumaTabLabel *tab_label,
+ GdkEventScroll *event,
+ PlumaNotebook *notebook)
+{
+ g_signal_emit_by_name (notebook, "scroll-event", &event);
+
+ return FALSE;
+}
+
static GtkWidget *
create_tab_label (PlumaNotebook *nb,
PlumaTab *tab)
@@ -850,6 +860,10 @@ create_tab_label (PlumaNotebook *nb,
"close-clicked",
G_CALLBACK (close_button_clicked_cb),
nb);
+ g_signal_connect (tab_label,
+ "scroll-event",
+ G_CALLBACK (tab_label_scroll_cb),
+ nb);
g_object_set_data (G_OBJECT (tab), "tab-label", tab_label);
diff --git a/pluma/pluma-tab-label.c b/pluma/pluma-tab-label.c
index 7f66b233..b1b30266 100644
--- a/pluma/pluma-tab-label.c
+++ b/pluma/pluma-tab-label.c
@@ -114,6 +114,16 @@ close_button_clicked_cb (GtkWidget *widget,
g_signal_emit (tab_label, signals[CLOSE_CLICKED], 0, NULL);
}
+static gboolean
+scroll_event_cb(GtkWidget *widget,
+ GdkEventScroll *event,
+ PlumaTabLabel *tab_label)
+{
+ g_signal_emit_by_name(tab_label, "scroll-event", &event);
+
+ return FALSE;
+}
+
static void
sync_tip (PlumaTab *tab, PlumaTabLabel *tab_label)
{
@@ -265,6 +275,7 @@ pluma_tab_label_init (PlumaTabLabel *tab_label)
GTK_ORIENTATION_HORIZONTAL);
ebox = gtk_event_box_new ();
+ gtk_widget_add_events (ebox, GDK_SCROLL_MASK);
gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
gtk_box_pack_start (GTK_BOX (tab_label), ebox, TRUE, TRUE, 0);
tab_label->priv->ebox = ebox;
@@ -273,6 +284,7 @@ pluma_tab_label_init (PlumaTabLabel *tab_label)
gtk_container_add (GTK_CONTAINER (ebox), hbox);
close_button = pluma_close_button_new ();
+ gtk_widget_add_events (close_button, GDK_SCROLL_MASK);
gtk_widget_set_tooltip_text (close_button, _("Close document"));
gtk_box_pack_start (GTK_BOX (tab_label), close_button, FALSE, FALSE, 0);
tab_label->priv->close_button = close_button;
@@ -281,6 +293,16 @@ pluma_tab_label_init (PlumaTabLabel *tab_label)
"clicked",
G_CALLBACK (close_button_clicked_cb),
tab_label);
+
+ g_signal_connect (close_button,
+ "scroll-event",
+ G_CALLBACK (scroll_event_cb),
+ tab_label);
+
+ g_signal_connect (ebox,
+ "scroll-event",
+ G_CALLBACK (scroll_event_cb),
+ tab_label);
spinner = gtk_spinner_new ();
gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0);
diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c
index c0eb29b4..f2f5a8ad 100644
--- a/pluma/pluma-window.c
+++ b/pluma/pluma-window.c
@@ -36,6 +36,7 @@
#include <sys/types.h>
#include <string.h>
+#include <gdk/gdk.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
@@ -3491,6 +3492,23 @@ notebook_button_press_event (GtkNotebook *notebook,
}
static gboolean
+notebook_scroll_event (GtkNotebook *notebook,
+ GdkEventScroll *event,
+ PlumaWindow *window)
+{
+ if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_LEFT)
+ {
+ gtk_notebook_prev_page (notebook);
+ }
+ else if (event->direction == GDK_SCROLL_DOWN || event->direction == GDK_SCROLL_RIGHT)
+ {
+ gtk_notebook_next_page (notebook);
+ }
+
+ return FALSE;
+}
+
+static gboolean
notebook_popup_menu (GtkNotebook *notebook,
PlumaWindow *window)
{
@@ -3856,6 +3874,10 @@ connect_notebook_signals (PlumaWindow *window,
"popup-menu",
G_CALLBACK (notebook_popup_menu),
window);
+ g_signal_connect (notebook,
+ "scroll-event",
+ G_CALLBACK (notebook_scroll_event),
+ window);
}
static void
@@ -3868,7 +3890,8 @@ add_notebook (PlumaWindow *window,
TRUE);
gtk_widget_show (notebook);
-
+
+ gtk_widget_add_events (notebook, GDK_SCROLL_MASK);
connect_notebook_signals (window, notebook);
}