summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcaja-private/caja-file.c')
-rw-r--r--libcaja-private/caja-file.c64
1 files changed, 23 insertions, 41 deletions
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index d80629e2..2e3ad466 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -72,8 +72,6 @@
#include <unistd.h>
#include <sys/stat.h>
-#include <src/glibcompat.h> /* for g_list_free_full */
-
#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#endif
@@ -116,7 +114,7 @@ enum {
static int date_format_pref;
-static guint signals[LAST_SIGNAL];
+static guint signals[LAST_SIGNAL] = { 0 };
static GHashTable *symbolic_links;
@@ -694,7 +692,7 @@ caja_file_get_internal (GFile *location, gboolean create)
/* Ref or create the file. */
if (file != NULL) {
caja_file_ref (file);
- } else if (create) {
+ } else if (create && directory != NULL) {
file = caja_file_new_from_filename (directory, basename, self_owned);
if (self_owned) {
g_assert (directory->details->as_file == NULL);
@@ -5958,14 +5956,10 @@ caja_file_get_size_as_string (CajaFile *file)
return NULL;
}
- #if GLIB_CHECK_VERSION(2, 30, 0)
- if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
- return g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS);
- else
- return g_format_size (file->details->size);
- #else // Since 2.16
- return g_format_size_for_display(file->details->size);
- #endif
+ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
+ return g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS);
+ else
+ return g_format_size (file->details->size);
}
/**
@@ -5985,8 +5979,8 @@ caja_file_get_size_as_string_with_real_size (CajaFile *file)
{
guint item_count;
gboolean count_unreadable;
- char * formated;
- char * formated_plus_real;
+ char * formatted;
+ char * formatted_plus_real;
char * real_size;
if (file == NULL) {
@@ -6006,21 +6000,17 @@ caja_file_get_size_as_string_with_real_size (CajaFile *file)
return NULL;
}
- #if GLIB_CHECK_VERSION(2, 30, 0)
- if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
- formated = g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS);
- else
- formated = g_format_size(file->details->size);
- #else
- formated = g_format_size_for_display(file->details->size);
- #endif
+ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
+ formatted = g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS);
+ else
+ formatted = g_format_size(file->details->size);
/* Do this in a separate stage so that we don't have to put G_GUINT64_FORMAT in the translated string */
real_size = g_strdup_printf (_("%"G_GUINT64_FORMAT), (guint64) file->details->size);
- formated_plus_real = g_strdup_printf (_("%s (%s bytes)"), formated, real_size);
+ formatted_plus_real = g_strdup_printf (_("%s (%s bytes)"), formatted, real_size);
g_free (real_size);
- g_free (formated);
- return formated_plus_real;
+ g_free (formatted);
+ return formatted_plus_real;
}
@@ -6081,14 +6071,10 @@ caja_file_get_deep_count_as_string_internal (CajaFile *file,
*/
if (report_size)
{
- #if GLIB_CHECK_VERSION(2, 30, 0)
- if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
- return g_format_size_full (total_size, G_FORMAT_SIZE_IEC_UNITS);
- else
- return g_format_size(total_size);
- #else
- return g_format_size_for_display(total_size);
- #endif
+ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
+ return g_format_size_full (total_size, G_FORMAT_SIZE_IEC_UNITS);
+ else
+ return g_format_size(total_size);
}
return format_item_count_for_display (report_directory_count
@@ -6899,14 +6885,10 @@ caja_file_get_volume_free_space (CajaFile *file)
if (directory->details->free_space != (guint64) -1)
{
- #if GLIB_CHECK_VERSION(2, 30, 0)
- if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
- res = g_format_size_full (directory->details->free_space, G_FORMAT_SIZE_IEC_UNITS);
- else
- res = g_format_size(directory->details->free_space);
- #else
- res = g_format_size_for_display(directory->details->free_space);
- #endif
+ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
+ res = g_format_size_full (directory->details->free_space, G_FORMAT_SIZE_IEC_UNITS);
+ else
+ res = g_format_size(directory->details->free_space);
}
return res;