[gtk+/wip/gbsneto/export-shortcuts-label: 18/19] shortcut-label: make it public



commit 9a1a5a18283d541fd19c29e3c0449c5d219c21e8
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jul 26 16:00:47 2016 -0300

    shortcut-label: make it public
    
    GtkShortcutLabel is a widget that displays a single
    shortcut accelerator or gesture in the user interface,
    and is currently used by the shortcuts window.
    
    This widget, however, has public value as other applications
    also may want to expose their own shortcuts. For instance,
    it'll be useful for the Keyboard panel on Control Center and
    the new shortcut editor in Pitivi, among others.
    
    This patch exposes GtkShortcutLabel as a public widget,
    and adds the necessary documentation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769205

 docs/reference/gtk/gtk3.types.in                   |    1 +
 gtk/Makefile.am                                    |    2 +-
 gtk/gtk.h                                          |    1 +
 gtk/gtkshortcutlabel.c                             |   49 +++++++++++++++++++-
 ...tkshortcutlabelprivate.h => gtkshortcutlabel.h} |    7 ++-
 gtk/gtkshortcutsshortcut.c                         |    2 +-
 6 files changed, 58 insertions(+), 4 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3.types.in b/docs/reference/gtk/gtk3.types.in
index beb5a4a..32d57eb 100644
--- a/docs/reference/gtk/gtk3.types.in
+++ b/docs/reference/gtk/gtk3.types.in
@@ -173,6 +173,7 @@ gtk_separator_get_type
 gtk_separator_menu_item_get_type
 gtk_separator_tool_item_get_type
 gtk_settings_get_type
+gtk_shortcuts_label_get_type
 gtk_shortcuts_window_get_type
 gtk_shortcuts_section_get_type
 gtk_shortcuts_group_get_type
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 611b96e..ed6c224 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -286,6 +286,7 @@ gtk_public_h_sources =              \
        gtkseparatormenuitem.h  \
        gtkseparatortoolitem.h  \
        gtksettings.h           \
+       gtkshortcutlabel.h      \
        gtkshortcutsgroup.h     \
        gtkshortcutssection.h   \
        gtkshortcutsshortcut.h  \
@@ -548,7 +549,6 @@ gtk_private_h_sources =             \
        gtksearchentryprivate.h \
        gtkselectionprivate.h   \
        gtksettingsprivate.h    \
-       gtkshortcutlabelprivate.h       \
        gtkshortcutswindowprivate.h     \
        gtkshortcutsshortcutprivate.h   \
        gtksidebarrowprivate.h  \
diff --git a/gtk/gtk.h b/gtk/gtk.h
index a7233da..c818f32 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -187,6 +187,7 @@
 #include <gtk/gtkseparatormenuitem.h>
 #include <gtk/gtkseparatortoolitem.h>
 #include <gtk/gtksettings.h>
+#include <gtk/gtkshortcutlabel.h>
 #include <gtk/gtkshortcutsgroup.h>
 #include <gtk/gtkshortcutssection.h>
 #include <gtk/gtkshortcutsshortcut.h>
diff --git a/gtk/gtkshortcutlabel.c b/gtk/gtkshortcutlabel.c
index 06b1736..45cf3da 100644
--- a/gtk/gtkshortcutlabel.c
+++ b/gtk/gtkshortcutlabel.c
@@ -18,13 +18,23 @@
 
 #include "config.h"
 
-#include "gtkshortcutlabelprivate.h"
+#include "gtkshortcutlabel.h"
 #include "gtklabel.h"
 #include "gtkframe.h"
 #include "gtkstylecontext.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
+/**
+ * SECTION:gtkshortcutlabel
+ * @Title: GtkShortcutLabel
+ * @Short_description: Displays a keyboard shortcut
+ * @See_also: #GtkCellRendererAccel
+ *
+ * #GtkShortcutLabel is a widget that represents a single keyboard shortcut or gesture
+ * in the user interface.
+ */
+
 struct _GtkShortcutLabel
 {
   GtkBox  parent_instance;
@@ -438,6 +448,14 @@ gtk_shortcut_label_class_init (GtkShortcutLabelClass *klass)
   object_class->get_property = gtk_shortcut_label_get_property;
   object_class->set_property = gtk_shortcut_label_set_property;
 
+  /**
+   * GtkShortcutLabel:accelerator:
+   *
+   * The accelerator that @self displays. See #GtkShortcutsShortcut:accelerator
+   * for the accepted syntax.
+   *
+   * Since: 3.22
+   */
   properties[PROP_ACCELERATOR] =
     g_param_spec_string ("accelerator", P_("Accelerator"), P_("Accelerator"),
                          NULL,
@@ -452,6 +470,16 @@ gtk_shortcut_label_init (GtkShortcutLabel *self)
   gtk_box_set_spacing (GTK_BOX (self), 6);
 }
 
+/**
+ * gtk_shortcut_label_new:
+ * @accelerator: the initial accelerator
+ *
+ * Creates a new #GtkShortcutLabel with @accelerator set.
+ *
+ * Returns: (transfer full): a newly-allocated #GtkShortcutLabel
+ *
+ * Since: 3.22
+ */
 GtkWidget *
 gtk_shortcut_label_new (const gchar *accelerator)
 {
@@ -460,6 +488,16 @@ gtk_shortcut_label_new (const gchar *accelerator)
                        NULL);
 }
 
+/**
+ * gtk_shortcut_label_get_accelerator:
+ * @self: a #GtkShortcutLabel
+ *
+ * Retrieves the current accelerator of @self.
+ *
+ * Returns: (transfer none)(nullable): the current accelerator.
+ *
+ * Since: 3.22
+ */
 const gchar *
 gtk_shortcut_label_get_accelerator (GtkShortcutLabel *self)
 {
@@ -468,6 +506,15 @@ gtk_shortcut_label_get_accelerator (GtkShortcutLabel *self)
   return self->accelerator;
 }
 
+/**
+ * gtk_shortcut_label_set_accelerator:
+ * @self: a #GtkShortcutLabel
+ * @accelerator: the new accelerator
+ *
+ * Sets the accelerator to be displayed by @self.
+ *
+ * Since: 3.22
+ */
 void
 gtk_shortcut_label_set_accelerator (GtkShortcutLabel *self,
                                     const gchar      *accelerator)
diff --git a/gtk/gtkshortcutlabelprivate.h b/gtk/gtkshortcutlabel.h
similarity index 95%
rename from gtk/gtkshortcutlabelprivate.h
rename to gtk/gtkshortcutlabel.h
index 4f5096c..aecaa78 100644
--- a/gtk/gtkshortcutlabelprivate.h
+++ b/gtk/gtkshortcutlabel.h
@@ -34,11 +34,16 @@ G_BEGIN_DECLS
 typedef struct _GtkShortcutLabel      GtkShortcutLabel;
 typedef struct _GtkShortcutLabelClass GtkShortcutLabelClass;
 
-
+GDK_AVAILABLE_IN_3_22
 GType        gtk_shortcut_label_get_type        (void) G_GNUC_CONST;
 
+GDK_AVAILABLE_IN_3_22
 GtkWidget   *gtk_shortcut_label_new             (const gchar      *accelerator);
+
+GDK_AVAILABLE_IN_3_22
 const gchar *gtk_shortcut_label_get_accelerator (GtkShortcutLabel *self);
+
+GDK_AVAILABLE_IN_3_22
 void         gtk_shortcut_label_set_accelerator (GtkShortcutLabel *self,
                                                  const gchar      *accelerator);
 
diff --git a/gtk/gtkshortcutsshortcut.c b/gtk/gtkshortcutsshortcut.c
index 01df8b9..ca06eab 100644
--- a/gtk/gtkshortcutsshortcut.c
+++ b/gtk/gtkshortcutsshortcut.c
@@ -20,7 +20,7 @@
 
 #include "gtkshortcutsshortcut.h"
 
-#include "gtkshortcutlabelprivate.h"
+#include "gtkshortcutlabel.h"
 #include "gtkshortcutswindowprivate.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"


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