[nautilus/wip/antoniof/switch-to-gtk4: 7/33] general: Update API moved from GtkEntry to GtkEditable




commit 67763170d4ffdc1bedf4d82639c2066a92ac2626
Author: António Fernandes <antoniof gnome org>
Date:   Sun Dec 19 18:52:03 2021 +0000

    general: Update API moved from GtkEntry to GtkEditable

 src/nautilus-batch-rename-dialog.c            | 12 ++++++------
 src/nautilus-compress-dialog-controller.c     |  6 +++---
 src/nautilus-file-conflict-dialog.c           | 12 ++++++------
 src/nautilus-file-name-widget-controller.c    |  2 +-
 src/nautilus-files-view.c                     |  2 +-
 src/nautilus-location-entry.c                 | 20 ++++++++++----------
 src/nautilus-new-folder-dialog-controller.c   |  2 +-
 src/nautilus-operations-ui-manager.c          |  2 +-
 src/nautilus-properties-window.c              |  4 ++--
 src/nautilus-query-editor.c                   | 10 +++++-----
 src/nautilus-rename-file-popover-controller.c | 12 ++++++------
 src/nautilus-search-popover.c                 |  6 +++---
 src/nautilus-toolbar.c                        |  2 +-
 13 files changed, 46 insertions(+), 46 deletions(-)
---
diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c
index 2b4d8093b..21e47eede 100644
--- a/src/nautilus-batch-rename-dialog.c
+++ b/src/nautilus-batch-rename-dialog.c
@@ -429,14 +429,14 @@ batch_rename_dialog_get_new_names (NautilusBatchRenameDialog *dialog)
 
     if (dialog->mode == NAUTILUS_BATCH_RENAME_DIALOG_REPLACE)
     {
-        entry_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->find_entry)));
+        entry_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (dialog->find_entry)));
     }
     else
     {
-        entry_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->name_entry)));
+        entry_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (dialog->name_entry)));
     }
 
-    replace_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->replace_entry)));
+    replace_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (dialog->replace_entry)));
 
     if (dialog->mode == NAUTILUS_BATCH_RENAME_DIALOG_REPLACE)
     {
@@ -939,7 +939,7 @@ update_listbox (NautilusBatchRenameDialog *dialog)
         else
         {
             new_name = batch_rename_replace_label_text (old_name,
-                                                        gtk_entry_get_text (GTK_ENTRY (dialog->find_entry)));
+                                                        gtk_editable_get_text (GTK_EDITABLE 
(dialog->find_entry)));
             gtk_label_set_markup (GTK_LABEL (label), new_name->str);
 
             g_string_free (new_name, TRUE);
@@ -1227,11 +1227,11 @@ have_unallowed_character (NautilusBatchRenameDialog *dialog)
 
     if (dialog->mode == NAUTILUS_BATCH_RENAME_DIALOG_FORMAT)
     {
-        entry_text = gtk_entry_get_text (GTK_ENTRY (dialog->name_entry));
+        entry_text = gtk_editable_get_text (GTK_EDITABLE (dialog->name_entry));
     }
     else
     {
-        entry_text = gtk_entry_get_text (GTK_ENTRY (dialog->replace_entry));
+        entry_text = gtk_editable_get_text (GTK_EDITABLE (dialog->replace_entry));
     }
 
     if (strstr (entry_text, "/") != NULL)
diff --git a/src/nautilus-compress-dialog-controller.c b/src/nautilus-compress-dialog-controller.c
index d6c33948d..dd188b4f3 100644
--- a/src/nautilus-compress-dialog-controller.c
+++ b/src/nautilus-compress-dialog-controller.c
@@ -203,7 +203,7 @@ update_selected_format (NautilusCompressDialogController *self,
     gtk_widget_set_visible (self->passphrase_entry, show_passphrase);
     if (!show_passphrase)
     {
-        gtk_entry_set_text (GTK_ENTRY (self->passphrase_entry), "");
+        gtk_editable_set_text (GTK_EDITABLE (self->passphrase_entry), "");
         gtk_entry_set_visibility (GTK_ENTRY (self->passphrase_entry), FALSE);
         gtk_entry_set_icon_from_icon_name (GTK_ENTRY (self->passphrase_entry),
                                            GTK_ENTRY_ICON_SECONDARY,
@@ -301,7 +301,7 @@ passphrase_entry_on_changed (GtkEditable *editable,
     self = NAUTILUS_COMPRESS_DIALOG_CONTROLLER (user_data);
 
     g_free (self->passphrase);
-    self->passphrase = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->passphrase_entry)));
+    self->passphrase = g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->passphrase_entry)));
 
     /* Simulate a change of the name_entry to ensure the correct sensitivity of
      * the activate_button, but only if the name_entry is valid in order to
@@ -508,7 +508,7 @@ nautilus_compress_dialog_controller_new (GtkWindow         *parent_window,
 
     if (initial_name != NULL)
     {
-        gtk_entry_set_text (GTK_ENTRY (name_entry), initial_name);
+        gtk_editable_set_text (GTK_EDITABLE (name_entry), initial_name);
     }
 
     gtk_widget_show_all (compress_dialog);
diff --git a/src/nautilus-file-conflict-dialog.c b/src/nautilus-file-conflict-dialog.c
index 0adc39142..adcecf5eb 100644
--- a/src/nautilus-file-conflict-dialog.c
+++ b/src/nautilus-file-conflict-dialog.c
@@ -97,7 +97,7 @@ nautilus_file_conflict_dialog_set_suggested_name (NautilusFileConflictDialog *fc
                                                   gchar                      *suggested_name)
 {
     fcd->suggested_name = g_strdup (suggested_name);
-    gtk_entry_set_text (GTK_ENTRY (fcd->entry), suggested_name);
+    gtk_editable_set_text (GTK_EDITABLE (fcd->entry), suggested_name);
 }
 
 void
@@ -129,8 +129,8 @@ static void
 entry_text_changed_cb (GtkEditable                *entry,
                        NautilusFileConflictDialog *dialog)
 {
-    if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (entry)), "") != 0 &&
-        g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (entry)), dialog->conflict_name) != 0)
+    if (g_strcmp0 (gtk_editable_get_text (GTK_EDITABLE (entry)), "") != 0 &&
+        g_strcmp0 (gtk_editable_get_text (GTK_EDITABLE (entry)), dialog->conflict_name) != 0)
     {
         gtk_widget_set_sensitive (dialog->rename_button, TRUE);
     }
@@ -171,7 +171,7 @@ on_expanded_notify (GtkExpander                *w,
         gtk_widget_set_sensitive (dialog->checkbox, FALSE);
 
         gtk_widget_grab_focus (dialog->entry);
-        if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (dialog->entry)), dialog->suggested_name) == 0)
+        if (g_strcmp0 (gtk_editable_get_text (GTK_EDITABLE (dialog->entry)), dialog->suggested_name) == 0)
         {
             /* The suggested name is in the form "original (1).txt", if the
              * the conflicting name was "original.txt". The user may want to
@@ -210,7 +210,7 @@ reset_button_clicked_cb (GtkButton                  *w,
 {
     int start_pos, end_pos;
 
-    gtk_entry_set_text (GTK_ENTRY (dialog->entry), dialog->conflict_name);
+    gtk_editable_set_text (GTK_EDITABLE (dialog->entry), dialog->conflict_name);
     gtk_widget_grab_focus (dialog->entry);
     eel_filename_get_rename_region (dialog->conflict_name, &start_pos, &end_pos);
     gtk_editable_select_region (GTK_EDITABLE (dialog->entry), start_pos, end_pos);
@@ -288,7 +288,7 @@ nautilus_file_conflict_dialog_delay_buttons_activation (NautilusFileConflictDial
 char *
 nautilus_file_conflict_dialog_get_new_name (NautilusFileConflictDialog *dialog)
 {
-    return g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->entry)));
+    return g_strdup (gtk_editable_get_text (GTK_EDITABLE (dialog->entry)));
 }
 
 gboolean
diff --git a/src/nautilus-file-name-widget-controller.c b/src/nautilus-file-name-widget-controller.c
index 308ab51f2..db048b7f8 100644
--- a/src/nautilus-file-name-widget-controller.c
+++ b/src/nautilus-file-name-widget-controller.c
@@ -122,7 +122,7 @@ real_get_new_name (NautilusFileNameWidgetController *self)
 
     priv = nautilus_file_name_widget_controller_get_instance_private (self);
 
-    return g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->name_entry))));
+    return g_strstrip (g_strdup (gtk_editable_get_text (GTK_EDITABLE (priv->name_entry))));
 }
 
 static gboolean
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index ba71fe192..d4ce7d1d7 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -1690,7 +1690,7 @@ pattern_select_response_cb (GtkWidget *dialog,
             entry = g_object_get_data (G_OBJECT (dialog), "entry");
             directory = nautilus_files_view_get_model (view);
             selection = nautilus_directory_match_pattern (directory,
-                                                          gtk_entry_get_text (GTK_ENTRY (entry)));
+                                                          gtk_editable_get_text (GTK_EDITABLE (entry)));
 
             nautilus_files_view_call_set_selection (view, selection);
             nautilus_files_view_reveal_selection (view);
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c
index 65130d51c..e90c55d2d 100644
--- a/src/nautilus-location-entry.c
+++ b/src/nautilus-location-entry.c
@@ -134,7 +134,7 @@ nautilus_location_entry_update_action (NautilusLocationEntry *entry)
         return;
     }
 
-    current_text = gtk_entry_get_text (GTK_ENTRY (entry));
+    current_text = gtk_editable_get_text (GTK_EDITABLE (entry));
     location = g_file_parse_name (current_text);
 
     if (g_file_equal (priv->last_location, location))
@@ -184,7 +184,7 @@ nautilus_location_entry_update_current_uri (NautilusLocationEntry *entry,
     g_free (priv->current_directory);
     priv->current_directory = g_strdup (uri);
 
-    gtk_entry_set_text (GTK_ENTRY (entry), uri);
+    gtk_editable_set_text (GTK_EDITABLE (entry), uri);
     set_position_and_selection_to_end (GTK_EDITABLE (entry));
 }
 
@@ -622,7 +622,7 @@ on_has_focus_changed (GObject    *object,
     if (priv->has_special_text)
     {
         priv->setting_special_text = TRUE;
-        gtk_entry_set_text (GTK_ENTRY (entry), "");
+        gtk_editable_set_text (GTK_EDITABLE (entry), "");
         priv->setting_special_text = FALSE;
     }
 }
@@ -665,7 +665,7 @@ nautilus_location_entry_icon_release (GtkEntry             *gentry,
 
         case NAUTILUS_LOCATION_ENTRY_ACTION_CLEAR:
         {
-            gtk_entry_set_text (gentry, "");
+            gtk_editable_set_text (GTK_EDITABLE (gentry), "");
         }
         break;
 
@@ -709,7 +709,7 @@ nautilus_location_entry_key_pressed (GtkEventControllerKey *controller,
         {
             int position;
 
-            position = strlen (gtk_entry_get_text (GTK_ENTRY (editable)));
+            position = strlen (gtk_editable_get_text (GTK_EDITABLE (editable)));
             gtk_editable_select_region (editable, position, position);
         }
         else
@@ -782,7 +782,7 @@ nautilus_location_entry_activate (GtkEntry *entry)
 
     loc_entry = NAUTILUS_LOCATION_ENTRY (entry);
     priv = nautilus_location_entry_get_instance_private (loc_entry);
-    entry_text = gtk_entry_get_text (entry);
+    entry_text = gtk_editable_get_text (GTK_EDITABLE (entry));
     path = g_strdup (entry_text);
     path = g_strchug (path);
     path = g_strchomp (path);
@@ -795,7 +795,7 @@ nautilus_location_entry_activate (GtkEntry *entry)
         {
             /* Fix non absolute paths */
             full_path = g_build_filename (priv->current_directory, path, NULL);
-            gtk_entry_set_text (entry, full_path);
+            gtk_editable_set_text (GTK_EDITABLE (entry), full_path);
             g_free (full_path);
         }
 
@@ -901,14 +901,14 @@ editable_activate_callback (GtkEntry *entry,
     const char *entry_text;
     g_autofree gchar *path = NULL;
 
-    entry_text = gtk_entry_get_text (entry);
+    entry_text = gtk_editable_get_text (GTK_EDITABLE (entry));
     path = g_strdup (entry_text);
     path = g_strchug (path);
     path = g_strchomp (path);
 
     if (path != NULL && *path != '\0')
     {
-        gtk_entry_set_text (entry, path);
+        gtk_editable_set_text (GTK_EDITABLE (entry), path);
         emit_location_changed (self);
     }
 }
@@ -1026,6 +1026,6 @@ nautilus_location_entry_set_special_text (NautilusLocationEntry *entry,
     priv->special_text = g_strdup (special_text);
 
     priv->setting_special_text = TRUE;
-    gtk_entry_set_text (GTK_ENTRY (entry), special_text);
+    gtk_editable_set_text (GTK_EDITABLE (entry), special_text);
     priv->setting_special_text = FALSE;
 }
diff --git a/src/nautilus-new-folder-dialog-controller.c b/src/nautilus-new-folder-dialog-controller.c
index c6c1a8b42..0b47ef478 100644
--- a/src/nautilus-new-folder-dialog-controller.c
+++ b/src/nautilus-new-folder-dialog-controller.c
@@ -139,7 +139,7 @@ nautilus_new_folder_dialog_controller_new (GtkWindow         *parent_window,
 
     if (initial_name != NULL)
     {
-        gtk_entry_set_text (GTK_ENTRY (name_entry), initial_name);
+        gtk_editable_set_text (GTK_EDITABLE (name_entry), initial_name);
     }
 
     gtk_button_set_label (GTK_BUTTON (activate_button), _("Create"));
diff --git a/src/nautilus-operations-ui-manager.c b/src/nautilus-operations-ui-manager.c
index afabe4f73..ed5c6a094 100644
--- a/src/nautilus-operations-ui-manager.c
+++ b/src/nautilus-operations-ui-manager.c
@@ -638,7 +638,7 @@ on_request_passphrase_cb (GtkDialog *dialog,
     if (response_id != GTK_RESPONSE_CANCEL &&
         response_id != GTK_RESPONSE_DELETE_EVENT)
     {
-        data->passphrase = g_strdup (gtk_entry_get_text (data->passphrase_entry));
+        data->passphrase = g_strdup (gtk_editable_get_text (GTK_EDITABLE (data->passphrase_entry)));
     }
 
     gtk_window_destroy (GTK_WINDOW (dialog));
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index fb361c6a6..5ed5328ec 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -633,7 +633,7 @@ set_name_field (NautilusPropertiesWindow *self,
             g_autofree gchar *displayed_name = gtk_editable_get_chars (GTK_EDITABLE (self->name_field), 0, 
-1);
             if (strcmp (displayed_name, name) != 0)
             {
-                gtk_entry_set_text (GTK_ENTRY (self->name_field), name);
+                gtk_editable_set_text (GTK_EDITABLE (self->name_field), name);
             }
         }
     }
@@ -742,7 +742,7 @@ name_field_restore_original_name (GtkWidget *name_field)
 
     if (strcmp (original_name, displayed_name) != 0)
     {
-        gtk_entry_set_text (GTK_ENTRY (name_field), original_name);
+        gtk_editable_set_text (GTK_EDITABLE (name_field), original_name);
     }
     gtk_editable_select_region (GTK_EDITABLE (name_field), 0, -1);
 }
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index 938b2c63a..d073aa815 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -351,7 +351,7 @@ create_query (NautilusQueryEditor *editor)
 
     nautilus_query_set_search_content (query, fts_enabled);
 
-    nautilus_query_set_text (query, gtk_entry_get_text (GTK_ENTRY (editor->entry)));
+    nautilus_query_set_text (query, gtk_editable_get_text (GTK_EDITABLE (editor->entry)));
     nautilus_query_set_location (query, editor->location);
 
     /* We only set the query using the global setting for recursivity here,
@@ -386,7 +386,7 @@ entry_changed_cb (GtkWidget           *entry,
     {
         g_autofree gchar *text = NULL;
 
-        text = g_strdup (gtk_entry_get_text (GTK_ENTRY (editor->entry)));
+        text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (editor->entry)));
         text = g_strstrip (text);
 
         nautilus_query_set_text (editor->query, text);
@@ -739,11 +739,11 @@ nautilus_query_editor_set_query (NautilusQueryEditor *self,
 
     self->change_frozen = TRUE;
 
-    current_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->entry)));
+    current_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->entry)));
     current_text = g_strstrip (current_text);
     if (!g_str_equal (current_text, text))
     {
-        gtk_entry_set_text (GTK_ENTRY (self->entry), text);
+        gtk_editable_set_text (GTK_EDITABLE (self->entry), text);
     }
 
     if (g_set_object (&self->query, query))
@@ -762,7 +762,7 @@ nautilus_query_editor_set_text (NautilusQueryEditor *self,
     g_return_if_fail (text != NULL);
 
     /* The handler of the entry will take care of everything */
-    gtk_entry_set_text (GTK_ENTRY (self->entry), text);
+    gtk_editable_set_text (GTK_EDITABLE (self->entry), text);
 }
 
 static gboolean
diff --git a/src/nautilus-rename-file-popover-controller.c b/src/nautilus-rename-file-popover-controller.c
index 6f52f8da6..471b65e0e 100644
--- a/src/nautilus-rename-file-popover-controller.c
+++ b/src/nautilus-rename-file-popover-controller.c
@@ -208,7 +208,7 @@ name_entry_on_f2_pressed (GtkWidget                           *widget,
         gint end_offset;
 
         /* Select the name part without the file extension */
-        eel_filename_get_rename_region (gtk_entry_get_text (GTK_ENTRY (widget)),
+        eel_filename_get_rename_region (gtk_editable_get_text (GTK_EDITABLE (widget)),
                                         &start_offset, &end_offset);
         gtk_editable_select_region (GTK_EDITABLE (widget),
                                     start_offset, end_offset);
@@ -225,7 +225,7 @@ name_entry_on_undo (GtkWidget                           *widget,
 
     edit_name = nautilus_file_get_edit_name (self->target_file);
 
-    gtk_entry_set_text (GTK_ENTRY (widget), edit_name);
+    gtk_editable_set_text (GTK_EDITABLE (widget), edit_name);
 
     gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
 
@@ -373,7 +373,7 @@ nautilus_rename_file_popover_controller_show_for_file   (NautilusRenameFilePopov
 
     edit_name = nautilus_file_get_edit_name (self->target_file);
 
-    gtk_entry_set_text (GTK_ENTRY (self->name_entry), edit_name);
+    gtk_editable_set_text (GTK_EDITABLE (self->name_entry), edit_name);
 
     gtk_popover_set_pointing_to (GTK_POPOVER (self->rename_file_popover), pointing_to);
     gtk_widget_set_parent (self->rename_file_popover, relative_to);
@@ -393,9 +393,9 @@ nautilus_rename_file_popover_controller_show_for_file   (NautilusRenameFilePopov
     }
 
     n_chars = g_utf8_strlen (edit_name, -1);
-    gtk_entry_set_width_chars (GTK_ENTRY (self->name_entry),
-                               MIN (MAX (n_chars, RENAME_ENTRY_MIN_CHARS),
-                                    RENAME_ENTRY_MAX_CHARS));
+    gtk_editable_set_width_chars (GTK_EDITABLE (self->name_entry),
+                                  MIN (MAX (n_chars, RENAME_ENTRY_MIN_CHARS),
+                                       RENAME_ENTRY_MAX_CHARS));
 }
 
 static void
diff --git a/src/nautilus-search-popover.c b/src/nautilus-search-popover.c
index e5f4ce9d7..034be9229 100644
--- a/src/nautilus-search-popover.c
+++ b/src/nautilus-search-popover.c
@@ -165,7 +165,7 @@ date_entry_activate (GtkEntry              *entry,
         GDate *date;
 
         date = g_date_new ();
-        g_date_set_parse (date, gtk_entry_get_text (entry));
+        g_date_set_parse (date, gtk_editable_get_text (GTK_EDITABLE (entry)));
 
         /* Invalid date silently does nothing */
         if (!g_date_valid (date))
@@ -676,7 +676,7 @@ update_date_label (NautilusSearchPopover *popover,
 
         label = get_text_for_date_range (date_range, TRUE);
 
-        gtk_entry_set_text (GTK_ENTRY (popover->date_entry), days < 1 ? label : "");
+        gtk_editable_set_text (GTK_EDITABLE (popover->date_entry), days < 1 ? label : "");
 
         gtk_widget_show (popover->clear_date_button);
         gtk_label_set_label (GTK_LABEL (popover->select_date_button_label), label);
@@ -688,7 +688,7 @@ update_date_label (NautilusSearchPopover *popover,
     {
         gtk_label_set_label (GTK_LABEL (popover->select_date_button_label),
                              _("Select Dates…"));
-        gtk_entry_set_text (GTK_ENTRY (popover->date_entry), "");
+        gtk_editable_set_text (GTK_EDITABLE (popover->date_entry), "");
         gtk_widget_hide (popover->clear_date_button);
     }
 }
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 7e71e5f2e..ce783d4d7 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -860,7 +860,7 @@ nautilus_toolbar_constructed (GObject *object)
 
     /* Setting a max width on one entry to effectively set a max expansion for
      * the whole title widget. */
-    gtk_entry_set_max_width_chars (GTK_ENTRY (self->location_entry), 88);
+    gtk_editable_set_max_width_chars (GTK_EDITABLE (self->location_entry), 88);
 
     gtk_widget_show_all (GTK_WIDGET (self));
     toolbar_update_appearance (self);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]