[gtk+] GtkWindow: improve the inspector keybinding



commit 3b62f2f01da84d78905f134cd0547a898eb236ee
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Sep 26 09:37:28 2014 -0400

    GtkWindow: improve the inspector keybinding
    
    Binding signals can return a boolean indicating whether they
    handled the event. Use that here and return FALSE if the
    inspector keybinding is disabled.

 gtk/gtkwindow.c |   14 +++++++++-----
 gtk/gtkwindow.h |    2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 8099f3a..22a95bf 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -416,7 +416,7 @@ static void gtk_window_real_set_focus     (GtkWindow         *window,
 static void gtk_window_real_activate_default (GtkWindow         *window);
 static void gtk_window_real_activate_focus   (GtkWindow         *window);
 static void gtk_window_keys_changed          (GtkWindow         *window);
-static void gtk_window_enable_debugging      (GtkWindow         *window,
+static gboolean gtk_window_enable_debugging  (GtkWindow         *window,
                                               gboolean           toggle);
 static gint gtk_window_draw                  (GtkWidget         *widget,
                                              cairo_t           *cr);
@@ -1208,6 +1208,8 @@ gtk_window_class_init (GtkWindowClass *klass)
    *
    * The default bindings for this signal are Ctrl-Shift-I
    * and Ctrl-Shift-D.
+   *
+   * Return: %TRUE if the key binding was handled
    */
   window_signals[ENABLE_DEBUGGING] =
     g_signal_new (I_("enable-debugging"),
@@ -1215,8 +1217,8 @@ gtk_window_class_init (GtkWindowClass *klass)
                   G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                   G_STRUCT_OFFSET (GtkWindowClass, enable_debugging),
                   NULL, NULL,
-                  _gtk_marshal_VOID__BOOLEAN,
-                  G_TYPE_NONE,
+                  _gtk_marshal_BOOLEAN__BOOLEAN,
+                  G_TYPE_BOOLEAN,
                   1, G_TYPE_BOOLEAN);
 
   /*
@@ -11773,14 +11775,14 @@ inspector_keybinding_enabled (gboolean *warn)
   return enabled;
 }
 
-static void
+static gboolean
 gtk_window_enable_debugging (GtkWindow *window,
                              gboolean   toggle)
 {
   gboolean warn;
 
   if (!inspector_keybinding_enabled (&warn))
-    return;
+    return FALSE;
 
   if (toggle)
     {
@@ -11792,6 +11794,8 @@ gtk_window_enable_debugging (GtkWindow *window,
     }
   else
     gtk_window_set_debugging (TRUE, TRUE, warn);
+
+  return TRUE;
 }
 
 void
diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h
index 9716091..687b312 100644
--- a/gtk/gtkwindow.h
+++ b/gtk/gtkwindow.h
@@ -80,7 +80,7 @@ struct _GtkWindowClass
   void     (* activate_focus)   (GtkWindow *window);
   void     (* activate_default) (GtkWindow *window);
   void    (* keys_changed)     (GtkWindow *window);
-  void    (* enable_debugging) (GtkWindow *window,
+  gboolean (* enable_debugging) (GtkWindow *window,
                                  gboolean   toggle);
 
   /*< private >*/


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