[gnome-flashback] input-sources: add xkb-info property to GfInputSourceXkb
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] input-sources: add xkb-info property to GfInputSourceXkb
- Date: Thu, 2 Jan 2020 10:57:39 +0000 (UTC)
commit 3695913b2b175014f3c1c2a510686095b1ff7a5c
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Jan 2 04:06:59 2020 +0200
input-sources: add xkb-info property to GfInputSourceXkb
.../libinput-sources/gf-input-source-manager.c | 7 +-
.../libinput-sources/gf-input-source-xkb.c | 74 +++++++++++++++++++++-
.../libinput-sources/gf-keyboard-manager.c | 8 +--
3 files changed, 79 insertions(+), 10 deletions(-)
---
diff --git a/gnome-flashback/libinput-sources/gf-input-source-manager.c
b/gnome-flashback/libinput-sources/gf-input-source-manager.c
index 24d6126..e3ec666 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-manager.c
+++ b/gnome-flashback/libinput-sources/gf-input-source-manager.c
@@ -806,8 +806,6 @@ get_source_info_list (GfInputSourceManager *manager)
list = g_list_append (list, info);
}
- g_object_unref (xkb_info);
-
return list;
}
@@ -1209,7 +1207,12 @@ sources_changed_cb (GfInputSourceSettings *settings,
}
else
{
+ GnomeXkbInfo *xkb_info;
+
+ xkb_info = gf_keyboard_manager_get_xkb_info (manager->keyboard_manager);
+
source = g_object_new (GF_TYPE_INPUT_SOURCE_XKB,
+ "xkb-info", xkb_info,
"type", info->type,
"id", info->id,
"display-name", info->display_name,
diff --git a/gnome-flashback/libinput-sources/gf-input-source-xkb.c
b/gnome-flashback/libinput-sources/gf-input-source-xkb.c
index a89ff1e..c4359de 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-xkb.c
+++ b/gnome-flashback/libinput-sources/gf-input-source-xkb.c
@@ -18,16 +18,88 @@
#include "config.h"
#include "gf-input-source-xkb.h"
+#include <libgnome-desktop/gnome-xkb-info.h>
+
struct _GfInputSourceXkb
{
- GfInputSource parent;
+ GfInputSource parent;
+
+ GnomeXkbInfo *xkb_info;
+};
+
+enum
+{
+ PROP_0,
+
+ PROP_XKB_INFO,
+
+ LAST_PROP
};
+static GParamSpec *xkb_properties[LAST_PROP] = { NULL };
+
G_DEFINE_TYPE (GfInputSourceXkb, gf_input_source_xkb, GF_TYPE_INPUT_SOURCE)
+static void
+gf_input_source_xkb_dispose (GObject *object)
+{
+ GfInputSourceXkb *self;
+
+ self = GF_INPUT_SOURCE_XKB (object);
+
+ g_clear_object (&self->xkb_info);
+
+ G_OBJECT_CLASS (gf_input_source_xkb_parent_class)->dispose (object);
+}
+
+static void
+gf_input_source_xkb_set_property (GObject *object,
+ unsigned int prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GfInputSourceXkb *self;
+
+ self = GF_INPUT_SOURCE_XKB (object);
+
+ switch (prop_id)
+ {
+ case PROP_XKB_INFO:
+ self->xkb_info = g_value_dup_object (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+install_properties (GObjectClass *object_class)
+{
+ xkb_properties[PROP_XKB_INFO] =
+ g_param_spec_object ("xkb-info",
+ "xkb-info",
+ "xkb-info",
+ GNOME_TYPE_XKB_INFO,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_WRITABLE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROP, xkb_properties);
+}
+
static void
gf_input_source_xkb_class_init (GfInputSourceXkbClass *self_class)
{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (self_class);
+
+ object_class->dispose = gf_input_source_xkb_dispose;
+ object_class->set_property = gf_input_source_xkb_set_property;
+
+ install_properties (object_class);
}
static void
diff --git a/gnome-flashback/libinput-sources/gf-keyboard-manager.c
b/gnome-flashback/libinput-sources/gf-keyboard-manager.c
index 84326c5..68013f2 100644
--- a/gnome-flashback/libinput-sources/gf-keyboard-manager.c
+++ b/gnome-flashback/libinput-sources/gf-keyboard-manager.c
@@ -507,16 +507,10 @@ gf_keyboard_manager_new (void)
return g_object_new (GF_TYPE_KEYBOARD_MANAGER, NULL);
}
-/**
- * gf_keyboard_manager_get_xkb_info:
- * @manager: a #GfKeyboardManager
- *
- * Returns: (transfer full):
- */
GnomeXkbInfo *
gf_keyboard_manager_get_xkb_info (GfKeyboardManager *manager)
{
- return g_object_ref (manager->xkb_info);
+ return manager->xkb_info;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]