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
This commit is contained 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
|
||||
|
@ -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 \
|
||||
|
@ -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>
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "gtkshortcutsshortcut.h"
|
||||
|
||||
#include "gtkshortcutlabelprivate.h"
|
||||
#include "gtkshortcutlabel.h"
|
||||
#include "gtkshortcutswindowprivate.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
Reference in New Issue
Block a user