diff options
author | Matthias Clasen <mclasen@redhat.com> | 2018-07-19 17:24:11 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2018-07-19 17:47:50 -0400 |
commit | 849ffebc214f1a9287bf3cefadf59ca56fb88f5b (patch) | |
tree | 25d6fd1576195dfcd707cce680aff0c93bcfe8b3 | |
parent | 7dabc2a42c41febd668fa8d2d1fc77850703ca09 (diff) | |
download | gtk+-849ffebc214f1a9287bf3cefadf59ca56fb88f5b.tar.gz |
Emoji chooser: Use icons for sections
This is more reliable than using text-style Emoji
which may not be present.
Based on work by Julian Sparber.
-rw-r--r-- | gtk/gtkemojichooser.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c index 627f83dfd9..2a774dbef0 100644 --- a/gtk/gtkemojichooser.c +++ b/gtk/gtkemojichooser.c @@ -583,19 +583,13 @@ static void setup_section (GtkEmojiChooser *chooser, EmojiSection *section, const char *first, - gunichar label) + const char *icon) { - char text[14]; - char *p; GtkAdjustment *adj; section->first = first; - p = text; - p += g_unichar_to_utf8 (label, p); - p += g_unichar_to_utf8 (0xfe0e, p); - p[0] = 0; - gtk_button_set_label (GTK_BUTTON (section->button), text); + gtk_button_set_icon_name (GTK_BUTTON (section->button), icon); adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (chooser->scrolled_window)); @@ -636,16 +630,16 @@ gtk_emoji_chooser_init (GtkEmojiChooser *chooser) adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (chooser->scrolled_window)); g_signal_connect (adj, "value-changed", G_CALLBACK (adj_value_changed), chooser); - setup_section (chooser, &chooser->recent, NULL, 0x1f557); - setup_section (chooser, &chooser->people, "grinning face", 0x1f642); - setup_section (chooser, &chooser->body, "selfie", 0x1f44d); - setup_section (chooser, &chooser->nature, "monkey face", 0x1f337); - setup_section (chooser, &chooser->food, "grapes", 0x1f374); - setup_section (chooser, &chooser->travel, "globe showing Europe-Africa", 0x2708); - setup_section (chooser, &chooser->activities, "jack-o-lantern", 0x1f3c3); - setup_section (chooser, &chooser->objects, "muted speaker", 0x1f514); - setup_section (chooser, &chooser->symbols, "ATM sign", 0x2764); - setup_section (chooser, &chooser->flags, "chequered flag", 0x1f3f4); + setup_section (chooser, &chooser->recent, NULL, "emoji-recent-symbolic"); + setup_section (chooser, &chooser->people, "grinning face", "emoji-people-symbolic"); + setup_section (chooser, &chooser->body, "selfie", "emoji-body-symbolic"); + setup_section (chooser, &chooser->nature, "monkey face", "emoji-nature-symbolic"); + setup_section (chooser, &chooser->food, "grapes", "emoji-food-symbolic"); + setup_section (chooser, &chooser->travel, "globe showing Europe-Africa", "emoji-travel-symbolic"); + setup_section (chooser, &chooser->activities, "jack-o-lantern", "emoji-activities-symbolic"); + setup_section (chooser, &chooser->objects, "muted speaker", "emoji-objects-symbolic"); + setup_section (chooser, &chooser->symbols, "ATM sign", "emoji-symbols-symbolic"); + setup_section (chooser, &chooser->flags, "chequered flag", "emoji-flags-symbolic"); populate_emoji_chooser (chooser); populate_recent_section (chooser); |