[gtk+/wip/matthiasc/emoji-picker] Use the emoji data in gvariant form
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/emoji-picker] Use the emoji data in gvariant form
- Date: Thu, 10 Aug 2017 02:31:53 +0000 (UTC)
commit 8bc31ba056fe3b5e11b1003ae37f94f2897bf45f
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Aug 9 22:30:57 2017 -0400
Use the emoji data in gvariant form
tests/gtkemojipicker.c | 858 +++++-------------------------------------------
1 files changed, 87 insertions(+), 771 deletions(-)
---
diff --git a/tests/gtkemojipicker.c b/tests/gtkemojipicker.c
index eaf4654..f347873 100644
--- a/tests/gtkemojipicker.c
+++ b/tests/gtkemojipicker.c
@@ -3,727 +3,6 @@
#include "gtkemojipicker.h"
-typedef struct {
- gunichar code;
- gboolean is_modifier_base;
- gunichar code2;
- const char **keywords;
-} EmojiData;
-
-static EmojiData people[] = {
- // face-positive
- { 0x1f600, 0, 0, (const char *[]) { "face", "grin", NULL } },
- { 0x1f601, 0, 0, (const char *[]) { "eye", "face", "grin", "smile", NULL } },
- { 0x1f602, 0, 0, (const char *[]) { "face", "joy", "laugh", "tear", NULL } },
- { 0x1f923, 0, 0, (const char *[]) { "face", "floor", "laugh", "rolling", NULL } },
- { 0x1f603, 0, 0, (const char *[]) { "face", "mouth", "open", "smiling", NULL } },
- { 0x1f604, 0, 0, (const char *[]) { "eye", "face", "mouth", "open", "smile", NULL } },
- { 0x1f605, 0, 0, (const char *[]) { "cold", "face", "open", "smile", "sweat", NULL } },
- { 0x1f606, 0, 0, (const char *[]) { "face", "laugh", "mouth", "open", "satisfied", "smile", NULL } },
- { 0x1f609, 0, 0, (const char *[]) { "face", "wink", NULL } },
- { 0x1f60a, 0, 0, (const char *[]) { "blush", "eye", "face", "smile", NULL } },
- { 0x1f60b, 0, 0, (const char *[]) { "delicious", "face", "savouring", "smile", "yum", NULL } },
- { 0x1f60e, 0, 0, (const char *[]) { "bright", "cool", "eye", "eyewear", "face", "glasses", "smile", "sun",
"sunglasses", NULL } },
- { 0x1f60d, 0, 0, (const char *[]) { NULL } },
- { 0x1f618, 0, 0, (const char *[]) { NULL } },
- { 0x1f617, 0, 0, (const char *[]) { NULL } },
- { 0x1f619, 0, 0, (const char *[]) { NULL } },
- { 0x1f61a, 0, 0, (const char *[]) { NULL } },
- { 0x1f642, 0, 0, (const char *[]) { NULL } },
- { 0x1f917, 0, 0, (const char *[]) { NULL } },
- { 0x1f929, 0, 0, (const char *[]) { NULL } },
- // face-neutral
- { 0x1f914, 0, 0, NULL },
- { 0x1f928, 0, 0, NULL },
- { 0x1f610, 0, 0, NULL },
- { 0x1f611, 0, 0, NULL },
- { 0x1f636, 0, 0, NULL },
- { 0x1f644, 0, 0, NULL },
- { 0x1f60f, 0, 0, NULL },
- { 0x1f623, 0, 0, NULL },
- { 0x1f625, 0, 0, NULL },
- { 0x1f62e, 0, 0, NULL },
- { 0x1f910, 0, 0, NULL },
- { 0x1f62f, 0, 0, NULL },
- { 0x1f62a, 0, 0, NULL },
- { 0x1f62b, 0, 0, NULL },
- { 0x1f634, 0, 0, NULL },
- { 0x1f60c, 0, 0, NULL },
- { 0x1f61b, 0, 0, NULL },
- { 0x1f61c, 0, 0, NULL },
- { 0x1f61d, 0, 0, NULL },
- { 0x1f924, 0, 0, NULL },
- { 0x1f612, 0, 0, NULL },
- { 0x1f613, 0, 0, NULL },
- { 0x1f614, 0, 0, NULL },
- { 0x1f615, 0, 0, NULL },
- { 0x1f643, 0, 0, NULL },
- { 0x1f911, 0, 0, NULL },
- { 0x1f632, 0, 0, NULL },
- //face-negative
- { 0x02639, 0, 0, NULL },
- { 0x1f641, 0, 0, NULL },
- { 0x1f616, 0, 0, NULL },
- { 0x1f61e, 0, 0, NULL },
- { 0x1f61f, 0, 0, NULL },
- { 0x1f624, 0, 0, NULL },
- { 0x1f622, 0, 0, NULL },
- { 0x1f62d, 0, 0, NULL },
- { 0x1f626, 0, 0, NULL },
- { 0x1f627, 0, 0, NULL },
- { 0x1f628, 0, 0, NULL },
- { 0x1f629, 0, 0, NULL },
- { 0x1f92f, 0, 0, NULL },
- { 0x1f62c, 0, 0, NULL },
- { 0x1f630, 0, 0, NULL },
- { 0x1f631, 0, 0, NULL },
- { 0x1f633, 0, 0, NULL },
- { 0x1f92a, 0, 0, NULL },
- { 0x1f635, 0, 0, NULL },
- { 0x1f621, 0, 0, NULL },
- { 0x1f620, 0, 0, NULL },
- { 0x1f92c, 0, 0, NULL },
- // face-sick
- { 0x1f637, 0, 0, NULL },
- { 0x1f912, 0, 0, NULL },
- { 0x1f915, 0, 0, NULL },
- { 0x1f922, 0, 0, NULL },
- { 0x1f92e, 0, 0, NULL },
- { 0x1f927, 0, 0, NULL },
- // face-role
- { 0x1f607, 0, 0, NULL },
- { 0x1f920, 0, 0, NULL },
- { 0x1f921, 0, 0, NULL },
- { 0x1f925, 0, 0, NULL },
- { 0x1f92b, 0, 0, NULL },
- { 0x1f92d, 0, 0, NULL },
- { 0x1f9d0, 0, 0, NULL },
- { 0x1f913, 0, 0, NULL },
- // face-fantasy
- { 0x1f608, 0, 0, NULL },
- { 0x1f47f, 0, 0, NULL },
- { 0x1f479, 0, 0, NULL },
- { 0x1f47a, 0, 0, NULL },
- { 0x1f480, 0, 0, NULL },
- { 0x02620, 0, 0, NULL },
- { 0x1f47b, 0, 0, NULL },
- { 0x1f47d, 0, 0, NULL },
- { 0x1f47e, 0, 0, NULL },
- { 0x1f916, 0, 0, NULL },
- { 0x1f4a9, 0, 0, NULL },
- // cat-face
- { 0x1f63a, 0, 0, NULL },
- { 0x1f638, 0, 0, NULL },
- { 0x1f63b, 0, 0, NULL },
- { 0x1f63c, 0, 0, NULL },
- { 0x1f63d, 0, 0, NULL },
- { 0x1f640, 0, 0, NULL },
- { 0x1f63f, 0, 0, NULL },
- { 0x1f63e, 0, 0, NULL },
- // monkey-face
- { 0x1f648, 0, 0, NULL },
- { 0x1f649, 0, 0, NULL },
- { 0x1f64a, 0, 0, NULL },
- // person
- { 0x1f476, 1, 0, NULL },
- { 0x1f9d2, 1, 0, NULL },
- { 0x1f466, 1, 0, NULL },
- { 0x1f467, 1, 0, NULL },
- { 0x1f9d1, 1, 0, NULL },
- { 0x1f468, 1, 0, NULL },
- { 0x1f469, 1, 0, NULL },
- { 0x1f9d3, 1, 0, NULL },
- { 0x1f474, 1, 0, NULL },
- { 0x1f475, 1, 0, NULL },
- // person-role
- { 0x1f468, 1, 0x02695, NULL },
- { 0x1f469, 1, 0x02695, NULL },
- { 0x1f468, 1, 0x1f393, NULL },
- { 0x1f469, 1, 0x1f393, NULL },
- { 0x1f468, 1, 0x1f3eb, NULL },
- { 0x1f469, 1, 0x1f3eb, NULL },
- { 0x1f468, 1, 0x02696, NULL },
- { 0x1f469, 1, 0x02696, NULL },
- { 0x1f468, 1, 0x1f33e, NULL },
- { 0x1f469, 1, 0x1f33e, NULL },
- { 0x1f468, 1, 0x1f373, NULL },
- { 0x1f469, 1, 0x1f373, NULL },
- { 0x1f468, 1, 0x1f527, NULL },
- { 0x1f469, 1, 0x1f527, NULL },
- { 0x1f468, 1, 0x1f3ed, NULL },
- { 0x1f469, 1, 0x1f3ed, NULL },
- { 0x1f468, 1, 0x1f4bc, NULL },
- { 0x1f469, 1, 0x1f4bc, NULL },
- { 0x1f468, 1, 0x1f52c, NULL },
- { 0x1f469, 1, 0x1f52c, NULL },
- { 0x1f468, 1, 0x1f4bb, NULL },
- { 0x1f469, 1, 0x1f4bb, NULL },
- { 0x1f468, 1, 0x1f3a4, NULL },
- { 0x1f469, 1, 0x1f3a4, NULL },
- { 0x1f468, 1, 0x1f3a8, NULL },
- { 0x1f469, 1, 0x1f3a8 , NULL},
- { 0x1f468, 1, 0x02708, NULL },
- { 0x1f469, 1, 0x02708, NULL },
- { 0x1f468, 1, 0x1f680, NULL },
- { 0x1f469, 1, 0x1f680, NULL },
- { 0x1f468, 1, 0x1f692, NULL },
- { 0x1f469, 1, 0x1f692, NULL },
- { 0x1f46e, 1, 0, NULL },
- { 0x1f46e, 1, 0x2642, NULL },
- { 0x1f46e, 1, 0x2640, NULL },
- { 0x1f575, 1, 0, NULL },
- { 0x1f575, 1, 0x2642, NULL },
- { 0x1f575, 1, 0x2640, NULL },
- { 0x1f482, 1, 0, NULL },
- { 0x1f482, 1, 0x2642, NULL },
- { 0x1f482, 1, 0x2640, NULL },
- { 0x1f477, 1, 0, NULL },
- { 0x1f477, 1, 0x2642, NULL },
- { 0x1f477, 1, 0x2640, NULL },
- { 0x1f934, 1, 0, NULL },
- { 0x1f478, 1, 0, NULL },
- { 0x1f473, 1, 0, NULL },
- { 0x1f473, 1, 0x2642, NULL },
- { 0x1f473, 1, 0x2640, NULL },
- { 0x1f472, 1, 0, NULL },
- { 0x1f9d5, 1, 0, NULL },
- { 0x1f9d4, 1, 0, NULL },
- { 0x1f471, 1, 0, NULL },
- { 0x1f471, 1, 0x2642, NULL },
- { 0x1f471, 1, 0x2640, NULL },
- { 0x1f935, 1, 0, NULL },
- { 0x1f470, 1, 0, NULL },
- { 0x1f930, 1, 0, NULL },
- { 0x1f931, 1, 0, NULL },
- // person-fantasy
- { 0x1f47c, 1, 0, NULL },
- { 0x1f385, 1, 0, NULL },
- { 0x1f936, 1, 0, NULL },
- { 0x1f9d9, 1, 0, NULL },
- { 0x1f9d9, 1, 0x2642, NULL },
- { 0x1f9d9, 1, 0x2640, NULL },
- { 0x1f9da, 1, 0, NULL },
- { 0x1f9da, 1, 0x2642, NULL },
- { 0x1f9da, 1, 0x2640, NULL },
- { 0x1f9db, 1, 0, NULL },
- { 0x1f9db, 1, 0x2642, NULL },
- { 0x1f9db, 1, 0x2640, NULL },
- { 0x1f9dc, 1, 0, NULL },
- { 0x1f9dc, 1, 0x2642, NULL },
- { 0x1f9dc, 1, 0x2640, NULL },
- { 0x1f9dd, 1, 0, NULL },
- { 0x1f9dd, 1, 0x2642, NULL },
- { 0x1f9dd, 1, 0x2640, NULL },
- { 0x1f9de, 0, 0, NULL },
- { 0x1f9de, 0, 0x2642, NULL },
- { 0x1f9de, 0, 0x2640, NULL },
- { 0x1f9df, 0, 0, NULL },
- { 0x1f9df, 0, 0x2642, NULL },
- { 0x1f9df, 0, 0x2640, NULL },
- // person-gesture
- { 0x1f64d, 1, 0, NULL },
- { 0x1f64d, 1, 0x2642, NULL },
- { 0x1f64d, 1, 0x2640, NULL },
- { 0x1f64e, 1, 0, NULL },
- { 0x1f64e, 1, 0x2642, NULL },
- { 0x1f64e, 1, 0x2640, NULL },
- { 0x1f645, 1, 0, NULL },
- { 0x1f645, 1, 0x2642, NULL },
- { 0x1f645, 1, 0x2640, NULL },
- { 0x1f646, 1, 0, NULL },
- { 0x1f646, 1, 0x2642, NULL },
- { 0x1f646, 1, 0x2640, NULL },
- { 0x1f481, 1, 0, NULL },
- { 0x1f481, 1, 0x2642, NULL },
- { 0x1f481, 1, 0x2640, NULL },
- { 0x1f64b, 1, 0, NULL },
- { 0x1f64b, 1, 0x2642, NULL },
- { 0x1f64b, 1, 0x2640, NULL },
- { 0x1f647, 1, 0, NULL },
- { 0x1f647, 1, 0x2642, NULL },
- { 0x1f647, 1, 0x2640, NULL },
- { 0x1f926, 1, 0, NULL },
- { 0x1f926, 1, 0x2642, NULL },
- { 0x1f926, 1, 0x2640, NULL },
- { 0x1f937, 1, 0, NULL },
- { 0x1f937, 1, 0x2642, NULL },
- { 0x1f937, 1, 0x2640, NULL },
- // person-activity
- { 0x1f486, 1, 0, NULL },
- { 0x1f486, 1, 0x2642, NULL },
- { 0x1f486, 1, 0x2640, NULL },
- { 0x1f487, 1, 0, NULL },
- { 0x1f487, 1, 0x2642, NULL },
- { 0x1f487, 1, 0x2640, NULL },
- { 0x1f6b6, 1, 0, NULL },
- { 0x1f6b6, 1, 0x2642, NULL },
- { 0x1f6b6, 1, 0x2640, NULL },
- { 0x1f3c3, 1, 0, NULL },
- { 0x1f3c3, 1, 0x2642, NULL },
- { 0x1f3c3, 1, 0x2640, NULL },
- { 0x1f483, 1, 0, NULL },
- { 0x1f57a, 1, 0, NULL },
- { 0x1f46f, 1, 0, NULL },
- { 0x1f46f, 1, 0x2642, NULL },
- { 0x1f46f, 1, 0x2640, NULL },
- { 0x1f9d6, 1, 0, NULL },
- { 0x1f9d6, 1, 0x2642, NULL },
- { 0x1f9d6, 1, 0x2640, NULL },
- { 0x1f9d7, 1, 0, NULL },
- { 0x1f9d7, 1, 0x2642, NULL },
- { 0x1f9d7, 1, 0x2640, NULL },
- { 0x1f9d8, 1, 0, NULL },
- { 0x1f9d8, 1, 0x2642, NULL },
- { 0x1f9d8, 1, 0x2640, NULL },
- { 0x1f6c0, 1, 0, NULL },
- { 0x1f6cc, 1, 0, NULL },
- { 0x1f574, 1, 0, NULL },
- { 0x1f5e3, 0, 0, NULL },
- { 0x1f464, 0, 0, NULL },
- { 0x1f465, 0, 0, NULL },
- // person-sport
- { 0x1f93a, 0, 0, NULL },
- { 0x1f3c7, 1, 0, NULL },
- { 0x026f7, 0, 0, NULL },
- { 0x1f3c2, 1, 0, NULL },
- { 0x1f3cc, 1, 0, NULL },
- { 0x1f3cc, 1, 0x2642, NULL },
- { 0x1f3cc, 1, 0x2640, NULL },
- { 0x1f3c4, 1, 0, NULL },
- { 0x1f3c4, 1, 0x2642, NULL },
- { 0x1f3c4, 1, 0x2640, NULL },
- { 0x1f6a3, 1, 0, NULL },
- { 0x1f6a3, 1, 0x2642, NULL },
- { 0x1f6a3, 1, 0x2640, NULL },
- { 0x1f3ca, 1, 0, NULL },
- { 0x1f3ca, 1, 0x2642, NULL },
- { 0x1f3ca, 1, 0x2640, NULL },
- { 0x026f9, 1, 0, NULL },
- { 0x026f9, 1, 0x2642, NULL },
- { 0x026f9, 1, 0x2640, NULL },
- { 0x1f3cb, 1, 0, NULL },
- { 0x1f3cb, 1, 0x2642, NULL },
- { 0x1f3cb, 1, 0x2640, NULL },
-
- { 0x1f6b4, 1, 0, NULL },
- { 0x1f6b4, 1, 0x2642, NULL },
- { 0x1f6b4, 1, 0x2640, NULL },
- { 0x1f6b5, 1, 0, NULL },
- { 0x1f6b5, 1, 0x2642, NULL },
- { 0x1f6b5, 1, 0x2640, NULL },
- { 0x1f3ce, 0, 0, NULL },
- { 0x1f3cd, 0, 0, NULL },
- { 0x1f938, 1, 0, NULL },
- { 0x1f938, 1, 0x2642, NULL },
- { 0x1f938, 1, 0x2640, NULL },
- { 0x1f93c, 0, 0, NULL },
- { 0x1f93c, 0, 0x2642, NULL },
- { 0x1f93c, 0, 0x2640, NULL },
- { 0x1f93d, 1, 0, NULL },
- { 0x1f93d, 1, 0x2642, NULL },
- { 0x1f93d, 1, 0x2640, NULL },
- { 0x1f93e, 1, 0, NULL },
- { 0x1f93e, 1, 0x2642, NULL },
- { 0x1f93e, 1, 0x2640, NULL },
- { 0x1f939, 1, 0, NULL },
- { 0x1f939, 1, 0x2642, NULL },
- { 0x1f939, 1, 0x2640, NULL },
- // family
- { 0x1f46b, 0, 0, NULL },
- { 0x1f46c, 0, 0, NULL },
- { 0x1f46d, 0, 0, NULL },
- { 0x1f48f, 0, 0, NULL },
- // 0x1f469 0x200d 0x274 0xfe0f 0x200d 0x1f48b 0x200d 0x1f468
- // 0x1f468 0x200d 0x274 0xfe0f 0x200d 0x1f48b 0x200d 0x1f468
- // 0x1f469 0x200d 0x274 0xfe0f 0x200d 0x1f48b 0x200d 0x1f469
- { 0x1f491, 0, 0, NULL },
- // 3 long sequences omitted
- { 0x1f46a, 0, 0, NULL },
- // 15 long sequences omitted
- { 0x1f468, 0, 0x1f466, NULL },
- // 1 long sequence omitted
- { 0x1f468, 0, 0x1f467, NULL },
- // 1 long sequence omitted
- { 0x1f469, 0, 0x1f466, NULL },
- // 1 long sequence omitted
- { 0x1f469, 0, 0x1f467, NULL },
- // 2 long sequences omitted
- // body
- { 0x1f933, 1, 0, NULL },
- { 0x1f4aa, 1, 0, NULL },
- { 0x1f448, 1, 0, NULL },
- { 0x1f449, 1, 0, NULL },
- { 0x0261d, 1, 0, NULL },
- { 0x1f446, 1, 0, NULL },
- { 0x1f595, 1, 0, NULL },
- { 0x1f447, 1, 0, NULL },
- { 0x0270c, 1, 0, NULL },
- { 0x1f91e, 1, 0, NULL },
- { 0x1f596, 1, 0, NULL },
- { 0x1f918, 1, 0, NULL },
- { 0x1f919, 1, 0, NULL },
- { 0x1f590, 1, 0, NULL },
- { 0x0270b, 1, 0, NULL },
- { 0x1f44c, 1, 0, NULL },
- { 0x1f44d, 1, 0, NULL },
- { 0x1f44e, 1, 0, NULL },
- { 0x0270a, 1, 0, NULL },
- { 0x1f44a, 1, 0, NULL },
- { 0x1f91b, 1, 0, NULL },
- { 0x1f91c, 1, 0, NULL },
- { 0x1f91a, 1, 0, NULL },
- { 0x1f44b, 1, 0, NULL },
- { 0x1f91f, 1, 0, NULL },
- { 0x0270d, 1, 0, NULL },
- { 0x1f44f, 1, 0, NULL },
- { 0x1f450, 1, 0, NULL },
- { 0x1f64c, 1, 0, NULL },
- { 0x1f932, 1, 0, NULL },
- { 0x1f64f, 1, 0, NULL },
- { 0x1f91d, 0, 0, NULL },
- { 0x1f485, 1, 0, NULL },
- { 0x1f442, 1, 0, NULL },
- { 0x1f443, 1, 0, NULL },
- { 0x1f463, 0, 0, NULL },
- { 0x1f440, 0, 0, NULL },
- { 0x1f441, 0, 0, NULL },
- // 1 long sequence omitted
- { 0x1f9e0, 0, 0, NULL },
- { 0x1f445, 0, 0, NULL },
- { 0x1f444, 0, 0, NULL },
- // emotion
- { 0x1f48b, 0, 0, NULL },
- { 0x1f498, 0, 0, NULL },
- { 0x02764, 0, 0, NULL },
- { 0x1f493, 0, 0, NULL },
- { 0x1f494, 0, 0, NULL },
- { 0x1f495, 0, 0, NULL },
- { 0x1f496, 0, 0, NULL },
- { 0x1f497, 0, 0, NULL },
- { 0x1f499, 0, 0, NULL },
- { 0x1f49a, 0, 0, NULL },
- { 0x1f498, 0, 0, NULL },
- { 0x1f9e1, 0, 0, NULL },
- { 0x1f49c, 0, 0, NULL },
- { 0x1f5a4, 0, 0, NULL },
- { 0x1f49d, 0, 0, NULL },
- { 0x1f49e, 0, 0, NULL },
- { 0x1f49f, 0, 0, NULL },
- { 0x02763, 0, 0, NULL },
- { 0x1f48c, 0, 0, NULL },
- { 0x1f4a4, 0, 0, NULL },
- { 0x1f4a2, 0, 0, NULL },
- { 0x1f4a3, 0, 0, NULL },
- { 0x1f4a5, 0, 0, NULL },
- { 0x1f4a6, 0, 0, NULL },
- { 0x1f4a8, 0, 0, NULL },
- { 0x1f4ab, 0, 0, NULL },
- { 0x1f4ac, 0, 0, NULL },
- { 0x1f5e8, 0, 0, NULL },
- { 0x1f5ef, 0, 0, NULL },
- { 0x1f4ad, 0, 0, NULL },
- { 0x1f573, 0, 0, NULL },
- // clothing
- { 0x1f453, 0, 0, NULL },
- { 0x1f576, 0, 0, NULL },
- { 0x1f454, 0, 0, NULL },
- { 0x1f455, 0, 0, NULL },
- { 0x1f456, 0, 0, NULL },
- { 0x1f9e3, 0, 0, NULL },
- { 0x1f9e4, 0, 0, NULL },
- { 0x1f9e5, 0, 0, NULL },
- { 0x1f9e6, 0, 0, NULL },
- { 0x1f457, 0, 0, NULL },
- { 0x1f458, 0, 0, NULL },
- { 0x1f459, 0, 0, NULL },
- { 0x1f45a, 0, 0, NULL },
- { 0x1f45b, 0, 0, NULL },
- { 0x1f45c, 0, 0, NULL },
- { 0x1f45d, 0, 0, NULL },
- { 0x1f6cd, 0, 0, NULL },
- { 0x1f392, 0, 0, NULL },
- { 0x1f45e, 0, 0, NULL },
- { 0x1f45f, 0, 0, NULL },
- { 0x1f460, 0, 0, NULL },
- { 0x1f461, 0, 0, NULL },
- { 0x1f462, 0, 0, NULL },
- { 0x1f451, 0, 0, NULL },
- { 0x1f452, 0, 0, NULL },
- { 0x1f3a9, 0, 0, NULL },
- { 0x1f393, 0, 0, NULL },
- { 0x1f9e2, 0, 0, NULL },
- { 0x026d1, 0, 0, NULL },
- { 0x1f4ff, 0, 0, NULL },
- { 0x1f484, 0, 0, NULL },
- { 0x1f48d, 0, 0, NULL },
- { 0x1f48e, 0, 0, NULL },
-};
-
-static EmojiData nature[] = {
- // animal-mammal
- { 0x1f435, 0, 0, NULL },
- { 0x1f412, 0, 0, NULL },
- { 0x1f980, 0, 0, NULL },
- { 0x1f436, 0, 0, NULL },
- { 0x1f415, 0, 0, NULL },
- { 0x1f429, 0, 0, NULL },
- { 0x1f43A, 0, 0, NULL },
- { 0x1f98A, 0, 0, NULL },
- { 0x1f431, 0, 0, NULL },
- { 0x1f408, 0, 0, NULL },
- { 0x1f981, 0, 0, NULL },
- { 0x1f42f, 0, 0, NULL },
- { 0x1f405, 0, 0, NULL },
- { 0x1f406, 0, 0, NULL },
- { 0x1f434, 0, 0, NULL },
- { 0x1f984, 0, 0, NULL },
- { 0x1f993, 0, 0, NULL },
- { 0x1f989, 0, 0, NULL },
- { 0x1f42e, 0, 0, NULL },
- { 0x1f402, 0, 0, NULL },
- { 0x1f403, 0, 0, NULL },
- { 0x1f437, 0, 0, NULL },
- { 0x1f416, 0, 0, NULL },
- { 0x1f417, 0, 0, NULL },
- { 0x1f43d, 0, 0, NULL },
- { 0x1f40f, 0, 0, NULL },
- { 0x1f411, 0, 0, NULL },
- { 0x1f410, 0, 0, NULL },
- { 0x1f42a, 0, 0, NULL },
- { 0x1f42b, 0, 0, NULL },
- { 0x1f992, 0, 0, NULL },
- { 0x1f418, 0, 0, NULL },
- { 0x1f98f, 0, 0, NULL },
- { 0x1f42d, 0, 0, NULL },
- { 0x1f401, 0, 0, NULL },
- { 0x1f400, 0, 0, NULL },
- { 0x1f439, 0, 0, NULL },
- { 0x1f430, 0, 0, NULL },
- { 0x1f407, 0, 0, NULL },
- { 0x1f43f, 0, 0, NULL },
- { 0x1f994, 0, 0, NULL },
- { 0x1f987, 0, 0, NULL },
- { 0x1f438, 0, 0, NULL },
- { 0x1f428, 0, 0, NULL },
- { 0x1f43c, 0, 0, NULL },
- { 0x1f43e, 0, 0, NULL },
- // animal-bird
- { 0x1f983, 0, 0, NULL },
- { 0x1f414, 0, 0, NULL },
- { 0x1f413, 0, 0, NULL },
- { 0x1f423, 0, 0, NULL },
- { 0x1f424, 0, 0, NULL },
- { 0x1f425, 0, 0, NULL },
- { 0x1f426, 0, 0, NULL },
- { 0x1f427, 0, 0, NULL },
- { 0x1f54a, 0, 0, NULL },
- { 0x1f985, 0, 0, NULL },
- { 0x1f986, 0, 0, NULL },
- { 0x1f989, 0, 0, NULL },
- // animal-amphibian
- { 0x1f438, 0, 0, NULL },
- // animal-reptile
- { 0x1f40a, 0, 0, NULL },
- { 0x1f422, 0, 0, NULL },
- { 0x1f98e, 0, 0, NULL },
- { 0x1f40d, 0, 0, NULL },
- { 0x1f432, 0, 0, NULL },
- { 0x1f409, 0, 0, NULL },
- { 0x1f995, 0, 0, NULL },
- { 0x1f996, 0, 0, NULL },
- // animal-marine
- { 0x1f433, 0, 0, NULL },
- { 0x1f40b, 0, 0, NULL },
- { 0x1f42c, 0, 0, NULL },
- { 0x1f41f, 0, 0, NULL },
- { 0x1f420, 0, 0, NULL },
- { 0x1f421, 0, 0, NULL },
- { 0x1f988, 0, 0, NULL },
- { 0x1f419, 0, 0, NULL },
- { 0x1f41a, 0, 0, NULL },
- { 0x1f980, 0, 0, NULL },
- { 0x1f990, 0, 0, NULL },
- { 0x1f991, 0, 0, NULL },
- // animal-bug
- { 0x1f40c, 0, 0, NULL },
- { 0x1f98b, 0, 0, NULL },
- { 0x1f41b, 0, 0, NULL },
- { 0x1f41c, 0, 0, NULL },
- { 0x1f41d, 0, 0, NULL },
- { 0x1f41e, 0, 0, NULL },
- { 0x1f997, 0, 0, NULL },
- { 0x1f577, 0, 0, NULL },
- { 0x1f578, 0, 0, NULL },
- { 0x1f982, 0, 0, NULL },
- // plant-flower
- { 0x1f490, 0, 0, NULL },
- { 0x1f338, 0, 0, NULL },
- { 0x1f4ae, 0, 0, NULL },
- { 0x1f3f5, 0, 0, NULL },
- { 0x1f339, 0, 0, NULL },
- { 0x1f940, 0, 0, NULL },
- { 0x1f33a, 0, 0, NULL },
- { 0x1f33b, 0, 0, NULL },
- { 0x1f33c, 0, 0, NULL },
- { 0x1f337, 0, 0, NULL },
- // plant-other
- { 0x1f331, 0, 0, NULL },
- { 0x1f332, 0, 0, NULL },
- { 0x1f333, 0, 0, NULL },
- { 0x1f334, 0, 0, NULL },
- { 0x1f335, 0, 0, NULL },
- { 0x1f33e, 0, 0, NULL },
- { 0x1f33f, 0, 0, NULL },
- { 0x02618, 0, 0, NULL },
- { 0x1f340, 0, 0, NULL },
- { 0x1f343, 0, 0 }
-};
-
-static EmojiData food[] = {
- // food-fruit
- { 0x1f347, 0, 0, NULL },
- { 0x1f348, 0, 0, NULL },
- { 0x1f349, 0, 0, NULL },
- { 0x1f34a, 0, 0, NULL },
- { 0x1f34b, 0, 0, NULL },
- { 0x1f34c, 0, 0, NULL },
- { 0x1f34d, 0, 0, NULL },
- { 0x1f34e, 0, 0, NULL },
- { 0x1f34f, 0, 0, NULL },
- { 0x1f350, 0, 0, NULL },
- { 0x1f351, 0, 0, NULL },
- { 0x1f352, 0, 0, NULL },
- { 0x1f353, 0, 0, NULL },
- { 0x1f95d, 0, 0, NULL },
- { 0x1f345, 0, 0, NULL },
- { 0x1f965, 0, 0, NULL },
- // food-vegetable
- { 0x1f951, 0, 0, NULL },
- { 0x1f346, 0, 0, NULL },
- { 0x1f954, 0, 0, NULL },
- { 0x1f955, 0, 0, NULL },
- { 0x1f33d, 0, 0, NULL },
- { 0x1f336, 0, 0, NULL },
- { 0x1f952, 0, 0, NULL },
- { 0x1f966, 0, 0, NULL },
- { 0x1f344, 0, 0, NULL },
- { 0x1f95c, 0, 0, NULL },
- { 0x1f330, 0, 0, NULL },
- // food-prepared
- { 0x1f35e, 0, 0, NULL },
- { 0x1f950, 0, 0, NULL },
- { 0x1f956, 0, 0, NULL },
- { 0x1f968, 0, 0, NULL },
- { 0x1f95e, 0, 0, NULL },
- { 0x1f9c0, 0, 0, NULL },
- { 0x1f356, 0, 0, NULL },
- { 0x1f357, 0, 0, NULL },
- { 0x1f969, 0, 0, NULL },
- { 0x1f953, 0, 0, NULL },
- { 0x1f354, 0, 0, NULL },
- { 0x1f35f, 0, 0, NULL },
- { 0x1f32d, 0, 0, NULL },
- { 0x1f96a, 0, 0, NULL },
- { 0x1f32e, 0, 0, NULL },
- { 0x1f32f, 0, 0, NULL },
- { 0x1f959, 0, 0, NULL },
- { 0x1f95a, 0, 0, NULL },
- { 0x1f373, 0, 0, NULL },
- { 0x1f958, 0, 0, NULL },
- { 0x1f372, 0, 0, NULL },
- { 0x1f963, 0, 0, NULL },
- { 0x1f957, 0, 0, NULL },
- { 0x1f96b, 0, 0, NULL },
- // food-asian
- // food-sweet
- // drink
- // dishware
- { 0x1f962, 0, 0, NULL },
- { 0x1f37d, 0, 0, NULL },
- { 0x1f374, 0, 0, NULL },
- { 0x1f944, 0, 0, NULL },
- { 0x1f52a, 0, 0, NULL },
- { 0x1f3f, 0, 0, NULL },
-};
-
-static EmojiData travel[] = {
- // place-map
- { 0x1f30d, 0, 0, NULL },
- // place-geographic
- { 0x1f3d4, 0, 0, NULL },
- // place building
- { 0x1f3df, 0, 0, NULL },
- // place-religious
- { 0x026ea, 0, 0, NULL },
- // place-other
- { 0x026f2, 0, 0, NULL },
- // transport-ground
- { 0x1f682, 0, 0, NULL },
- // transport-water
- { 0x02693, 0, 0, NULL },
- // transport-air
- // hotel
- // time
- // sky & weather
-};
-
-static EmojiData activities[] = {
- // event
- { 0x1f383, 0, 0, NULL },
- // award-medal
- { 0x1f396, 0, 0, NULL },
- // sport
- { 0x026bd, 0, 0, NULL },
- // game
- { 0x1f3ae, 0, 0, NULL },
-};
-
-static EmojiData objects[] = {
- // sound
- { 0x1f507, 0, 0, NULL },
- // music
- { 0x1f3bc, 0, 0, NULL },
- // musical-instrument
- { 0x1f3b7, 0, 0, NULL },
- // phone
- // computer
- // light & video
- // book-paper
- // money
- // mail
- // writing
- // office
- // lock
- // tool
- // medical
- // other-object
-};
-
-static EmojiData symbols[] = {
- // transport-sign
- // warning
- // arrow
- // religion
- // zodiac
- // av-symbol
- // other-symbol
- // keycap
- // alphanum
- // geometric
-};
-
-static EmojiData flags[] = {
- // flags
- { 0x1f3c1, 0, 0, (const char *[]) { "checkered", "chequered", "racing", NULL } },
- { 0x1f6a9, 0, 0, (const char *[]) { "post", NULL } },
- { 0x1f38c, 0, 0, (const char *[]) { "japanese", "celebration", "cross", "crossed", NULL } },
- { 0x1f3f4, 0, 0, (const char *[]) { "waving", NULL } },
- { 0x1f3f3, 0, 0, (const char *[]) { "waving", NULL } },
- { 0x1f3f3, 0, 0x1f308, (const char *[]) { "rainbow", NULL } },
- // country-flag
- // subdivision-flag
-};
-
struct _GtkEmojiPicker
{
GtkPopover parent_instance;
@@ -774,6 +53,8 @@ struct _GtkEmojiPicker
GtkWidget *scroll_to_button;
GtkGesture *people_press;
+
+ GVariant *data;
};
enum {
@@ -788,6 +69,10 @@ G_DEFINE_TYPE (GtkEmojiPicker, gtk_emoji_picker, GTK_TYPE_POPOVER)
static void
gtk_emoji_picker_finalize (GObject *object)
{
+ GtkEmojiPicker *picker = GTK_EMOJI_PICKER (object);
+
+ g_variant_unref (picker->data);
+
G_OBJECT_CLASS (gtk_emoji_picker_parent_class)->finalize (object);
}
@@ -860,7 +145,9 @@ emoji_activated (GtkFlowBox *box,
}
static void
-add_emoji (GtkWidget *box, EmojiData *emoji, gunichar modifier);
+add_emoji (GtkWidget *box,
+ GVariantIter *iter,
+ GVariant *data);
static void
people_pressed_cb (GtkGesture *gesture,
@@ -873,18 +160,25 @@ people_pressed_cb (GtkGesture *gesture,
GtkWidget *popover;
GtkWidget *view;
GtkWidget *box;
- EmojiData *emoji_data;
- gunichar modifier;
+ GVariant *emoji_data;
GtkWidget *parent_popover;
+ GVariantIter *iter;
+ GVariantIter *codes;
child = GTK_WIDGET (gtk_flow_box_get_child_at_pos (GTK_FLOW_BOX (picker->people_box), x, y));
if (!child)
return;
- emoji_data = (EmojiData*) g_object_get_data (G_OBJECT (child), "emoji-data");
- if (!emoji_data->is_modifier_base)
+ emoji_data = (GVariant*) g_object_get_data (G_OBJECT (child), "emoji-data");
+ if (!emoji_data)
return;
+ g_variant_get_child (emoji_data, 2, "aau", &iter);
+ if (g_variant_iter_n_children (iter) == 0) {
+ g_variant_iter_free (iter);
+ return;
+ }
+
parent_popover = gtk_widget_get_ancestor (child, GTK_TYPE_POPOVER);
popover = gtk_popover_new (child);
view = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -900,31 +194,31 @@ people_pressed_cb (GtkGesture *gesture,
g_signal_connect (box, "child-activated", G_CALLBACK (emoji_activated), parent_popover);
- add_emoji (box, emoji_data, 0);
- for (modifier = 0x1f3fb; modifier <= 0x1f3ff; modifier++)
- add_emoji (box, emoji_data, modifier);
+ g_variant_get_child (emoji_data, 0, "au", &codes);
+ add_emoji (box, codes, NULL);
+ g_variant_iter_free (codes);
+ while (g_variant_iter_next (iter, "au", &codes)) {
+ add_emoji (box, codes, NULL);
+ g_variant_iter_free (codes);
+ }
gtk_popover_popup (GTK_POPOVER (popover));
}
static void
-add_emoji (GtkWidget *box,
- EmojiData *data,
- gunichar modifier)
+add_emoji (GtkWidget *box,
+ GVariantIter *iter,
+ GVariant *data)
{
GtkWidget *child;
GtkWidget *label;
PangoAttrList *attrs;
- char text[32];
+ char text[64];
char *p = text;
+ gunichar code;
- p += g_unichar_to_utf8 (data->code, p);
- if (modifier != 0)
- p += g_unichar_to_utf8 (modifier, p);
- if (data->code2 != 0) {
- p += g_unichar_to_utf8 (0x200d, p);
- p += g_unichar_to_utf8 (data->code2, p);
- }
+ while (g_variant_iter_next (iter, "u", &code))
+ p += g_unichar_to_utf8 (code, p);
p[0] = 0;
label = gtk_label_new (text);
@@ -936,7 +230,10 @@ add_emoji (GtkWidget *box,
child = gtk_flow_box_child_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (child), "emojicell");
- g_object_set_data (G_OBJECT (child), "emoji-data", data);
+ if (data)
+ g_object_set_data_full (G_OBJECT (child), "emoji-data",
+ g_variant_ref (data),
+ (GDestroyNotify)g_variant_unref);
gtk_container_add (GTK_CONTAINER (child), label);
gtk_container_add (GTK_CONTAINER (box), child);
@@ -958,29 +255,48 @@ set_label (GtkWidget *label, gunichar code)
static void
populate_emoji_picker (GtkEmojiPicker *picker)
{
+ g_autoptr(GMappedFile) file = NULL;
+ g_autoptr(GBytes) bytes = NULL;
+ GVariantIter iter;
+ GVariant *item;
int i;
- for (i = 0; i < G_N_ELEMENTS (people); i++)
- add_emoji (picker->people_box, &people[i], 0);
- for (i = 0; i < G_N_ELEMENTS (nature); i++)
- add_emoji (picker->nature_box, &nature[i], 0);
- for (i = 0; i < G_N_ELEMENTS (food); i++)
- add_emoji (picker->food_box, &food[i], 0);
-
- for (i = 0; i < G_N_ELEMENTS (travel); i++)
- add_emoji (picker->travel_box, &travel[i], 0);
-
- for (i = 0; i < G_N_ELEMENTS (activities); i++)
- add_emoji (picker->activities_box, &activities[i], 0);
-
- for (i = 0; i < G_N_ELEMENTS (objects); i++)
- add_emoji (picker->objects_box, &objects[i], 0);
-
- for (i = 0; i < G_N_ELEMENTS (symbols); i++)
- add_emoji (picker->symbols_box, &symbols[i], 0);
-
- for (i = 0; i < G_N_ELEMENTS (flags); i++)
- add_emoji (picker->flags_box, &flags[i], 0);
+ file = g_mapped_file_new ("emoji.data", FALSE, NULL);
+ if (!file)
+ g_error ("Failed to map data\n");
+
+ bytes = g_mapped_file_get_bytes (file);
+ picker->data = g_variant_ref_sink (g_variant_new_from_bytes (G_VARIANT_TYPE ("a(ausaau)"), bytes,
TRUE));
+
+ g_variant_iter_init (&iter, picker->data);
+ i = 0;
+ while ((item = g_variant_iter_next_value (&iter))) {
+ GVariantIter *codes;
+ GtkWidget *box;
+
+ if (i <= 446)
+ box = picker->people_box;
+ else if (i <= 559)
+ box = picker->nature_box;
+ else if (i <= 661)
+ box = picker->food_box;
+ else if (i <= 868)
+ box = picker->travel_box;
+ else if (i <= 928)
+ box = picker->activities_box;
+ else if (i <= 1090)
+ box = picker->objects_box;
+ else if (i <= 1295)
+ box = picker->symbols_box;
+ else
+ box = picker->flags_box;
+
+ g_variant_get_child (item, 0, "au", &codes);
+ add_emoji (box, codes, item);
+ g_variant_iter_free (codes);
+
+ i++;
+ }
set_label (picker->people_label, 0x1f642);
set_label (picker->nature_label, 0x1f337);
@@ -1024,23 +340,23 @@ static gboolean
filter_func (GtkFlowBoxChild *child, gpointer data)
{
GtkEmojiPicker *picker = data;
- EmojiData *emoji_data;
+ GVariant *emoji_data;
const char *text;
- int i;
+ const char *name;
text = gtk_entry_get_text (GTK_ENTRY (picker->search_entry));
- emoji_data = (EmojiData*) g_object_get_data (G_OBJECT (child), "emoji-data");
+ emoji_data = (GVariant *) g_object_get_data (G_OBJECT (child), "emoji-data");
if (text[0] == 0 || text[1] == 0)
return TRUE;
- if (!emoji_data->keywords)
- return FALSE;
+ if (!emoji_data)
+ return TRUE;
- for (i = 0; emoji_data->keywords[i]; i++) {
- if (g_str_has_prefix (emoji_data->keywords[i], text))
- return TRUE;
- }
+ g_variant_get_child (emoji_data, 1, "&s", &name);
+
+ if (strstr (name, text))
+ return TRUE;
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]