mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 01:06:16 +02:00
Build file extensions filter from the MIME types present on the OPK
This feature is enabled only if libxdgmime is available.
This commit is contained in:
parent
e7e21b424b
commit
5f1cff6d0f
@ -27,6 +27,9 @@ AC_CHECK_LIB(png, png_read_image,,check_png="no")
|
|||||||
# Check for libopk
|
# Check for libopk
|
||||||
AC_CHECK_LIB(opk, opk_open)
|
AC_CHECK_LIB(opk, opk_open)
|
||||||
|
|
||||||
|
# Check for libxdgmime
|
||||||
|
AC_CHECK_LIB(xdgmime, xdg_mime_get_extensions_from_mime_type)
|
||||||
|
|
||||||
AC_ARG_ENABLE(platform,
|
AC_ARG_ENABLE(platform,
|
||||||
[ --enable-platform=X specify the targeted platform],
|
[ --enable-platform=X specify the targeted platform],
|
||||||
[GMENU2X_PLATFORM="$enableval"], [GMENU2X_PLATFORM="default"])
|
[GMENU2X_PLATFORM="$enableval"], [GMENU2X_PLATFORM="default"])
|
||||||
|
@ -45,6 +45,10 @@
|
|||||||
#include <opk.h>
|
#include <opk.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBXDGMIME
|
||||||
|
#include <xdgmime.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using fastdelegate::MakeDelegate;
|
using fastdelegate::MakeDelegate;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -158,6 +162,35 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
|||||||
consoleApp = !strcmp(param, "true");
|
consoleApp = !strcmp(param, "true");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBXDGMIME
|
||||||
|
param = opk_read_param(pdata, "MimeType");
|
||||||
|
if (param) {
|
||||||
|
string::size_type oldpos = 0;
|
||||||
|
string mimetypes = param;
|
||||||
|
|
||||||
|
while ((pos = mimetypes.find(';')) != mimetypes.npos) {
|
||||||
|
int nb = 16;
|
||||||
|
char *extensions[nb];
|
||||||
|
string mimetype = mimetypes.substr(oldpos, pos);
|
||||||
|
mimetypes = mimetypes.substr(pos + 1);
|
||||||
|
|
||||||
|
nb = xdg_mime_get_extensions_from_mime_type(
|
||||||
|
mimetype.c_str(), extensions, nb);
|
||||||
|
|
||||||
|
while (nb--) {
|
||||||
|
selectorfilter += (string) extensions[nb] + ',';
|
||||||
|
free(extensions[nb]);
|
||||||
|
}
|
||||||
|
|
||||||
|
oldpos = pos + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove last comma */
|
||||||
|
selectorfilter.erase(selectorfilter.end());
|
||||||
|
DEBUG("Compatible extensions: %s\n", selectorfilter.c_str());
|
||||||
|
}
|
||||||
|
#endif /* HAVE_LIBXDGMIME */
|
||||||
|
|
||||||
param = opk_read_param(pdata, "X-OD-Manual");
|
param = opk_read_param(pdata, "X-OD-Manual");
|
||||||
if (param)
|
if (param)
|
||||||
manual = param;
|
manual = param;
|
||||||
|
Loading…
Reference in New Issue
Block a user