forked from AuroraMiddleware/gtk
Merge branch 'entry-fix' into 'master'
Fix Emoji insertion See merge request GNOME/gtk!800
This commit is contained in:
commit
3ce6a710a3
@ -1234,10 +1234,13 @@ notify_cb (GObject *object,
|
||||
gpointer data)
|
||||
{
|
||||
gpointer iface;
|
||||
gpointer class;
|
||||
|
||||
/* The editable interface properties are already forwarded by the editable delegate setup */
|
||||
iface = g_type_interface_peek (g_type_class_peek (G_OBJECT_TYPE (object)), gtk_editable_get_type ());
|
||||
if (!g_object_interface_find_property (iface, pspec->name))
|
||||
class = g_type_class_peek (GTK_TYPE_ENTRY);
|
||||
if (!g_object_interface_find_property (iface, pspec->name) &&
|
||||
g_object_class_find_property (class, pspec->name))
|
||||
g_object_notify (data, pspec->name);
|
||||
}
|
||||
|
||||
|
@ -6596,9 +6596,25 @@ gtk_text_get_tabs (GtkText *self)
|
||||
return priv->tabs;
|
||||
}
|
||||
|
||||
static void
|
||||
emoji_picked (GtkEmojiChooser *chooser,
|
||||
const char *text,
|
||||
GtkText *self)
|
||||
{
|
||||
int current_pos;
|
||||
int selection_bound;
|
||||
|
||||
current_pos = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (chooser), "current-pos"));
|
||||
selection_bound = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (chooser), "selection-bound"));
|
||||
|
||||
gtk_text_set_positions (self, current_pos, selection_bound);
|
||||
gtk_text_enter_text (self, text);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_insert_emoji (GtkText *self)
|
||||
{
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
GtkWidget *chooser;
|
||||
|
||||
if (gtk_widget_get_ancestor (GTK_WIDGET (self), GTK_TYPE_EMOJI_CHOOSER) != NULL)
|
||||
@ -6611,9 +6627,12 @@ gtk_text_insert_emoji (GtkText *self)
|
||||
g_object_set_data (G_OBJECT (self), "gtk-emoji-chooser", chooser);
|
||||
|
||||
gtk_popover_set_relative_to (GTK_POPOVER (chooser), GTK_WIDGET (self));
|
||||
g_signal_connect_swapped (chooser, "emoji-picked", G_CALLBACK (gtk_text_enter_text), self);
|
||||
g_signal_connect (chooser, "emoji-picked", G_CALLBACK (emoji_picked), self);
|
||||
}
|
||||
|
||||
g_object_set_data (G_OBJECT (chooser), "current-pos", GINT_TO_POINTER (priv->current_pos));
|
||||
g_object_set_data (G_OBJECT (chooser), "selection-bound", GINT_TO_POINTER (priv->selection_bound));
|
||||
|
||||
gtk_popover_popup (GTK_POPOVER (chooser));
|
||||
}
|
||||
|
||||
|
@ -819,7 +819,7 @@ property_editor (GObject *object,
|
||||
|
||||
prop_edit = gtk_spin_button_new (adj, 1.0, 0);
|
||||
|
||||
g_object_connect_property (object, spec, G_CALLBACK (int_changed), adj, G_OBJECT (adj));
|
||||
g_object_connect_property (object, spec, G_CALLBACK (int_changed), adj, G_OBJECT (adj));
|
||||
|
||||
connect_controller (G_OBJECT (adj), "value_changed",
|
||||
object, spec, G_CALLBACK (int_modified));
|
||||
@ -1519,6 +1519,25 @@ add_gtk_settings_info (GtkInspectorPropEditor *editor)
|
||||
gtk_container_add (GTK_CONTAINER (editor), row);
|
||||
}
|
||||
|
||||
static void
|
||||
readonly_changed (GObject *object,
|
||||
GParamSpec *spec,
|
||||
gpointer data)
|
||||
{
|
||||
GValue gvalue = {0};
|
||||
gchar *value;
|
||||
gchar *type;
|
||||
|
||||
g_value_init (&gvalue, spec->value_type);
|
||||
g_object_get_property (object, spec->name, &gvalue);
|
||||
strdup_value_contents (&gvalue, &value, &type);
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (data), value);
|
||||
|
||||
g_free (value);
|
||||
g_free (type);
|
||||
}
|
||||
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
@ -1557,20 +1576,14 @@ constructed (GObject *object)
|
||||
|
||||
if (!can_modify)
|
||||
{
|
||||
GValue gvalue = {0};
|
||||
gchar *value;
|
||||
gchar *type;
|
||||
|
||||
g_value_init (&gvalue, spec->value_type);
|
||||
g_object_get_property (editor->priv->object, spec->name, &gvalue);
|
||||
strdup_value_contents (&gvalue, &value, &type);
|
||||
|
||||
label = gtk_label_new (value);
|
||||
label = gtk_label_new ("");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_DIM_LABEL);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
g_free (value);
|
||||
g_free (type);
|
||||
readonly_changed (editor->priv->object, spec, label);
|
||||
g_object_connect_property (editor->priv->object, spec,
|
||||
G_CALLBACK (readonly_changed),
|
||||
label, G_OBJECT (label));
|
||||
|
||||
if (editor->priv->size_group)
|
||||
gtk_size_group_add_widget (editor->priv->size_group, box);
|
||||
|
@ -574,21 +574,6 @@ gtk_inspector_prop_list_create_row (GtkInspectorPropList *pl,
|
||||
return row;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_prop_list_prop_changed_cb (GObject *pspec,
|
||||
GParamSpec *prop,
|
||||
GtkInspectorPropList *pl)
|
||||
{
|
||||
if (!pl->priv->object)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
iter = g_hash_table_lookup (pl->priv->prop_iters, prop->name);
|
||||
if (iter != NULL)
|
||||
gtk_inspector_prop_list_update_prop (pl, iter, prop);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup_object (GtkInspectorPropList *pl)
|
||||
{
|
||||
@ -644,11 +629,6 @@ gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
|
||||
if (GTK_IS_WIDGET (object))
|
||||
g_signal_connect_object (object, "destroy", G_CALLBACK (cleanup_object), pl, G_CONNECT_SWAPPED);
|
||||
|
||||
/* Listen for updates */
|
||||
pl->priv->notify_handler_id =
|
||||
g_signal_connect_object (object, "notify",
|
||||
G_CALLBACK (gtk_inspector_prop_list_prop_changed_cb), pl, 0);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (pl));
|
||||
|
||||
return TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user