[gtk/shortcuts-rebased-again: 109/139] inspector: Show shortcut actions and triggers
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/shortcuts-rebased-again: 109/139] inspector: Show shortcut actions and triggers
- Date: Sat, 22 Jun 2019 05:25:08 +0000 (UTC)
commit 9961a15130994896d97b1cb327b443c915d6e0e9
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jun 19 04:27:56 2019 +0000
inspector: Show shortcut actions and triggers
Show these in the property details for
GtkShortcut objects.
gtk/inspector/prop-editor.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
---
diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c
index b44a2c177b..24158be0a1 100644
--- a/gtk/inspector/prop-editor.c
+++ b/gtk/inspector/prop-editor.c
@@ -46,6 +46,8 @@
#include "gtklistbox.h"
#include "gtkcomboboxtext.h"
#include "gtkmenubutton.h"
+#include "gtkshortcutaction.h"
+#include "gtkshortcuttrigger.h"
struct _GtkInspectorPropEditorPrivate
{
@@ -1095,6 +1097,47 @@ property_editor (GObject *object,
gtk_widget_set_halign (prop_edit, GTK_ALIGN_START);
gtk_widget_set_valign (prop_edit, GTK_ALIGN_CENTER);
}
+ else if (type == G_TYPE_PARAM_BOXED &&
+ G_PARAM_SPEC_VALUE_TYPE (spec) == GTK_TYPE_SHORTCUT_ACTION)
+ {
+ GtkShortcutAction *action;
+ g_object_get (object, spec->name, &action, NULL);
+ if (action)
+ {
+ msg = gtk_shortcut_action_to_string (action);
+ gtk_shortcut_action_unref (action);
+ }
+ else
+ msg = NULL;
+ prop_edit = gtk_label_new (msg);
+ }
+ else if (type == G_TYPE_PARAM_BOXED &&
+ G_PARAM_SPEC_VALUE_TYPE (spec) == GTK_TYPE_SHORTCUT_TRIGGER)
+ {
+ GtkShortcutTrigger *trigger;
+ g_object_get (object, spec->name, &trigger, NULL);
+ if (trigger)
+ {
+ msg = gtk_shortcut_trigger_to_string (trigger);
+ gtk_shortcut_trigger_unref (trigger);
+ }
+ else
+ msg = NULL;
+ prop_edit = gtk_label_new (msg);
+ }
+ else if (type == G_TYPE_PARAM_VARIANT)
+ {
+ GVariant *variant;
+ g_object_get (object, spec->name, &variant, NULL);
+ if (variant)
+ {
+ msg = g_variant_print (variant, FALSE);
+ g_variant_unref (variant);
+ }
+ else
+ msg = NULL;
+ prop_edit = gtk_label_new (msg);
+ }
else
{
msg = g_strdup_printf (_("Uneditable property type: %s"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]