[libdazzle] shortcuts: allow hiding shortcut portion of label



commit 6744d060ca7b1fe75e38e8a8c3c0fc528a6a3748
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jul 9 20:56:44 2017 -0700

    shortcuts: allow hiding shortcut portion of label
    
    This is convenient since we can use it for menu labels.

 src/shortcuts/dzl-shortcut-simple-label.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/shortcuts/dzl-shortcut-simple-label.c b/src/shortcuts/dzl-shortcut-simple-label.c
index 3c8f8ef..000c6ad 100644
--- a/src/shortcuts/dzl-shortcut-simple-label.c
+++ b/src/shortcuts/dzl-shortcut-simple-label.c
@@ -39,6 +39,7 @@ enum {
   PROP_ACCEL,
   PROP_ACTION,
   PROP_COMMAND,
+  PROP_SHOW_ACCEL,
   PROP_TITLE,
   N_PROPS
 };
@@ -69,6 +70,10 @@ dzl_shortcut_simple_label_get_property (GObject    *object,
       g_value_set_static_string (value, dzl_shortcut_simple_label_get_command (self));
       break;
 
+    case PROP_SHOW_ACCEL:
+      g_object_get_property (G_OBJECT (self->accel_label), "visible", value);
+      break;
+
     case PROP_TITLE:
       g_value_set_string (value, dzl_shortcut_simple_label_get_title (self));
       break;
@@ -100,6 +105,10 @@ dzl_shortcut_simple_label_set_property (GObject      *object,
       dzl_shortcut_simple_label_set_command (self, g_value_get_string (value));
       break;
 
+    case PROP_SHOW_ACCEL:
+      g_object_set_property (G_OBJECT (self->accel_label), "visible", value);
+      break;
+
     case PROP_TITLE:
       dzl_shortcut_simple_label_set_title (self, g_value_get_string (value));
       break;
@@ -138,6 +147,11 @@ dzl_shortcut_simple_label_class_init (DzlShortcutSimpleLabelClass *klass)
                          NULL,
                          (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
 
+  properties [PROP_SHOW_ACCEL] =
+    g_param_spec_boolean ("show-accel", NULL, NULL,
+                          TRUE,
+                          (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
   properties [PROP_TITLE] =
     g_param_spec_string ("title",
                          "Title",


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