gvfs r1586 - in trunk: . daemon
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: gvfs r1586 - in trunk: . daemon
- Date: Thu, 6 Mar 2008 20:51:30 +0000 (GMT)
Author: alexl
Date: Thu Mar 6 20:51:30 2008
New Revision: 1586
URL: http://svn.gnome.org/viewvc/gvfs?rev=1586&view=rev
Log:
2008-03-06 Alexander Larsson <alexl redhat com>
* daemon/gvfsbackendsftp.c:
* daemon/gvfsbackendsmb.c:
Use g_content_type_get_icon() instead of open
coding it. Also picks up more icons since
that has been fixed. (#520742)
Modified:
trunk/ChangeLog
trunk/daemon/gvfsbackendsftp.c
trunk/daemon/gvfsbackendsmb.c
Modified: trunk/daemon/gvfsbackendsftp.c
==============================================================================
--- trunk/daemon/gvfsbackendsftp.c (original)
+++ trunk/daemon/gvfsbackendsftp.c Thu Mar 6 20:51:30 2008
@@ -1644,41 +1644,15 @@
{
icon = NULL;
if (S_ISDIR(mode))
- icon = g_themed_icon_new ("folder-remote");
+ icon = g_themed_icon_new ("folder");
else if (mimetype)
{
- char *mimetype_icon, *generic_mimetype_icon, *type_icon, *p;
- char *icon_names[3];
- int i;
-
- mimetype_icon = g_strdup (mimetype);
- g_strdelimit (mimetype_icon, "/", '-');
-
- p = strchr (mimetype, '/');
- if (p == NULL)
- p = mimetype + strlen (mimetype);
-
- generic_mimetype_icon = g_malloc (p - mimetype + strlen ("-x-generic") + 1);
- memcpy (generic_mimetype_icon, mimetype, p - mimetype);
- memcpy (generic_mimetype_icon + (p - mimetype), "-x-generic", strlen ("-x-generic"));
- generic_mimetype_icon[(p - mimetype) + strlen ("-x-generic")] = 0;
-
- type_icon = "text-x-generic";
-
- i = 0;
- icon_names[i++] = mimetype_icon;
- icon_names[i++] = generic_mimetype_icon;
- if (strcmp (generic_mimetype_icon, type_icon) != 0 &&
- strcmp (mimetype_icon, type_icon) != 0)
- icon_names[i++] = type_icon;
-
- icon = g_themed_icon_new_from_names (icon_names, i);
-
- g_free (mimetype_icon);
- g_free (generic_mimetype_icon);
-
+ icon = g_content_type_get_icon (mimetype);
+ if (G_IS_THEMED_ICON (icon))
+ g_themed_icon_append_name (G_THEMED_ICON (icon), "text-x-generic");
}
- else
+
+ if (icon == NULL)
icon = g_themed_icon_new ("text-x-generic");
g_file_info_set_icon (info, icon);
Modified: trunk/daemon/gvfsbackendsmb.c
==============================================================================
--- trunk/daemon/gvfsbackendsmb.c (original)
+++ trunk/daemon/gvfsbackendsmb.c Thu Mar 6 20:51:30 2008
@@ -1295,35 +1295,9 @@
if (content_type)
{
- char *mimetype_icon, *generic_mimetype_icon, *type_icon, *p;
- char *icon_names[3];
- int i;
-
- mimetype_icon = g_strdup (content_type);
- g_strdelimit (mimetype_icon, "/", '-');
-
- p = strchr (content_type, '/');
- if (p == NULL)
- p = content_type + strlen (content_type);
-
- generic_mimetype_icon = g_malloc (p - content_type + strlen ("-x-generic") + 1);
- memcpy (generic_mimetype_icon, content_type, p - content_type);
- memcpy (generic_mimetype_icon + (p - content_type), "-x-generic", strlen ("-x-generic"));
- generic_mimetype_icon[(p - content_type) + strlen ("-x-generic")] = 0;
-
- type_icon = "text-x-generic";
-
- i = 0;
- icon_names[i++] = mimetype_icon;
- icon_names[i++] = generic_mimetype_icon;
- if (strcmp (generic_mimetype_icon, type_icon) != 0 &&
- strcmp (mimetype_icon, type_icon) != 0)
- icon_names[i++] = type_icon;
-
- icon = g_themed_icon_new_from_names (icon_names, i);
-
- g_free (mimetype_icon);
- g_free (generic_mimetype_icon);
+ icon = g_content_type_get_icon (content_type);
+ if (G_IS_THEMED_ICON (icon))
+ g_themed_icon_append_name (G_THEMED_ICON (icon), "text-x-generic");
}
}
@@ -1332,12 +1306,12 @@
g_file_info_set_content_type (info, content_type);
g_free (content_type);
}
+
+ if (icon == NULL)
+ icon = g_themed_icon_new ("text-x-generic");
- if (icon)
- {
- g_file_info_set_icon (info, icon);
- g_object_unref (icon);
- }
+ g_file_info_set_icon (info, icon);
+ g_object_unref (icon);
}
/* Don't trust n_link, uid, gid, etc returned from libsmb, its just made up.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]