summaryrefslogtreecommitdiff
path: root/src/nautilus-batch-rename-dialog.c
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniojpfernandes@gmail.com>2022-01-09 01:25:39 +0000
committerAntónio Fernandes <antoniojpfernandes@gmail.com>2022-01-09 01:25:39 +0000
commite358c2343c47aa26d568254a12f06a8431b2da42 (patch)
tree592e1ec16487dc510d699c2f5215c67b4ef16060 /src/nautilus-batch-rename-dialog.c
parent041719803013e0a6c9e9b06bf3a35a9cbe2bf81b (diff)
downloadnautilus-e358c2343c47aa26d568254a12f06a8431b2da42.tar.gz
general: Switch to GTK4
The new major version of the toolkit is a requirement to fix old issues and enable future enhancements. Update symbols and adapt logic to API changes. Update and simplify UI definitions. Update local copy of places sidebar and places view. Replace dependencies with their GTK4-compatible successors. Make a minimum changes required to build and run, with known regressions to be fixed in future commits. For a detailed breakup of the changes, see the 36 commits-deep log leading to d5763facb1e5045251171ed1273dca0859f3542f. This is the main part of https://gitlab.gnome.org/GNOME/nautilus/-/issues/276
Diffstat (limited to 'src/nautilus-batch-rename-dialog.c')
-rw-r--r--src/nautilus-batch-rename-dialog.c52
1 files changed, 18 insertions, 34 deletions
diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c
index 9bb16e0c1..514be8879 100644
--- a/src/nautilus-batch-rename-dialog.c
+++ b/src/nautilus-batch-rename-dialog.c
@@ -63,8 +63,6 @@ struct _NautilusBatchRenameDialog
GList *listbox_icons;
GtkSizeGroup *size_group;
- GList *motion_controllers;
-
GList *selection;
GList *new_names;
NautilusBatchRenameDialogMode mode;
@@ -429,14 +427,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)
{
@@ -474,7 +472,7 @@ begin_batch_rename (NautilusBatchRenameDialog *dialog,
/* do the actual rename here */
nautilus_file_batch_rename (dialog->selection, new_names, NULL, NULL);
- gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (dialog->window)), NULL);
+ gtk_widget_set_cursor (GTK_WIDGET (dialog->window), NULL);
}
static void
@@ -584,7 +582,7 @@ create_original_name_label (NautilusBatchRenameDialog *dialog,
dialog->listbox_labels_old = g_list_prepend (dialog->listbox_labels_old, label_old);
- gtk_widget_show_all (label_old);
+ gtk_widget_show (label_old);
return label_old;
}
@@ -603,7 +601,7 @@ create_result_label (NautilusBatchRenameDialog *dialog,
dialog->listbox_labels_new = g_list_prepend (dialog->listbox_labels_new, label_new);
- gtk_widget_show_all (label_new);
+ gtk_widget_show (label_new);
return label_new;
}
@@ -629,7 +627,7 @@ create_arrow (NautilusBatchRenameDialog *dialog,
dialog->listbox_icons = g_list_prepend (dialog->listbox_icons, icon);
- gtk_widget_show_all (icon);
+ gtk_widget_show (icon);
return icon;
}
@@ -637,9 +635,6 @@ create_arrow (NautilusBatchRenameDialog *dialog,
static void
prepare_batch_rename (NautilusBatchRenameDialog *dialog)
{
- GdkCursor *cursor;
- GdkDisplay *display;
-
/* wait for checking conflicts to finish, to be sure that
* the rename can actually take place */
if (dialog->directories_pending_conflict_check != NULL)
@@ -653,22 +648,14 @@ prepare_batch_rename (NautilusBatchRenameDialog *dialog)
return;
}
- display = gtk_widget_get_display (GTK_WIDGET (dialog->window));
- cursor = gdk_cursor_new_from_name (display, "progress");
- gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (dialog->window)),
- cursor);
- g_object_unref (cursor);
+ gtk_widget_set_cursor_from_name (GTK_WIDGET (dialog->window), "progress");
- display = gtk_widget_get_display (GTK_WIDGET (dialog));
- cursor = gdk_cursor_new_from_name (display, "progress");
- gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (dialog)),
- cursor);
- g_object_unref (cursor);
+ gtk_widget_set_cursor_from_name (GTK_WIDGET (dialog), "progress");
gtk_widget_hide (GTK_WIDGET (dialog));
begin_batch_rename (dialog, dialog->new_names);
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
@@ -687,7 +674,7 @@ batch_rename_dialog_on_response (NautilusBatchRenameDialog *dialog,
cancel_conflict_check (dialog);
}
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
}
@@ -939,7 +926,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 +1214,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)
@@ -1386,7 +1373,7 @@ update_display_text (NautilusBatchRenameDialog *dialog)
static void
batch_rename_dialog_mode_changed (NautilusBatchRenameDialog *dialog)
{
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->format_mode_button)))
+ if (gtk_check_button_get_active (GTK_CHECK_BUTTON (dialog->format_mode_button)))
{
gtk_stack_set_visible_child_name (GTK_STACK (dialog->mode_stack), "format");
@@ -1859,7 +1846,6 @@ nautilus_batch_rename_dialog_finalize (GObject *object)
nautilus_directory_list_free (dialog->distinct_parent_directories);
g_object_unref (dialog->size_group);
- g_clear_list (&dialog->motion_controllers, g_object_unref);
g_hash_table_destroy (dialog->tag_info_table);
@@ -1994,7 +1980,7 @@ nautilus_batch_rename_dialog_new (GList *selection,
fill_display_listbox (dialog);
- gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), NULL);
+ gtk_widget_set_cursor (GTK_WIDGET (window), NULL);
g_string_free (dialog_title, TRUE);
@@ -2007,15 +1993,13 @@ connect_to_pointer_motion_events (NautilusBatchRenameDialog *self,
{
GtkEventController *controller;
- controller = gtk_event_controller_motion_new (listbox);
+ controller = gtk_event_controller_motion_new ();
+ gtk_widget_add_controller (listbox, controller);
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
g_signal_connect (controller, "leave",
G_CALLBACK (on_event_controller_motion_leave), self);
g_signal_connect (controller, "motion",
G_CALLBACK (on_event_controller_motion_motion), self);
-
- self->motion_controllers = g_list_prepend (self->motion_controllers,
- controller);
}
static void