[gnome-flashback/wip/segeiger/inputmethods: 3/8] input-sources: use properties to inject a GfIBusManager instance
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback/wip/segeiger/inputmethods: 3/8] input-sources: use properties to inject a GfIBusManager instance
- Date: Sat, 19 Sep 2015 18:07:05 +0000 (UTC)
commit faf6573cb6ed7b119cc41e24b586dc48df329e41
Author: Sebastian Geiger <sbastig gmx net>
Date: Sat Sep 19 19:20:25 2015 +0200
input-sources: use properties to inject a GfIBusManager instance
.../libinput-sources/gf-input-source-manager.c | 79 +++++++++++++++++++-
.../libinput-sources/gf-input-source-manager.h | 3 +-
2 files changed, 79 insertions(+), 3 deletions(-)
---
diff --git a/gnome-flashback/libinput-sources/gf-input-source-manager.c
b/gnome-flashback/libinput-sources/gf-input-source-manager.c
index 493c3b3..1429e99 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-manager.c
+++ b/gnome-flashback/libinput-sources/gf-input-source-manager.c
@@ -18,17 +18,90 @@
#include "config.h"
#include "gf-input-source-manager.h"
+#include "gf-ibus-manager.h"
struct _GfInputSourceManager
{
GObject parent;
+
+ GfIBusManager *ibus_manager;
};
G_DEFINE_TYPE (GfInputSourceManager, gf_input_source_manager, G_TYPE_OBJECT)
+enum {
+ PROP_0,
+
+ PROP_IBUS_MANAGER,
+
+ LAST_PROP
+};
+
+static GParamSpec *properties[LAST_PROP] = {NULL};
+
+static void
+set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GfInputSourceManager *input_source_manager;
+
+ input_source_manager = GF_INPUT_SOURCE_MANAGER (object);
+
+ switch (property_id) {
+ case PROP_IBUS_MANAGER:
+ input_source_manager->ibus_manager = g_value_get_boxed (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GfInputSourceManager *input_source_manager;
+
+ input_source_manager = GF_INPUT_SOURCE_MANAGER (object);
+
+ switch (property_id)
+ {
+ case PROP_IBUS_MANAGER:
+ g_value_set_boxed (value, input_source_manager->ibus_manager);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
static void
gf_input_source_manager_class_init (GfInputSourceManagerClass *manager_class)
{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (manager_class);
+
+ object_class->get_property = get_property;
+ object_class->set_property = set_property;
+
+ properties[PROP_IBUS_MANAGER] =
+ g_param_spec_string ("ibus-manager",
+ "IBus Manager",
+ "An instance of GfIBusManager",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, 1, properties);
}
static void
@@ -37,7 +110,9 @@ gf_input_source_manager_init (GfInputSourceManager *manager)
}
GfInputSourceManager *
-gf_input_source_manager_new (void)
+gf_input_source_manager_new (GfIBusManager *ibus_manager)
{
- return g_object_new (GF_TYPE_INPUT_SOURCE_MANAGER, NULL);
+ return g_object_new (GF_TYPE_INPUT_SOURCE_MANAGER,
+ "ibus-manager", ibus_manager,
+ NULL);
}
diff --git a/gnome-flashback/libinput-sources/gf-input-source-manager.h
b/gnome-flashback/libinput-sources/gf-input-source-manager.h
index b673456..c8bcfe9 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-manager.h
+++ b/gnome-flashback/libinput-sources/gf-input-source-manager.h
@@ -19,11 +19,12 @@
#define GF_INPUT_SOURCE_MANAGER_H
#include <glib-object.h>
+#include "gf-ibus-manager.h"
#define GF_TYPE_INPUT_SOURCE_MANAGER gf_input_source_manager_get_type ()
G_DECLARE_FINAL_TYPE (GfInputSourceManager, gf_input_source_manager,
GF, INPUT_SOURCE_MANAGER, GObject)
-GfInputSourceManager *gf_input_source_manager_new (void);
+GfInputSourceManager *gf_input_source_manager_new (GfIBusManager *manager);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]