~ubuntu-branches/debian/jessie/file-roller/jessie

« back to all changes in this revision

Viewing changes to src/glib-utils.h

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2013-05-25 13:13:26 UTC
  • mfrom: (1.8.1) (5.1.10 experimental)
  • Revision ID: package-import@ubuntu.com-20130525131326-bm7bv6b4yig6820h
Tags: 3.8.2-1
* New upstream release.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#define _GLIB_UTILS_H
24
24
 
25
25
#include <time.h>
26
 
 
27
 
#define g_signal_handlers_disconnect_by_data(instance, data) \
28
 
    g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, \
29
 
                                          0, 0, NULL, NULL, (data))
30
 
 
31
 
/* gobject utils */
32
 
 
33
 
gpointer            _g_object_ref                (gpointer    object);
34
 
void                _g_object_unref              (gpointer    object);
35
 
 
36
 
/* string utils */
37
 
 
38
 
gboolean            strchrs                      (const char *str,
39
 
                                                  const char *chars);
40
 
char *              str_substitute               (const char *str,
41
 
                                                  const char *from_str,
42
 
                                                  const char *to_str);
43
 
int                 strcmp_null_tolerant         (const char *s1, const char *s2);
44
 
char*               escape_str_common            (const char *str,
45
 
                                                  const char *meta_chars,
46
 
                                                  const char  prefix,
47
 
                                                  const char  postfix);
48
 
char*               escape_str                   (const char  *str,
49
 
                                                  const char  *meta_chars);
50
 
gchar *             shell_escape                 (const gchar *filename);
51
 
gboolean            match_regexps                (GRegex     **regexps,
52
 
                                                  const char  *string,
53
 
                                                  GRegexMatchFlags match_options);
54
 
char **             search_util_get_patterns     (const char  *pattern_string);
55
 
GRegex **           search_util_get_regexps      (const char  *pattern_string,
56
 
                                                  GRegexCompileFlags  compile_options);
57
 
void                free_regexps                 (GRegex     **regexps);
58
 
char *              _g_strdup_with_max_size      (const char  *s,
59
 
                                                  int          max_size);
60
 
const char *        eat_spaces                   (const char  *line);
61
 
const char *        eat_void_chars               (const char  *line);
62
 
char **             split_line                   (const char  *line,
63
 
                                                  int          n_fields);
64
 
const char *        get_last_field               (const char  *line,
65
 
                                                  int          last_field);
66
 
int                 n_fields                     (char       **str_array);
67
 
char *              get_time_string              (time_t       time);
68
 
GPtrArray *         g_ptr_array_copy             (GPtrArray   *array);
69
 
void                g_ptr_array_free_full        (GPtrArray   *array,
70
 
                                                  GFunc        func,
71
 
                                                  gpointer     user_data);
72
 
void                g_ptr_array_reverse          (GPtrArray   *array);
73
 
int                 g_ptr_array_binary_search    (GPtrArray   *array,
74
 
                                                  gpointer     value,
75
 
                                                  GCompareFunc func);
76
 
const char *        get_static_string            (const char  *s);
77
 
char*               g_uri_display_basename       (const char  *uri);
78
 
char **             _g_strv_prepend              (char        **str_array,
79
 
                                                  const char   *str);
80
 
gboolean            _g_strv_remove               (char        **str_array,
81
 
                                                  const char   *str);
82
 
 
83
 
/**/
 
26
#include <glib.h>
 
27
#include <gio/gio.h>
84
28
 
85
29
#ifndef __GNUC__
86
30
#define __FUNCTION__ ""
87
31
#endif
88
32
 
89
33
#define DEBUG_INFO __FILE__, __LINE__, __FUNCTION__
90
 
 
91
 
void     debug                     (const char *file,
92
 
                                    int         line,
93
 
                                    const char *function,
94
 
                                    const char *format, ...);
 
34
#define MIME_TYPE_DIRECTORY "folder"
 
35
#define MIME_TYPE_ARCHIVE "application/x-archive"
 
36
 
 
37
#define get_home_relative_path(x)        \
 
38
        g_strconcat (g_get_home_dir (), \
 
39
                     "/",               \
 
40
                     (x),               \
 
41
                     NULL)
 
42
 
 
43
#define g_signal_handlers_disconnect_by_data(instance, data) \
 
44
    g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, \
 
45
                                          0, 0, NULL, NULL, (data))
 
46
 
 
47
/* gobject */
 
48
 
 
49
gpointer            _g_object_ref                  (gpointer             object);
 
50
void                _g_object_unref                (gpointer             object);
 
51
void                _g_clear_object                (gpointer             p);
 
52
GList *             _g_object_list_ref             (GList               *list);
 
53
void                _g_object_list_unref           (GList               *list);
 
54
 
 
55
/* enum */
 
56
 
 
57
GEnumValue *        _g_enum_type_get_value         (GType                enum_type,
 
58
                                                    int                  value);
 
59
GEnumValue *        _g_enum_type_get_value_by_nick (GType                enum_type,
 
60
                                                    const char          *nick);
 
61
 
 
62
/* error */
 
63
 
 
64
void                _g_error_free                  (GError              *error);
 
65
 
 
66
/* string */
 
67
 
 
68
gboolean            _g_strchrs                     (const char          *str,
 
69
                                                    const char          *chars);
 
70
char *              _g_str_substitute              (const char          *str,
 
71
                                                    const char          *from_str,
 
72
                                                    const char          *to_str);
 
73
gboolean            _g_str_equal                   (const char          *s1,
 
74
                                                    const char          *s2);
 
75
char*               _g_str_escape_full             (const char          *str,
 
76
                                                    const char          *meta_chars,
 
77
                                                    const char           prefix,
 
78
                                                    const char           postfix);
 
79
char*               _g_str_escape                  (const char          *str,
 
80
                                                    const char          *meta_chars);
 
81
char *              _g_str_shell_escape            (const char          *filename);
 
82
char *              _g_strdup_with_max_size        (const char          *s,
 
83
                                                    int                  max_size);
 
84
const char *        _g_str_eat_spaces              (const char          *line);
 
85
const char *        _g_str_eat_void_chars          (const char          *line);
 
86
char **             _g_str_split_line              (const char          *line,
 
87
                                                    int                  n_fields);
 
88
const char *        _g_str_get_last_field          (const char          *line,
 
89
                                                    int                  last_field);
 
90
const char *        _g_str_get_static              (const char          *s);
 
91
 
 
92
/* string vector */
 
93
 
 
94
char **             _g_strv_prepend                (char               **str_array,
 
95
                                                    const char          *str);
 
96
gboolean            _g_strv_remove                 (char               **str_array,
 
97
                                                    const char          *str);
 
98
 
 
99
/* string list */
 
100
 
 
101
void                _g_string_list_free            (GList               *path_list);
 
102
GList *             _g_string_list_dup             (GList               *path_list);
 
103
 
 
104
/* GPtrArray */
 
105
 
 
106
GPtrArray *         _g_ptr_array_copy              (GPtrArray           *array);
 
107
void                _g_ptr_array_free_full         (GPtrArray           *array,
 
108
                                                    GFunc                func,
 
109
                                                    gpointer             user_data);
 
110
void                _g_ptr_array_reverse           (GPtrArray           *array);
 
111
int                 _g_ptr_array_binary_search     (GPtrArray           *array,
 
112
                                                    gpointer             value,
 
113
                                                    GCompareFunc         func);
 
114
 
 
115
/* GRegex */
 
116
 
 
117
gboolean            _g_regexp_matchv               (GRegex             **regexps,
 
118
                                                    const char          *string,
 
119
                                                    GRegexMatchFlags     match_options);
 
120
void                _g_regexp_freev                (GRegex             **regexps);
 
121
char **             _g_regexp_get_patternv         (const char          *pattern_string);
 
122
GRegex **           _g_regexp_split_from_patterns  (const char          *pattern_string,
 
123
                                                    GRegexCompileFlags   compile_options);
 
124
 
 
125
/* time */
 
126
 
 
127
char *              _g_time_to_string              (time_t               time);
 
128
 
 
129
/* uri/path/filename */
 
130
 
 
131
const char *        _g_uri_get_home                (void);
 
132
char *              _g_uri_get_home_relative       (const char          *partial_uri);
 
133
const char *        _g_uri_remove_host             (const char          *uri);
 
134
char *              _g_uri_get_host                (const char          *uri);
 
135
char *              _g_uri_get_root                (const char          *uri);
 
136
int                 _g_uri_cmp                     (const char          *uri1,
 
137
                                                    const char          *uri2);
 
138
const char *        _g_path_get_basename           (const char          *path);
 
139
char *              _g_path_get_dir_name           (const char          *path);
 
140
char *              _g_path_remove_level           (const char          *path);
 
141
char *              _g_path_remove_ending_separator(const char          *path);
 
142
char *              _g_path_remove_extension       (const char          *path);
 
143
gboolean            _g_path_is_parent_of           (const char          *dirname,
 
144
                                                    const char          *filename);
 
145
const char *        _g_path_get_relative_basename  (const char          *path,
 
146
                                                    const char          *base_dir,
 
147
                                                    gboolean             junk_paths);
 
148
gboolean            _g_filename_is_hidden          (const char          *name);
 
149
const char *        _g_filename_get_extension      (const char          *filename);
 
150
gboolean            _g_filename_has_extension      (const char          *filename,
 
151
                                                    const char          *ext);
 
152
char *              _g_filename_get_random         (int                  random_part_len,
 
153
                                                    const char          *suffix);
 
154
gboolean            _g_mime_type_matches           (const char          *type,
 
155
                                                    const char          *pattern);
 
156
const char *        _g_mime_type_get_from_content  (char                *buffer,
 
157
                                                    gsize                buffer_size);
 
158
 
 
159
/* GFile */
 
160
 
 
161
int                 _g_file_cmp_uris               (GFile               *a,
 
162
                                                    GFile               *b);
 
163
gboolean            _g_file_is_local               (GFile               *file);
 
164
GFile *             _g_file_get_home               (void);
 
165
char *              _g_file_get_display_basename   (GFile               *file);
 
166
GFile *             _g_file_new_home_relative      (const char          *partial_uri);
 
167
GList *             _g_file_list_dup               (GList               *l);
 
168
void                _g_file_list_free              (GList               *l);
 
169
GList *             _g_file_list_new_from_uri_list (GList               *uris);
 
170
GFile *             _g_file_append_path            (GFile               *file,
 
171
                                                    ...);
 
172
 
 
173
/* GKeyFile */
 
174
 
 
175
GList *             _g_key_file_get_string_list    (GKeyFile            *key_file,
 
176
                                                    const char          *group_name,
 
177
                                                    const char          *key,
 
178
                                                    GError             **error);
 
179
 
 
180
/* functions used to parse a command output lines. */
 
181
 
 
182
gboolean            _g_line_matches_pattern        (const char          *line,
 
183
                                                    const char          *pattern);
 
184
int                 _g_line_get_index_from_pattern (const char          *line,
 
185
                                                    const char          *pattern);
 
186
char*               _g_line_get_next_field         (const char          *line,
 
187
                                                    int                  start_from,
 
188
                                                    int                  field_n);
 
189
char*               _g_line_get_prev_field         (const char          *line,
 
190
                                                    int                  start_from,
 
191
                                                    int                  field_n);
 
192
 
 
193
/* debug */
 
194
 
 
195
void                debug                          (const char          *file,
 
196
                                                    int                  line,
 
197
                                                    const char          *function,
 
198
                                                    const char          *format,
 
199
                                                    ...);
95
200
 
96
201
#endif /* _GLIB_UTILS_H */