r984@localhost: muntyan | 2005-11-24 18:06:00 -0600
moo_get_icon_for_path()
This commit is contained in:
parent
6f8f092d40
commit
9216c7dfa8
@ -126,6 +126,9 @@ static guint8 get_blank_icon (void);
|
||||
static GdkPixbuf *render_icon (const MooFile *file,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size);
|
||||
static GdkPixbuf *render_icon_for_path (const char *path,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size);
|
||||
|
||||
#define FILE_PATH(folder,file) g_build_filename (folder->priv->path, file->name, NULL)
|
||||
#define MAKE_PATH(dirname,file) g_build_filename (dirname, file->name, NULL)
|
||||
@ -1325,15 +1328,27 @@ gconstpointer moo_file_get_stat (const MooFile *file)
|
||||
#endif
|
||||
|
||||
|
||||
GdkPixbuf *moo_file_get_icon (const MooFile *file,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size)
|
||||
GdkPixbuf *
|
||||
moo_file_get_icon (const MooFile *file,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size)
|
||||
{
|
||||
g_return_val_if_fail (file != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
return render_icon (file, widget, size);
|
||||
}
|
||||
|
||||
|
||||
GdkPixbuf *
|
||||
moo_get_icon_for_path (const char *path,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
return render_icon_for_path (path, widget, size);
|
||||
}
|
||||
|
||||
|
||||
#ifndef __WIN32__
|
||||
const char *moo_file_link_get_target (const MooFile *file)
|
||||
{
|
||||
@ -1822,9 +1837,10 @@ static GdkPixbuf *_render_icon (MooIconType icon,
|
||||
}
|
||||
|
||||
|
||||
static GdkPixbuf *render_icon (const MooFile *file,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size)
|
||||
static GdkPixbuf *
|
||||
render_icon (const MooFile *file,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size)
|
||||
{
|
||||
GdkPixbuf *pixbuf = _render_icon (file->icon, file->mime_type,
|
||||
_get_icon_flags (file), widget, size);
|
||||
@ -1833,6 +1849,28 @@ static GdkPixbuf *render_icon (const MooFile *file,
|
||||
}
|
||||
|
||||
|
||||
static GdkPixbuf *
|
||||
render_icon_for_path (const char *path,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size)
|
||||
{
|
||||
MooIconType icon = MOO_ICON_BLANK;
|
||||
const char *mime_type = xdg_mime_type_unknown;
|
||||
|
||||
if (path)
|
||||
{
|
||||
mime_type = xdg_mime_get_mime_type_for_file (path);
|
||||
|
||||
if (mime_type != xdg_mime_type_unknown)
|
||||
{
|
||||
icon = MOO_ICON_MIME;
|
||||
}
|
||||
}
|
||||
|
||||
return _render_icon (icon, mime_type, 0, widget, size);
|
||||
}
|
||||
|
||||
|
||||
static GdkPixbuf *_create_icon_simple (GtkIconTheme *icon_theme,
|
||||
MooIconType icon,
|
||||
const char *mime_type,
|
||||
|
@ -155,9 +155,14 @@ gboolean moo_file_test (const MooFile *file,
|
||||
|
||||
const char *moo_file_name (const MooFile *file);
|
||||
const char *moo_file_get_mime_type (const MooFile *file);
|
||||
|
||||
/* returned pixbuf is owned by icon cache */
|
||||
GdkPixbuf *moo_file_get_icon (const MooFile *file,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size);
|
||||
GdkPixbuf *moo_get_icon_for_path (const char *path,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size);
|
||||
|
||||
const char *moo_file_display_name (const MooFile *file);
|
||||
const char *moo_file_collation_key (const MooFile *file);
|
||||
|
Loading…
x
Reference in New Issue
Block a user