mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-10-29 03:34:16 +00:00
general: Use g_set_* macros
This commit is contained in:
parent
45f58ae68d
commit
be9fc5678a
8 changed files with 14 additions and 56 deletions
|
@ -2458,9 +2458,7 @@ show_rename_popover (NautilusGtkSidebarRow *row)
|
|||
|
||||
create_rename_popover (sidebar);
|
||||
|
||||
if (sidebar->rename_uri)
|
||||
g_free (sidebar->rename_uri);
|
||||
sidebar->rename_uri = g_strdup (uri);
|
||||
g_set_str (&sidebar->rename_uri, uri);
|
||||
|
||||
gtk_editable_set_text (GTK_EDITABLE (sidebar->rename_entry), name);
|
||||
|
||||
|
@ -3710,10 +3708,8 @@ update_hostname (NautilusGtkPlacesSidebar *sidebar)
|
|||
|
||||
hostname = g_variant_get_string (variant, &len);
|
||||
if (len > 0 &&
|
||||
g_strcmp0 (sidebar->hostname, hostname) != 0)
|
||||
g_set_str (&sidebar->hostname, hostname))
|
||||
{
|
||||
g_free (sidebar->hostname);
|
||||
sidebar->hostname = g_strdup (hostname);
|
||||
update_places (sidebar);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,11 +79,8 @@ static void
|
|||
nautilus_bookmark_set_name_internal (NautilusBookmark *bookmark,
|
||||
const char *new_name)
|
||||
{
|
||||
if (g_strcmp0 (bookmark->name, new_name) != 0)
|
||||
if (g_set_str (&bookmark->name, new_name))
|
||||
{
|
||||
g_free (bookmark->name);
|
||||
bookmark->name = g_strdup (new_name);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (bookmark), properties[PROP_NAME]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2720,11 +2720,9 @@ update_info_internal (NautilusFile *file,
|
|||
}
|
||||
|
||||
thumbnail_path = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH);
|
||||
if (g_strcmp0 (file->details->thumbnail_path, thumbnail_path) != 0)
|
||||
if (g_set_str (&file->details->thumbnail_path, thumbnail_path))
|
||||
{
|
||||
changed = TRUE;
|
||||
g_free (file->details->thumbnail_path);
|
||||
file->details->thumbnail_path = g_strdup (thumbnail_path);
|
||||
}
|
||||
|
||||
thumbnailing_failed = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED);
|
||||
|
@ -2736,11 +2734,9 @@ update_info_internal (NautilusFile *file,
|
|||
|
||||
symlink_name = g_file_info_get_attribute_byte_string (info,
|
||||
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET);
|
||||
if (g_strcmp0 (file->details->symlink_name, symlink_name) != 0)
|
||||
if (g_set_str (&file->details->symlink_name, symlink_name))
|
||||
{
|
||||
changed = TRUE;
|
||||
g_free (file->details->symlink_name);
|
||||
file->details->symlink_name = g_strdup (symlink_name);
|
||||
}
|
||||
|
||||
mime_type = g_file_info_get_attribute_string (info,
|
||||
|
@ -2757,11 +2753,9 @@ update_info_internal (NautilusFile *file,
|
|||
}
|
||||
|
||||
selinux_context = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_SELINUX_CONTEXT);
|
||||
if (g_strcmp0 (file->details->selinux_context, selinux_context) != 0)
|
||||
if (g_set_str (&file->details->selinux_context, selinux_context))
|
||||
{
|
||||
changed = TRUE;
|
||||
g_free (file->details->selinux_context);
|
||||
file->details->selinux_context = g_strdup (selinux_context);
|
||||
}
|
||||
|
||||
filesystem_id = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_ID_FILESYSTEM);
|
||||
|
@ -2795,11 +2789,9 @@ update_info_internal (NautilusFile *file,
|
|||
}
|
||||
|
||||
trash_orig_path = g_file_info_get_attribute_byte_string (info, "trash::orig-path");
|
||||
if (g_strcmp0 (file->details->trash_orig_path, trash_orig_path) != 0)
|
||||
if (g_set_str (&file->details->trash_orig_path, trash_orig_path))
|
||||
{
|
||||
changed = TRUE;
|
||||
g_free (file->details->trash_orig_path);
|
||||
file->details->trash_orig_path = g_strdup (trash_orig_path);
|
||||
}
|
||||
|
||||
if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_PREVIEW_ICON))
|
||||
|
|
|
@ -448,11 +448,8 @@ void
|
|||
nautilus_floating_bar_set_primary_label (NautilusFloatingBar *self,
|
||||
const gchar *label)
|
||||
{
|
||||
if (g_strcmp0 (self->primary_label, label) != 0)
|
||||
if (g_set_str (&self->primary_label, label))
|
||||
{
|
||||
g_free (self->primary_label);
|
||||
self->primary_label = g_strdup (label);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PRIMARY_LABEL]);
|
||||
|
||||
update_labels (self);
|
||||
|
@ -463,11 +460,8 @@ void
|
|||
nautilus_floating_bar_set_details_label (NautilusFloatingBar *self,
|
||||
const gchar *label)
|
||||
{
|
||||
if (g_strcmp0 (self->details_label, label) != 0)
|
||||
if (g_set_str (&self->details_label, label))
|
||||
{
|
||||
g_free (self->details_label);
|
||||
self->details_label = g_strdup (label);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_DETAILS_LABEL]);
|
||||
|
||||
update_labels (self);
|
||||
|
|
|
@ -162,11 +162,7 @@ nautilus_freedesktop_dbus_dispose (GObject *object)
|
|||
fdb->owner_id = 0;
|
||||
}
|
||||
|
||||
if (fdb->skeleton != NULL)
|
||||
{
|
||||
g_object_unref (fdb->skeleton);
|
||||
fdb->skeleton = NULL;
|
||||
}
|
||||
g_clear_object (&fdb->skeleton);
|
||||
|
||||
G_OBJECT_CLASS (nautilus_freedesktop_dbus_parent_class)->dispose (object);
|
||||
}
|
||||
|
|
|
@ -1117,12 +1117,7 @@ button_data_file_changed (NautilusFile *file,
|
|||
/* MOUNTs use the GMount as the name, so don't update for those */
|
||||
if (button_data->type != MOUNT_BUTTON)
|
||||
{
|
||||
const char *display_name = nautilus_file_get_display_name (file);
|
||||
if (g_strcmp0 (display_name, button_data->dir_name) != 0)
|
||||
{
|
||||
g_free (button_data->dir_name);
|
||||
button_data->dir_name = g_strdup (display_name);
|
||||
}
|
||||
g_set_str (&button_data->dir_name, nautilus_file_get_display_name (file));
|
||||
}
|
||||
current_dir = g_file_equal (self->current_path, button_data->path);
|
||||
nautilus_path_bar_update_button_appearance (button_data, current_dir);
|
||||
|
@ -1341,11 +1336,6 @@ nautilus_path_bar_set_path (NautilusPathBar *self,
|
|||
nautilus_path_bar_update_path (self, file_path);
|
||||
button_data = g_list_nth_data (self->button_list, 0);
|
||||
|
||||
if (self->current_path != NULL)
|
||||
{
|
||||
g_object_unref (self->current_path);
|
||||
}
|
||||
|
||||
self->current_path = g_object_ref (file_path);
|
||||
g_set_object (&self->current_path, file_path);
|
||||
self->current_button_data = button_data;
|
||||
}
|
||||
|
|
|
@ -1252,11 +1252,8 @@ update_extension_list (NautilusPropertiesWindow *self)
|
|||
|
||||
const char *mime_type = nautilus_file_get_mime_type (get_file (self));
|
||||
|
||||
if (g_strcmp0 (self->mime_type, mime_type) != 0)
|
||||
if (g_set_str (&self->mime_type, mime_type))
|
||||
{
|
||||
g_free (self->mime_type);
|
||||
self->mime_type = g_strdup (mime_type);
|
||||
|
||||
refresh_extension_model_pages (self);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,11 +207,7 @@ static void
|
|||
nautilus_x_content_bar_set_mount (NautilusXContentBar *bar,
|
||||
GMount *mount)
|
||||
{
|
||||
if (bar->mount != NULL)
|
||||
{
|
||||
g_object_unref (bar->mount);
|
||||
}
|
||||
bar->mount = mount != NULL ? g_object_ref (mount) : NULL;
|
||||
g_set_object (&bar->mount, mount);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue