106
egg_recent_item_copy_groups (const GList *list)
108
GList *newlist = NULL;
111
gchar *group = (gchar *)list->data;
113
newlist = g_list_prepend (newlist, g_strdup (group));
123
egg_recent_item_copy (const EggRecentItem *item)
125
EggRecentItem *newitem;
127
newitem = egg_recent_item_new ();
128
newitem->uri = g_strdup (item->uri);
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);
142
egg_recent_item_new_valist (const gchar *uri, va_list args)
150
item = egg_recent_item_new ();
152
arg = va_arg (args, EggRecentArg);
154
while (arg != EGG_RECENT_ARG_NONE) {
156
case EGG_RECENT_ARG_MIME_TYPE:
157
str1 = va_arg (args, gchar*);
159
egg_recent_item_set_mime_type (item, str1);
161
case EGG_RECENT_ARG_GROUP:
162
str1 = va_arg (args, gchar*);
164
egg_recent_item_add_group (item, str1);
166
case EGG_RECENT_ARG_PRIVATE:
167
priv = va_arg (args, gboolean);
169
egg_recent_item_set_private (item, priv);
175
arg = va_arg (args, EggRecentArg);
183
105
egg_recent_item_update_mime_type (EggRecentItem *item)
288
210
return g_string_free (string, FALSE);
214
get_uri_shortname_for_display (GnomeVFSURI *uri)
220
name = gnome_vfs_uri_extract_short_name (uri);
224
name = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_PASSWORD);
226
else if (g_ascii_strcasecmp (uri->method_string, "file") == 0)
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);
233
if (local_file != NULL)
236
name = g_filename_display_basename (local_file);
243
else if (!gnome_vfs_uri_has_parent (uri))
247
method = uri->method_string;
250
strcmp (name, GNOME_VFS_URI_PATH_STR) == 0)
253
name = g_strdup (method);
260
name = g_strdup_printf ("%s: %s", method, name);
265
if (!validated && !g_utf8_validate (name, -1, NULL))
269
utf8_name = make_valid_utf8 (name);
292
278
* egg_recent_item_get_short_name:
293
279
* @item: an #EggRecentItem
318
short_name = gnome_vfs_uri_extract_short_name (uri);
319
if (short_name == NULL) {
320
gnome_vfs_uri_unref (uri);
326
if (strcmp (gnome_vfs_uri_get_scheme (uri), "file") == 0) {
329
tmp = g_filename_to_utf8 (short_name, -1, NULL, NULL, NULL);
340
tmp = make_valid_utf8 (short_name);
341
g_assert (tmp != NULL);
303
short_name = get_uri_shortname_for_display (uri);
346
305
gnome_vfs_uri_unref (uri);