[nautilus] file: replace eel_ref_str with GRefString
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] file: replace eel_ref_str with GRefString
- Date: Fri, 22 Feb 2019 11:56:01 +0000 (UTC)
commit b4d200fed3610f52620c69f1cd271a0e5aa34462
Author: Jordan Petridis <jpetridis gnome org>
Date: Mon Dec 10 19:55:38 2018 +0200
file: replace eel_ref_str with GRefString
glib now offers a reference counted api.
This allows us to replace a lot of legacy code and get rid of
eel_ref_str. GRefString [1] is almost a drop-in replacement.
nautilus-file-operations.c was indirectly depending upon
eel/eel-string.h from nautilus-file-private.h and thus
a new include was added.
This bumps the minimum version of glib to 2.58
Close #781
https://gitlab.gnome.org/GNOME/nautilus/issues/781
[1] https://developer.gnome.org/glib/stable/glib-Reference-counted-strings.html
eel/eel-string.c | 115 -------------------------
eel/eel-string.h | 9 --
meson.build | 2 +-
src/nautilus-directory-async.c | 6 +-
src/nautilus-file-operations.c | 1 +
src/nautilus-file-private.h | 19 ++---
src/nautilus-file.c | 158 ++++++++++++++++-------------------
src/nautilus-search-directory-file.c | 2 +-
8 files changed, 89 insertions(+), 223 deletions(-)
---
diff --git a/eel/eel-string.c b/eel/eel-string.c
index 077c1c379..6720d0af6 100644
--- a/eel/eel-string.c
+++ b/eel/eel-string.c
@@ -365,121 +365,6 @@ enum
ARG_TYPE_POINTER
};
-/*********** refcounted strings ****************/
-
-G_LOCK_DEFINE_STATIC (unique_ref_strs);
-static GHashTable *unique_ref_strs = NULL;
-
-static eel_ref_str
-eel_ref_str_new_internal (const char *string,
- int start_count)
-{
- char *res;
- volatile gint *count;
- gsize len;
-
- len = strlen (string);
- res = g_malloc (sizeof (gint) + len + 1);
- count = (volatile gint *) res;
- *count = start_count;
- res += sizeof (gint);
- memcpy (res, string, len + 1);
- return res;
-}
-
-eel_ref_str
-eel_ref_str_new (const char *string)
-{
- if (string == NULL)
- {
- return NULL;
- }
-
- return eel_ref_str_new_internal (string, 1);
-}
-
-eel_ref_str
-eel_ref_str_get_unique (const char *string)
-{
- eel_ref_str res;
-
- if (string == NULL)
- {
- return NULL;
- }
-
- G_LOCK (unique_ref_strs);
- if (unique_ref_strs == NULL)
- {
- unique_ref_strs =
- g_hash_table_new (g_str_hash, g_str_equal);
- }
-
- res = g_hash_table_lookup (unique_ref_strs, string);
- if (res != NULL)
- {
- eel_ref_str_ref (res);
- }
- else
- {
- res = eel_ref_str_new_internal (string, 0x80000001);
- g_hash_table_insert (unique_ref_strs, res, res);
- }
-
- G_UNLOCK (unique_ref_strs);
-
- return res;
-}
-
-eel_ref_str
-eel_ref_str_ref (eel_ref_str str)
-{
- volatile gint *count;
-
- count = (volatile gint *) ((char *) str - sizeof (gint));
- g_atomic_int_add (count, 1);
-
- return str;
-}
-
-void
-eel_ref_str_unref (eel_ref_str str)
-{
- volatile gint *count;
- gint old_ref;
-
- if (str == NULL)
- {
- return;
- }
-
- count = (volatile gint *) ((char *) str - sizeof (gint));
-
-retry_atomic_decrement:
- old_ref = g_atomic_int_get (count);
- if (old_ref == 1)
- {
- g_free ((char *) count);
- }
- else if (old_ref == 0x80000001)
- {
- G_LOCK (unique_ref_strs);
- /* Need to recheck after taking lock to avoid races with _get_unique() */
- if (g_atomic_int_add (count, -1) == 0x80000001)
- {
- g_hash_table_remove (unique_ref_strs, (char *) str);
- g_free ((char *) count);
- }
- G_UNLOCK (unique_ref_strs);
- }
- else if (!g_atomic_int_compare_and_exchange (count,
- old_ref, old_ref - 1))
- {
- goto retry_atomic_decrement;
- }
-}
-
-
#if !defined (EEL_OMIT_SELF_CHECK)
void
diff --git a/eel/eel-string.h b/eel/eel-string.h
index 63147d1cc..a83375055 100644
--- a/eel/eel-string.h
+++ b/eel/eel-string.h
@@ -77,12 +77,3 @@ char * eel_str_replace_substring (const char *str,
* common prefix of length min_required_len
*/
char * eel_str_get_common_prefix (GList *strs, int min_required_len);
-
-typedef char * eel_ref_str;
-
-eel_ref_str eel_ref_str_new (const char *string);
-eel_ref_str eel_ref_str_get_unique (const char *string);
-eel_ref_str eel_ref_str_ref (eel_ref_str str);
-void eel_ref_str_unref (eel_ref_str str);
-
-#define eel_ref_str_peek(__str) ((const char *)(__str))
\ No newline at end of file
diff --git a/meson.build b/meson.build
index 1185f38c5..0a267d670 100644
--- a/meson.build
+++ b/meson.build
@@ -105,7 +105,7 @@ pkgconfig = import('pkgconfig')
################
# Dependencies #
################
-glib_ver = '>= 2.55.1'
+glib_ver = '>= 2.58.1'
libgd = subproject(
'libgd',
diff --git a/src/nautilus-directory-async.c b/src/nautilus-directory-async.c
index 1b930f6a4..fc22bd042 100644
--- a/src/nautilus-directory-async.c
+++ b/src/nautilus-directory-async.c
@@ -4010,10 +4010,10 @@ got_filesystem_info (FilesystemInfoState *state,
g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY);
filesystem_type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
file->details->filesystem_remote = g_file_info_get_attribute_boolean (info,
G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE);
- if (g_strcmp0 (eel_ref_str_peek (file->details->filesystem_type), filesystem_type) != 0)
+ if (g_strcmp0 (file->details->filesystem_type, filesystem_type) != 0)
{
- eel_ref_str_unref (file->details->filesystem_type);
- file->details->filesystem_type = eel_ref_str_get_unique (filesystem_type);
+ g_clear_pointer (&file->details->filesystem_type, g_ref_string_release);
+ file->details->filesystem_type = g_ref_string_new_intern (filesystem_type);
}
}
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index d5379c7db..7579cd083 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -41,6 +41,7 @@
#include <eel/eel-glib-extensions.h>
#include <eel/eel-vfs-extensions.h>
+#include <eel/eel-string.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
diff --git a/src/nautilus-file-private.h b/src/nautilus-file-private.h
index 3ed301a75..ed9725b23 100644
--- a/src/nautilus-file-private.h
+++ b/src/nautilus-file-private.h
@@ -26,7 +26,6 @@
#include "nautilus-monitor.h"
#include "nautilus-file-undo-operations.h"
#include <eel/eel-glib-extensions.h>
-#include <eel/eel-string.h>
#define NAUTILUS_FILE_DEFAULT_ATTRIBUTES \
"standard::*,access::*,mountable::*,time::*,unix::*,owner::*,selinux::*,thumbnail::*,id::filesystem,trash::orig-path,trash::deletion-date,metadata::*,recent::*"
@@ -44,15 +43,15 @@ struct NautilusFileDetails
{
NautilusDirectory *directory;
- eel_ref_str name;
+ GRefString *name;
/* File info: */
GFileType type;
- eel_ref_str display_name;
+ GRefString *display_name;
char *display_name_collation_key;
char *directory_name_collation_key;
- eel_ref_str edit_name;
+ GRefString *edit_name;
goffset size; /* -1 is unknown */
@@ -62,16 +61,16 @@ struct NautilusFileDetails
int uid; /* -1 is none */
int gid; /* -1 is none */
- eel_ref_str owner;
- eel_ref_str owner_real;
- eel_ref_str group;
+ GRefString *owner;
+ GRefString *owner_real;
+ GRefString *group;
time_t atime; /* 0 is unknown */
time_t mtime; /* 0 is unknown */
char *symlink_name;
- eel_ref_str mime_type;
+ GRefString *mime_type;
char *selinux_context;
char *description;
@@ -103,7 +102,7 @@ struct NautilusFileDetails
/* used during DND, for checking whether source and destination are on
* the same file system.
*/
- eel_ref_str filesystem_id;
+ GRefString *filesystem_id;
char *trash_orig_path;
@@ -195,7 +194,7 @@ struct NautilusFileDetails
eel_boolean_bit filesystem_use_preview : 2; /* GFilesystemPreviewType */
eel_boolean_bit filesystem_info_is_up_to_date : 1;
eel_boolean_bit filesystem_remote : 1;
- eel_ref_str filesystem_type;
+ GRefString *filesystem_type;
time_t trash_time; /* 0 is unknown */
time_t recency; /* 0 is unknown */
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index c1b326762..0a76d64e3 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -257,37 +257,37 @@ nautilus_file_set_display_name (NautilusFile *file,
changed = FALSE;
- if (g_strcmp0 (eel_ref_str_peek (file->details->display_name), display_name) != 0)
+ if (g_strcmp0 (file->details->display_name, display_name) != 0)
{
changed = TRUE;
- eel_ref_str_unref (file->details->display_name);
+ g_clear_pointer (&file->details->display_name, g_ref_string_release);
- if (g_strcmp0 (eel_ref_str_peek (file->details->name), display_name) == 0)
+ if (g_strcmp0 (file->details->name, display_name) == 0)
{
- file->details->display_name = eel_ref_str_ref (file->details->name);
+ file->details->display_name = g_ref_string_acquire (file->details->name);
}
else
{
- file->details->display_name = eel_ref_str_new (display_name);
+ file->details->display_name = g_ref_string_new (display_name);
}
g_free (file->details->display_name_collation_key);
file->details->display_name_collation_key = g_utf8_collate_key_for_filename (display_name, -1);
}
- if (g_strcmp0 (eel_ref_str_peek (file->details->edit_name), edit_name) != 0)
+ if (g_strcmp0 (file->details->edit_name, edit_name) != 0)
{
changed = TRUE;
- eel_ref_str_unref (file->details->edit_name);
- if (g_strcmp0 (eel_ref_str_peek (file->details->display_name), edit_name) == 0)
+ g_clear_pointer (&file->details->edit_name, g_ref_string_release);
+ if (g_strcmp0 (file->details->display_name, edit_name) == 0)
{
- file->details->edit_name = eel_ref_str_ref (file->details->display_name);
+ file->details->edit_name = g_ref_string_acquire (file->details->display_name);
}
else
{
- file->details->edit_name = eel_ref_str_new (edit_name);
+ file->details->edit_name = g_ref_string_new (edit_name);
}
}
@@ -298,12 +298,10 @@ nautilus_file_set_display_name (NautilusFile *file,
static void
nautilus_file_clear_display_name (NautilusFile *file)
{
- eel_ref_str_unref (file->details->display_name);
- file->details->display_name = NULL;
+ g_clear_pointer (&file->details->display_name, g_ref_string_release);
g_free (file->details->display_name_collation_key);
file->details->display_name_collation_key = NULL;
- eel_ref_str_unref (file->details->edit_name);
- file->details->edit_name = NULL;
+ g_clear_pointer (&file->details->edit_name, g_ref_string_release);
}
static gboolean
@@ -560,21 +558,16 @@ nautilus_file_clear_info (NautilusFile *file)
file->details->recency = 0;
g_free (file->details->symlink_name);
file->details->symlink_name = NULL;
- eel_ref_str_unref (file->details->mime_type);
- file->details->mime_type = NULL;
+ g_clear_pointer (&file->details->mime_type, g_ref_string_release);
g_free (file->details->selinux_context);
file->details->selinux_context = NULL;
g_free (file->details->description);
file->details->description = NULL;
- eel_ref_str_unref (file->details->owner);
- file->details->owner = NULL;
- eel_ref_str_unref (file->details->owner_real);
- file->details->owner_real = NULL;
- eel_ref_str_unref (file->details->group);
- file->details->group = NULL;
+ g_clear_pointer (&file->details->owner, g_ref_string_release);
+ g_clear_pointer (&file->details->owner_real, g_ref_string_release);
+ g_clear_pointer (&file->details->group, g_ref_string_release);
- eel_ref_str_unref (file->details->filesystem_id);
- file->details->filesystem_id = NULL;
+ g_clear_pointer (&file->details->filesystem_id, g_ref_string_release);
clear_metadata (file);
}
@@ -615,7 +608,7 @@ nautilus_file_new_from_filename (NautilusDirectory *directory,
g_assert (filename[0] != '\0');
file = nautilus_directory_new_file_from_filename (directory, filename, self_owned);
- file->details->name = eel_ref_str_new (filename);
+ file->details->name = g_ref_string_new (filename);
#ifdef NAUTILUS_FILE_DEBUG_REF
DEBUG_REF_PRINTF ("%10p ref'd", file);
@@ -893,21 +886,21 @@ finalize (GObject *object)
}
nautilus_directory_unref (directory);
- eel_ref_str_unref (file->details->name);
- eel_ref_str_unref (file->details->display_name);
+ g_clear_pointer (&file->details->name, g_ref_string_release);
+ g_clear_pointer (&file->details->display_name, g_ref_string_release);
g_free (file->details->display_name_collation_key);
g_free (file->details->directory_name_collation_key);
- eel_ref_str_unref (file->details->edit_name);
+ g_clear_pointer (&file->details->edit_name, g_ref_string_release);
if (file->details->icon)
{
g_object_unref (file->details->icon);
}
g_free (file->details->thumbnail_path);
g_free (file->details->symlink_name);
- eel_ref_str_unref (file->details->mime_type);
- eel_ref_str_unref (file->details->owner);
- eel_ref_str_unref (file->details->owner_real);
- eel_ref_str_unref (file->details->group);
+ g_clear_pointer (&file->details->mime_type, g_ref_string_release);
+ g_clear_pointer (&file->details->owner, g_ref_string_release);
+ g_clear_pointer (&file->details->owner_real, g_ref_string_release);
+ g_clear_pointer (&file->details->group, g_ref_string_release);
g_free (file->details->selinux_context);
g_free (file->details->description);
g_free (file->details->activation_uri);
@@ -928,9 +921,8 @@ finalize (GObject *object)
g_object_unref (file->details->mount);
}
- eel_ref_str_unref (file->details->filesystem_id);
- eel_ref_str_unref (file->details->filesystem_type);
- file->details->filesystem_type = NULL;
+ g_clear_pointer (&file->details->filesystem_id, g_ref_string_release);
+ g_clear_pointer (&file->details->filesystem_type, g_ref_string_release);
g_free (file->details->trash_orig_path);
g_list_free_full (file->details->mime_list, g_free);
@@ -1935,7 +1927,7 @@ name_is (NautilusFile *file,
const char *new_name)
{
const char *old_name;
- old_name = eel_ref_str_peek (file->details->name);
+ old_name = file->details->name;
return strcmp (new_name, old_name) == 0;
}
@@ -2724,25 +2716,25 @@ update_info_internal (NautilusFile *file,
file->details->uid = uid;
file->details->gid = gid;
- if (g_strcmp0 (eel_ref_str_peek (file->details->owner), owner) != 0)
+ if (g_strcmp0 (file->details->owner, owner) != 0)
{
changed = TRUE;
- eel_ref_str_unref (file->details->owner);
- file->details->owner = eel_ref_str_get_unique (owner);
+ g_clear_pointer (&file->details->owner, g_ref_string_release);
+ file->details->owner = g_ref_string_new_intern (owner);
}
- if (g_strcmp0 (eel_ref_str_peek (file->details->owner_real), owner_real) != 0)
+ if (g_strcmp0 (file->details->owner_real, owner_real) != 0)
{
changed = TRUE;
- eel_ref_str_unref (file->details->owner_real);
- file->details->owner_real = eel_ref_str_get_unique (owner_real);
+ g_clear_pointer (&file->details->owner_real, g_ref_string_release);
+ file->details->owner_real = g_ref_string_new_intern (owner_real);
}
- if (g_strcmp0 (eel_ref_str_peek (file->details->group), group) != 0)
+ if (g_strcmp0 (file->details->group, group) != 0)
{
changed = TRUE;
- eel_ref_str_unref (file->details->group);
- file->details->group = eel_ref_str_get_unique (group);
+ g_clear_pointer (&file->details->group, g_ref_string_release);
+ file->details->group = g_ref_string_new_intern (group);
}
if (free_owner)
@@ -2831,11 +2823,11 @@ update_info_internal (NautilusFile *file,
}
mime_type = g_file_info_get_content_type (info);
- if (g_strcmp0 (eel_ref_str_peek (file->details->mime_type), mime_type) != 0)
+ if (g_strcmp0 (file->details->mime_type, mime_type) != 0)
{
changed = TRUE;
- eel_ref_str_unref (file->details->mime_type);
- file->details->mime_type = eel_ref_str_get_unique (mime_type);
+ g_clear_pointer (&file->details->mime_type, g_ref_string_release);
+ file->details->mime_type = g_ref_string_new_intern (mime_type);
}
selinux_context = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_SELINUX_CONTEXT);
@@ -2855,11 +2847,11 @@ update_info_internal (NautilusFile *file,
}
filesystem_id = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_ID_FILESYSTEM);
- if (g_strcmp0 (eel_ref_str_peek (file->details->filesystem_id), filesystem_id) != 0)
+ if (g_strcmp0 (file->details->filesystem_id, filesystem_id) != 0)
{
changed = TRUE;
- eel_ref_str_unref (file->details->filesystem_id);
- file->details->filesystem_id = eel_ref_str_get_unique (filesystem_id);
+ g_clear_pointer (&file->details->filesystem_id, g_ref_string_release);
+ file->details->filesystem_id = g_ref_string_new_intern (filesystem_id);
}
trash_time = 0;
@@ -2897,22 +2889,21 @@ update_info_internal (NautilusFile *file,
{
name = g_file_info_get_name (info);
if (file->details->name == NULL ||
- strcmp (eel_ref_str_peek (file->details->name), name) != 0)
+ strcmp (file->details->name, name) != 0)
{
changed = TRUE;
node = nautilus_directory_begin_file_name_change
(file->details->directory, file);
- eel_ref_str_unref (file->details->name);
- if (g_strcmp0 (eel_ref_str_peek (file->details->display_name),
- name) == 0)
+ g_clear_pointer (&file->details->name, g_ref_string_release);
+ if (g_strcmp0 (file->details->display_name, name) == 0)
{
- file->details->name = eel_ref_str_ref (file->details->display_name);
+ file->details->name = g_ref_string_acquire (file->details->display_name);
}
else
{
- file->details->name = eel_ref_str_new (name);
+ file->details->name = g_ref_string_new (name);
}
if (!file->details->got_custom_display_name &&
@@ -2980,8 +2971,8 @@ update_name_internal (NautilusFile *file,
(file->details->directory, file);
}
- eel_ref_str_unref (file->details->name);
- file->details->name = eel_ref_str_new (name);
+ g_clear_pointer (&file->details->name, g_ref_string_release);
+ file->details->name = g_ref_string_new (name);
if (!file->details->got_custom_display_name)
{
@@ -3437,8 +3428,8 @@ compare_by_type (NautilusFile *file_1,
if (file_1->details->mime_type != NULL &&
file_2->details->mime_type != NULL &&
- strcmp (eel_ref_str_peek (file_1->details->mime_type),
- eel_ref_str_peek (file_2->details->mime_type)) == 0)
+ strcmp (file_1->details->mime_type,
+ file_2->details->mime_type) == 0)
{
return 0;
}
@@ -3976,8 +3967,7 @@ nautilus_file_is_home (NautilusFile *file)
return FALSE;
}
- return nautilus_is_home_directory_file (location,
- eel_ref_str_peek (file->details->name));
+ return nautilus_is_home_directory_file (location, file->details->name);
}
gboolean
@@ -4401,7 +4391,7 @@ nautilus_file_peek_display_name (NautilusFile *file)
if (file->details->display_name == NULL)
{
- name = eel_ref_str_peek (file->details->name);
+ name = file->details->name;
if (g_utf8_validate (name, -1, NULL))
{
nautilus_file_set_display_name (file,
@@ -4421,7 +4411,7 @@ nautilus_file_peek_display_name (NautilusFile *file)
}
return file->details->display_name ?
- eel_ref_str_peek (file->details->display_name) : "";
+ file->details->display_name : "";
}
char *
@@ -4444,7 +4434,7 @@ nautilus_file_get_edit_name (NautilusFile *file)
{
const char *res;
- res = eel_ref_str_peek (file->details->edit_name);
+ res = file->details->edit_name;
if (res == NULL)
{
res = "";
@@ -4678,14 +4668,14 @@ nautilus_file_get_filesystem_type (NautilusFile *file)
if (nautilus_file_is_directory (file))
{
- filesystem_type = g_strdup (eel_ref_str_peek (file->details->filesystem_type));
+ filesystem_type = g_strdup (file->details->filesystem_type);
}
else
{
parent = nautilus_file_get_parent (file);
if (parent != NULL)
{
- filesystem_type = g_strdup (eel_ref_str_peek (parent->details->filesystem_type));
+ filesystem_type = g_strdup (parent->details->filesystem_type);
nautilus_file_unref (parent);
}
}
@@ -4724,7 +4714,7 @@ nautilus_file_should_show_thumbnail (NautilusFile *file)
use_preview = nautilus_file_get_filesystem_use_preview (file);
- mime_type = eel_ref_str_peek (file->details->mime_type);
+ mime_type = file->details->mime_type;
if (mime_type == NULL)
{
mime_type = "application/octet-stream";
@@ -4783,7 +4773,7 @@ nautilus_is_video_file (NautilusFile *file)
const char *mime_type;
guint i;
- mime_type = eel_ref_str_peek (file->details->mime_type);
+ mime_type = file->details->mime_type;
if (mime_type == NULL)
{
return FALSE;
@@ -5663,7 +5653,7 @@ nautilus_file_should_show_directory_item_count (NautilusFile *file)
g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
if (file->details->mime_type &&
- strcmp (eel_ref_str_peek (file->details->mime_type), "x-directory/smb-share") == 0)
+ strcmp (file->details->mime_type, "x-directory/smb-share") == 0)
{
return FALSE;
}
@@ -6502,7 +6492,7 @@ nautilus_file_can_get_group (NautilusFile *file)
char *
nautilus_file_get_group_name (NautilusFile *file)
{
- return g_strdup (eel_ref_str_peek (file->details->group));
+ return g_strdup (file->details->group);
}
/**
@@ -6844,20 +6834,20 @@ nautilus_file_get_owner_as_string (NautilusFile *file,
}
else if (file->details->owner_real == NULL)
{
- user_name = g_strdup (eel_ref_str_peek (file->details->owner));
+ user_name = g_strdup (file->details->owner);
}
else if (file->details->owner == NULL)
{
- user_name = g_strdup (eel_ref_str_peek (file->details->owner_real));
+ user_name = g_strdup (file->details->owner_real);
}
else if (include_real_name &&
- strcmp (eel_ref_str_peek (file->details->owner), eel_ref_str_peek (file->details->owner_real))
!= 0)
+ strcmp (file->details->owner, file->details->owner_real) != 0)
{
- user_name = g_strdup (eel_ref_str_peek (file->details->owner_real));
+ user_name = g_strdup (file->details->owner_real);
}
else
{
- user_name = g_strdup (eel_ref_str_peek (file->details->owner));
+ user_name = g_strdup (file->details->owner);
}
return user_name;
@@ -7490,7 +7480,7 @@ get_description (NautilusFile *file,
g_assert (NAUTILUS_IS_FILE (file));
- mime_type = eel_ref_str_peek (file->details->mime_type);
+ mime_type = file->details->mime_type;
if (mime_type == NULL)
{
return NULL;
@@ -7690,7 +7680,7 @@ nautilus_file_is_launchable (NautilusFile *file)
if (file->details->mime_type != NULL)
{
type_can_be_executable =
- g_content_type_can_be_executable (eel_ref_str_peek (file->details->mime_type));
+ g_content_type_can_be_executable (file->details->mime_type);
}
return type_can_be_executable &&
@@ -8219,7 +8209,7 @@ nautilus_file_is_executable (NautilusFile *file)
char *
nautilus_file_get_filesystem_id (NautilusFile *file)
{
- return g_strdup (eel_ref_str_peek (file->details->filesystem_id));
+ return g_strdup (file->details->filesystem_id);
}
NautilusFile *
@@ -9400,7 +9390,7 @@ get_name (NautilusFileInfo *file_info)
file = NAUTILUS_FILE (file_info);
- return g_strdup (eel_ref_str_peek (file->details->name));
+ return g_strdup (file->details->name);
}
static char *
@@ -9462,7 +9452,7 @@ get_mime_type (NautilusFileInfo *file_info)
if (file->details->mime_type != NULL)
{
- return g_strdup (eel_ref_str_peek (file->details->mime_type));
+ return g_strdup (file->details->mime_type);
}
return g_strdup ("application/octet-stream");
@@ -9481,7 +9471,7 @@ is_mime_type (NautilusFileInfo *file_info,
return FALSE;
}
- return g_content_type_is_a (eel_ref_str_peek (file->details->mime_type), mime_type);
+ return g_content_type_is_a (file->details->mime_type, mime_type);
}
static gboolean
@@ -9616,7 +9606,7 @@ get_location (NautilusFileInfo *file_info)
return g_object_ref (location);
}
- return g_file_get_child (location, eel_ref_str_peek (file->details->name));
+ return g_file_get_child (location, file->details->name);
}
static GFile *
diff --git a/src/nautilus-search-directory-file.c b/src/nautilus-search-directory-file.c
index e8091d497..1a87a59a8 100644
--- a/src/nautilus-search-directory-file.c
+++ b/src/nautilus-search-directory-file.c
@@ -256,7 +256,7 @@ nautilus_search_directory_file_init (NautilusSearchDirectoryFile *search_file)
g_free (xdg_dir);
file->details->got_file_info = TRUE;
- file->details->mime_type = eel_ref_str_get_unique ("x-directory/normal");
+ file->details->mime_type = g_ref_string_new_intern ("x-directory/normal");
file->details->type = G_FILE_TYPE_DIRECTORY;
file->details->size = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]