[vte/vte-0-50-ntfy-scroll: 3/5] Test the notification-received signal
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-0-50-ntfy-scroll: 3/5] Test the notification-received signal
- Date: Thu, 5 Oct 2017 12:42:56 +0000 (UTC)
commit 3d933494eefdad354cd7cbf902287118469230a4
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Jan 22 16:37:10 2015 +0100
Test the notification-received signal
bindings/vala/app.vala | 7 +++++++
src/vteapp.c | 10 ++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/bindings/vala/app.vala b/bindings/vala/app.vala
index 8663d63..4c5d9a2 100644
--- a/bindings/vala/app.vala
+++ b/bindings/vala/app.vala
@@ -309,6 +309,8 @@ class Window : Gtk.ApplicationWindow
if (App.Options.object_notifications)
terminal.notify.connect(notify_cb);
+ terminal.notification_received.connect(notification_received_cb);
+
/* Settings */
if (App.Options.no_double_buffer)
terminal.set_double_buffered(false);
@@ -780,6 +782,11 @@ class Window : Gtk.ApplicationWindow
set_title(terminal.get_window_title());
}
+ private void notification_received_cb(Vte.Terminal terminal, string summary, string? body)
+ {
+ print ("[%s]: %s\n", summary, body);
+ }
+
} /* class Window */
class App : Gtk.Application
diff --git a/src/vteapp.c b/src/vteapp.c
index 865df64..be3bab8 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -49,6 +49,13 @@ static const char *builtin_dingus[] = {
static gboolean use_gregex = FALSE;
static void
+notification_received (GtkWidget *widget, const gchar *summary, const gchar *body)
+{
+ g_assert(VTE_TERMINAL(widget));
+ g_print("[%s]: %s\n", summary, body);
+}
+
+static void
window_title_changed(GtkWidget *widget, gpointer win)
{
GtkWindow *window;
@@ -966,6 +973,9 @@ main(int argc, char **argv)
G_CALLBACK(icon_title_changed), window);
}
+ g_signal_connect(widget, "notification-received",
+ G_CALLBACK(notification_received), NULL);
+
/* Connect to the "button-press" event. */
g_signal_connect(widget, "button-press-event",
G_CALLBACK(button_pressed), widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]