[gnome-panel] [panel] Use special XDG directory icon names
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] [panel] Use special XDG directory icon names
- Date: Tue, 9 Mar 2010 04:50:05 +0000 (UTC)
commit 732fbca9bb3f3143c2e721884ca1e570929c81f5
Author: Marcel Stimberg <marcelcoding googlemail com>
Date: Tue Mar 9 05:45:29 2010 +0100
[panel] Use special XDG directory icon names
https://bugzilla.gnome.org/show_bug.cgi?id=586695
gnome-panel/panel-icon-names.h | 7 +++++++
gnome-panel/panel-menu-items.c | 6 +++++-
gnome-panel/panel-util.c | 25 +++++++++++++++++++++++++
gnome-panel/panel.c | 7 +++++++
4 files changed, 44 insertions(+), 1 deletions(-)
---
diff --git a/gnome-panel/panel-icon-names.h b/gnome-panel/panel-icon-names.h
index b972b21..d09052c 100644
--- a/gnome-panel/panel-icon-names.h
+++ b/gnome-panel/panel-icon-names.h
@@ -8,6 +8,13 @@
#define PANEL_ICON_DRAWER "gnome-panel-drawer"
#define PANEL_ICON_FILESYSTEM "drive-harddisk"
#define PANEL_ICON_FOLDER "folder"
+#define PANEL_ICON_FOLDER_DOCUMENTS "folder-documents"
+#define PANEL_ICON_FOLDER_DOWNLOAD "folder-download"
+#define PANEL_ICON_FOLDER_MUSIC "folder-music"
+#define PANEL_ICON_FOLDER_PICTURES "folder-pictures"
+#define PANEL_ICON_FOLDER_PUBLIC_SHARE "folder-publicshare"
+#define PANEL_ICON_FOLDER_TEMPLATES "folder-templates"
+#define PANEL_ICON_FOLDER_VIDEOS "folder-videos"
#define PANEL_ICON_FONTS "preferences-desktop-font"
#define PANEL_ICON_FORCE_QUIT "gnome-panel-force-quit"
#define PANEL_ICON_HOME "user-home"
diff --git a/gnome-panel/panel-menu-items.c b/gnome-panel/panel-menu-items.c
index ba99f44..778a38b 100644
--- a/gnome-panel/panel-menu-items.c
+++ b/gnome-panel/panel-menu-items.c
@@ -484,6 +484,7 @@ panel_place_menu_item_append_gtk_bookmarks (GtkWidget *menu)
char *label;
char *icon;
GFile *file;
+ GIcon *gicon;
bookmark = l->data;
@@ -522,8 +523,10 @@ panel_place_menu_item_append_gtk_bookmarks (GtkWidget *menu)
if (!icon)
icon = g_strdup (PANEL_ICON_FOLDER);
+ gicon = g_themed_icon_new_with_default_fallbacks (icon);
+
//FIXME: drag and drop will be broken for x-nautilus-search uris
- panel_menu_items_append_place_item (icon, NULL,
+ panel_menu_items_append_place_item (icon, gicon,
label,
tooltip,
add_menu,
@@ -531,6 +534,7 @@ panel_place_menu_item_append_gtk_bookmarks (GtkWidget *menu)
bookmark->full_uri);
g_free (icon);
+ g_object_unref (gicon);
g_free (tooltip);
g_free (label);
g_free (bookmark->full_uri);
diff --git a/gnome-panel/panel-util.c b/gnome-panel/panel-util.c
index 4dfec4c..cc1c64b 100644
--- a/gnome-panel/panel-util.c
+++ b/gnome-panel/panel-util.c
@@ -920,6 +920,7 @@ panel_util_get_file_icon_name_if_mount (GFile *file)
return ret;
}
+/* TODO: convert this to a simple call to g_file_query_info? */
static const char *
panel_util_get_icon_for_uri_known_folders (const char *uri)
{
@@ -949,6 +950,27 @@ panel_util_get_icon_for_uri_known_folders (const char *uri)
else if (strcmp (path,
g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)) == 0)
icon = PANEL_ICON_DESKTOP;
+ else if (g_strcmp0 (path,
+ g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS)) == 0)
+ icon = PANEL_ICON_FOLDER_DOCUMENTS;
+ else if (g_strcmp0 (path,
+ g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD)) == 0)
+ icon = PANEL_ICON_FOLDER_DOWNLOAD;
+ else if (g_strcmp0 (path,
+ g_get_user_special_dir (G_USER_DIRECTORY_MUSIC)) == 0)
+ icon = PANEL_ICON_FOLDER_MUSIC;
+ else if (g_strcmp0 (path,
+ g_get_user_special_dir (G_USER_DIRECTORY_PICTURES)) == 0)
+ icon = PANEL_ICON_FOLDER_PICTURES;
+ else if (g_strcmp0 (path,
+ g_get_user_special_dir (G_USER_DIRECTORY_PUBLIC_SHARE)) == 0)
+ icon = PANEL_ICON_FOLDER_PUBLIC_SHARE;
+ else if (g_strcmp0 (path,
+ g_get_user_special_dir (G_USER_DIRECTORY_TEMPLATES)) == 0)
+ icon = PANEL_ICON_FOLDER_TEMPLATES;
+ else if (g_strcmp0 (path,
+ g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS)) == 0)
+ icon = PANEL_ICON_FOLDER_VIDEOS;
g_free (path);
@@ -1040,6 +1062,9 @@ panel_util_get_label_for_uri (const char *text_uri)
return label;
}
+/* FIXME: we probably want to return a GIcon, that would be built with
+ * g_themed_icon_new_with_default_fallbacks() since we can get an icon like
+ * "folder-music", where "folder" is the safe fallback. */
char *
panel_util_get_icon_for_uri (const char *text_uri)
{
diff --git a/gnome-panel/panel.c b/gnome-panel/panel.c
index 18b9cb5..e838ff2 100644
--- a/gnome-panel/panel.c
+++ b/gnome-panel/panel.c
@@ -527,6 +527,13 @@ drop_uri (PanelWidget *panel,
if (!icon)
icon = g_strdup (fallback_icon);
+ /* FIXME: we might get icons like "folder-music" that might not exist in
+ * the icon theme. This would usually be okay if we could use fallback
+ * icons (and get "folder" this way). However, this is not possible for
+ * launchers: this could be an application that uses an icon named
+ * folder-magic-app, for which we don't want fallbacks. We just want to
+ * go to hicolor. */
+
file = g_file_new_for_uri (uri);
buf = g_file_get_parse_name (file);
g_object_unref (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]