~ubuntu-branches/ubuntu/wily/caja/wily

« back to all changes in this revision

Viewing changes to libcaja-private/caja-file.c

  • Committer: Package Import Robot
  • Author(s): John Paul Adrian Glaubitz, Martin Wimpress, John Paul Adrian Glaubitz
  • Date: 2015-08-10 13:39:55 UTC
  • mfrom: (1.2.1) (9.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20150810133955-b2uyptg7cf8rn8su
Tags: 1.10.3-1
[ Martin Wimpress ]
* New upstream release.
* debian/caja-common.install:
  + Add common files.
* debian/caja.install:
  + Remove common files.
* debian/libcaja-extension-dev.install:
  + Add usr/share/gtk-doc.
* debian/rules:
  + Add --enable-gtk-doc.
  + Remove dfsg suffix.
* debian/watch:
  + Remove dfsg suffix.

[ John Paul Adrian Glaubitz ]
* Fix spelling in debian/control (allows to -> allows one to).
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
 
63
63
#include <libcaja-extension/caja-file-info.h>
64
64
#include <libcaja-extension/caja-extension-private.h>
 
65
#include <libcaja-private/caja-extensions.h>
 
66
 
65
67
#include <libxml/parser.h>
66
68
#include <pwd.h>
67
69
#include <stdlib.h>
70
72
#include <unistd.h>
71
73
#include <sys/stat.h>
72
74
 
73
 
#include <src/glibcompat.h> /* for g_list_free_full */
74
 
 
75
75
#ifdef HAVE_SELINUX
76
76
#include <selinux/selinux.h>
77
77
#endif
114
114
 
115
115
static int date_format_pref;
116
116
 
117
 
static guint signals[LAST_SIGNAL];
 
117
static guint signals[LAST_SIGNAL] = { 0 };
118
118
 
119
119
static GHashTable *symbolic_links;
120
120
 
692
692
        /* Ref or create the file. */
693
693
        if (file != NULL) {
694
694
                caja_file_ref (file);
695
 
        } else if (create) {
 
695
        } else if (create && directory != NULL) {
696
696
                file = caja_file_new_from_filename (directory, basename, self_owned);
697
697
                if (self_owned) {
698
698
                        g_assert (directory->details->as_file == NULL);
5956
5956
                return NULL;
5957
5957
        }
5958
5958
 
5959
 
        #if GLIB_CHECK_VERSION(2, 30, 0)
5960
 
                if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
5961
 
                        return g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS);
5962
 
                else
5963
 
                        return g_format_size (file->details->size);
5964
 
        #else  // Since 2.16
5965
 
                return g_format_size_for_display(file->details->size);
5966
 
        #endif
 
5959
        if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
 
5960
                return g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS);
 
5961
        else
 
5962
                return g_format_size (file->details->size);
5967
5963
}
5968
5964
 
5969
5965
/**
5983
5979
{
5984
5980
        guint item_count;
5985
5981
        gboolean count_unreadable;
5986
 
        char * formated;
5987
 
        char * formated_plus_real;
 
5982
        char * formatted;
 
5983
        char * formatted_plus_real;
5988
5984
        char * real_size;
5989
5985
 
5990
5986
        if (file == NULL) {
6004
6000
                return NULL;
6005
6001
        }
6006
6002
 
6007
 
        #if GLIB_CHECK_VERSION(2, 30, 0)
6008
 
                if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
6009
 
                        formated = g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS);
6010
 
                else
6011
 
                        formated = g_format_size(file->details->size);
6012
 
        #else
6013
 
                formated = g_format_size_for_display(file->details->size);
6014
 
        #endif
 
6003
        if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
 
6004
                formatted = g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS);
 
6005
        else
 
6006
                formatted = g_format_size(file->details->size);
6015
6007
 
6016
6008
        /* Do this in a separate stage so that we don't have to put G_GUINT64_FORMAT in the translated string */
6017
6009
        real_size = g_strdup_printf (_("%"G_GUINT64_FORMAT), (guint64) file->details->size);
6018
 
        formated_plus_real = g_strdup_printf (_("%s (%s bytes)"), formated, real_size);
 
6010
        formatted_plus_real = g_strdup_printf (_("%s (%s bytes)"), formatted, real_size);
6019
6011
        g_free (real_size);
6020
 
        g_free (formated);
6021
 
        return formated_plus_real;
 
6012
        g_free (formatted);
 
6013
        return formatted_plus_real;
6022
6014
}
6023
6015
 
6024
6016
 
6079
6071
         */
6080
6072
        if (report_size)
6081
6073
        {
6082
 
                #if GLIB_CHECK_VERSION(2, 30, 0)
6083
 
                        if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
6084
 
                                return g_format_size_full (total_size, G_FORMAT_SIZE_IEC_UNITS);
6085
 
                        else
6086
 
                                return g_format_size(total_size);
6087
 
                #else
6088
 
                        return g_format_size_for_display(total_size);
6089
 
                #endif
 
6074
                if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
 
6075
                        return g_format_size_full (total_size, G_FORMAT_SIZE_IEC_UNITS);
 
6076
                else
 
6077
                        return g_format_size(total_size);
6090
6078
        }
6091
6079
 
6092
6080
        return format_item_count_for_display (report_directory_count
6897
6885
 
6898
6886
        if (directory->details->free_space != (guint64) -1)
6899
6887
        {
6900
 
                #if GLIB_CHECK_VERSION(2, 30, 0)
6901
 
                        if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
6902
 
                                res = g_format_size_full (directory->details->free_space, G_FORMAT_SIZE_IEC_UNITS);
6903
 
                        else
6904
 
                                res = g_format_size(directory->details->free_space);
6905
 
                #else
6906
 
                        res = g_format_size_for_display(directory->details->free_space);
6907
 
                #endif
 
6888
                if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
 
6889
                        res = g_format_size_full (directory->details->free_space, G_FORMAT_SIZE_IEC_UNITS);
 
6890
                else
 
6891
                        res = g_format_size(directory->details->free_space);
6908
6892
        }
6909
6893
 
6910
6894
        return res;
7586
7570
                g_list_free_full (file->details->pending_info_providers, g_object_unref);
7587
7571
 
7588
7572
        file->details->pending_info_providers =
7589
 
                caja_module_get_extensions_for_type (CAJA_TYPE_INFO_PROVIDER);
 
7573
                caja_extensions_get_for_type (CAJA_TYPE_INFO_PROVIDER);
7590
7574
}
7591
7575
 
7592
7576
void