Enabled unicode_alt in EmojiOne json file
- Enabled to type multiple code points on Emojier - Fixed IBusEmojiDialog_1_0_gir_LIBS for --as-needed LDFLAGS
This commit is contained in:
parent
424038a8b9
commit
c46a197882
729
ibus-HEAD.patch
729
ibus-HEAD.patch
@ -3668,3 +3668,732 @@ index 0982134..7350dcc 100644
|
||||
--
|
||||
2.9.3
|
||||
|
||||
From 164300758c70fd3a590788e038de31b6c53d458a Mon Sep 17 00:00:00 2001
|
||||
From: fujiwarat <takao.fujiwara1@gmail.com>
|
||||
Date: Tue, 28 Mar 2017 12:15:26 +0900
|
||||
Subject: [PATCH] data: Fix a typo
|
||||
|
||||
R=Shawn.P.Huang@gmail.com
|
||||
|
||||
Review URL: https://codereview.appspot.com/321800043
|
||||
---
|
||||
data/ibus.schemas.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
|
||||
index c0bbd6f..096dd71 100644
|
||||
--- a/data/ibus.schemas.in
|
||||
+++ b/data/ibus.schemas.in
|
||||
@@ -386,7 +386,7 @@
|
||||
<short>Default language for emoji dictionary</short>
|
||||
<long>Choose a default language of emoji dictionaries on
|
||||
the emoji dialog. The value $lang is applied to
|
||||
- /usr/share/unicode/cldr/common/annotations/$lang.xml
|
||||
+ /usr/share/ibus/dicts/emoji-$lang.dict
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
--
|
||||
2.9.3
|
||||
|
||||
From c3168d4701eb4e89094249abaa4f0f83ab24149b Mon Sep 17 00:00:00 2001
|
||||
From: fujiwarat <takao.fujiwara1@gmail.com>
|
||||
Date: Wed, 29 Mar 2017 13:01:28 +0900
|
||||
Subject: [PATCH] Fix IBusEmojiDialog_1_0_gir_LIBS for --as-needed LDFLAGS
|
||||
|
||||
The order gets omitted libibus-1.0.la
|
||||
|
||||
BUG=https://github.com/ibus/ibus/issues/1917
|
||||
|
||||
Review URL: https://codereview.appspot.com/324720043
|
||||
---
|
||||
ui/gtk3/Makefile.am | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ui/gtk3/Makefile.am b/ui/gtk3/Makefile.am
|
||||
index b055f67..7122ff3 100644
|
||||
--- a/ui/gtk3/Makefile.am
|
||||
+++ b/ui/gtk3/Makefile.am
|
||||
@@ -205,7 +205,7 @@ IBusEmojiDialog_1_0_gir_SCANNERFLAGS = \
|
||||
$(NULL)
|
||||
IBusEmojiDialog-1.0.gir: $(libibus_emoji_dialog) Makefile
|
||||
IBusEmojiDialog_1_0_gir_INCLUDES = Gtk-3.0 GLib-2.0 GObject-2.0 Gio-2.0
|
||||
-IBusEmojiDialog_1_0_gir_LIBS = $(libibus) $(libibus_emoji_dialog)
|
||||
+IBusEmojiDialog_1_0_gir_LIBS = $(libibus_emoji_dialog) $(libibus)
|
||||
IBusEmojiDialog_1_0_gir_FILES = \
|
||||
$(addprefix $(srcdir)/,$(introspection_sources)) \
|
||||
$(NULL)
|
||||
--
|
||||
2.9.3
|
||||
|
||||
From 8b6f9fa531aa9d9b5d6c0184b2294d071f920d7f Mon Sep 17 00:00:00 2001
|
||||
From: fujiwarat <takao.fujiwara1@gmail.com>
|
||||
Date: Thu, 30 Mar 2017 12:08:39 +0900
|
||||
Subject: [PATCH] ui/gtk3: Enable to type multiple code points on Emojier
|
||||
|
||||
- Can type multiple Unicode characters with digits and Shift-space
|
||||
keys. E.g. "1f468 1f468 1f466"
|
||||
- Always show Unicode points of the selected emoji
|
||||
- Removed a function to commit an emoji by typing a digit char since
|
||||
it conflicts with digit annotations, code points but it had enabled
|
||||
with single digits only so not so useful.
|
||||
|
||||
R=Shawn.P.Huang@gmail.com
|
||||
|
||||
Review URL: https://codereview.appspot.com/321820043
|
||||
---
|
||||
ui/gtk3/emojier.vala | 207 ++++++++++++++++++++++++---------------------------
|
||||
1 file changed, 98 insertions(+), 109 deletions(-)
|
||||
|
||||
diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
|
||||
index 20c1378..8a2726c 100644
|
||||
--- a/ui/gtk3/emojier.vala
|
||||
+++ b/ui/gtk3/emojier.vala
|
||||
@@ -97,12 +97,27 @@ class IBusEmojier : Gtk.Window {
|
||||
set_label(text);
|
||||
}
|
||||
}
|
||||
- private class EPaddedLabel : Gtk.Box {
|
||||
+ private class EPaddedLabel : Gtk.Label {
|
||||
public EPaddedLabel(string text,
|
||||
- Gtk.Align align,
|
||||
- TravelDirection direction=TravelDirection.NONE) {
|
||||
+ Gtk.Align align) {
|
||||
GLib.Object(
|
||||
name : "IBusEmojierPaddedLabel",
|
||||
+ halign : align,
|
||||
+ valign : Gtk.Align.CENTER,
|
||||
+ margin_start : 20,
|
||||
+ margin_end : 20,
|
||||
+ margin_top : 6,
|
||||
+ margin_bottom : 6
|
||||
+ );
|
||||
+ set_text(text);
|
||||
+ }
|
||||
+ }
|
||||
+ private class EPaddedLabelBox : Gtk.Box {
|
||||
+ public EPaddedLabelBox(string text,
|
||||
+ Gtk.Align align,
|
||||
+ TravelDirection direction=TravelDirection.NONE) {
|
||||
+ GLib.Object(
|
||||
+ name : "IBusEmojierPaddedLabelBox",
|
||||
orientation : Gtk.Orientation.HORIZONTAL,
|
||||
spacing : 0
|
||||
);
|
||||
@@ -118,36 +133,29 @@ class IBusEmojier : Gtk.Window {
|
||||
}
|
||||
pack_start(icon, false, true, 0);
|
||||
}
|
||||
- Gtk.Label label = new Gtk.Label(text);
|
||||
- label.set_halign(align);
|
||||
- label.set_valign(Gtk.Align.CENTER);
|
||||
- label.set_margin_start(20);
|
||||
- label.set_margin_end(20);
|
||||
- label.set_margin_top(6);
|
||||
- label.set_margin_bottom(6);
|
||||
+ EPaddedLabel label = new EPaddedLabel(text, align);
|
||||
pack_start(label, true, true, 0);
|
||||
}
|
||||
}
|
||||
- private class ETitleLabel : Gtk.Box {
|
||||
- private Gtk.Label m_label;
|
||||
+ private class ETitleLabelBox : Gtk.Box {
|
||||
+ EPaddedLabel m_lang_label;
|
||||
private Gtk.Button m_close_button;
|
||||
private ulong m_close_handler;
|
||||
|
||||
- public ETitleLabel(string text,
|
||||
- Gtk.Align align) {
|
||||
+ public ETitleLabelBox(string text,
|
||||
+ Gtk.Align align) {
|
||||
GLib.Object(
|
||||
- name : "IBusEmojierTitleLabel",
|
||||
+ name : "IBusEmojierTitleLabelBox",
|
||||
orientation : Gtk.Orientation.HORIZONTAL,
|
||||
spacing : 0
|
||||
);
|
||||
- m_label = new Gtk.Label(text);
|
||||
- m_label.set_halign(align);
|
||||
- m_label.set_valign(align);
|
||||
- m_label.set_margin_start(20);
|
||||
- m_label.set_margin_end(20);
|
||||
- m_label.set_margin_top(6);
|
||||
- m_label.set_margin_bottom(6);
|
||||
- pack_start(m_label, true, true, 0);
|
||||
+ EPaddedLabel label = new EPaddedLabel(text, align);
|
||||
+ pack_start(label, true, true, 0);
|
||||
+ Gtk.Separator separator =
|
||||
+ new Gtk.Separator (Gtk.Orientation.VERTICAL);
|
||||
+ pack_start(separator, false, true, 0);
|
||||
+ m_lang_label = new EPaddedLabel("", align);
|
||||
+ pack_start(m_lang_label, false, true, 0);
|
||||
IconWidget icon = new IconWidget("window-close", Gtk.IconSize.MENU);
|
||||
m_close_button = new Gtk.Button();
|
||||
m_close_button.add(icon);
|
||||
@@ -168,8 +176,8 @@ class IBusEmojier : Gtk.Window {
|
||||
m_close_handler = 0;
|
||||
}
|
||||
}
|
||||
- public void set_label(string str) {
|
||||
- m_label.set_label(str);
|
||||
+ public void set_lang_label(string str) {
|
||||
+ m_lang_label.set_label(str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +189,7 @@ class IBusEmojier : Gtk.Window {
|
||||
private const uint EMOJI_GRID_PAGE = 10;
|
||||
private ThemedRGBA m_rgba;
|
||||
private Gtk.Box m_vbox;
|
||||
- private ETitleLabel m_title;
|
||||
+ private ETitleLabelBox m_title;
|
||||
private EEntry m_entry;
|
||||
private string? m_backward;
|
||||
private EScrolledWindow? m_scrolled_window = null;
|
||||
@@ -278,8 +286,8 @@ class IBusEmojier : Gtk.Window {
|
||||
m_vbox = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
|
||||
add(m_vbox);
|
||||
|
||||
- m_title = new ETitleLabel(_("Emoji Dialog"),
|
||||
- Gtk.Align.CENTER);
|
||||
+ m_title = new ETitleLabelBox(_("Emoji Dialog"),
|
||||
+ Gtk.Align.CENTER);
|
||||
m_vbox.add(m_title);
|
||||
m_entry = new EEntry();
|
||||
m_entry.set_placeholder_text(_("Type annotation or choose emoji"));
|
||||
@@ -419,6 +427,21 @@ class IBusEmojier : Gtk.Window {
|
||||
}
|
||||
|
||||
|
||||
+ private string utf8_code_point(string str) {
|
||||
+ StringBuilder buff = new StringBuilder();
|
||||
+ int length = str.char_count();
|
||||
+ for (int i = 0; i < length; i++) {
|
||||
+ unichar ch = str.get_char(0);
|
||||
+ if (i == 0)
|
||||
+ buff.append("U+%04X".printf(ch));
|
||||
+ else
|
||||
+ buff.append(" %04X".printf(ch));
|
||||
+ str = str.next_char();
|
||||
+ }
|
||||
+ return buff.str;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
private void update_emoji_to_data_dict(IBus.EmojiData data,
|
||||
string lang) {
|
||||
string emoji = data.get_emoji();
|
||||
@@ -501,7 +524,7 @@ class IBusEmojier : Gtk.Window {
|
||||
private void remove_all_children() {
|
||||
foreach (Gtk.Widget w in m_vbox.get_children()) {
|
||||
if (w.name == "IBusEmojierEntry" ||
|
||||
- w.name == "IBusEmojierTitleLabel") {
|
||||
+ w.name == "IBusEmojierTitleLabelBox") {
|
||||
continue;
|
||||
}
|
||||
w.destroy();
|
||||
@@ -514,10 +537,9 @@ class IBusEmojier : Gtk.Window {
|
||||
m_scrolled_window = new EScrolledWindow();
|
||||
set_fixed_size();
|
||||
|
||||
- string language = "%s (%s)".printf(
|
||||
- _("Emoji Dialog"),
|
||||
- IBus.get_language_name(m_current_lang_id));
|
||||
- m_title.set_label(language);
|
||||
+ string language =
|
||||
+ IBus.get_language_name(m_current_lang_id);
|
||||
+ m_title.set_lang_label(language);
|
||||
m_vbox.add(m_scrolled_window);
|
||||
Gtk.Viewport viewport = new Gtk.Viewport(null, null);
|
||||
m_scrolled_window.add(viewport);
|
||||
@@ -535,8 +557,8 @@ class IBusEmojier : Gtk.Window {
|
||||
uint n = 1;
|
||||
if (m_favorites.length > 0) {
|
||||
EBoxRow row = new EBoxRow("@favorites");
|
||||
- EPaddedLabel widget =
|
||||
- new EPaddedLabel(_("Favorites"), Gtk.Align.CENTER);
|
||||
+ EPaddedLabelBox widget =
|
||||
+ new EPaddedLabelBox(_("Favorites"), Gtk.Align.CENTER);
|
||||
row.add(widget);
|
||||
m_list_box.add(row);
|
||||
if (n++ == m_category_active_index)
|
||||
@@ -551,9 +573,9 @@ class IBusEmojier : Gtk.Window {
|
||||
foreach (unowned string category in categories) {
|
||||
EBoxRow row = new EBoxRow(category);
|
||||
string locale_category = _(category);
|
||||
- EPaddedLabel widget =
|
||||
- new EPaddedLabel(utf8_title(locale_category),
|
||||
- Gtk.Align.CENTER);
|
||||
+ EPaddedLabelBox widget =
|
||||
+ new EPaddedLabelBox(utf8_title(locale_category),
|
||||
+ Gtk.Align.CENTER);
|
||||
row.add(widget);
|
||||
m_list_box.add(row);
|
||||
if (n++ == m_category_active_index)
|
||||
@@ -626,18 +648,23 @@ class IBusEmojier : Gtk.Window {
|
||||
}
|
||||
|
||||
|
||||
- private bool check_unicode_point(string? annotation=null) {
|
||||
- bool check_xdigit_only = true;
|
||||
- if (annotation == null) {
|
||||
- annotation = m_entry.get_text();
|
||||
- m_unicode_point = null;
|
||||
- check_xdigit_only = false;
|
||||
- }
|
||||
+ private bool check_unicode_point() {
|
||||
+ string annotation = m_entry.get_text();
|
||||
+ m_unicode_point = null;
|
||||
GLib.StringBuilder buff = new GLib.StringBuilder();
|
||||
+ GLib.StringBuilder retval = new GLib.StringBuilder();
|
||||
for (int i = 0; i < annotation.char_count(); i++) {
|
||||
unichar ch = annotation.get_char(i);
|
||||
if (ch == 0)
|
||||
return false;
|
||||
+ if (ch.isspace()) {
|
||||
+ unichar code = (unichar)buff.str.to_ulong(null, 16);
|
||||
+ buff.erase();
|
||||
+ if (!code.validate())
|
||||
+ return false;
|
||||
+ retval.append(code.to_string());
|
||||
+ continue;
|
||||
+ }
|
||||
if (!ch.isxdigit())
|
||||
return false;
|
||||
buff.append_unichar(ch);
|
||||
@@ -645,9 +672,8 @@ class IBusEmojier : Gtk.Window {
|
||||
unichar code = (unichar)buff.str.to_ulong(null, 16);
|
||||
if (!code.validate())
|
||||
return false;
|
||||
- if (check_xdigit_only)
|
||||
- return true;
|
||||
- m_unicode_point = code.to_string();
|
||||
+ retval.append(code.to_string());
|
||||
+ m_unicode_point = retval.str;
|
||||
if (m_unicode_point == null)
|
||||
return true;
|
||||
IBus.Text text = new IBus.Text.from_string(m_unicode_point);
|
||||
@@ -699,9 +725,10 @@ class IBusEmojier : Gtk.Window {
|
||||
if (m_backward != null) {
|
||||
string backward_desc =
|
||||
"%s (%u / %u)".printf(m_backward, cursor, ncandidates - 1);
|
||||
- EPaddedLabel label = new EPaddedLabel(backward_desc,
|
||||
- Gtk.Align.CENTER,
|
||||
- TravelDirection.BACKWARD);
|
||||
+ EPaddedLabelBox label =
|
||||
+ new EPaddedLabelBox(backward_desc,
|
||||
+ Gtk.Align.CENTER,
|
||||
+ TravelDirection.BACKWARD);
|
||||
Gtk.Button button = new Gtk.Button();
|
||||
button.add(label);
|
||||
m_vbox.add(button);
|
||||
@@ -776,27 +803,24 @@ class IBusEmojier : Gtk.Window {
|
||||
IBus.Text candidate = m_lookup_table.get_candidate(cursor);
|
||||
unowned IBus.EmojiData? data =
|
||||
m_emoji_to_data_dict.lookup(candidate.text);
|
||||
- if (cursor == 0 && candidate.text == m_unicode_point) {
|
||||
- EPaddedLabel widget = new EPaddedLabel(
|
||||
- _("Description: Unicode point U+%04X").printf(
|
||||
- m_unicode_point.get_char(0)),
|
||||
- Gtk.Align.START);
|
||||
- m_vbox.add(widget);
|
||||
- widget.show_all();
|
||||
- if (data == null)
|
||||
- return;
|
||||
- } else if (data == null) {
|
||||
+ if (data == null) {
|
||||
// TODO: Provide a custom description and annotation for
|
||||
// the favorite emojis.
|
||||
- EPaddedLabel widget = new EPaddedLabel(
|
||||
+ EPaddedLabelBox widget = new EPaddedLabelBox(
|
||||
_("Description: %s").printf(_("None")),
|
||||
Gtk.Align.START);
|
||||
m_vbox.add(widget);
|
||||
widget.show_all();
|
||||
+ EPaddedLabelBox widget_code = new EPaddedLabelBox(
|
||||
+ _("Code point: %s").printf(
|
||||
+ utf8_code_point(candidate.text)),
|
||||
+ Gtk.Align.START);
|
||||
+ m_vbox.add(widget_code);
|
||||
+ widget_code.show_all();
|
||||
return;
|
||||
} else {
|
||||
unowned string description = data.get_description();
|
||||
- EPaddedLabel widget = new EPaddedLabel(
|
||||
+ EPaddedLabelBox widget = new EPaddedLabelBox(
|
||||
_("Description: %s").printf(description),
|
||||
Gtk.Align.START);
|
||||
m_vbox.add(widget);
|
||||
@@ -812,19 +836,26 @@ class IBusEmojier : Gtk.Window {
|
||||
else
|
||||
buff.append_printf(" | %s", annotation);
|
||||
if (buff.str.char_count() > 30) {
|
||||
- EPaddedLabel widget = new EPaddedLabel(buff.str,
|
||||
- Gtk.Align.START);
|
||||
+ EPaddedLabelBox widget =
|
||||
+ new EPaddedLabelBox(buff.str,
|
||||
+ Gtk.Align.START);
|
||||
m_vbox.add(widget);
|
||||
widget.show_all();
|
||||
buff.erase();
|
||||
}
|
||||
}
|
||||
if (buff.str != "") {
|
||||
- EPaddedLabel widget = new EPaddedLabel(buff.str,
|
||||
- Gtk.Align.START);
|
||||
+ EPaddedLabelBox widget = new EPaddedLabelBox(buff.str,
|
||||
+ Gtk.Align.START);
|
||||
m_vbox.add(widget);
|
||||
widget.show_all();
|
||||
}
|
||||
+ EPaddedLabelBox widget_code = new EPaddedLabelBox(
|
||||
+ _("Code point: %s").printf(
|
||||
+ utf8_code_point(candidate.text)),
|
||||
+ Gtk.Align.START);
|
||||
+ m_vbox.add(widget_code);
|
||||
+ widget_code.show_all();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -837,43 +868,6 @@ class IBusEmojier : Gtk.Window {
|
||||
}
|
||||
|
||||
|
||||
- private bool if_in_range_of_lookup(uint keyval) {
|
||||
- if (!m_candidate_panel_is_visible)
|
||||
- return false;
|
||||
- StringBuilder buffer_string = new StringBuilder(m_entry.get_text());
|
||||
- unichar ch = IBus.keyval_to_unicode (keyval);
|
||||
- buffer_string.append_unichar(ch);
|
||||
- if (check_unicode_point(buffer_string.str))
|
||||
- return false;
|
||||
- if (keyval < Gdk.Key.@0 || keyval > Gdk.Key.@9)
|
||||
- return false;
|
||||
- if (keyval == Gdk.Key.@0)
|
||||
- keyval = Gdk.Key.@9 + 1;
|
||||
- uint index = keyval - Gdk.Key.@1 + 1;
|
||||
- uint candidates = m_lookup_table.get_number_of_candidates();
|
||||
- uint cursor_pos = m_lookup_table.get_cursor_pos();
|
||||
- uint page_size = m_lookup_table.get_page_size();
|
||||
- if (index > uint.min(candidates - (cursor_pos / page_size) * page_size,
|
||||
- page_size)) {
|
||||
- return false;
|
||||
- }
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
-
|
||||
- private void set_number_on_lookup(uint keyval) {
|
||||
- if (keyval == Gdk.Key.@0)
|
||||
- keyval = Gdk.Key.@9 + 1;
|
||||
- uint index = keyval - Gdk.Key.@1;
|
||||
- uint cursor_pos = m_lookup_table.get_cursor_pos();
|
||||
- uint cursor_in_page= m_lookup_table.get_cursor_in_page();
|
||||
- uint real_index = cursor_pos - cursor_in_page + index;
|
||||
- m_lookup_table.set_cursor_pos(real_index);
|
||||
- IBus.Text text = m_lookup_table.get_candidate(real_index);
|
||||
- m_result = text.text;
|
||||
- }
|
||||
-
|
||||
-
|
||||
private void enter_notify_disable_with_timer() {
|
||||
// Enable keyboard operation and disable mouse operation.
|
||||
m_enter_notify_enable = false;
|
||||
@@ -1154,11 +1148,6 @@ class IBusEmojier : Gtk.Window {
|
||||
* key_release_event() so that this can know if the event
|
||||
* was handled by IME.
|
||||
*/
|
||||
- if (if_in_range_of_lookup(keyval)) {
|
||||
- set_number_on_lookup(keyval);
|
||||
- m_loop.quit();
|
||||
- return true;
|
||||
- }
|
||||
switch (keyval) {
|
||||
case Gdk.Key.Escape:
|
||||
if (key_press_cursor_escape())
|
||||
--
|
||||
2.9.3
|
||||
|
||||
From cb0a36c254dc7a96b2a984e715f96cc2ec32e2d5 Mon Sep 17 00:00:00 2001
|
||||
From: fujiwarat <takao.fujiwara1@gmail.com>
|
||||
Date: Mon, 3 Apr 2017 12:24:27 +0900
|
||||
Subject: [PATCH] src: Enable unicode_alt in EmojiOne json file
|
||||
|
||||
EmojiOne json file has unicode_alt property which includes
|
||||
emoji modifer characters.
|
||||
|
||||
Review URL: https://codereview.appspot.com/316420043
|
||||
---
|
||||
src/emoji-parser.c | 20 +++++++++++++++++---
|
||||
src/ibusemoji.c | 48 ++++++++++++++++++++++++++++++++++++++++++++----
|
||||
src/ibusemoji.h | 14 ++++++++++++++
|
||||
ui/gtk3/emojier.vala | 9 ++++++---
|
||||
4 files changed, 81 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/emoji-parser.c b/src/emoji-parser.c
|
||||
index f9e3470..e5dce3f 100644
|
||||
--- a/src/emoji-parser.c
|
||||
+++ b/src/emoji-parser.c
|
||||
@@ -40,6 +40,7 @@
|
||||
typedef struct _EmojiData EmojiData;
|
||||
struct _EmojiData {
|
||||
gchar *emoji;
|
||||
+ gchar *emoji_alternates;
|
||||
GSList *annotations;
|
||||
gboolean is_annotation;
|
||||
gchar *description;
|
||||
@@ -54,6 +55,7 @@ reset_emoji_element (EmojiData *data)
|
||||
g_assert (data != NULL);
|
||||
|
||||
g_clear_pointer (&data->emoji, g_free);
|
||||
+ g_clear_pointer (&data->emoji_alternates, g_free);
|
||||
g_slist_free_full (data->annotations, g_free);
|
||||
data->annotations = NULL;
|
||||
g_clear_pointer (&data->description, g_free);
|
||||
@@ -112,6 +114,10 @@ update_emoji_list (EmojiData *data)
|
||||
"category",
|
||||
data->category ? data->category
|
||||
: g_strdup (""),
|
||||
+ "emoji-alternates",
|
||||
+ data->emoji_alternates
|
||||
+ ? data->emoji_alternates
|
||||
+ : g_strdup (""),
|
||||
NULL);
|
||||
data->list = g_slist_append (data->list, emoji);
|
||||
}
|
||||
@@ -271,7 +277,8 @@ failed_to_parse_unicode_annotations:
|
||||
|
||||
static gboolean
|
||||
parse_emojione_unicode (JsonNode *node,
|
||||
- EmojiData *data)
|
||||
+ EmojiData *data,
|
||||
+ gboolean is_alternates)
|
||||
{
|
||||
const gchar *str, *unicode;
|
||||
gchar *endptr = NULL;
|
||||
@@ -305,7 +312,10 @@ parse_emojione_unicode (JsonNode *node,
|
||||
endptr = NULL;
|
||||
}
|
||||
|
||||
- data->emoji = g_string_free (emoji, FALSE);
|
||||
+ if (is_alternates)
|
||||
+ data->emoji_alternates = g_string_free (emoji, FALSE);
|
||||
+ else
|
||||
+ data->emoji = g_string_free (emoji, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -480,7 +490,11 @@ parse_emojione_emoji_data (JsonNode *node,
|
||||
EmojiData *data)
|
||||
{
|
||||
if (g_strcmp0 (member, "unicode") == 0)
|
||||
- return parse_emojione_unicode (node, data);
|
||||
+ return parse_emojione_unicode (node, data, FALSE);
|
||||
+ else if (g_strcmp0 (member, "unicode_alt") == 0)
|
||||
+ return parse_emojione_unicode (node, data, TRUE);
|
||||
+ else if (g_strcmp0 (member, "unicode_alternates") == 0)
|
||||
+ return parse_emojione_unicode (node, data, TRUE);
|
||||
else if (g_strcmp0 (member, "shortname") == 0)
|
||||
return parse_emojione_shortname (node, data);
|
||||
else if (g_strcmp0 (member, "name") == 0)
|
||||
diff --git a/src/ibusemoji.c b/src/ibusemoji.c
|
||||
index c61cd70..4be092a 100644
|
||||
--- a/src/ibusemoji.c
|
||||
+++ b/src/ibusemoji.c
|
||||
@@ -29,14 +29,15 @@
|
||||
#include "ibusinternal.h"
|
||||
|
||||
#define IBUS_EMOJI_DATA_MAGIC "IBusEmojiData"
|
||||
-#define IBUS_EMOJI_DATA_VERSION (2)
|
||||
+#define IBUS_EMOJI_DATA_VERSION (3)
|
||||
|
||||
enum {
|
||||
PROP_0 = 0,
|
||||
PROP_EMOJI,
|
||||
PROP_ANNOTATIONS,
|
||||
PROP_DESCRIPTION,
|
||||
- PROP_CATEGORY
|
||||
+ PROP_CATEGORY,
|
||||
+ PROP_EMOJI_ALTERNATES
|
||||
};
|
||||
|
||||
struct _IBusEmojiDataPrivate {
|
||||
@@ -44,6 +45,7 @@ struct _IBusEmojiDataPrivate {
|
||||
GSList *annotations;
|
||||
gchar *description;
|
||||
gchar *category;
|
||||
+ gchar *emoji_alternates;
|
||||
};
|
||||
|
||||
#define IBUS_EMOJI_DATA_GET_PRIVATE(o) \
|
||||
@@ -142,6 +144,19 @@ ibus_emoji_data_class_init (IBusEmojiDataClass *class)
|
||||
"The emoji category",
|
||||
"",
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
+
|
||||
+ /**
|
||||
+ * IBusEmojiData:emoji_alternates:
|
||||
+ *
|
||||
+ * The emoji alternate characters
|
||||
+ */
|
||||
+ g_object_class_install_property (gobject_class,
|
||||
+ PROP_EMOJI_ALTERNATES,
|
||||
+ g_param_spec_string ("emoji-alternates",
|
||||
+ "emoji alternate charasters",
|
||||
+ "The emoji alternate characters UTF-8",
|
||||
+ "",
|
||||
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -180,19 +195,24 @@ ibus_emoji_data_set_property (IBusEmojiData *emoji,
|
||||
emoji->priv->emoji = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_ANNOTATIONS:
|
||||
- g_assert (emoji->priv->annotations == NULL);
|
||||
+ if (emoji->priv->annotations)
|
||||
+ g_slist_free_full (emoji->priv->annotations, g_free);
|
||||
emoji->priv->annotations =
|
||||
g_slist_copy_deep (g_value_get_pointer (value),
|
||||
(GCopyFunc) g_strdup, NULL);
|
||||
break;
|
||||
case PROP_DESCRIPTION:
|
||||
- g_assert (emoji->priv->description == NULL);
|
||||
+ g_free (emoji->priv->description);
|
||||
emoji->priv->description = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_CATEGORY:
|
||||
g_assert (emoji->priv->category == NULL);
|
||||
emoji->priv->category = g_value_dup_string (value);
|
||||
break;
|
||||
+ case PROP_EMOJI_ALTERNATES:
|
||||
+ g_assert (emoji->priv->emoji_alternates == NULL);
|
||||
+ emoji->priv->emoji_alternates = g_value_dup_string (value);
|
||||
+ break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (emoji, prop_id, pspec);
|
||||
}
|
||||
@@ -220,6 +240,9 @@ ibus_emoji_data_get_property (IBusEmojiData *emoji,
|
||||
case PROP_CATEGORY:
|
||||
g_value_set_string (value, ibus_emoji_data_get_category (emoji));
|
||||
break;
|
||||
+ case PROP_EMOJI_ALTERNATES:
|
||||
+ g_value_set_string (value, ibus_emoji_data_get_emoji_alternates(emoji));
|
||||
+ break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (emoji, prop_id, pspec);
|
||||
}
|
||||
@@ -247,6 +270,9 @@ ibus_emoji_data_serialize (IBusEmojiData *emoji,
|
||||
}
|
||||
g_variant_builder_add (builder, "s", NOTNULL (emoji->priv->description));
|
||||
g_variant_builder_add (builder, "s", NOTNULL (emoji->priv->category));
|
||||
+ g_variant_builder_add (builder, "s",
|
||||
+ NOTNULL (emoji->priv->emoji_alternates));
|
||||
+#undef NOTNULL
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -277,6 +303,10 @@ ibus_emoji_data_deserialize (IBusEmojiData *emoji,
|
||||
&emoji->priv->description);
|
||||
ibus_g_variant_get_child_string (variant, retval++,
|
||||
&emoji->priv->category);
|
||||
+ if (g_variant_n_children (variant) < retval + 1)
|
||||
+ return retval;
|
||||
+ ibus_g_variant_get_child_string (variant, retval++,
|
||||
+ &emoji->priv->emoji_alternates);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -295,6 +325,7 @@ ibus_emoji_data_copy (IBusEmojiData *dest,
|
||||
NULL);
|
||||
dest->priv->description = g_strdup (src->priv->description);
|
||||
dest->priv->category = g_strdup (src->priv->category);
|
||||
+ dest->priv->emoji_alternates = g_strdup (src->priv->emoji_alternates);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -314,6 +345,7 @@ ibus_emoji_data_new (const gchar *first_property_name, ...)
|
||||
g_assert (emoji->priv->emoji != NULL);
|
||||
g_assert (emoji->priv->description != NULL);
|
||||
g_assert (emoji->priv->category != NULL);
|
||||
+ g_assert (emoji->priv->emoji_alternates != NULL);
|
||||
return emoji;
|
||||
}
|
||||
|
||||
@@ -370,6 +402,14 @@ ibus_emoji_data_get_category (IBusEmojiData *emoji)
|
||||
return emoji->priv->category;
|
||||
}
|
||||
|
||||
+const gchar *
|
||||
+ibus_emoji_data_get_emoji_alternates (IBusEmojiData *emoji)
|
||||
+{
|
||||
+ g_return_val_if_fail (IBUS_IS_EMOJI_DATA (emoji), NULL);
|
||||
+
|
||||
+ return emoji->priv->emoji_alternates;
|
||||
+}
|
||||
+
|
||||
|
||||
static void
|
||||
variant_foreach_add_emoji (IBusEmojiData *emoji,
|
||||
diff --git a/src/ibusemoji.h b/src/ibusemoji.h
|
||||
index eb24fdd..233cadd 100644
|
||||
--- a/src/ibusemoji.h
|
||||
+++ b/src/ibusemoji.h
|
||||
@@ -156,6 +156,20 @@ const gchar * ibus_emoji_data_get_category (IBusEmojiData *emoji);
|
||||
|
||||
|
||||
/**
|
||||
+ * ibus_emoji_data_get_emoji_alternates:
|
||||
+ * @emoji : An #IBusEmojiData
|
||||
+ *
|
||||
+ * Gets the emoji alternate characters in #IBusEmojiData. It should not be
|
||||
+ * freed. The alternates are defined in "unicode_alt" in EmojiOne json.
|
||||
+ *
|
||||
+ * Returns: emoji alternates property in #IBusEmojiData
|
||||
+ *
|
||||
+ */
|
||||
+const gchar * ibus_emoji_data_get_emoji_alternates
|
||||
+ (IBusEmojiData *emoji);
|
||||
+
|
||||
+
|
||||
+/**
|
||||
* ibus_emoji_dict_save:
|
||||
* @path: A path of the saved dictionary file.
|
||||
* @dict: (element-type utf8 gpointer) (transfer none): An Emoji dictionary
|
||||
diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
|
||||
index 8a2726c..7b6107f 100644
|
||||
--- a/ui/gtk3/emojier.vala
|
||||
+++ b/ui/gtk3/emojier.vala
|
||||
@@ -381,7 +381,8 @@ class IBusEmojier : Gtk.Window {
|
||||
|
||||
|
||||
private void update_annotation_to_emojis_dict(IBus.EmojiData data) {
|
||||
- string emoji = data.get_emoji();
|
||||
+ string emoji = (data.get_emoji_alternates() != "") ?
|
||||
+ data.get_emoji_alternates() : data.get_emoji();
|
||||
unowned GLib.SList<string> annotations = data.get_annotations();
|
||||
foreach (string annotation in annotations) {
|
||||
bool has_emoji = false;
|
||||
@@ -444,7 +445,8 @@ class IBusEmojier : Gtk.Window {
|
||||
|
||||
private void update_emoji_to_data_dict(IBus.EmojiData data,
|
||||
string lang) {
|
||||
- string emoji = data.get_emoji();
|
||||
+ string emoji = (data.get_emoji_alternates() != "") ?
|
||||
+ data.get_emoji_alternates() : data.get_emoji();
|
||||
if (lang == "en") {
|
||||
string description = utf8_down(data.get_description());
|
||||
unowned GLib.SList<string> annotations = data.get_annotations();
|
||||
@@ -496,7 +498,8 @@ class IBusEmojier : Gtk.Window {
|
||||
|
||||
private void update_category_to_emojis_dict(IBus.EmojiData data,
|
||||
string lang) {
|
||||
- string emoji = data.get_emoji();
|
||||
+ string emoji = (data.get_emoji_alternates() != "") ?
|
||||
+ data.get_emoji_alternates() : data.get_emoji();
|
||||
string category = data.get_category();
|
||||
if (lang == "en" && category != "") {
|
||||
bool has_emoji = false;
|
||||
--
|
||||
2.9.3
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
Name: ibus
|
||||
Version: 1.5.15
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
Summary: Intelligent Input Bus for Linux OS
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
@ -427,6 +427,11 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache &> /dev/null || :
|
||||
%{_datadir}/gtk-doc/html/*
|
||||
|
||||
%changelog
|
||||
* Wed Apr 05 2017 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.15-6
|
||||
- Enabled unicode_alt in EmojiOne json file
|
||||
- Enabled to type multiple code points on Emojier
|
||||
- Fixed IBusEmojiDialog_1_0_gir_LIBS for --as-needed LDFLAGS
|
||||
|
||||
* Mon Mar 27 2017 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.15-5
|
||||
- Moved language setting on IBusEmojier to ibus-setup.
|
||||
- Enabled strcasecmp to match emoji annotations.
|
||||
|
Loading…
Reference in New Issue
Block a user