New icons and mime types functions
parent
4b31da9d83
commit
5278a41252
|
@ -36,12 +36,13 @@
|
|||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mooutils-debug.h"
|
||||
#include "mooutils/mooi18n.h"
|
||||
#include "mooutils/xdgmime/xdgmime.h"
|
||||
#include "mooutils/moo-mime.h"
|
||||
#include "mooutils/moohelp.h"
|
||||
#include <glib/gmappedfile.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#include <ige-mac-dock.h>
|
||||
|
@ -937,7 +938,7 @@ static void
|
|||
moo_app_cleanup (void)
|
||||
{
|
||||
_moo_app_input_shutdown ();
|
||||
xdg_mime_shutdown ();
|
||||
moo_mime_shutdown ();
|
||||
moo_cleanup ();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "mooedit/mooeditdialogs.h"
|
||||
#include "mooedit/mootextbuffer.h"
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "moofileview/moofile.h"
|
||||
#include "mooutils/moofileicon.h"
|
||||
#include "mooutils/moofilewatch.h"
|
||||
#include "mooutils/mooencodings.h"
|
||||
#include "mooutils/mooi18n.h"
|
||||
|
@ -1291,5 +1291,5 @@ _moo_edit_get_icon (MooEdit *doc,
|
|||
GtkWidget *widget,
|
||||
GtkIconSize size)
|
||||
{
|
||||
return _moo_get_icon_for_path (doc->priv->filename, widget, size);
|
||||
return moo_get_icon_for_file (doc->priv->filename, widget, size);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "mooutils/mooutils-fs.h"
|
||||
#include "mooutils/mooprefs.h"
|
||||
#include "marshals.h"
|
||||
#include "mooutils/xdgmime/xdgmime.h"
|
||||
#include "mooutils/moo-mime.h"
|
||||
#include <string.h>
|
||||
|
||||
#define LANGUAGE_DIR "language-specs"
|
||||
|
@ -406,11 +406,9 @@ moo_lang_mgr_get_lang_for_file (MooLangMgr *mgr,
|
|||
if (lang)
|
||||
return lang;
|
||||
|
||||
/* XXX: xdgmime wants utf8-encoded filename here. is it a problem? */
|
||||
/* It's a big problem! */
|
||||
mime_type = xdg_mime_get_mime_type_for_file (filename, NULL);
|
||||
mime_type = moo_get_mime_type_for_file (filename, NULL);
|
||||
|
||||
if (mime_type != XDG_MIME_TYPE_UNKNOWN)
|
||||
if (mime_type != MOO_MIME_TYPE_UNKNOWN)
|
||||
lang = get_lang_for_mime_type (mgr, mime_type);
|
||||
|
||||
if (lang)
|
||||
|
@ -440,12 +438,9 @@ get_lang_for_filename (MooLangMgr *mgr,
|
|||
if (lang)
|
||||
return lang;
|
||||
|
||||
/* XXX: xdgmime wants utf8-encoded filename here. is it a problem? */
|
||||
/* It's a big problem! */
|
||||
mime_type = moo_get_mime_type_for_filename (filename);
|
||||
|
||||
mime_type = xdg_mime_get_mime_type_from_file_name (filename);
|
||||
|
||||
if (mime_type != XDG_MIME_TYPE_UNKNOWN)
|
||||
if (mime_type != MOO_MIME_TYPE_UNKNOWN)
|
||||
lang = get_lang_for_mime_type (mgr, mime_type);
|
||||
|
||||
if (lang)
|
||||
|
@ -464,7 +459,7 @@ static int
|
|||
check_mime_subclass (const char *base,
|
||||
const char *mime)
|
||||
{
|
||||
return !xdg_mime_mime_type_subclass (mime, base);
|
||||
return !moo_mime_type_is_subclass (mime, base);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "mooutils/moodialogs.h"
|
||||
#include "mooutils/mooactionfactory.h"
|
||||
#include "mooutils/mooi18n.h"
|
||||
#include "mooutils/moo-mime.h"
|
||||
#include "plugins/moofileselector-gxml.h"
|
||||
#include "mooutils/moohelp.h"
|
||||
#include "help-sections.h"
|
||||
|
@ -38,8 +39,6 @@
|
|||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <mooutils/xdgmime/xdgmime.h>
|
||||
|
||||
#ifndef MOO_VERSION
|
||||
#define MOO_VERSION NULL
|
||||
#endif
|
||||
|
@ -291,7 +290,7 @@ moo_file_selector_activate (MooFileView *fileview,
|
|||
}
|
||||
|
||||
{
|
||||
const char *mime_type = xdg_mime_get_mime_type_for_file (path, &statbuf);
|
||||
const char *mime_type = moo_get_mime_type_for_file (path, &statbuf);
|
||||
|
||||
if (!strcmp (mime_type, "application/x-trash"))
|
||||
{
|
||||
|
@ -302,14 +301,14 @@ moo_file_selector_activate (MooFileView *fileview,
|
|||
if (g_str_has_suffix (path, bak_suffixes[i]))
|
||||
{
|
||||
char *tmp = g_strndup (path, strlen (path) - strlen (bak_suffixes[i]));
|
||||
mime_type = xdg_mime_get_mime_type_from_file_name (tmp);
|
||||
mime_type = moo_get_mime_type_for_filename (tmp);
|
||||
g_free (tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
is_text = !strcmp (mime_type, "application/octet-stream") ||
|
||||
xdg_mime_mime_type_subclass (mime_type, "text/plain");
|
||||
moo_mime_type_is_subclass (mime_type, "text/plain");
|
||||
is_exe = !strcmp (mime_type, "application/x-executable");
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@ moofileview_sources = \
|
|||
moofile-private.h \
|
||||
moofileentry.c \
|
||||
moofileentry.h \
|
||||
moofileicons.c \
|
||||
moofileicons.h \
|
||||
moofilesystem.c \
|
||||
moofilesystem.h \
|
||||
moofileview.c \
|
||||
|
@ -34,18 +32,6 @@ moofileview_sources = \
|
|||
mootreeview.c \
|
||||
mootreeview.h
|
||||
|
||||
moofileview_pixmaps = \
|
||||
symlink.png \
|
||||
symlink-small.png
|
||||
BUILT_SOURCES += moofileicons-symlink.h
|
||||
CLEANFILES += moofileicons-symlink.h
|
||||
EXTRA_DIST += $(moofileview_pixmaps)
|
||||
|
||||
moofileicons-symlink.h: $(moofileview_pixmaps)
|
||||
gdk-pixbuf-csource --static --build-list \
|
||||
SYMLINK_ARROW $(srcdir)/symlink.png \
|
||||
SYMLINK_ARROW_SMALL $(srcdir)/symlink-small.png > $@.tmp && mv $@.tmp $@
|
||||
|
||||
GLADE2_FILES = \
|
||||
glade/moofileview-drop.glade \
|
||||
glade/moofileprops.glade \
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
#define MOO_FILE_VIEW_COMPILATION
|
||||
#include "moofileview/moofilesystem.h"
|
||||
#include "moofileview/moofile-private.h"
|
||||
#include "moofileview/moofileicons.h"
|
||||
#include "mooutils/moofileicon.h"
|
||||
#include "mooutils/mooutils-fs.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mooutils-debug.h"
|
||||
#include "mooutils/moocompat.h"
|
||||
#include "marshals.h"
|
||||
#include "mooutils/xdgmime/xdgmime.h"
|
||||
#include "mooutils/moo-mime.h"
|
||||
#include <glib/gstdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -46,8 +46,6 @@
|
|||
|
||||
MOO_DEBUG_INIT(file, FALSE)
|
||||
|
||||
#define MIME_TYPE_UNKNOWN xdg_mime_type_unknown
|
||||
|
||||
#define NORMAL_PRIORITY G_PRIORITY_DEFAULT_IDLE
|
||||
#define NORMAL_TIMEOUT 0.04
|
||||
#define BACKGROUND_PRIORITY G_PRIORITY_LOW
|
||||
|
@ -59,15 +57,8 @@ G_STMT_START { \
|
|||
g_timer_stop (timer); \
|
||||
} G_STMT_END
|
||||
|
||||
static MooIconType _get_folder_icon (const char *path);
|
||||
static MooIconEmblem _get_icon_flags (const MooFile *file);
|
||||
|
||||
static GdkPixbuf *render_icon (const MooFile *file,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size);
|
||||
static GdkPixbuf *render_icon_for_path (const char *path,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size);
|
||||
static MooIconType get_folder_icon (const char *path);
|
||||
static MooIconEmblem get_icon_flags (const MooFile *file);
|
||||
|
||||
#define MAKE_PATH(dirname,file) g_build_filename (dirname, file->name, NULL)
|
||||
|
||||
|
@ -76,13 +67,13 @@ void
|
|||
_moo_file_find_mime_type (MooFile *file,
|
||||
const char *path)
|
||||
{
|
||||
file->mime_type = xdg_mime_get_mime_type_for_file (path, file->statbuf);
|
||||
file->mime_type = moo_get_mime_type_for_file (path, file->statbuf);
|
||||
|
||||
if (!file->mime_type || !file->mime_type[0])
|
||||
{
|
||||
/* this should not happen */
|
||||
_moo_message ("%s: oops, %s", G_STRLOC, file->display_name);
|
||||
file->mime_type = MIME_TYPE_UNKNOWN;
|
||||
file->mime_type = MOO_MIME_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
file->flags |= MOO_FILE_HAS_MIME_TYPE;
|
||||
|
@ -526,19 +517,15 @@ _moo_file_get_icon (const MooFile *file,
|
|||
GtkWidget *widget,
|
||||
GtkIconSize size)
|
||||
{
|
||||
MooFileIcon icon = {0};
|
||||
|
||||
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);
|
||||
icon.mime_type = file->mime_type;
|
||||
icon.type = file->icon;
|
||||
icon.emblem = get_icon_flags (file);
|
||||
return moo_file_icon_get_pixbuf (&icon, widget, size);
|
||||
}
|
||||
|
||||
|
||||
|
@ -634,43 +621,6 @@ _moo_file_info_get_type (void)
|
|||
}
|
||||
|
||||
|
||||
static GdkPixbuf *
|
||||
render_icon (const MooFile *file,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size)
|
||||
{
|
||||
GdkPixbuf *pixbuf = _moo_get_icon (widget, file->icon, file->mime_type,
|
||||
_get_icon_flags (file), size);
|
||||
g_assert (pixbuf != NULL);
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
|
||||
static GdkPixbuf *
|
||||
render_icon_for_path (const char *path,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size)
|
||||
{
|
||||
const char *mime_type = MIME_TYPE_UNKNOWN;
|
||||
|
||||
#ifndef __WIN32__
|
||||
if (path)
|
||||
{
|
||||
mime_type = xdg_mime_get_mime_type_for_file (path, NULL);
|
||||
|
||||
if (!mime_type || !mime_type[0])
|
||||
mime_type = MIME_TYPE_UNKNOWN;
|
||||
}
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#warning "Implement render_icon_for_path()"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return _moo_get_icon (widget, MOO_ICON_MIME, mime_type, 0, size);
|
||||
}
|
||||
|
||||
|
||||
guint8
|
||||
_moo_file_get_icon_type (MooFile *file,
|
||||
const char *dirname)
|
||||
|
@ -684,7 +634,7 @@ _moo_file_get_icon_type (MooFile *file,
|
|||
if (MOO_FILE_IS_DIR (file))
|
||||
{
|
||||
char *path = MAKE_PATH (dirname, file);
|
||||
MooIconType icon = _get_folder_icon (path);
|
||||
MooIconType icon = get_folder_icon (path);
|
||||
g_free (path);
|
||||
return icon;
|
||||
}
|
||||
|
@ -716,7 +666,7 @@ _moo_file_icon_blank (void)
|
|||
|
||||
|
||||
static MooIconType
|
||||
_get_folder_icon (const char *path)
|
||||
get_folder_icon (const char *path)
|
||||
{
|
||||
static const char *home_path = NULL;
|
||||
static char *desktop_path = NULL;
|
||||
|
@ -750,7 +700,7 @@ _get_folder_icon (const char *path)
|
|||
|
||||
|
||||
static MooIconEmblem
|
||||
_get_icon_flags (const MooFile *file)
|
||||
get_icon_flags (const MooFile *file)
|
||||
{
|
||||
return
|
||||
#if 0
|
||||
|
|
|
@ -56,13 +56,7 @@ typedef enum {
|
|||
|
||||
gboolean _moo_file_test (const MooFile *file,
|
||||
MooFileInfo test);
|
||||
|
||||
const char *_moo_file_get_mime_type (const MooFile *file);
|
||||
|
||||
GdkPixbuf *_moo_get_icon_for_path (const char *path,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size);
|
||||
|
||||
const char *_moo_file_display_name (const MooFile *file);
|
||||
|
||||
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* moofileicons.h
|
||||
*
|
||||
* Copyright (C) 2004-2007 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef MOO_FILE_ICONS_H
|
||||
#define MOO_FILE_ICONS_H
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef enum {
|
||||
MOO_ICON_EMBLEM_LINK = 1 << 0
|
||||
} MooIconEmblem;
|
||||
|
||||
typedef enum {
|
||||
MOO_ICON_MIME = 0,
|
||||
MOO_ICON_HOME,
|
||||
MOO_ICON_DESKTOP,
|
||||
MOO_ICON_TRASH,
|
||||
MOO_ICON_DIRECTORY,
|
||||
MOO_ICON_BROKEN_LINK,
|
||||
MOO_ICON_NONEXISTENT,
|
||||
MOO_ICON_BLOCK_DEVICE,
|
||||
MOO_ICON_CHARACTER_DEVICE,
|
||||
MOO_ICON_FIFO,
|
||||
MOO_ICON_SOCKET,
|
||||
MOO_ICON_FILE,
|
||||
MOO_ICON_BLANK,
|
||||
MOO_ICON_INVALID
|
||||
} MooIconType;
|
||||
|
||||
|
||||
GdkPixbuf *_moo_get_icon (GtkWidget *widget,
|
||||
MooIconType type,
|
||||
const char *mime_type,
|
||||
MooIconEmblem emblem,
|
||||
GtkIconSize size);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* MOO_FILE_ICONS_H */
|
|
@ -23,7 +23,7 @@
|
|||
#include "mooutils/mooutils-fs.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include "mooutils/mooi18n.h"
|
||||
#include "mooutils/xdgmime/xdgmime.h"
|
||||
#include "mooutils/moo-mime.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
@ -325,11 +325,11 @@ action_check_one (ToolAction *action,
|
|||
mime = _moo_file_get_mime_type (file);
|
||||
g_return_val_if_fail (mime != NULL, FALSE);
|
||||
|
||||
if (mime == XDG_MIME_TYPE_UNKNOWN)
|
||||
if (mime == MOO_MIME_TYPE_UNKNOWN)
|
||||
return FALSE;
|
||||
|
||||
for (l = action->mimetypes; l != NULL; l = l->next)
|
||||
if (xdg_mime_mime_type_subclass (mime, l->data))
|
||||
if (moo_mime_type_is_subclass (mime, l->data))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -74,6 +74,8 @@ mooutils_sources = \
|
|||
mooentry.h \
|
||||
moofiledialog.c \
|
||||
moofiledialog.h \
|
||||
moofileicon.c \
|
||||
moofileicon.h \
|
||||
moofilewatch.c \
|
||||
moofilewatch.h \
|
||||
moofiltermgr.c \
|
||||
|
@ -98,6 +100,8 @@ mooutils_sources = \
|
|||
moomenumgr.h \
|
||||
moomenutoolbutton.c \
|
||||
moomenutoolbutton.h \
|
||||
moo-mime.c \
|
||||
moo-mime.h \
|
||||
moonotebook.c \
|
||||
moonotebook.h \
|
||||
moopane.c \
|
||||
|
@ -232,3 +236,15 @@ ENUM_HDRS = \
|
|||
mooprefs.h \
|
||||
moouixml.h \
|
||||
mooutils-misc.h
|
||||
|
||||
file_pixmaps = \
|
||||
pixmaps/symlink.png \
|
||||
pixmaps/symlink-small.png
|
||||
BUILT_SOURCES += moofileicon-symlink.h
|
||||
CLEANFILES += moofileicon-symlink.h
|
||||
EXTRA_DIST += $(file_pixmaps)
|
||||
|
||||
moofileicon-symlink.h: $(file_pixmaps)
|
||||
gdk-pixbuf-csource --static --build-list \
|
||||
SYMLINK_ARROW $(srcdir)/pixmaps/symlink.png \
|
||||
SYMLINK_ARROW_SMALL $(srcdir)/pixmaps/symlink-small.png > $@.tmp && mv $@.tmp $@
|
||||
|
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* moo-mime.c
|
||||
*
|
||||
* Copyright (C) 2004-2008 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#include "mooutils/moo-mime.h"
|
||||
#include "mooutils/xdgmime/xdgmime.h"
|
||||
#include "mooutils/mooutils-fs.h"
|
||||
#include <string.h>
|
||||
|
||||
G_LOCK_DEFINE (moo_mime);
|
||||
|
||||
const char *
|
||||
moo_mime_type_unknown (void)
|
||||
{
|
||||
return XDG_MIME_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
static const char *
|
||||
mime_type_intern (const char *mime)
|
||||
{
|
||||
static GHashTable *hash;
|
||||
const char *interned;
|
||||
|
||||
if (mime == XDG_MIME_TYPE_UNKNOWN || mime == NULL)
|
||||
return XDG_MIME_TYPE_UNKNOWN;
|
||||
|
||||
if (G_UNLIKELY (!hash))
|
||||
hash = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
if (G_UNLIKELY (!(interned = g_hash_table_lookup (hash, mime))))
|
||||
{
|
||||
char *copy = g_strdup (mime);
|
||||
g_hash_table_insert (hash, copy, copy);
|
||||
interned = copy;
|
||||
}
|
||||
|
||||
return interned;
|
||||
}
|
||||
|
||||
const char *
|
||||
moo_get_mime_type_for_file (const char *filename,
|
||||
struct stat *statbuf)
|
||||
{
|
||||
const char *mime;
|
||||
char *filename_utf8 = NULL;
|
||||
|
||||
if (filename)
|
||||
filename_utf8 = g_filename_display_name (filename);
|
||||
|
||||
G_LOCK (moo_mime);
|
||||
mime = mime_type_intern (xdg_mime_get_mime_type_for_file (filename_utf8, statbuf));
|
||||
G_UNLOCK (moo_mime);
|
||||
|
||||
g_free (filename_utf8);
|
||||
return mime;
|
||||
}
|
||||
|
||||
const char *
|
||||
moo_get_mime_type_for_filename (const char *filename)
|
||||
{
|
||||
const char *mime;
|
||||
char *filename_utf8 = NULL;
|
||||
|
||||
if (filename)
|
||||
filename_utf8 = g_filename_display_name (filename);
|
||||
|
||||
G_LOCK (moo_mime);
|
||||
mime = mime_type_intern (xdg_mime_get_mime_type_from_file_name (filename_utf8));
|
||||
G_UNLOCK (moo_mime);
|
||||
|
||||
g_free (filename_utf8);
|
||||
return mime;
|
||||
}
|
||||
|
||||
gboolean
|
||||
moo_mime_type_is_subclass (const char *mime_type,
|
||||
const char *base)
|
||||
{
|
||||
gboolean ret;
|
||||
G_LOCK (moo_mime);
|
||||
ret = xdg_mime_mime_type_subclass (mime_type, base);
|
||||
G_UNLOCK (moo_mime);
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char **
|
||||
moo_mime_type_list_parents (const char *mime_type)
|
||||
{
|
||||
char **p;
|
||||
char **ret;
|
||||
|
||||
G_LOCK (moo_mime);
|
||||
|
||||
ret = xdg_mime_list_mime_parents (mime_type);
|
||||
for (p = ret; p && *p; ++p)
|
||||
*p = (char*) mime_type_intern (*p);
|
||||
|
||||
G_UNLOCK (moo_mime);
|
||||
|
||||
return (const char**) ret;
|
||||
}
|
||||
|
||||
void
|
||||
moo_mime_shutdown (void)
|
||||
{
|
||||
G_LOCK (moo_mime);
|
||||
xdg_mime_shutdown ();
|
||||
G_UNLOCK (moo_mime);
|
||||
}
|
||||
|
||||
|
||||
/* should not contain duplicates */
|
||||
const char * const *
|
||||
_moo_get_mime_data_dirs (void)
|
||||
{
|
||||
/* It is called from inside xdgmime, i.e. when mime_lock is held */
|
||||
static char **data_dirs = NULL;
|
||||
|
||||
if (!data_dirs)
|
||||
{
|
||||
guint i, n_dirs;
|
||||
GSList *dirs = NULL;
|
||||
const char* const *sys_dirs;
|
||||
|
||||
sys_dirs = g_get_system_data_dirs ();
|
||||
|
||||
#ifndef __WIN32__
|
||||
dirs = g_slist_prepend (NULL, _moo_normalize_file_path (g_get_user_data_dir ()));
|
||||
#endif
|
||||
|
||||
for (i = 0; sys_dirs[i] && sys_dirs[i][0]; ++i)
|
||||
{
|
||||
char *norm = _moo_normalize_file_path (sys_dirs[i]);
|
||||
|
||||
if (norm && !g_slist_find_custom (dirs, norm, (GCompareFunc) strcmp))
|
||||
dirs = g_slist_prepend (dirs, norm);
|
||||
else
|
||||
g_free (norm);
|
||||
}
|
||||
|
||||
dirs = g_slist_reverse (dirs);
|
||||
n_dirs = g_slist_length (dirs);
|
||||
data_dirs = g_new (char*, n_dirs + 1);
|
||||
|
||||
for (i = 0; i < n_dirs; ++i)
|
||||
{
|
||||
data_dirs[i] = dirs->data;
|
||||
dirs = g_slist_delete_link (dirs, dirs);
|
||||
}
|
||||
|
||||
data_dirs[n_dirs] = NULL;
|
||||
}
|
||||
|
||||
return (const char* const*) data_dirs;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* moo-mime.h
|
||||
*
|
||||
* Copyright (C) 2004-2008 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef MOO_MIME_H
|
||||
#define MOO_MIME_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
/* All public functions here are thread-safe */
|
||||
|
||||
#define MOO_MIME_TYPE_UNKNOWN (moo_mime_type_unknown ())
|
||||
|
||||
const char *moo_mime_type_unknown (void) G_GNUC_CONST;
|
||||
|
||||
struct stat;
|
||||
const char *moo_get_mime_type_for_file (const char *filename,
|
||||
struct stat *statbuf);
|
||||
const char *moo_get_mime_type_for_filename (const char *filename);
|
||||
gboolean moo_mime_type_is_subclass (const char *mime_type,
|
||||
const char *base);
|
||||
const char **moo_mime_type_list_parents (const char *mime_type);
|
||||
void moo_mime_shutdown (void);
|
||||
|
||||
const char *const *_moo_get_mime_data_dirs (void);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* MOO_MIME_H */
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* moofileicons.c
|
||||
* moofileicon.c
|
||||
*
|
||||
* Copyright (C) 2004-2007 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
* Copyright (C) 2004-2008 by Yevgen Muntyan <muntyan@tamu.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -10,19 +10,77 @@
|
|||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "moofileview/moofileicons.h"
|
||||
#include "moofileicons-symlink.h"
|
||||
#include "mooutils/moofileicon.h"
|
||||
#include "mooutils/moo-mime.h"
|
||||
#include "mooutils/mooutils-fs.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mooutils-debug.h"
|
||||
#include "mooutils/moostock.h"
|
||||
#include "mooutils/xdgmime/xdgmime.h"
|
||||
#include "moofileicon-symlink.h"
|
||||
#include <glib/gstdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
|
||||
void
|
||||
moo_file_icon_for_file (MooFileIcon *icon,
|
||||
const char *path)
|
||||
{
|
||||
const char *mime_type = NULL;
|
||||
|
||||
g_return_if_fail (icon != NULL);
|
||||
|
||||
#ifndef __WIN32__
|
||||
if (path)
|
||||
mime_type = moo_get_mime_type_for_file (path, NULL);
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#warning "Implement render_icon_for_path()"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (!mime_type || !mime_type[0])
|
||||
mime_type = MOO_MIME_TYPE_UNKNOWN;
|
||||
|
||||
icon->mime_type = mime_type;
|
||||
icon->type = MOO_ICON_MIME;
|
||||
icon->emblem = 0;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
moo_get_icon_for_file (const char *path,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size)
|
||||
{
|
||||
MooFileIcon icon = {0};
|
||||
moo_file_icon_for_file (&icon, path);
|
||||
return moo_file_icon_get_pixbuf (&icon, widget, size);
|
||||
}
|
||||
|
||||
MooFileIcon *
|
||||
moo_file_icon_new (void)
|
||||
{
|
||||
return moo_new (MooFileIcon);
|
||||
}
|
||||
|
||||
MooFileIcon *
|
||||
moo_file_icon_copy (MooFileIcon *icon)
|
||||
{
|
||||
return icon ? moo_slice_dup (MooFileIcon, icon) : NULL;
|
||||
}
|
||||
|
||||
void
|
||||
moo_file_icon_free (MooFileIcon *icon)
|
||||
{
|
||||
if (icon)
|
||||
moo_free (MooFileIcon, icon);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
/* Icon cache
|
||||
*/
|
||||
|
||||
#define MOO_ICON_EMBLEM_LEN 2
|
||||
|
||||
MOO_DEBUG_INIT(icons, FALSE)
|
||||
|
@ -251,72 +309,6 @@ moo_icon_cache_get_for_screen (GdkScreen *screen,
|
|||
}
|
||||
|
||||
|
||||
GdkPixbuf *
|
||||
_moo_get_icon (GtkWidget *widget,
|
||||
MooIconType type,
|
||||
const char *mime_type,
|
||||
MooIconEmblem emblem,
|
||||
GtkIconSize size)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *original;
|
||||
MooIconCache *cache;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
g_return_val_if_fail (type < MOO_ICON_INVALID, NULL);
|
||||
g_return_val_if_fail (type != MOO_ICON_MIME || mime_type != NULL, NULL);
|
||||
g_return_val_if_fail (emblem < MOO_ICON_EMBLEM_LEN, NULL);
|
||||
|
||||
if (type != MOO_ICON_MIME)
|
||||
mime_type = NULL;
|
||||
|
||||
if (gtk_widget_has_screen (widget))
|
||||
screen = gtk_widget_get_screen (widget);
|
||||
else
|
||||
screen = gdk_screen_get_default ();
|
||||
|
||||
cache = moo_icon_cache_get_for_screen (screen, size);
|
||||
g_return_val_if_fail (cache != NULL, NULL);
|
||||
|
||||
pixbuf = moo_icon_cache_get (cache, type, mime_type, emblem);
|
||||
|
||||
if (pixbuf)
|
||||
return pixbuf;
|
||||
|
||||
original = NULL;
|
||||
|
||||
if (emblem)
|
||||
original = moo_icon_cache_get (cache, type, mime_type, 0);
|
||||
|
||||
if (!original)
|
||||
{
|
||||
if (mime_type)
|
||||
original = create_mime_icon (widget, mime_type, size);
|
||||
else
|
||||
original = create_special_icon (widget, type, size);
|
||||
|
||||
if (!original)
|
||||
original = create_fallback_icon (widget, size);
|
||||
|
||||
g_return_val_if_fail (original != NULL, NULL);
|
||||
|
||||
moo_icon_cache_set (cache, type, mime_type, 0, original);
|
||||
g_object_unref (original);
|
||||
}
|
||||
|
||||
if (!emblem)
|
||||
return original;
|
||||
|
||||
pixbuf = add_emblem (original, emblem, size);
|
||||
g_return_val_if_fail (pixbuf != NULL, NULL);
|
||||
moo_icon_cache_set (cache, type, mime_type, emblem, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
|
||||
static GdkPixbuf *
|
||||
add_arrow (GdkPixbuf *original,
|
||||
GtkIconSize size)
|
||||
|
@ -687,7 +679,7 @@ create_mime_icon (GtkWidget *widget,
|
|||
icon_theme = gtk_icon_theme_get_for_screen (screen);
|
||||
pixels_from_icon_size (screen, size, NULL, &pixel_size);
|
||||
|
||||
if (!strcmp (mime_type, XDG_MIME_TYPE_UNKNOWN))
|
||||
if (!strcmp (mime_type, MOO_MIME_TYPE_UNKNOWN))
|
||||
{
|
||||
pixbuf = get_named_icon (icon_theme, "unknown", pixel_size);
|
||||
|
||||
|
@ -715,11 +707,11 @@ create_mime_icon (GtkWidget *widget,
|
|||
|
||||
if (!pixbuf)
|
||||
{
|
||||
char **parent_types = xdg_mime_list_mime_parents (mime_type);
|
||||
const char **parent_types = moo_mime_type_list_parents (mime_type);
|
||||
|
||||
if (parent_types && parent_types[0])
|
||||
{
|
||||
char **p;
|
||||
const char **p;
|
||||
|
||||
for (p = parent_types; *p && !pixbuf; ++p)
|
||||
{
|
||||
|
@ -744,3 +736,70 @@ create_mime_icon (GtkWidget *widget,
|
|||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
moo_file_icon_get_pixbuf (MooFileIcon *icon,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *original;
|
||||
MooIconCache *cache;
|
||||
const char *mime_type;
|
||||
|
||||
g_return_val_if_fail (icon != NULL, NULL);
|
||||
g_return_val_if_fail (!widget || GTK_IS_WIDGET (widget), NULL);
|
||||
g_return_val_if_fail (icon->type < MOO_ICON_INVALID, NULL);
|
||||
g_return_val_if_fail (icon->type != MOO_ICON_MIME || icon->mime_type != NULL, NULL);
|
||||
g_return_val_if_fail (icon->emblem < MOO_ICON_EMBLEM_LEN, NULL);
|
||||
|
||||
if (icon->type != MOO_ICON_MIME)
|
||||
mime_type = NULL;
|
||||
else
|
||||
mime_type = icon->mime_type;
|
||||
|
||||
if (widget && gtk_widget_has_screen (widget))
|
||||
screen = gtk_widget_get_screen (widget);
|
||||
else
|
||||
screen = gdk_screen_get_default ();
|
||||
|
||||
cache = moo_icon_cache_get_for_screen (screen, size);
|
||||
g_return_val_if_fail (cache != NULL, NULL);
|
||||
|
||||
pixbuf = moo_icon_cache_get (cache, icon->type, mime_type, icon->emblem);
|
||||
|
||||
if (pixbuf)
|
||||
return pixbuf;
|
||||
|
||||
original = NULL;
|
||||
|
||||
if (icon->emblem)
|
||||
original = moo_icon_cache_get (cache, icon->type, mime_type, 0);
|
||||
|
||||
if (!original)
|
||||
{
|
||||
if (mime_type)
|
||||
original = create_mime_icon (widget, mime_type, size);
|
||||
else
|
||||
original = create_special_icon (widget, icon->type, size);
|
||||
|
||||
if (!original)
|
||||
original = create_fallback_icon (widget, size);
|
||||
|
||||
g_return_val_if_fail (original != NULL, NULL);
|
||||
|
||||
moo_icon_cache_set (cache, icon->type, mime_type, 0, original);
|
||||
g_object_unref (original);
|
||||
}
|
||||
|
||||
if (!icon->emblem)
|
||||
return original;
|
||||
|
||||
pixbuf = add_emblem (original, icon->emblem, size);
|
||||
g_return_val_if_fail (pixbuf != NULL, NULL);
|
||||
moo_icon_cache_set (cache, icon->type, mime_type, icon->emblem, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
return pixbuf;
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* moofileicon.h
|
||||
*
|
||||
* Copyright (C) 2004-2008 by Yevgen Muntyan <muntyan@tamu.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef MOO_FILE_ICON_H
|
||||
#define MOO_FILE_ICON_H
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
MOO_ICON_EMBLEM_LINK = 1 << 0
|
||||
} MooIconEmblem;
|
||||
|
||||
typedef enum {
|
||||
MOO_ICON_MIME = 0,
|
||||
MOO_ICON_HOME,
|
||||
MOO_ICON_DESKTOP,
|
||||
MOO_ICON_TRASH,
|
||||
MOO_ICON_DIRECTORY,
|
||||
MOO_ICON_BROKEN_LINK,
|
||||
MOO_ICON_NONEXISTENT,
|
||||
MOO_ICON_BLOCK_DEVICE,
|
||||
MOO_ICON_CHARACTER_DEVICE,
|
||||
MOO_ICON_FIFO,
|
||||
MOO_ICON_SOCKET,
|
||||
MOO_ICON_FILE,
|
||||
MOO_ICON_BLANK,
|
||||
MOO_ICON_INVALID
|
||||
} MooIconType;
|
||||
|
||||
typedef struct {
|
||||
const char *mime_type; /* interned inside mime code */
|
||||
MooIconType type;
|
||||
MooIconEmblem emblem;
|
||||
} MooFileIcon;
|
||||
|
||||
/* thread-safe */
|
||||
void moo_file_icon_for_file (MooFileIcon *icon,
|
||||
const char *path);
|
||||
/* needs gtk lock */
|
||||
GdkPixbuf *moo_file_icon_get_pixbuf (MooFileIcon *icon,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size);
|
||||
/* needs gtk lock */
|
||||
GdkPixbuf *moo_get_icon_for_file (const char *path,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size);
|
||||
|
||||
MooFileIcon *moo_file_icon_new (void);
|
||||
MooFileIcon *moo_file_icon_copy (MooFileIcon *icon);
|
||||
void moo_file_icon_free (MooFileIcon *icon);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* MOO_FILE_ICON_H */
|
|
@ -1501,56 +1501,6 @@ moo_get_locale_dir (void)
|
|||
}
|
||||
|
||||
|
||||
/* For xdgmime: should not contain duplicates */
|
||||
const char* const *
|
||||
_moo_get_shared_data_dirs (void)
|
||||
{
|
||||
static char **data_dirs = NULL;
|
||||
G_LOCK_DEFINE_STATIC(data_dirs);
|
||||
|
||||
G_LOCK (data_dirs);
|
||||
|
||||
if (!data_dirs)
|
||||
{
|
||||
guint i, n_dirs;
|
||||
GSList *dirs = NULL;
|
||||
const char* const *sys_dirs;
|
||||
|
||||
sys_dirs = g_get_system_data_dirs ();
|
||||
|
||||
#ifndef __WIN32__
|
||||
dirs = g_slist_prepend (NULL, _moo_normalize_file_path (g_get_user_data_dir ()));
|
||||
#endif
|
||||
|
||||
for (i = 0; sys_dirs[i] && sys_dirs[i][0]; ++i)
|
||||
{
|
||||
char *norm = _moo_normalize_file_path (sys_dirs[i]);
|
||||
|
||||
if (norm && !g_slist_find_custom (dirs, norm, (GCompareFunc) strcmp))
|
||||
dirs = g_slist_prepend (dirs, norm);
|
||||
else
|
||||
g_free (norm);
|
||||
}
|
||||
|
||||
dirs = g_slist_reverse (dirs);
|
||||
n_dirs = g_slist_length (dirs);
|
||||
data_dirs = g_new (char*, n_dirs + 1);
|
||||
|
||||
for (i = 0; i < n_dirs; ++i)
|
||||
{
|
||||
data_dirs[i] = dirs->data;
|
||||
dirs = g_slist_delete_link (dirs, dirs);
|
||||
}
|
||||
|
||||
data_dirs[n_dirs] = NULL;
|
||||
}
|
||||
|
||||
G_UNLOCK (data_dirs);
|
||||
|
||||
return (const char* const*) data_dirs;
|
||||
}
|
||||
|
||||
|
||||
char **
|
||||
moo_get_data_subdirs (const char *subdir,
|
||||
MooDataDirType type,
|
||||
|
|
|
@ -88,8 +88,6 @@ char *moo_tempnam (void);
|
|||
void moo_cleanup (void);
|
||||
|
||||
const char *moo_get_locale_dir (void);
|
||||
const char *const *_moo_get_shared_data_dirs (void);
|
||||
|
||||
|
||||
void moo_selection_data_set_pointer (GtkSelectionData *data,
|
||||
GdkAtom type,
|
||||
|
@ -182,10 +180,12 @@ gboolean _moo_regex_escape (const char *string,
|
|||
#define moo_new g_slice_new
|
||||
#define moo_new0 g_slice_new0
|
||||
#define moo_free g_slice_free
|
||||
#define moo_slice_dup g_slice_dup
|
||||
#else
|
||||
#define moo_new(type) g_new (type, 1)
|
||||
#define moo_new0(type) g_new0 (type, 1)
|
||||
#define moo_free(type,mem) g_free (mem)
|
||||
#define moo_slice_dup(type,mem) ((type*) g_memdup (mem, sizeof (type)))
|
||||
#endif
|
||||
|
||||
#if GLIB_CHECK_VERSION(2,10,0)
|
||||
|
|
Before Width: | Height: | Size: 97 B After Width: | Height: | Size: 97 B |
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 183 B |
|
@ -91,16 +91,6 @@ struct XdgCallbackList
|
|||
XdgMimeDestroy destroy;
|
||||
};
|
||||
|
||||
static const char *
|
||||
xdg_mime_intern_mime_type (const char *mime_type)
|
||||
{
|
||||
if (!mime_type || mime_type == XDG_MIME_TYPE_UNKNOWN ||
|
||||
!strcmp (mime_type, XDG_MIME_TYPE_UNKNOWN))
|
||||
return XDG_MIME_TYPE_UNKNOWN;
|
||||
else
|
||||
return _moo_intern_string (mime_type);
|
||||
}
|
||||
|
||||
/* Function called by xdg_run_command_on_dirs. If it returns TRUE, further
|
||||
* directories aren't looked at */
|
||||
typedef int (*XdgDirectoryFunc) (const char *directory,
|
||||
|
@ -234,7 +224,7 @@ xdg_run_command_on_dirs (XdgDirectoryFunc func,
|
|||
const char* const *dirs;
|
||||
const char* const *p;
|
||||
|
||||
dirs = _moo_get_shared_data_dirs ();
|
||||
dirs = _moo_get_mime_data_dirs ();
|
||||
|
||||
for (p = dirs; p && *p; ++p)
|
||||
if (func (*p, user_data))
|
||||
|
@ -416,12 +406,12 @@ xdg_mime_get_mime_type_for_data (const void *data,
|
|||
xdg_mime_init ();
|
||||
|
||||
if (_xdg_mime_caches)
|
||||
return xdg_mime_intern_mime_type (_xdg_mime_cache_get_mime_type_for_data (data, len, result_prio));
|
||||
return _xdg_mime_cache_get_mime_type_for_data (data, len, result_prio);
|
||||
|
||||
mime_type = _xdg_mime_magic_lookup_data (global_magic, data, len, result_prio, NULL, 0);
|
||||
|
||||
if (mime_type)
|
||||
return xdg_mime_intern_mime_type (mime_type);
|
||||
return mime_type;
|
||||
|
||||
return XDG_MIME_TYPE_UNKNOWN;
|
||||
}
|
||||
|
@ -451,13 +441,13 @@ xdg_mime_get_mime_type_for_file (const char *file_name,
|
|||
xdg_mime_init ();
|
||||
|
||||
if (_xdg_mime_caches)
|
||||
return xdg_mime_intern_mime_type (_xdg_mime_cache_get_mime_type_for_file (file_name, statbuf));
|
||||
return _xdg_mime_cache_get_mime_type_for_file (file_name, statbuf);
|
||||
|
||||
base_name = _xdg_get_base_name (file_name);
|
||||
n = _xdg_glob_hash_lookup_file_name (global_hash, base_name, mime_types, 5);
|
||||
|
||||
if (n == 1)
|
||||
return xdg_mime_intern_mime_type (mime_types[0]);
|
||||
return mime_types[0];
|
||||
|
||||
if (!statbuf)
|
||||
{
|
||||
|
@ -504,7 +494,7 @@ xdg_mime_get_mime_type_for_file (const char *file_name,
|
|||
fclose (file);
|
||||
|
||||
if (mime_type)
|
||||
return xdg_mime_intern_mime_type (mime_type);
|
||||
return mime_type;
|
||||
|
||||
return XDG_MIME_TYPE_UNKNOWN;
|
||||
}
|
||||
|
@ -517,10 +507,10 @@ xdg_mime_get_mime_type_from_file_name (const char *file_name)
|
|||
xdg_mime_init ();
|
||||
|
||||
if (_xdg_mime_caches)
|
||||
return xdg_mime_intern_mime_type (_xdg_mime_cache_get_mime_type_from_file_name (file_name));
|
||||
return _xdg_mime_cache_get_mime_type_from_file_name (file_name);
|
||||
|
||||
if (_xdg_glob_hash_lookup_file_name (global_hash, file_name, &mime_type, 1))
|
||||
return xdg_mime_intern_mime_type (mime_type);
|
||||
return mime_type;
|
||||
else
|
||||
return XDG_MIME_TYPE_UNKNOWN;
|
||||
}
|
||||
|
@ -660,7 +650,7 @@ xdg_mime_unalias_mime_type (const char *mime_type)
|
|||
{
|
||||
xdg_mime_init ();
|
||||
|
||||
return xdg_mime_intern_mime_type (_xdg_mime_unalias_mime_type (mime_type));
|
||||
return _xdg_mime_unalias_mime_type (mime_type);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -881,14 +871,14 @@ xdg_mime_get_icon (const char *mime)
|
|||
xdg_mime_init ();
|
||||
|
||||
if (_xdg_mime_caches)
|
||||
return xdg_mime_intern_mime_type (_xdg_mime_cache_get_icon (mime));
|
||||
return _xdg_mime_cache_get_icon (mime);
|
||||
|
||||
icon = _xdg_mime_icon_list_lookup (icon_list, mime);
|
||||
|
||||
if (!icon)
|
||||
icon = xdg_mime_intern_mime_type (xdg_mime_get_generic_icon (mime));
|
||||
icon = xdg_mime_get_generic_icon (mime);
|
||||
|
||||
return xdg_mime_intern_mime_type (icon);
|
||||
return icon;
|
||||
}
|
||||
|
||||
const char *
|
||||
|
@ -897,7 +887,7 @@ xdg_mime_get_generic_icon (const char *mime)
|
|||
xdg_mime_init ();
|
||||
|
||||
if (_xdg_mime_caches)
|
||||
return xdg_mime_intern_mime_type (_xdg_mime_cache_get_generic_icon (mime));
|
||||
return _xdg_mime_cache_get_generic_icon (mime);
|
||||
|
||||
return xdg_mime_intern_mime_type (_xdg_mime_icon_list_lookup (generic_icon_list, mime));
|
||||
return _xdg_mime_icon_list_lookup (generic_icon_list, mime);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ const char *_xdg_get_base_name (const char *file_name);
|
|||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/moo-mime.h"
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#define HAVE_MMAP 1
|
||||
|
|
Loading…
Reference in New Issue