[gnome-flashback] input-sources: add gf_input_source_ibus_new



commit 2008c94334120845df0c91c1ca323b2a92d829d1
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Jan 2 05:15:57 2020 +0200

    input-sources: add gf_input_source_ibus_new

 gnome-flashback/libinput-sources/gf-input-source-ibus.c   | 15 +++++++++++++--
 gnome-flashback/libinput-sources/gf-input-source-ibus.h   | 14 ++++++++++----
 .../libinput-sources/gf-input-source-manager.c            |  9 +++------
 .../libinput-sources/gf-input-source-manager.h            |  3 ---
 gnome-flashback/libinput-sources/gf-input-source.h        |  3 +++
 5 files changed, 29 insertions(+), 15 deletions(-)
---
diff --git a/gnome-flashback/libinput-sources/gf-input-source-ibus.c 
b/gnome-flashback/libinput-sources/gf-input-source-ibus.c
index 224d9a8..d605964 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-ibus.c
+++ b/gnome-flashback/libinput-sources/gf-input-source-ibus.c
@@ -18,8 +18,6 @@
 #include "config.h"
 #include "gf-input-source-ibus.h"
 
-#include "gf-ibus-manager.h"
-
 struct _GfInputSourceIBus
 {
   GfInputSource  parent;
@@ -303,6 +301,19 @@ gf_input_source_ibus_init (GfInputSourceIBus *self)
 {
 }
 
+GfInputSource *
+gf_input_source_ibus_new (GfIBusManager *ibus_manager,
+                          const char    *id,
+                          int            index)
+{
+  return g_object_new (GF_TYPE_INPUT_SOURCE_IBUS,
+                       "ibus-manager", ibus_manager,
+                       "type", INPUT_SOURCE_TYPE_IBUS,
+                       "id", id,
+                       "index", index,
+                       NULL);
+}
+
 const char *
 gf_input_source_ibus_get_icon (GfInputSourceIBus *self)
 {
diff --git a/gnome-flashback/libinput-sources/gf-input-source-ibus.h 
b/gnome-flashback/libinput-sources/gf-input-source-ibus.h
index 4f54903..9a18974 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-ibus.h
+++ b/gnome-flashback/libinput-sources/gf-input-source-ibus.h
@@ -19,6 +19,8 @@
 #define GF_INPUT_SOURCE_IBUS_H
 
 #include <ibus-1.0/ibus.h>
+
+#include "gf-ibus-manager.h"
 #include "gf-input-source.h"
 
 G_BEGIN_DECLS
@@ -27,12 +29,16 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE (GfInputSourceIBus, gf_input_source_ibus,
                       GF, INPUT_SOURCE_IBUS, GfInputSource)
 
-const char   *gf_input_source_ibus_get_icon       (GfInputSourceIBus *self);
+GfInputSource *gf_input_source_ibus_new            (GfIBusManager     *ibus_manager,
+                                                    const char        *id,
+                                                    int                index);
+
+const char    *gf_input_source_ibus_get_icon       (GfInputSourceIBus *self);
 
-IBusPropList *gf_input_source_ibus_get_properties (GfInputSourceIBus *self);
+IBusPropList  *gf_input_source_ibus_get_properties (GfInputSourceIBus *self);
 
-void          gf_input_source_ibus_set_properties (GfInputSourceIBus *self,
-                                                   IBusPropList      *prop_list);
+void           gf_input_source_ibus_set_properties (GfInputSourceIBus *self,
+                                                    IBusPropList      *prop_list);
 
 G_END_DECLS
 
diff --git a/gnome-flashback/libinput-sources/gf-input-source-manager.c 
b/gnome-flashback/libinput-sources/gf-input-source-manager.c
index df9f8fd..506fa5c 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-manager.c
+++ b/gnome-flashback/libinput-sources/gf-input-source-manager.c
@@ -1119,12 +1119,9 @@ sources_changed_cb (GfInputSourceSettings *settings,
 
       if (g_strcmp0 (info->type, INPUT_SOURCE_TYPE_IBUS) == 0)
         {
-          source = g_object_new (GF_TYPE_INPUT_SOURCE_IBUS,
-                                 "ibus-manager", manager->ibus_manager,
-                                 "type", info->type,
-                                 "id", info->id,
-                                 "index", position,
-                                 NULL);
+          source = gf_input_source_ibus_new (manager->ibus_manager,
+                                             info->id,
+                                             position);
         }
       else
         {
diff --git a/gnome-flashback/libinput-sources/gf-input-source-manager.h 
b/gnome-flashback/libinput-sources/gf-input-source-manager.h
index 0e72a77..af402f8 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-manager.h
+++ b/gnome-flashback/libinput-sources/gf-input-source-manager.h
@@ -22,9 +22,6 @@
 #include "gf-ibus-manager.h"
 #include "gf-input-source.h"
 
-#define INPUT_SOURCE_TYPE_XKB "xkb"
-#define INPUT_SOURCE_TYPE_IBUS "ibus"
-
 #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)
diff --git a/gnome-flashback/libinput-sources/gf-input-source.h 
b/gnome-flashback/libinput-sources/gf-input-source.h
index 186be49..2d9cb1d 100644
--- a/gnome-flashback/libinput-sources/gf-input-source.h
+++ b/gnome-flashback/libinput-sources/gf-input-source.h
@@ -21,6 +21,9 @@
 
 #include <glib-object.h>
 
+#define INPUT_SOURCE_TYPE_XKB "xkb"
+#define INPUT_SOURCE_TYPE_IBUS "ibus"
+
 G_BEGIN_DECLS
 
 #define GF_TYPE_INPUT_SOURCE gf_input_source_get_type ()


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