[gtk+/wip/matthiasc/emoji-picker] Split the person section
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/emoji-picker] Split the person section
- Date: Thu, 10 Aug 2017 17:29:37 +0000 (UTC)
commit f2a9fb61d92dc8774aa72ec1e783c40e2eaf63b0
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Aug 10 13:27:54 2017 -0400
Split the person section
This is just too long, split off a 'body & clothing' one.
tests/gtkemojipicker.c | 26 ++++++++++++++++++++++----
tests/gtkemojipicker.ui | 47 ++++++++++++++++++++++++++++++++++++++---------
2 files changed, 60 insertions(+), 13 deletions(-)
---
diff --git a/tests/gtkemojipicker.c b/tests/gtkemojipicker.c
index f347873..256120a 100644
--- a/tests/gtkemojipicker.c
+++ b/tests/gtkemojipicker.c
@@ -15,6 +15,11 @@ struct _GtkEmojiPicker
GtkWidget *people_button;
GtkWidget *people_label;
+ GtkWidget *body_box;
+ GtkWidget *body_heading;
+ GtkWidget *body_button;
+ GtkWidget *body_label;
+
GtkWidget *nature_box;
GtkWidget *nature_heading;
GtkWidget *nature_button;
@@ -88,6 +93,8 @@ scroll_in_idle (gpointer data)
if (picker->scroll_to_button == picker->people_button)
heading = picker->people_heading;
+ else if (picker->scroll_to_button == picker->body_button)
+ heading = picker->body_heading;
else if (picker->scroll_to_button == picker->nature_button)
heading = picker->nature_heading;
else if (picker->scroll_to_button == picker->food_button)
@@ -222,14 +229,13 @@ add_emoji (GtkWidget *box,
p[0] = 0;
label = gtk_label_new (text);
- g_object_set(label, "margin", 6, NULL);
attrs = pango_attr_list_new ();
pango_attr_list_insert (attrs, pango_attr_scale_new (PANGO_SCALE_X_LARGE));
gtk_label_set_attributes (GTK_LABEL (label), attrs);
pango_attr_list_unref (attrs);
child = gtk_flow_box_child_new ();
- gtk_style_context_add_class (gtk_widget_get_style_context (child), "emojicell");
+ gtk_style_context_add_class (gtk_widget_get_style_context (child), "emoji");
if (data)
g_object_set_data_full (G_OBJECT (child), "emoji-data",
g_variant_ref (data),
@@ -274,8 +280,10 @@ populate_emoji_picker (GtkEmojiPicker *picker)
GVariantIter *codes;
GtkWidget *box;
- if (i <= 446)
+ if (i <= 297)
box = picker->people_box;
+ else if (i <= 446)
+ box = picker->body_box;
else if (i <= 559)
box = picker->nature_box;
else if (i <= 661)
@@ -299,6 +307,7 @@ populate_emoji_picker (GtkEmojiPicker *picker)
}
set_label (picker->people_label, 0x1f642);
+ set_label (picker->body_label, 0x1f44d);
set_label (picker->nature_label, 0x1f337);
set_label (picker->food_label, 0x1f374);
set_label (picker->travel_label, 0x2708);
@@ -327,6 +336,7 @@ adj_value_changed (GtkAdjustment *adj, gpointer data)
double value = gtk_adjustment_get_value (adj);
update_state (picker->people_heading, picker->people_button, value);
+ update_state (picker->body_heading, picker->body_button, value);
update_state (picker->nature_heading, picker->nature_button, value);
update_state (picker->food_heading, picker->food_button, value);
update_state (picker->travel_heading, picker->travel_button, value);
@@ -367,6 +377,7 @@ search_changed (GtkEntry *entry, gpointer data)
GtkEmojiPicker *picker = data;
gtk_flow_box_invalidate_filter (GTK_FLOW_BOX (picker->people_box));
+ gtk_flow_box_invalidate_filter (GTK_FLOW_BOX (picker->body_box));
gtk_flow_box_invalidate_filter (GTK_FLOW_BOX (picker->nature_box));
gtk_flow_box_invalidate_filter (GTK_FLOW_BOX (picker->food_box));
gtk_flow_box_invalidate_filter (GTK_FLOW_BOX (picker->travel_box));
@@ -391,7 +402,7 @@ gtk_emoji_picker_init (GtkEmojiPicker *picker)
gtk_css_provider_load_from_path (provider, "gtkemojipicker.css");
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_THEME);
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
populate_emoji_picker (picker);
@@ -400,6 +411,7 @@ gtk_emoji_picker_init (GtkEmojiPicker *picker)
g_signal_connect (adj, "value-changed", G_CALLBACK (adj_value_changed), picker);
gtk_container_set_focus_vadjustment (GTK_CONTAINER (picker->people_box), adj);
+ gtk_container_set_focus_vadjustment (GTK_CONTAINER (picker->body_box), adj);
gtk_container_set_focus_vadjustment (GTK_CONTAINER (picker->nature_box), adj);
gtk_container_set_focus_vadjustment (GTK_CONTAINER (picker->food_box), adj);
gtk_container_set_focus_vadjustment (GTK_CONTAINER (picker->travel_box), adj);
@@ -409,6 +421,7 @@ gtk_emoji_picker_init (GtkEmojiPicker *picker)
gtk_container_set_focus_vadjustment (GTK_CONTAINER (picker->flags_box), adj);
gtk_flow_box_set_filter_func (GTK_FLOW_BOX (picker->people_box), filter_func, picker, NULL);
+ gtk_flow_box_set_filter_func (GTK_FLOW_BOX (picker->body_box), filter_func, picker, NULL);
gtk_flow_box_set_filter_func (GTK_FLOW_BOX (picker->nature_box), filter_func, picker, NULL);
gtk_flow_box_set_filter_func (GTK_FLOW_BOX (picker->food_box), filter_func, picker, NULL);
gtk_flow_box_set_filter_func (GTK_FLOW_BOX (picker->travel_box), filter_func, picker, NULL);
@@ -450,6 +463,11 @@ gtk_emoji_picker_class_init (GtkEmojiPickerClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkEmojiPicker, people_button);
gtk_widget_class_bind_template_child (widget_class, GtkEmojiPicker, people_label);
+ gtk_widget_class_bind_template_child (widget_class, GtkEmojiPicker, body_box);
+ gtk_widget_class_bind_template_child (widget_class, GtkEmojiPicker, body_heading);
+ gtk_widget_class_bind_template_child (widget_class, GtkEmojiPicker, body_button);
+ gtk_widget_class_bind_template_child (widget_class, GtkEmojiPicker, body_label);
+
gtk_widget_class_bind_template_child (widget_class, GtkEmojiPicker, nature_box);
gtk_widget_class_bind_template_child (widget_class, GtkEmojiPicker, nature_heading);
gtk_widget_class_bind_template_child (widget_class, GtkEmojiPicker, nature_button);
diff --git a/tests/gtkemojipicker.ui b/tests/gtkemojipicker.ui
index 973c8ce..c822249 100644
--- a/tests/gtkemojipicker.ui
+++ b/tests/gtkemojipicker.ui
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk-3">
<template class="GtkEmojiPicker" parent="GtkPopover">
- <property name="vexpand">1</property>
<property name="modal">1</property>
<child>
<object class="GtkBox" id="box">
@@ -16,6 +15,7 @@
<property name="vexpand">1</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
+ <property name="min-content-height">250</property>
<style>
<class name="view"/>
</style>
@@ -41,6 +41,22 @@
</object>
</child>
<child>
+ <object class="GtkLabel" id="body_heading">
+ <property name="label" translatable="yes">Body & Clothing</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkFlowBox" id="body_box">
+ <property name="homogeneous">1</property>
+ <property name="selection-mode">none</property>
+ <property name="min-children-per-line">6</property>
+ <property name="max-children-per-line">6</property>
+ <property name="activate-on-single-click">1</property>
+ <signal name="child-activated" handler="emoji_activated"/>
+ </object>
+ </child>
+ <child>
<object class="GtkLabel" id="nature_heading">
<property name="label" translatable="yes">Animals & Nature</property>
<property name="xalign">0</property>
@@ -178,7 +194,7 @@
<property name="relief">none</property>
<signal name="clicked" handler="scroll_to_section"/>
<style>
- <class name="emojisection"/>
+ <class name="emoji-section"/>
</style>
<child>
<object class="GtkLabel" id="people_label">
@@ -187,11 +203,24 @@
</object>
</child>
<child>
+ <object class="GtkButton" id="body_button">
+ <property name="relief">none</property>
+ <signal name="clicked" handler="scroll_to_section"/>
+ <style>
+ <class name="emoji-section"/>
+ </style>
+ <child>
+ <object class="GtkLabel" id="body_label">
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
<object class="GtkButton" id="nature_button">
<property name="relief">none</property>
<signal name="clicked" handler="scroll_to_section"/>
<style>
- <class name="emojisection"/>
+ <class name="emoji-section"/>
</style>
<child>
<object class="GtkLabel" id="nature_label">
@@ -204,7 +233,7 @@
<property name="relief">none</property>
<signal name="clicked" handler="scroll_to_section"/>
<style>
- <class name="emojisection"/>
+ <class name="emoji-section"/>
</style>
<child>
<object class="GtkLabel" id="food_label">
@@ -217,7 +246,7 @@
<property name="relief">none</property>
<signal name="clicked" handler="scroll_to_section"/>
<style>
- <class name="emojisection"/>
+ <class name="emoji-section"/>
</style>
<child>
<object class="GtkLabel" id="travel_label">
@@ -230,7 +259,7 @@
<property name="relief">none</property>
<signal name="clicked" handler="scroll_to_section"/>
<style>
- <class name="emojisection"/>
+ <class name="emoji-section"/>
</style>
<child>
<object class="GtkLabel" id="activities_label">
@@ -243,7 +272,7 @@
<property name="relief">none</property>
<signal name="clicked" handler="scroll_to_section"/>
<style>
- <class name="emojisection"/>
+ <class name="emoji-section"/>
</style>
<child>
<object class="GtkLabel" id="objects_label">
@@ -256,7 +285,7 @@
<property name="relief">none</property>
<signal name="clicked" handler="scroll_to_section"/>
<style>
- <class name="emojisection"/>
+ <class name="emoji-section"/>
</style>
<child>
<object class="GtkLabel" id="symbols_label">
@@ -269,7 +298,7 @@
<property name="relief">none</property>
<signal name="clicked" handler="scroll_to_section"/>
<style>
- <class name="emojisection"/>
+ <class name="emoji-section"/>
</style>
<child>
<object class="GtkLabel" id="flags_label">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]