eekboard_context: Rename to LayoutHolder
This commit is contained in:
@ -35,17 +35,17 @@ enum {
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
#define EEKBOARD_CONTEXT_SERVICE_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEKBOARD_TYPE_CONTEXT_SERVICE, EekboardContextServicePrivate))
|
||||
#define LAYOUT_HOLDER_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEKBOARD_TYPE_LAYOUT_HOLDER, LayoutHolderPrivate))
|
||||
|
||||
struct _EekboardContextServicePrivate {
|
||||
struct _LayoutHolderPrivate {
|
||||
LevelKeyboard *keyboard; // currently used keyboard
|
||||
|
||||
/// Needed for keymap changes after keyboard updates
|
||||
struct submission *submission; // unowned
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (EekboardContextService, eekboard_context_service, G_TYPE_OBJECT);
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (LayoutHolder, layout_holder, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
eekboard_context_service_set_property (GObject *object,
|
||||
@ -67,7 +67,7 @@ eekboard_context_service_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
EekboardContextService *context = EEKBOARD_CONTEXT_SERVICE(object);
|
||||
LayoutHolder *context = LAYOUT_HOLDER(object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_KEYBOARD:
|
||||
@ -82,7 +82,7 @@ eekboard_context_service_get_property (GObject *object,
|
||||
static void
|
||||
eekboard_context_service_dispose (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (eekboard_context_service_parent_class)->
|
||||
G_OBJECT_CLASS (layout_holder_parent_class)->
|
||||
dispose (object);
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ settings_get_layout(GSettings *settings, char **type, char **layout)
|
||||
}
|
||||
|
||||
void
|
||||
eekboard_context_service_use_layout(EekboardContextService *context, struct squeek_layout_state *state) {
|
||||
eekboard_context_service_use_layout(LayoutHolder *context, struct squeek_layout_state *state) {
|
||||
gchar *layout_name = state->overlay_name;
|
||||
|
||||
if (layout_name == NULL) {
|
||||
@ -150,8 +150,8 @@ eekboard_context_service_use_layout(EekboardContextService *context, struct sque
|
||||
}
|
||||
|
||||
static void
|
||||
eekboard_context_service_init (EekboardContextService *self) {
|
||||
self->priv = EEKBOARD_CONTEXT_SERVICE_GET_PRIVATE(self);
|
||||
layout_holder_init (LayoutHolder *self) {
|
||||
self->priv = LAYOUT_HOLDER_GET_PRIVATE(self);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -161,7 +161,7 @@ eekboard_context_service_constructed (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
eekboard_context_service_class_init (EekboardContextServiceClass *klass)
|
||||
layout_holder_class_init (LayoutHolderClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
@ -186,7 +186,7 @@ eekboard_context_service_class_init (EekboardContextServiceClass *klass)
|
||||
}
|
||||
|
||||
void
|
||||
eekboard_context_service_destroy (EekboardContextService *context)
|
||||
eekboard_context_service_destroy (LayoutHolder *context)
|
||||
{
|
||||
(void)context;
|
||||
}
|
||||
@ -199,12 +199,12 @@ eekboard_context_service_destroy (EekboardContextService *context)
|
||||
* Returns: (transfer none): an #EekKeyboard
|
||||
*/
|
||||
LevelKeyboard *
|
||||
eekboard_context_service_get_keyboard (EekboardContextService *context)
|
||||
eekboard_context_service_get_keyboard (LayoutHolder *context)
|
||||
{
|
||||
return context->priv->keyboard;
|
||||
}
|
||||
|
||||
void eekboard_context_service_set_hint_purpose(EekboardContextService *context,
|
||||
void eekboard_context_service_set_hint_purpose(LayoutHolder *context,
|
||||
uint32_t hint, uint32_t purpose)
|
||||
{
|
||||
if (context->layout->hint != hint || context->layout->purpose != purpose) {
|
||||
@ -215,7 +215,7 @@ void eekboard_context_service_set_hint_purpose(EekboardContextService *context,
|
||||
}
|
||||
|
||||
void
|
||||
eekboard_context_service_set_overlay(EekboardContextService *context, const char* name) {
|
||||
eekboard_context_service_set_overlay(LayoutHolder *context, const char* name) {
|
||||
if (g_strcmp0(context->layout->overlay_name, name)) {
|
||||
g_free(context->layout->overlay_name);
|
||||
context->layout->overlay_name = g_strdup(name);
|
||||
@ -224,19 +224,19 @@ eekboard_context_service_set_overlay(EekboardContextService *context, const char
|
||||
}
|
||||
|
||||
const char*
|
||||
eekboard_context_service_get_overlay(EekboardContextService *context) {
|
||||
eekboard_context_service_get_overlay(LayoutHolder *context) {
|
||||
return context->layout->overlay_name;
|
||||
}
|
||||
|
||||
EekboardContextService *eekboard_context_service_new(struct squeek_layout_state *state)
|
||||
LayoutHolder *eekboard_context_service_new(struct squeek_layout_state *state)
|
||||
{
|
||||
EekboardContextService *context = g_object_new (EEKBOARD_TYPE_CONTEXT_SERVICE, NULL);
|
||||
LayoutHolder *context = g_object_new (EEKBOARD_TYPE_LAYOUT_HOLDER, NULL);
|
||||
context->layout = state;
|
||||
eekboard_context_service_use_layout(context, context->layout);
|
||||
return context;
|
||||
}
|
||||
|
||||
void eekboard_context_service_set_submission(EekboardContextService *context, struct submission *submission) {
|
||||
void eekboard_context_service_set_submission(LayoutHolder *context, struct submission *submission) {
|
||||
context->priv->submission = submission;
|
||||
if (context->priv->submission) {
|
||||
submission_set_keyboard(context->priv->submission, context->priv->keyboard);
|
||||
@ -274,7 +274,7 @@ handle_layout_changed(GSettings *s,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void eek_gsettings_tracker_init(struct gsettings_tracker *tracker, EekboardContextService *context, struct squeek_layout_state *layout)
|
||||
void eek_gsettings_tracker_init(struct gsettings_tracker *tracker, LayoutHolder *context, struct squeek_layout_state *layout)
|
||||
{
|
||||
tracker->layout = layout;
|
||||
tracker->context = context;
|
||||
|
||||
@ -30,35 +30,30 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EEKBOARD_CONTEXT_SERVICE_PATH "/org/fedorahosted/Eekboard/Context_%d"
|
||||
#define EEKBOARD_CONTEXT_SERVICE_INTERFACE "org.fedorahosted.Eekboard.Context"
|
||||
|
||||
#define EEKBOARD_TYPE_CONTEXT_SERVICE (eekboard_context_service_get_type())
|
||||
#define EEKBOARD_CONTEXT_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEKBOARD_TYPE_CONTEXT_SERVICE, EekboardContextService))
|
||||
#define EEKBOARD_TYPE_LAYOUT_HOLDER (layout_holder_get_type())
|
||||
#define LAYOUT_HOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEKBOARD_TYPE_LAYOUT_HOLDER, LayoutHolder))
|
||||
#define EEKBOARD_CONTEXT_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEKBOARD_TYPE_CONTEXT_SERVICE, EekboardContextServiceClass))
|
||||
#define EEKBOARD_IS_CONTEXT_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEKBOARD_TYPE_CONTEXT_SERVICE))
|
||||
#define EEKBOARD_IS_CONTEXT_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEKBOARD_TYPE_CONTEXT_SERVICE))
|
||||
#define EEKBOARD_CONTEXT_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEKBOARD_TYPE_CONTEXT_SERVICE, EekboardContextServiceClass))
|
||||
|
||||
|
||||
typedef struct _EekboardContextServiceClass EekboardContextServiceClass;
|
||||
typedef struct _EekboardContextServicePrivate EekboardContextServicePrivate;
|
||||
typedef struct _LayoutHolderClass LayoutHolderClass;
|
||||
typedef struct _LayoutHolderPrivate LayoutHolderPrivate;
|
||||
|
||||
/**
|
||||
* EekboardContextService:
|
||||
*
|
||||
* Handles layout state, and virtual-keyboard.
|
||||
*
|
||||
* TODO: Restrict to managing keyboard layouts, and maybe button repeats,
|
||||
* and the virtual keyboard protocol.
|
||||
*/
|
||||
struct _EekboardContextService {
|
||||
struct _LayoutHolder {
|
||||
GObject parent;
|
||||
EekboardContextServicePrivate *priv;
|
||||
LayoutHolderPrivate *priv;
|
||||
struct squeek_layout_state *layout; // Unowned
|
||||
};
|
||||
|
||||
struct _EekboardContextServiceClass {
|
||||
struct _LayoutHolderClass {
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
@ -67,29 +62,28 @@ struct _EekboardContextServiceClass {
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eekboard_context_service_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
GType layout_holder_get_type(void) G_GNUC_CONST;
|
||||
|
||||
/// Handles gsettings os-level keyboard layout switches.
|
||||
struct gsettings_tracker {
|
||||
GSettings *gsettings; // Owned reference
|
||||
EekboardContextService *context; // Unowned
|
||||
LayoutHolder *context; // Unowned
|
||||
struct squeek_layout_state *layout; // Unowned
|
||||
};
|
||||
|
||||
void eek_gsettings_tracker_init(struct gsettings_tracker* tracker, EekboardContextService *context, struct squeek_layout_state *layout);
|
||||
void eek_gsettings_tracker_init(struct gsettings_tracker* tracker, LayoutHolder *context, struct squeek_layout_state *layout);
|
||||
|
||||
EekboardContextService *eekboard_context_service_new(struct squeek_layout_state *state);
|
||||
void eekboard_context_service_set_submission(EekboardContextService *context, struct submission *submission);
|
||||
LevelKeyboard *eekboard_context_service_get_keyboard(EekboardContextService *context);
|
||||
LayoutHolder *eekboard_context_service_new(struct squeek_layout_state *state);
|
||||
void eekboard_context_service_set_submission(LayoutHolder *context, struct submission *submission);
|
||||
LevelKeyboard *eekboard_context_service_get_keyboard(LayoutHolder *context);
|
||||
|
||||
void eekboard_context_service_set_keymap(EekboardContextService *context,
|
||||
void eekboard_context_service_set_keymap(LayoutHolder *context,
|
||||
const LevelKeyboard *keyboard);
|
||||
|
||||
void eekboard_context_service_set_hint_purpose(EekboardContextService *context,
|
||||
void eekboard_context_service_set_hint_purpose(LayoutHolder *context,
|
||||
uint32_t hint,
|
||||
uint32_t purpose);
|
||||
void
|
||||
eekboard_context_service_use_layout(EekboardContextService *context, struct squeek_layout_state *layout);
|
||||
eekboard_context_service_use_layout(LayoutHolder *context, struct squeek_layout_state *layout);
|
||||
G_END_DECLS
|
||||
#endif /* EEKBOARD_CONTEXT_SERVICE_H */
|
||||
|
||||
Reference in New Issue
Block a user