[xchat-gnome] Bug 642855 - No plugin event for window-close



commit cfc4f7b8c34b58f6d33461fcb8fbf34394cccf08
Author: Jeremy Nickurak <gnome-bugs trk nickurak ca>
Date:   Thu Oct 8 12:00:50 2015 +0530

    Bug 642855 - No plugin event for window-close
    
    allow xchat-gnome plugins to catch, intercept, and optionally ignore the main window's "delete-event"

 src/fe-gnome/main-window.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/fe-gnome/main-window.c b/src/fe-gnome/main-window.c
index fcbf7b0..bd1d23c 100644
--- a/src/fe-gnome/main-window.c
+++ b/src/fe-gnome/main-window.c
@@ -48,8 +48,10 @@
 #include "../common/xchatc.h"
 #include "../common/outbound.h"
 #include "../common/fe.h"
+#include "../common/xchat-plugin.h"
+#include "../common/plugin.h"
 
-static void on_main_window_close (GtkWidget *widget, GdkEvent *event, gpointer data);
+static gboolean on_main_window_close (GtkWidget *widget, GdkEvent *event, gpointer data);
 static void on_pgup (GtkAccelGroup *accelgroup, GObject *arg1, guint arg2, GdkModifierType arg3, gpointer 
data);
 static void on_pgdn (GtkAccelGroup *accelgroup, GObject *arg1, guint arg2, GdkModifierType arg3, gpointer 
data);
 
@@ -348,15 +350,21 @@ save_main_window ()
        g_object_unref (client);
 }
 
-static void
+static gboolean
 on_main_window_close (GtkWidget *widget, GdkEvent *event, gpointer data)
 {
+       session *s = gui.current_session;
+       int r = plugin_emit_dummy_print (s, "Close Main");
+       if (r & XCHAT_EAT_XCHAT) {
+         return TRUE;
+       }
        save_main_window ();
        gui.quit = TRUE;
 
        gtk_widget_hide (GTK_WIDGET (gui.dcc));
        userlist_gui_hide ();
        xchat_exit ();
+       return FALSE;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]