[nautilus/wip/apoos-maximus/gsoc2020: 7/8] properties-window: Use modern GList code patterns
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/apoos-maximus/gsoc2020: 7/8] properties-window: Use modern GList code patterns
- Date: Thu, 17 Dec 2020 18:40:31 +0000 (UTC)
commit fc8180c986a5b71eed1e8d2b58cedd37817257a0
Author: António Fernandes <antoniof gnome org>
Date: Tue Dec 15 15:09:44 2020 +0000
properties-window: Use modern GList code patterns
- Use GList API instead of reimplementing it:
- g_list_copy_deep()
- g_list_foreach()
- g_list_delete_link()
- Declare looping pointer in for()
- Don't reimplement nautilus_mime_get_default_application_for_file()
src/nautilus-properties-window.c | 273 +++++++++++++--------------------------
1 file changed, 87 insertions(+), 186 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index f655a3829..d88cfa35d 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -284,12 +284,12 @@ static void schedule_directory_contents_update (NautilusPropertiesWindow *self);
static void directory_contents_value_field_update (NautilusPropertiesWindow *self);
static void file_changed_callback (NautilusFile *file,
gpointer user_data);
-static void permission_button_update (NautilusPropertiesWindow *self,
- GtkToggleButton *button);
-static void permission_combo_update (NautilusPropertiesWindow *self,
- GtkComboBox *combo);
-static void value_field_update (NautilusPropertiesWindow *self,
- GtkLabel *field);
+static void permission_button_update (GtkToggleButton *button,
+ NautilusPropertiesWindow *self);
+static void permission_combo_update (GtkComboBox *combo,
+ NautilusPropertiesWindow *self);
+static void value_field_update (GtkLabel *field,
+ NautilusPropertiesWindow *self);
static void properties_window_update (NautilusPropertiesWindow *self,
GList *files);
static void is_directory_ready_callback (NautilusFile *file,
@@ -317,12 +317,11 @@ G_DEFINE_TYPE (NautilusPropertiesWindow, nautilus_properties_window, GTK_TYPE_WI
static gboolean
is_multi_file_window (NautilusPropertiesWindow *self)
{
- GList *l;
int count;
count = 0;
- for (l = self->original_files; l != NULL; l = l->next)
+ for (GList *l = self->original_files; l != NULL; l = l->next)
{
if (!nautilus_file_is_gone (NAUTILUS_FILE (l->data)))
{
@@ -340,12 +339,11 @@ is_multi_file_window (NautilusPropertiesWindow *self)
static int
get_not_gone_original_file_count (NautilusPropertiesWindow *self)
{
- GList *l;
int count;
count = 0;
- for (l = self->original_files; l != NULL; l = l->next)
+ for (GList *l = self->original_files; l != NULL; l = l->next)
{
if (!nautilus_file_is_gone (NAUTILUS_FILE (l->data)))
{
@@ -395,12 +393,11 @@ get_image_for_properties_window (NautilusPropertiesWindow *self,
GdkPixbuf **icon_pixbuf)
{
g_autoptr (NautilusIconInfo) icon = NULL;
- GList *l;
gint icon_scale;
icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (self->notebook));
- for (l = self->original_files; l != NULL; l = l->next)
+ for (GList *l = self->original_files; l != NULL; l = l->next)
{
NautilusFile *file;
g_autoptr (NautilusIconInfo) new_icon = NULL;
@@ -499,9 +496,7 @@ uri_is_local_image (const char *uri)
static void
reset_icon (NautilusPropertiesWindow *self)
{
- GList *l;
-
- for (l = self->original_files; l != NULL; l = l->next)
+ for (GList *l = self->original_files; l != NULL; l = l->next)
{
NautilusFile *file;
@@ -653,13 +648,12 @@ update_name_field (NautilusPropertiesWindow *self)
/* Multifile property dialog, show all names */
g_autoptr (GString) str = NULL;
gboolean first;
- GList *l;
str = g_string_new ("");
first = TRUE;
- for (l = self->target_files; l != NULL; l = l->next)
+ for (GList *l = self->target_files; l != NULL; l = l->next)
{
g_autofree gchar *name = NULL;
@@ -963,11 +957,8 @@ remove_from_dialog (NautilusPropertiesWindow *self,
original_file = NAUTILUS_FILE (original_link->data);
target_file = NAUTILUS_FILE (target_link->data);
- self->original_files = g_list_remove_link (self->original_files, original_link);
- g_list_free (original_link);
-
- self->target_files = g_list_remove_link (self->target_files, target_link);
- g_list_free (target_link);
+ self->original_files = g_list_delete_link (self->original_files, original_link);
+ self->target_files = g_list_delete_link (self->target_files, target_link);
g_hash_table_remove (self->initial_permissions, target_file);
@@ -1002,16 +993,9 @@ mime_list_equal (GList *a,
static GList *
get_mime_list (NautilusPropertiesWindow *self)
{
- GList *ret;
- GList *l;
-
- ret = NULL;
- for (l = self->target_files; l != NULL; l = l->next)
- {
- ret = g_list_append (ret, nautilus_file_get_mime_type (NAUTILUS_FILE (l->data)));
- }
- ret = g_list_reverse (ret);
- return ret;
+ return g_list_copy_deep (self->target_files,
+ (GCopyFunc) nautilus_file_get_mime_type,
+ NULL);
}
static gboolean
@@ -1063,8 +1047,8 @@ stop_deep_count_for_file (NautilusPropertiesWindow *self,
}
static void
-start_deep_count_for_file (NautilusPropertiesWindow *self,
- NautilusFile *file)
+start_deep_count_for_file (NautilusFile *file,
+ NautilusPropertiesWindow *self)
{
if (!nautilus_file_is_directory (file))
{
@@ -1092,9 +1076,7 @@ static void
properties_window_update (NautilusPropertiesWindow *self,
GList *files)
{
- GList *l;
GList *mime_list;
- GList *tmp;
NautilusFile *changed_file;
gboolean dirty_original = FALSE;
gboolean dirty_target = FALSE;
@@ -1105,7 +1087,7 @@ properties_window_update (NautilusPropertiesWindow *self,
dirty_target = TRUE;
}
- for (tmp = files; tmp != NULL; tmp = tmp->next)
+ for (GList *tmp = files; tmp != NULL; tmp = tmp->next)
{
changed_file = NAUTILUS_FILE (tmp->data);
@@ -1144,25 +1126,20 @@ properties_window_update (NautilusPropertiesWindow *self,
if (dirty_target)
{
- for (l = self->permission_buttons; l != NULL; l = l->next)
- {
- permission_button_update (self, GTK_TOGGLE_BUTTON (l->data));
- }
-
- for (l = self->permission_combos; l != NULL; l = l->next)
- {
- permission_combo_update (self, GTK_COMBO_BOX (l->data));
- }
-
- for (l = self->value_fields; l != NULL; l = l->next)
- {
- value_field_update (self, GTK_LABEL (l->data));
- }
+ g_list_foreach (self->permission_buttons,
+ (GFunc) permission_button_update,
+ self);
+ g_list_foreach (self->permission_combos,
+ (GFunc) permission_combo_update,
+ self);
+ g_list_foreach (self->value_fields,
+ (GFunc) value_field_update,
+ self);
}
mime_list = get_mime_list (self);
- if (!self->mime_list)
+ if (self->mime_list == NULL)
{
self->mime_list = mime_list;
}
@@ -1223,11 +1200,10 @@ file_list_attributes_identical (GList *file_list,
{
gboolean identical;
g_autofree char *first_attr = NULL;
- GList *l;
identical = TRUE;
- for (l = file_list; l != NULL; l = l->next)
+ for (GList *l = file_list; l != NULL; l = l->next)
{
NautilusFile *file;
@@ -1264,9 +1240,7 @@ file_list_get_string_attribute (GList *file_list,
{
if (file_list_attributes_identical (file_list, attribute_name))
{
- GList *l;
-
- for (l = file_list; l != NULL; l = l->next)
+ for (GList *l = file_list; l != NULL; l = l->next)
{
NautilusFile *file;
@@ -1286,21 +1260,6 @@ file_list_get_string_attribute (GList *file_list,
}
}
-
-static gboolean
-file_list_all_directories (GList *file_list)
-{
- GList *l;
- for (l = file_list; l != NULL; l = l->next)
- {
- if (!nautilus_file_is_directory (NAUTILUS_FILE (l->data)))
- {
- return FALSE;
- }
- }
- return TRUE;
-}
-
#define INCONSISTENT_STATE_STRING \
"\xE2\x80\x92"
@@ -1316,13 +1275,13 @@ location_show_original (NautilusPropertiesWindow *self)
}
static void
-value_field_update (NautilusPropertiesWindow *self,
- GtkLabel *label)
+value_field_update (GtkLabel *label,
+ NautilusPropertiesWindow *self)
{
GList *file_list;
const char *attribute_name;
g_autofree char *attribute_value = NULL;
- char *inconsistent_string;
+ const char *inconsistent_string = INCONSISTENT_STATE_STRING;
gboolean is_where;
g_assert (GTK_IS_LABEL (label));
@@ -1339,7 +1298,6 @@ value_field_update (NautilusPropertiesWindow *self,
file_list = self->target_files;
}
- inconsistent_string = INCONSISTENT_STATE_STRING;
attribute_value = file_list_get_string_attribute (file_list,
attribute_name,
inconsistent_string);
@@ -1621,7 +1579,7 @@ static void
synch_groups_combo_box (GtkComboBox *combo_box,
NautilusFile *file)
{
- GList *groups;
+ GList *groups = NULL;
GList *node;
GtkTreeModel *model;
GtkListStore *store;
@@ -1882,7 +1840,7 @@ static void
synch_user_menu (GtkComboBox *combo_box,
NautilusFile *file)
{
- GList *users;
+ GList *users = NULL;
GList *node;
GtkTreeModel *model;
GtkListStore *store;
@@ -2013,12 +1971,11 @@ static gboolean
file_has_prefix (NautilusFile *file,
GList *prefix_candidates)
{
- GList *p;
g_autoptr (GFile) location = NULL;
location = nautilus_file_get_location (file);
- for (p = prefix_candidates; p != NULL; p = p->next)
+ for (GList *p = prefix_candidates; p != NULL; p = p->next)
{
g_autoptr (GFile) candidate_location = NULL;
@@ -2048,7 +2005,6 @@ directory_contents_value_field_update (NautilusPropertiesWindow *self)
guint unreadable_directory_count;
goffset total_size;
NautilusFile *file;
- GList *l;
guint file_unreadable;
goffset file_size;
gboolean deep_count_active;
@@ -2059,7 +2015,7 @@ directory_contents_value_field_update (NautilusPropertiesWindow *self)
total_size = 0;
unreadable_directory_count = FALSE;
- for (l = self->target_files; l; l = l->next)
+ for (GList *l = self->target_files; l; l = l->next)
{
file = NAUTILUS_FILE (l->data);
@@ -2187,15 +2143,9 @@ static void
setup_contents_field (NautilusPropertiesWindow *self,
GtkGrid *grid)
{
- GList *l;
-
- for (l = self->target_files; l; l = l->next)
- {
- NautilusFile *file;
-
- file = NAUTILUS_FILE (l->data);
- start_deep_count_for_file (self, file);
- }
+ g_list_foreach (self->target_files,
+ (GFunc) start_deep_count_for_file,
+ self);
/* Fill in the initial value. */
directory_contents_value_field_update (self);
@@ -2262,9 +2212,7 @@ should_show_file_type (NautilusPropertiesWindow *self)
static gboolean
should_show_location_info (NautilusPropertiesWindow *self)
{
- GList *l;
-
- for (l = self->original_files; l != NULL; l = l->next)
+ for (GList *l = self->original_files; l != NULL; l = l->next)
{
if (nautilus_file_is_in_trash (NAUTILUS_FILE (l->data)) ||
is_root_directory (NAUTILUS_FILE (l->data)) ||
@@ -2281,9 +2229,7 @@ should_show_location_info (NautilusPropertiesWindow *self)
static gboolean
should_show_trash_orig_path (NautilusPropertiesWindow *self)
{
- GList *l;
-
- for (l = self->original_files; l != NULL; l = l->next)
+ for (GList *l = self->original_files; l != NULL; l = l->next)
{
if (!nautilus_file_is_in_trash (NAUTILUS_FILE (l->data)))
{
@@ -2301,7 +2247,7 @@ should_show_accessed_date (NautilusPropertiesWindow *self)
* day decide that it is useful, we should separately
* consider whether it's useful for "trash:".
*/
- if (file_list_all_directories (self->target_files)
+ if (nautilus_file_list_are_all_folders (self->target_files)
|| is_multi_file_window (self))
{
return FALSE;
@@ -2319,9 +2265,7 @@ should_show_modified_date (NautilusPropertiesWindow *self)
static gboolean
should_show_trashed_on (NautilusPropertiesWindow *self)
{
- GList *l;
-
- for (l = self->original_files; l != NULL; l = l->next)
+ for (GList *l = self->original_files; l != NULL; l = l->next)
{
if (!nautilus_file_is_in_trash (NAUTILUS_FILE (l->data)))
{
@@ -2356,7 +2300,7 @@ should_show_free_space (NautilusPropertiesWindow *self)
return FALSE;
}
- if (file_list_all_directories (self->target_files))
+ if (nautilus_file_list_are_all_folders (self->target_files))
{
return TRUE;
}
@@ -2821,9 +2765,7 @@ setup_basic_page (NautilusPropertiesWindow *self)
static gboolean
files_has_directory (NautilusPropertiesWindow *self)
{
- GList *l;
-
- for (l = self->target_files; l != NULL; l = l->next)
+ for (GList *l = self->target_files; l != NULL; l = l->next)
{
NautilusFile *file;
file = NAUTILUS_FILE (l->data);
@@ -2839,10 +2781,9 @@ files_has_directory (NautilusPropertiesWindow *self)
static gboolean
files_has_changable_permissions_directory (NautilusPropertiesWindow *self)
{
- GList *l;
gboolean changable = FALSE;
- for (l = self->target_files; l != NULL; l = l->next)
+ for (GList *l = self->target_files; l != NULL; l = l->next)
{
NautilusFile *file;
file = NAUTILUS_FILE (l->data);
@@ -2865,9 +2806,7 @@ files_has_changable_permissions_directory (NautilusPropertiesWindow *self)
static gboolean
files_has_file (NautilusPropertiesWindow *self)
{
- GList *l;
-
- for (l = self->target_files; l != NULL; l = l->next)
+ for (GList *l = self->target_files; l != NULL; l = l->next)
{
NautilusFile *file;
file = NAUTILUS_FILE (l->data);
@@ -2931,9 +2870,7 @@ update_permissions (NautilusPropertiesWindow *self,
gboolean apply_to_both_folder_and_dir,
gboolean use_original)
{
- GList *l;
-
- for (l = self->target_files; l != NULL; l = l->next)
+ for (GList *l = self->target_files; l != NULL; l = l->next)
{
NautilusFile *file;
guint32 permissions;
@@ -2982,13 +2919,12 @@ initial_permission_state_consistent (NautilusPropertiesWindow *self,
gboolean is_folder,
gboolean both_folder_and_dir)
{
- GList *l;
gboolean first;
guint32 first_permissions;
first = TRUE;
first_permissions = 0;
- for (l = self->target_files; l != NULL; l = l->next)
+ for (GList *l = self->target_files; l != NULL; l = l->next)
{
NautilusFile *file;
guint32 permissions;
@@ -3088,10 +3024,9 @@ permission_button_toggled (GtkToggleButton *button,
}
static void
-permission_button_update (NautilusPropertiesWindow *self,
- GtkToggleButton *button)
+permission_button_update (GtkToggleButton *button,
+ NautilusPropertiesWindow *self)
{
- GList *l;
gboolean all_set;
gboolean all_unset;
gboolean all_cannot_set;
@@ -3111,7 +3046,7 @@ permission_button_update (NautilusPropertiesWindow *self,
all_unset = TRUE;
all_cannot_set = TRUE;
no_match = TRUE;
- for (l = self->target_files; l != NULL; l = l->next)
+ for (GList *l = self->target_files; l != NULL; l = l->next)
{
NautilusFile *file;
guint32 file_permissions;
@@ -3383,8 +3318,8 @@ permission_combo_add_multiple_choice (GtkComboBox *combo,
}
static void
-permission_combo_update (NautilusPropertiesWindow *self,
- GtkComboBox *combo)
+permission_combo_update (GtkComboBox *combo,
+ NautilusPropertiesWindow *self)
{
PermissionType type;
PermissionValue perm, all_dir_perm, all_file_perm, all_perm;
@@ -3394,7 +3329,6 @@ permission_combo_update (NautilusPropertiesWindow *self,
int mask;
GtkTreeModel *model;
GtkListStore *store;
- GList *l;
gboolean is_multi;
model = gtk_combo_box_get_model (combo);
@@ -3417,7 +3351,7 @@ permission_combo_update (NautilusPropertiesWindow *self,
all_dir_cannot_set = TRUE;
all_file_cannot_set = TRUE;
- for (l = self->target_files; l != NULL; l = l->next)
+ for (GList *l = self->target_files; l != NULL; l = l->next)
{
NautilusFile *file;
guint32 file_permissions;
@@ -3675,8 +3609,7 @@ setup_permissions_combo_box (GtkComboBox *combo,
static gboolean
all_can_get_permissions (GList *file_list)
{
- GList *l;
- for (l = file_list; l != NULL; l = l->next)
+ for (GList *l = file_list; l != NULL; l = l->next)
{
NautilusFile *file;
@@ -3694,8 +3627,7 @@ all_can_get_permissions (GList *file_list)
static gboolean
all_can_set_permissions (GList *file_list)
{
- GList *l;
- for (l = file_list; l != NULL; l = l->next)
+ for (GList *l = file_list; l != NULL; l = l->next)
{
NautilusFile *file;
@@ -3714,12 +3646,11 @@ static GHashTable *
get_initial_permissions (GList *file_list)
{
GHashTable *ret;
- GList *l;
ret = g_hash_table_new (g_direct_hash,
g_direct_equal);
- for (l = file_list; l != NULL; l = l->next)
+ for (GList *l = file_list; l != NULL; l = l->next)
{
guint32 permissions;
NautilusFile *file;
@@ -3901,7 +3832,6 @@ on_change_permissions_response (GtkDialog *dialog,
guint32 vfs_mask, vfs_new_perm;
GtkWidget *combo;
gboolean is_folder, use_original;
- GList *l;
GtkTreeModel *model;
GtkTreeIter iter;
PermissionType type;
@@ -3920,7 +3850,7 @@ on_change_permissions_response (GtkDialog *dialog,
dir_permission_mask = 0;
/* Simple mode, minus exec checkbox */
- for (l = self->change_permission_combos; l != NULL; l = l->next)
+ for (GList *l = self->change_permission_combos; l != NULL; l = l->next)
{
combo = l->data;
@@ -3964,7 +3894,7 @@ on_change_permissions_response (GtkDialog *dialog,
}
}
- for (l = self->target_files; l != NULL; l = l->next)
+ for (GList *l = self->target_files; l != NULL; l = l->next)
{
NautilusFile *file;
@@ -4215,22 +4145,20 @@ static void
append_extension_pages (NautilusPropertiesWindow *self)
{
g_autolist (GObject) providers = NULL;
- GList *p;
providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER);
- for (p = providers; p != NULL; p = p->next)
+ for (GList *p = providers; p != NULL; p = p->next)
{
NautilusPropertyPageProvider *provider;
g_autolist (NautilusPropertyPage) pages = NULL;
- GList *l;
provider = NAUTILUS_PROPERTY_PAGE_PROVIDER (p->data);
pages = nautilus_property_page_provider_get_pages
(provider, self->original_files);
- for (l = pages; l != NULL; l = l->next)
+ for (GList *l = pages; l != NULL; l = l->next)
{
NautilusPropertyPage *page;
g_autoptr (GtkWidget) page_widget = NULL;
@@ -4259,12 +4187,10 @@ append_extension_pages (NautilusPropertiesWindow *self)
static gboolean
should_show_permissions (NautilusPropertiesWindow *self)
{
- GList *l;
-
/* Don't show permissions for Trash and Computer since they're not
* really file system objects.
*/
- for (l = self->original_files; l != NULL; l = l->next)
+ for (GList *l = self->original_files; l != NULL; l = l->next)
{
if (nautilus_file_is_in_trash (NAUTILUS_FILE (l->data)) ||
nautilus_file_is_in_recent (NAUTILUS_FILE (l->data)))
@@ -4279,20 +4205,19 @@ should_show_permissions (NautilusPropertiesWindow *self)
static char *
get_pending_key (GList *file_list)
{
- GList *l;
- GList *uris;
+ GList *uris = NULL;
GString *key;
char *ret;
uris = NULL;
- for (l = file_list; l != NULL; l = l->next)
+ for (GList *l = file_list; l != NULL; l = l->next)
{
uris = g_list_prepend (uris, nautilus_file_get_uri (NAUTILUS_FILE (l->data)));
}
uris = g_list_sort (uris, (GCompareFunc) strcmp);
key = g_string_new ("");
- for (l = uris; l != NULL; l = l->next)
+ for (GList *l = uris; l != NULL; l = l->next)
{
g_string_append (key, l->data);
g_string_append (key, ";");
@@ -4318,7 +4243,6 @@ startup_data_new (GList *original_files,
NautilusPropertiesWindow *window)
{
StartupData *data;
- GList *l;
data = g_new0 (StartupData, 1);
data->original_files = nautilus_file_list_copy (original_files);
@@ -4333,7 +4257,7 @@ startup_data_new (GList *original_files,
data->callback_data = callback_data;
data->window = window;
- for (l = data->target_files; l != NULL; l = l->next)
+ for (GList *l = data->target_files; l != NULL; l = l->next)
{
g_hash_table_insert (data->pending_files, l->data, l->data);
}
@@ -4383,15 +4307,13 @@ should_show_open_with (NautilusPropertiesWindow *self)
if (is_multi_file_window (self))
{
- GList *l;
-
if (!file_list_attributes_identical (self->target_files,
"mime_type"))
{
return FALSE;
}
- for (l = self->target_files; l; l = l->next)
+ for (GList *l = self->target_files; l; l = l->next)
{
g_autoptr (GAppInfo) app_info = NULL;
@@ -4718,7 +4640,6 @@ static NautilusPropertiesWindow *
create_properties_window (StartupData *startup_data)
{
NautilusPropertiesWindow *window;
- GList *l;
window = NAUTILUS_PROPERTIES_WINDOW (gtk_widget_new (NAUTILUS_TYPE_PROPERTIES_WINDOW,
NULL));
@@ -4751,7 +4672,7 @@ create_properties_window (StartupData *startup_data)
* target files.
*/
- for (l = window->original_files; l != NULL; l = l->next)
+ for (GList *l = window->original_files; l != NULL; l = l->next)
{
NautilusFile *file;
NautilusFileAttributes attributes;
@@ -4767,7 +4688,7 @@ create_properties_window (StartupData *startup_data)
attributes);
}
- for (l = window->target_files; l != NULL; l = l->next)
+ for (GList *l = window->target_files; l != NULL; l = l->next)
{
NautilusFile *file;
NautilusFileAttributes attributes;
@@ -4784,7 +4705,7 @@ create_properties_window (StartupData *startup_data)
nautilus_file_monitor_add (file, &window->target_files, attributes);
}
- for (l = window->target_files; l != NULL; l = l->next)
+ for (GList *l = window->target_files; l != NULL; l = l->next)
{
g_signal_connect_object (NAUTILUS_FILE (l->data),
"changed",
@@ -4793,7 +4714,7 @@ create_properties_window (StartupData *startup_data)
0);
}
- for (l = window->original_files; l != NULL; l = l->next)
+ for (GList *l = window->original_files; l != NULL; l = l->next)
{
g_signal_connect_object (NAUTILUS_FILE (l->data),
"changed",
@@ -4829,23 +4750,9 @@ create_properties_window (StartupData *startup_data)
static GList *
get_target_file_list (GList *original_files)
{
- GList *ret;
- GList *l;
-
- ret = NULL;
-
- for (l = original_files; l != NULL; l = l->next)
- {
- NautilusFile *target;
-
- target = get_target_file_for_original_file (NAUTILUS_FILE (l->data));
-
- ret = g_list_prepend (ret, target);
- }
-
- ret = g_list_reverse (ret);
-
- return ret;
+ return g_list_copy_deep (original_files,
+ (GCopyFunc) get_target_file_for_original_file,
+ NULL);
}
static void
@@ -5010,7 +4917,7 @@ nautilus_properties_window_present (GList *original_f
NautilusPropertiesWindowCallback callback,
gpointer callback_data)
{
- GList *l, *next;
+ GList *next;
GtkWindow *parent_window;
StartupData *startup_data;
g_autolist (NautilusFile) target_files = NULL;
@@ -5104,7 +5011,7 @@ nautilus_properties_window_present (GList *original_f
_("Creating Properties window."),
parent_window == NULL ? NULL : GTK_WINDOW (parent_window));
- for (l = startup_data->target_files; l != NULL; l = next)
+ for (GList *l = startup_data->target_files; l != NULL; l = next)
{
next = l->next;
nautilus_file_call_when_ready
@@ -5119,7 +5026,6 @@ static void
real_destroy (GtkWidget *object)
{
NautilusPropertiesWindow *self;
- GList *l;
self = NAUTILUS_PROPERTIES_WINDOW (object);
@@ -5128,17 +5034,15 @@ real_destroy (GtkWidget *object)
unschedule_or_cancel_group_change (self);
unschedule_or_cancel_owner_change (self);
- for (l = self->original_files; l != NULL; l = l->next)
- {
- nautilus_file_monitor_remove (NAUTILUS_FILE (l->data), &self->original_files);
- }
+ g_list_foreach (self->original_files,
+ (GFunc) nautilus_file_monitor_remove,
+ &self->original_files);
nautilus_file_list_free (self->original_files);
self->original_files = NULL;
- for (l = self->target_files; l != NULL; l = l->next)
- {
- nautilus_file_monitor_remove (NAUTILUS_FILE (l->data), &self->target_files);
- }
+ g_list_foreach (self->target_files,
+ (GFunc) nautilus_file_monitor_remove,
+ &self->target_files);
nautilus_file_list_free (self->target_files);
self->target_files = NULL;
@@ -5224,9 +5128,7 @@ set_icon (const char *icon_uri,
/* we don't allow remote URIs */
if (icon_path != NULL)
{
- GList *l;
-
- for (l = self->original_files; l != NULL; l = l->next)
+ for (GList *l = self->original_files; l != NULL; l = l->next)
{
g_autofree gchar *file_uri = NULL;
g_autoptr (GFile) file_location = NULL;
@@ -5339,7 +5241,6 @@ select_image_button_callback (GtkWidget *widget,
{
GtkWidget *dialog, *preview;
GtkFileFilter *filter;
- GList *l;
NautilusFile *file;
gboolean revert_is_sensitive;
@@ -5401,7 +5302,7 @@ select_image_button_callback (GtkWidget *widget,
}
revert_is_sensitive = FALSE;
- for (l = self->original_files; l != NULL; l = l->next)
+ for (GList *l = self->original_files; l != NULL; l = l->next)
{
g_autofree gchar *image_path = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]