diff options
author | Matthias Clasen <mclasen@redhat.com> | 2018-05-17 16:48:34 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2018-05-19 22:53:24 -0400 |
commit | 7928532bc5c33b2c6a10bae138ebc6dca1843cb0 (patch) | |
tree | 46e793e2a7c05d863f908f78738d0979eced066f /gtk/gtkemojichooser.c | |
parent | 3edd24fb0152789fc383568a14b38792a2c9b535 (diff) | |
download | gtk+-7928532bc5c33b2c6a10bae138ebc6dca1843cb0.tar.gz |
emoji: Hide recent section when empty
This is part of https://gitlab.gnome.org/GNOME/gtk/merge_requests/143
by Julian Sperber.
Diffstat (limited to 'gtk/gtkemojichooser.c')
-rw-r--r-- | gtk/gtkemojichooser.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c index 14025e3ab1..627f83dfd9 100644 --- a/gtk/gtkemojichooser.c +++ b/gtk/gtkemojichooser.c @@ -127,6 +127,7 @@ populate_recent_section (GtkEmojiChooser *chooser) GVariant *variant; GVariant *item; GVariantIter iter; + gboolean empty = FALSE; variant = g_settings_get_value (chooser->settings, "recent-emoji"); g_variant_iter_init (&iter, variant); @@ -140,6 +141,13 @@ populate_recent_section (GtkEmojiChooser *chooser) add_emoji (chooser->recent.box, FALSE, emoji_data, modifier, chooser); g_variant_unref (emoji_data); g_variant_unref (item); + empty = FALSE; + } + + if (!empty) + { + gtk_widget_show (chooser->recent.box); + gtk_widget_set_sensitive (chooser->recent.button, TRUE); } g_variant_unref (variant); } @@ -182,6 +190,10 @@ add_recent_item (GtkEmojiChooser *chooser, add_emoji (chooser->recent.box, TRUE, item, modifier, chooser); + /* Enable recent */ + gtk_widget_show (chooser->recent.box); + gtk_widget_set_sensitive (chooser->recent.button, TRUE); + g_settings_set_value (chooser->settings, "recent-emoji", g_variant_builder_end (&builder)); g_variant_unref (item); |