[gnome-builder/wip/gtk4-port: 251/1774] plugins/project-tree: port popover to GTK 4
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 251/1774] plugins/project-tree: port popover to GTK 4
- Date: Mon, 11 Jul 2022 22:31:04 +0000 (UTC)
commit 89d783d53823179db4a13d5c2fe8ab43d3774b9c
Author: Christian Hergert <chergert redhat com>
Date: Thu Mar 31 02:00:50 2022 -0700
plugins/project-tree: port popover to GTK 4
src/plugins/project-tree/gbp-rename-file-popover.c | 24 +++++++++++++---------
1 file changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/project-tree/gbp-rename-file-popover.c
b/src/plugins/project-tree/gbp-rename-file-popover.c
index a13dd1741..93435635e 100644
--- a/src/plugins/project-tree/gbp-rename-file-popover.c
+++ b/src/plugins/project-tree/gbp-rename-file-popover.c
@@ -85,7 +85,7 @@ gbp_rename_file_popover_set_file (GbpRenameFilePopover *self,
label = g_strdup_printf (_("Rename %s"), name);
gtk_label_set_label (self->label, label);
- gtk_entry_set_text (self->entry, name);
+ gtk_editable_set_text (GTK_EDITABLE (self->entry), name);
}
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_FILE]);
@@ -167,7 +167,7 @@ gbp_rename_file_popover__entry_changed (GbpRenameFilePopover *self,
gtk_widget_set_sensitive (GTK_WIDGET (self->button), FALSE);
gtk_label_set_label (self->message, NULL);
- text = gtk_entry_get_text (entry);
+ text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (ide_str_empty0 (text))
return;
@@ -214,7 +214,7 @@ select_range_in_idle_cb (GtkEntry *entry)
g_assert (GTK_IS_ENTRY (entry));
- name = gtk_entry_get_text (entry);
+ name = gtk_editable_get_text (GTK_EDITABLE (entry));
if ((dot = strrchr (name, '.')))
{
@@ -227,16 +227,15 @@ select_range_in_idle_cb (GtkEntry *entry)
static void
gbp_rename_file_popover__entry_focus_in_event (GbpRenameFilePopover *self,
- GdkEvent *event,
GtkEntry *entry)
{
g_assert (GBP_IS_RENAME_FILE_POPOVER (self));
g_assert (GTK_IS_ENTRY (entry));
- gdk_threads_add_idle_full (G_PRIORITY_DEFAULT,
- (GSourceFunc) select_range_in_idle_cb,
- g_object_ref (entry),
- g_object_unref);
+ g_idle_add_full (G_PRIORITY_DEFAULT,
+ (GSourceFunc) select_range_in_idle_cb,
+ g_object_ref (entry),
+ g_object_unref);
}
static void
@@ -254,7 +253,7 @@ gbp_rename_file_popover__button_clicked (GbpRenameFilePopover *self,
g_assert (self->file != NULL);
g_assert (G_IS_FILE (self->file));
- path = gtk_entry_get_text (self->entry);
+ path = gtk_editable_get_text (GTK_EDITABLE (self->entry));
if (ide_str_empty0 (path))
return;
@@ -404,6 +403,8 @@ gbp_rename_file_popover_class_init (GbpRenameFilePopoverClass *klass)
static void
gbp_rename_file_popover_init (GbpRenameFilePopover *self)
{
+ GtkEventController *controller;
+
gtk_widget_init_template (GTK_WIDGET (self));
g_signal_connect_object (self->entry,
@@ -424,11 +425,14 @@ gbp_rename_file_popover_init (GbpRenameFilePopover *self)
self,
G_CONNECT_SWAPPED);
+ controller = gtk_event_controller_focus_new ();
g_signal_connect_object (self->entry,
- "focus-in-event",
+ "enter",
G_CALLBACK (gbp_rename_file_popover__entry_focus_in_event),
self,
G_CONNECT_SWAPPED | G_CONNECT_AFTER);
+ gtk_widget_add_controller (GTK_WIDGET (self->entry), controller);
+
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]