From 5680dbcc4995bd860e0e7659481e3d2079b09382 Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Sat, 27 Oct 2012 13:14:25 +0200 Subject: [icon-info] add a method to fetch GIcons for user special dirs http://git.gnome.org/browse/nautilus/commit/?id=1df83c6586560a8ae5efc96037e673e52b4b119b --- libcaja-private/caja-icon-info.c | 27 +++++++++++++++++++++++++++ libcaja-private/caja-icon-info.h | 2 ++ libcaja-private/caja-icon-names.h | 9 +++++++++ 3 files changed, 38 insertions(+) (limited to 'libcaja-private') diff --git a/libcaja-private/caja-icon-info.c b/libcaja-private/caja-icon-info.c index 7873ebfa..5d783877 100644 --- a/libcaja-private/caja-icon-info.c +++ b/libcaja-private/caja-icon-info.c @@ -21,6 +21,7 @@ #include #include #include "caja-icon-info.h" +#include "caja-icon-names.h" #include "caja-default-file-icon.h" #include #include @@ -778,3 +779,29 @@ caja_icon_theme_can_render (GThemedIcon *icon) return FALSE; } + +GIcon * +caja_user_special_directory_get_gicon (GUserDirectory directory) +{ + + #define ICON_CASE(x) \ + case G_USER_DIRECTORY_ ## x:\ + return g_themed_icon_new (CAJA_ICON_FOLDER_ ## x); + + switch (directory) { + + ICON_CASE (DESKTOP); + ICON_CASE (DOCUMENTS); + ICON_CASE (DOWNLOAD); + ICON_CASE (MUSIC); + ICON_CASE (PICTURES); + ICON_CASE (PUBLIC_SHARE); + ICON_CASE (TEMPLATES); + ICON_CASE (VIDEOS); + + default: + return g_themed_icon_new ("folder"); + } + + #undef ICON_CASE +} diff --git a/libcaja-private/caja-icon-info.h b/libcaja-private/caja-icon-info.h index d2bbc926..d4523d1a 100644 --- a/libcaja-private/caja-icon-info.h +++ b/libcaja-private/caja-icon-info.h @@ -91,6 +91,8 @@ extern "C" { guint caja_icon_get_emblem_size_for_icon_size (guint size); gboolean caja_icon_theme_can_render (GThemedIcon *icon); +GIcon * caja_user_special_directory_get_gicon (GUserDirectory directory); + #ifdef __cplusplus diff --git a/libcaja-private/caja-icon-names.h b/libcaja-private/caja-icon-names.h index d0598749..bb50a772 100644 --- a/libcaja-private/caja-icon-names.h +++ b/libcaja-private/caja-icon-names.h @@ -20,6 +20,15 @@ #define CAJA_ICON_EMBLEM_UNREADABLE "emblem-unreadable" #define CAJA_ICON_EMBLEM_SYMLINK "emblem-symbolic-link" +#define CAJA_ICON_FOLDER_DESKTOP "folder-documents" +#define CAJA_ICON_FOLDER_DOCUMENTS "folder-documents" +#define CAJA_ICON_FOLDER_DOWNLOAD "folder-download" +#define CAJA_ICON_FOLDER_MUSIC "folder-music" +#define CAJA_ICON_FOLDER_PICTURES "folder-pictures" +#define CAJA_ICON_FOLDER_PUBLIC_SHARE "folder-publicshare" +#define CAJA_ICON_FOLDER_TEMPLATES "folder-templates" +#define CAJA_ICON_FOLDER_VIDEOS "folder-videos" + /* Other icons */ #define CAJA_ICON_TEMPLATE "text-x-generic-template" -- cgit v1.2.1