[gnome-flashback] input-sources: move icon_file to GfInputSourceIBus
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] input-sources: move icon_file to GfInputSourceIBus
- Date: Thu, 2 Jan 2020 10:57:50 +0000 (UTC)
commit 3624a428b18f058e8dbeb6812f27bb940dcb37c0
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Jan 2 04:47:39 2020 +0200
input-sources: move icon_file to GfInputSourceIBus
.../libinput-sources/gf-input-source-ibus.c | 11 ++++++++++
.../libinput-sources/gf-input-source-ibus.h | 2 ++
.../libinput-sources/gf-input-source-manager.c | 9 --------
gnome-flashback/libinput-sources/gf-input-source.c | 25 ----------------------
gnome-flashback/libinput-sources/gf-input-source.h | 5 -----
.../libinput-sources/gf-input-sources.c | 17 ++++++++-------
6 files changed, 22 insertions(+), 47 deletions(-)
---
diff --git a/gnome-flashback/libinput-sources/gf-input-source-ibus.c
b/gnome-flashback/libinput-sources/gf-input-source-ibus.c
index 02dfee6..10831f1 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-ibus.c
+++ b/gnome-flashback/libinput-sources/gf-input-source-ibus.c
@@ -31,6 +31,8 @@ struct _GfInputSourceIBus
char *display_name;
char *short_name;
+ char *icon;
+
char *xkb_id;
};
@@ -127,6 +129,8 @@ gf_input_source_ibus_constructed (GObject *object)
self->display_name = g_strdup_printf ("%s (%s)", language, longname);
self->short_name = make_engine_short_name (engine_desc);
+ self->icon = g_strdup (ibus_engine_desc_get_icon (engine_desc));
+
layout = ibus_engine_desc_get_layout (engine_desc);
layout_variant = ibus_engine_desc_get_layout_variant (engine_desc);
@@ -158,6 +162,7 @@ gf_input_source_ibus_finalize (GObject *object)
g_clear_pointer (&self->display_name, g_free);
g_clear_pointer (&self->short_name, g_free);
+ g_clear_pointer (&self->icon, g_free);
g_clear_pointer (&self->xkb_id, g_free);
G_OBJECT_CLASS (gf_input_source_ibus_parent_class)->finalize (object);
@@ -274,6 +279,12 @@ gf_input_source_ibus_init (GfInputSourceIBus *self)
{
}
+const char *
+gf_input_source_ibus_get_icon (GfInputSourceIBus *self)
+{
+ return self->icon;
+}
+
IBusPropList *
gf_input_source_ibus_get_properties (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 eece92c..4f54903 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-ibus.h
+++ b/gnome-flashback/libinput-sources/gf-input-source-ibus.h
@@ -27,6 +27,8 @@ 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);
+
IBusPropList *gf_input_source_ibus_get_properties (GfInputSourceIBus *self);
void gf_input_source_ibus_set_properties (GfInputSourceIBus *self,
diff --git a/gnome-flashback/libinput-sources/gf-input-source-manager.c
b/gnome-flashback/libinput-sources/gf-input-source-manager.c
index b021cbc..df9f8fd 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-manager.c
+++ b/gnome-flashback/libinput-sources/gf-input-source-manager.c
@@ -44,8 +44,6 @@ struct _SourceInfo
gchar *type;
gchar *id;
-
- char *icon_file;
};
typedef struct
@@ -416,7 +414,6 @@ source_info_free (gpointer data)
g_free (info->type);
g_free (info->id);
- g_free (info->icon_file);
g_free (info);
}
@@ -700,7 +697,6 @@ get_source_info_list (GfInputSourceManager *manager)
else if (g_strcmp0 (type, INPUT_SOURCE_TYPE_IBUS) == 0)
{
IBusEngineDesc *engine_desc;
- const char *icon;
if (manager->disable_ibus)
continue;
@@ -711,10 +707,7 @@ get_source_info_list (GfInputSourceManager *manager)
if (engine_desc == NULL)
continue;
- icon = ibus_engine_desc_get_icon (engine_desc);
-
info = source_info_new (type, id);
- info->icon_file = g_strdup (icon);
}
if (info != NULL)
@@ -1147,8 +1140,6 @@ sources_changed_cb (GfInputSourceSettings *settings,
NULL);
}
- gf_input_source_set_icon_file (source, info->icon_file);
-
g_signal_connect (source, "activate",
G_CALLBACK (activate_cb), manager);
diff --git a/gnome-flashback/libinput-sources/gf-input-source.c
b/gnome-flashback/libinput-sources/gf-input-source.c
index ac77a44..1772582 100644
--- a/gnome-flashback/libinput-sources/gf-input-source.c
+++ b/gnome-flashback/libinput-sources/gf-input-source.c
@@ -26,8 +26,6 @@ typedef struct
gchar *type;
gchar *id;
guint index;
-
- char *icon_file;
} GfInputSourcePrivate;
enum
@@ -130,7 +128,6 @@ gf_input_source_finalize (GObject *object)
g_free (priv->type);
g_free (priv->id);
- g_free (priv->icon_file);
G_OBJECT_CLASS (gf_input_source_parent_class)->finalize (object);
}
@@ -243,25 +240,3 @@ gf_input_source_activate (GfInputSource *source,
{
g_signal_emit (source, signals[SIGNAL_ACTIVATE], 0, interactive);
}
-
-const char *
-gf_input_source_get_icon_file (GfInputSource *self)
-{
- GfInputSourcePrivate *priv;
-
- priv = gf_input_source_get_instance_private (self);
-
- return priv->icon_file;
-}
-
-void
-gf_input_source_set_icon_file (GfInputSource *self,
- const char *icon_file)
-{
- GfInputSourcePrivate *priv;
-
- priv = gf_input_source_get_instance_private (self);
-
- g_clear_pointer (&priv->icon_file, g_free);
- priv->icon_file = g_strdup (icon_file);
-}
diff --git a/gnome-flashback/libinput-sources/gf-input-source.h
b/gnome-flashback/libinput-sources/gf-input-source.h
index a1807ae..1cf7114 100644
--- a/gnome-flashback/libinput-sources/gf-input-source.h
+++ b/gnome-flashback/libinput-sources/gf-input-source.h
@@ -59,11 +59,6 @@ const gchar *gf_input_source_get_xkb_id (GfInputSource *source);
void gf_input_source_activate (GfInputSource *source,
gboolean interactive);
-const char *gf_input_source_get_icon_file (GfInputSource *self);
-
-void gf_input_source_set_icon_file (GfInputSource *self,
- const char *icon_file);
-
G_END_DECLS
#endif
diff --git a/gnome-flashback/libinput-sources/gf-input-sources.c
b/gnome-flashback/libinput-sources/gf-input-sources.c
index 8da11d7..20ca245 100644
--- a/gnome-flashback/libinput-sources/gf-input-sources.c
+++ b/gnome-flashback/libinput-sources/gf-input-sources.c
@@ -66,20 +66,27 @@ append_icon_info (GVariantBuilder *builder,
{
const char *display_name;
const char *icon_text;
- const char *icon_file;
display_name = gf_input_source_get_display_name (self->current_source);
icon_text = gf_input_source_get_short_name (self->current_source);
- icon_file = gf_input_source_get_icon_file (self->current_source);
if (GF_IS_INPUT_SOURCE_IBUS (self->current_source))
{
GfInputSourceIBus *ibus_source;
+ const char *icon;
IBusPropList *prop_list;
ibus_source = GF_INPUT_SOURCE_IBUS (self->current_source);
+
+ icon = gf_input_source_ibus_get_icon (ibus_source);
prop_list = gf_input_source_ibus_get_properties (ibus_source);
+ if (icon != NULL)
+ {
+ g_variant_builder_add (builder, "{sv}", "icon-file",
+ g_variant_new_string (icon));
+ }
+
if (prop_list != NULL)
{
guint i;
@@ -120,12 +127,6 @@ append_icon_info (GVariantBuilder *builder,
g_variant_builder_add (builder, "{sv}", "icon-text",
g_variant_new_string (icon_text));
-
- if (icon_file != NULL)
- {
- g_variant_builder_add (builder, "{sv}", "icon-file",
- g_variant_new_string (icon_file));
- }
}
static const char *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]