[gtk/shortcuts-rebased-again: 158/171] window: Replace enable-debugging by an action
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/shortcuts-rebased-again: 158/171] window: Replace enable-debugging by an action
- Date: Mon, 24 Jun 2019 23:17:46 +0000 (UTC)
commit d1691c5a48ac9513b4f54ca3903a12652a317d89
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 23 18:50:15 2019 +0000
window: Replace enable-debugging by an action
gtk/gtkwindow.c | 71 ++++++++++++++++++++++++++-------------------------------
gtk/gtkwindow.h | 4 ----
2 files changed, 32 insertions(+), 43 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 45260c628d..2dcb43ece6 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -436,8 +436,9 @@ static void gtk_window_move_focus (GtkWidget *widget,
GtkDirectionType dir);
static void gtk_window_keys_changed (GtkWindow *window);
-static gboolean gtk_window_enable_debugging (GtkWindow *window,
- gboolean toggle);
+static void gtk_window_activate_debugging_enable (GtkWidget *widget,
+ const char *action_name,
+ GVariant *parameter);
static void gtk_window_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_window_unset_transient_for (GtkWindow *window);
@@ -820,7 +821,6 @@ gtk_window_class_init (GtkWindowClass *klass)
container_class->forall = gtk_window_forall;
klass->keys_changed = gtk_window_keys_changed;
- klass->enable_debugging = gtk_window_enable_debugging;
klass->close_request = gtk_window_close_request;
window_props[PROP_TYPE] =
@@ -1093,32 +1093,6 @@ gtk_window_class_init (GtkWindowClass *klass)
G_TYPE_NONE,
0);
- /**
- * GtkWindow::enable-debugging:
- * @window: the window on which the signal is emitted
- * @toggle: toggle the debugger
- *
- * The ::enable-debugging signal is a [keybinding signal][GtkBindingSignal]
- * which gets emitted when the user enables or disables interactive
- * debugging. When @toggle is %TRUE, interactive debugging is toggled
- * on or off, when it is %FALSE, the debugger will be pointed at the
- * widget under the pointer.
- *
- * 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"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GtkWindowClass, enable_debugging),
- NULL, NULL,
- _gtk_marshal_BOOLEAN__BOOLEAN,
- G_TYPE_BOOLEAN,
- 1, G_TYPE_BOOLEAN);
-
/**
* GtkWindow::close-request:
* @window: the window on which the signal is emitted
@@ -1160,6 +1134,23 @@ gtk_window_class_init (GtkWindowClass *klass)
gtk_widget_class_install_action (widget_class, "focus.activate", NULL,
gtk_window_activate_focus_activate);
+ /**
+ * GtkWindow|debugging.enable:
+ * @toggle: whether to toggle or enable
+ *
+ * The debugging.enable action enables or disables interactive
+ * debugging.
+ *
+ * When @toggle is %TRUE, interactive debugging is toggled
+ * on or off, when it is %FALSE, the debugger will be pointed
+ * at the widget under the pointer.
+ *
+ * The default bindings for this action are Ctrl-Shift-I
+ * and Ctrl-Shift-D.
+ */
+ gtk_widget_class_install_action (widget_class, "debugging.enable", "b",
+ gtk_window_activate_debugging_enable);
+
/*
* Key bindings
*/
@@ -1176,10 +1167,10 @@ gtk_window_class_init (GtkWindowClass *klass)
gtk_widget_class_bind_action (widget_class, GDK_KEY_KP_Enter, 0,
"default.activate", NULL);
- gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_I, GDK_CONTROL_MASK|GDK_SHIFT_MASK,
- "enable-debugging", "(b)", FALSE);
- gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_D, GDK_CONTROL_MASK|GDK_SHIFT_MASK,
- "enable-debugging", "(b)", TRUE);
+ gtk_widget_class_bind_action (widget_class, GDK_KEY_I, GDK_CONTROL_MASK|GDK_SHIFT_MASK,
+ "debugging.enable", "b", FALSE);
+ gtk_widget_class_bind_action (widget_class, GDK_KEY_D, GDK_CONTROL_MASK|GDK_SHIFT_MASK,
+ "debugging.enable", "b", TRUE);
add_arrow_bindings (widget_class, GDK_KEY_Up, GTK_DIR_UP);
add_arrow_bindings (widget_class, GDK_KEY_Down, GTK_DIR_DOWN);
@@ -8507,14 +8498,18 @@ set_warn_again (gboolean warn)
}
}
-static gboolean
-gtk_window_enable_debugging (GtkWindow *window,
- gboolean toggle)
+static void
+gtk_window_activate_debugging_enable (GtkWidget *widget,
+ const char *action_name,
+ GVariant *parameter)
{
+ gboolean toggle;
gboolean warn;
+ toggle = g_variant_get_boolean (parameter);
+
if (!inspector_keybinding_enabled (&warn))
- return FALSE;
+ return;
if (toggle)
{
@@ -8526,8 +8521,6 @@ 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 a95ff496cc..be01898cdc 100644
--- a/gtk/gtkwindow.h
+++ b/gtk/gtkwindow.h
@@ -71,11 +71,7 @@ struct _GtkWindowClass
/*< public >*/
- /* G_SIGNAL_ACTION signals for keybindings */
-
void (* keys_changed) (GtkWindow *window);
- gboolean (* enable_debugging) (GtkWindow *window,
- gboolean toggle);
gboolean (* close_request) (GtkWindow *window);
/*< private >*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]