~ubuntu-branches/ubuntu/dapper/file-roller/dapper-updates

« back to all changes in this revision

Viewing changes to src/recent-files/egg-recent-item.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-12-13 00:19:53 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051213001953-0klipgnhk6vikhrt
Tags: 2.13.2-0ubuntu1
* New upstream version:
  - Fixed bug #323713: "Save as" should default to current archive filename
    (Ubuntu: #20132)
  - Fixed bug #315069: file-roller: drag 'n drop doesn't work for more
    than 1 file.
  - Fixed bug #323534: Passwords improperly escaped for zip files
  - Do not open a progress dialog when dragging files, use a progressbar
    in the statusbar instead.
  - Fixed bug #316364: Nautilus dependency should be optional
  - Fixed bug #311821: ascending and descending indicators are opposite
    from expected.
  - Fixed bug #317423: Conflicting mnemonic in "Extract" dialog.
  - Fixed bug #323068: file-roller fails in chosing extract-to directory
  - Fixed bug #322197: Improve Naming Filename when create new Archive file
  - Fixed bug #316564: needs unzip AND zip
    (Ubuntu: #15595)
  - Simplified the add dialog populating the file type combobox with the
    extensions instead of the descriptions.
  - Set progress dialog display delay to 1 second.
  - More HIG compliant progress dialog.
  - Use a single command execution to add many files and folders to an
    archive to speed up the operation.
  - Allow to stop creation of a new archive.
  - Correctly associate fr to 7zip files.
* debian/patches/03_lp-autoconf.patch:
  - updated

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
        return item;
102
102
}
103
103
 
104
 
/*
105
 
static GList *
106
 
egg_recent_item_copy_groups (const GList *list)
107
 
{
108
 
        GList *newlist = NULL;
109
 
 
110
 
        while (list) {
111
 
                gchar *group = (gchar *)list->data;
112
 
 
113
 
                newlist = g_list_prepend (newlist, g_strdup (group));
114
 
 
115
 
                list = list->next;
116
 
        }
117
 
 
118
 
        return newlist;
119
 
}
120
 
 
121
 
 
122
 
EggRecentItem *
123
 
egg_recent_item_copy (const EggRecentItem *item)
124
 
{
125
 
        EggRecentItem *newitem;
126
 
 
127
 
        newitem = egg_recent_item_new ();
128
 
        newitem->uri = g_strdup (item->uri);
129
 
        if (item->mime_type)
130
 
                newitem->mime_type = g_strdup (item->mime_type);
131
 
        newitem->mime_type_is_explicit = item->mime_type_is_explicit
132
 
        newitem->timestamp = item->timestamp;
133
 
        newitem->private_data = item->private_data;
134
 
        newitem->groups = egg_recent_item_copy_groups (item->groups);
135
 
 
136
 
        return newitem;
137
 
}
138
 
*/
139
 
 
140
 
/*
141
 
EggRecentItem *
142
 
egg_recent_item_new_valist (const gchar *uri, va_list args)
143
 
{
144
 
        EggRecentItem *item;
145
 
        EggRecentArg arg;
146
 
        gchar *str1;
147
 
        gchar *str2;
148
 
        gboolean priv;
149
 
 
150
 
        item = egg_recent_item_new ();
151
 
 
152
 
        arg = va_arg (args, EggRecentArg);
153
 
 
154
 
        while (arg != EGG_RECENT_ARG_NONE) {
155
 
                switch (arg) {
156
 
                        case EGG_RECENT_ARG_MIME_TYPE:
157
 
                                str1 = va_arg (args, gchar*);
158
 
 
159
 
                                egg_recent_item_set_mime_type (item, str1);
160
 
                        break;
161
 
                        case EGG_RECENT_ARG_GROUP:
162
 
                                str1 = va_arg (args, gchar*);
163
 
 
164
 
                                egg_recent_item_add_group (item, str1);
165
 
                        break;
166
 
                        case EGG_RECENT_ARG_PRIVATE:
167
 
                                priv = va_arg (args, gboolean);
168
 
 
169
 
                                egg_recent_item_set_private (item, priv);
170
 
                        break;
171
 
                        default:
172
 
                        break;
173
 
                }
174
 
 
175
 
                arg = va_arg (args, EggRecentArg);
176
 
        }
177
 
 
178
 
        return item;
179
 
}
180
 
*/
181
 
 
182
104
static void
183
105
egg_recent_item_update_mime_type (EggRecentItem *item)
184
106
{
288
210
        return g_string_free (string, FALSE);
289
211
}
290
212
 
 
213
static gchar *
 
214
get_uri_shortname_for_display (GnomeVFSURI *uri)
 
215
{
 
216
        gchar    *name; 
 
217
        gboolean  validated;
 
218
 
 
219
        validated = FALSE;
 
220
        name = gnome_vfs_uri_extract_short_name (uri);
 
221
        
 
222
        if (name == NULL)
 
223
        {
 
224
                name = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_PASSWORD);
 
225
        }
 
226
        else if (g_ascii_strcasecmp (uri->method_string, "file") == 0)
 
227
        {
 
228
                gchar *text_uri;
 
229
                gchar *local_file;
 
230
                text_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_PASSWORD);
 
231
                local_file = gnome_vfs_get_local_path_from_uri (text_uri);
 
232
                
 
233
                if (local_file != NULL)
 
234
                {
 
235
                        g_free (name);
 
236
                        name = g_filename_display_basename (local_file);
 
237
                        validated = TRUE;
 
238
                }
 
239
                
 
240
                g_free (local_file);
 
241
                g_free (text_uri);
 
242
        } 
 
243
        else if (!gnome_vfs_uri_has_parent (uri)) 
 
244
        {
 
245
                const gchar *method;
 
246
                
 
247
                method = uri->method_string;
 
248
                
 
249
                if (name == NULL ||
 
250
                    strcmp (name, GNOME_VFS_URI_PATH_STR) == 0) 
 
251
                {
 
252
                        g_free (name);
 
253
                        name = g_strdup (method);
 
254
                } 
 
255
                else 
 
256
                {
 
257
                        gchar *tmp;
 
258
                        
 
259
                        tmp = name;
 
260
                        name = g_strdup_printf ("%s: %s", method, name);
 
261
                        g_free (tmp);
 
262
                }
 
263
        }
 
264
 
 
265
        if (!validated && !g_utf8_validate (name, -1, NULL)) 
 
266
        {
 
267
                gchar *utf8_name;
 
268
                
 
269
                utf8_name = make_valid_utf8 (name);
 
270
                g_free (name);
 
271
                name = utf8_name;
 
272
        }
 
273
 
 
274
        return name;
 
275
}
 
276
 
291
277
/**
292
278
 * egg_recent_item_get_short_name:
293
279
 * @item: an #EggRecentItem
303
289
egg_recent_item_get_short_name (const EggRecentItem *item)
304
290
{
305
291
        GnomeVFSURI *uri;
306
 
        char *short_name;
307
 
        gboolean valid;
 
292
        gchar *short_name;
308
293
 
309
294
        g_return_val_if_fail (item != NULL, NULL);
310
295
 
315
300
        if (uri == NULL)
316
301
                return NULL;
317
302
 
318
 
        short_name = gnome_vfs_uri_extract_short_name (uri);
319
 
        if (short_name == NULL) {
320
 
                gnome_vfs_uri_unref (uri);
321
 
                return NULL;
322
 
        }
323
 
 
324
 
        valid = FALSE;
325
 
 
326
 
        if (strcmp (gnome_vfs_uri_get_scheme (uri), "file") == 0) {
327
 
                char *tmp;
328
 
 
329
 
                tmp = g_filename_to_utf8 (short_name, -1, NULL, NULL, NULL);
330
 
                if (tmp) {
331
 
                        g_free (short_name);
332
 
                        short_name = tmp;
333
 
                        valid = TRUE;
334
 
                }
335
 
        }
336
 
 
337
 
        if (!valid) {
338
 
                char *tmp;
339
 
 
340
 
                tmp = make_valid_utf8 (short_name);
341
 
                g_assert (tmp != NULL);
342
 
                g_free (short_name);
343
 
                short_name = tmp;
344
 
        }
 
303
        short_name = get_uri_shortname_for_display (uri);
345
304
 
346
305
        gnome_vfs_uri_unref (uri);
347
306