Use xdgmime unconditionally; added --enable-generated-files

This commit is contained in:
Yevgen Muntyan 2008-02-10 12:53:42 -06:00
parent a3d66b4f70
commit 192a09726f
13 changed files with 21 additions and 64 deletions

View File

@ -50,10 +50,6 @@ configure has the following medit-specific options:
If libxml2 is not available or --without-xml is used, syntax highlighting
will be disabled.
--disable-help do not build html help files
By default help files are built and installed if xsltproc can process DocBook
sources, i.e. if both xsltproc and docbook are installed and functional.
--disable-nls do not use localization
Use this option if you get build errors in po or po-gsv directories, or
if configure says you do not have intltool.

View File

@ -18,7 +18,6 @@ m4files = \
m4/moo-pygtk.m4 \
m4/moo-python.m4 \
m4/moo-version.m4 \
m4/moo-xdgmime.m4 \
m4/moo-xml.m4 \
m4/moo-python-cross-mingw.m4
@ -71,8 +70,14 @@ DISTCLEANFILES = \
po-subdirs-stamp-2 \
po-subdirs-stamp
DISTCHECK_CONFIGURE_FLAGS = --enable-unit-tests
# DISTCHECK_CONFIGURE_FLAGS = --enable-unit-tests
distuninstallcheck_listfiles = find . -type f -print | grep -v share/mime/ | grep -v share/icons/hicolor
snapshot:
$(MAKE) dist && mv $(PACKAGE)-$(VERSION).tar.bz2 $(PACKAGE)-`date +%F-%H-%M`.tar.bz2
win-test-stuff:
$(MAKE) all && mkdir -p test-stuff/test-data && \
cp moo/.libs/libmoo.dll test-stuff/ && \
cp -r $(srcdir)/tests/data/* test-stuff/test-data/ && \
cp tests/.libs/run-tests.exe test-stuff/

View File

@ -20,12 +20,19 @@ AC_DEFUN_ONCE([MOO_AC_FLAGS],[
MOO_AC_DEBUG
MOO_AC_FAM
MOO_AC_XML
MOO_AC_XDGMIME
MOO_AC_PCRE
MOO_AC_PYTHON
dnl must be called after MOO_AC_PYTHON
MOO_AC_LIB
MOO_ENABLE_GENERATED_FILES="yes"
AC_ARG_ENABLE(generated-files,
AC_HELP_STRING([--enable-generated-files],[run update-mime-database and gtk-update-icon-cache on install (default = YES)]),[
if test "x$enable_generated_files" = "xno"; then
MOO_ENABLE_GENERATED_FILES="no"
fi ])
AM_CONDITIONAL(MOO_ENABLE_GENERATED_FILES, test x$MOO_ENABLE_GENERATED_FILES = "xyes")
AC_CHECK_LIB(Xrender, XRenderFindFormat,[
AC_SUBST(RENDER_LIBS, "-lXrender -lXext")
AC_DEFINE(HAVE_RENDER, 1, [Define if libXrender is available.])

View File

@ -9,6 +9,7 @@ AC_DEFUN_ONCE([MOO_AC_FUNCS],[
# for xdgmime
AC_CHECK_HEADERS(fnmatch.h netinet/in.h)
AC_CHECK_FUNCS(getc_unlocked)
# for GMappedFile
AC_CHECK_HEADERS(unistd.h)

View File

@ -1,10 +0,0 @@
##############################################################################
# MOO_AC_XDGMIME([])
# does nothing, just defines MOO_USE_XDGMIME on unix
#
AC_DEFUN_ONCE([MOO_AC_XDGMIME],[
MOO_USE_XDGMIME=true
AC_DEFINE(MOO_USE_XDGMIME, 1, [use xdgmime])
AM_CONDITIONAL(MOO_USE_XDGMIME, true)
AC_CHECK_FUNCS(getc_unlocked)
])

View File

@ -56,6 +56,7 @@ icontheme_DATA = ../moo/mooutils/pixmaps/medit.png
update_icon_cache = gtk-update-icon-cache -f -t $(DESTDIR)$(hicolor)
if MOO_ENABLE_GENERATED_FILES
install-data-hook:
if echo "Updating icon cache" && $(update_icon_cache); then \
echo "Done."; \
@ -65,3 +66,4 @@ install-data-hook:
fi
uninstall-hook:
echo "Updating icon cache" && $(update_icon_cache) && echo "Done."
endif

View File

@ -1131,9 +1131,7 @@ moo_app_cleanup (void)
moo_app_data.input = NULL;
}
#ifdef MOO_USE_XDGMIME
xdg_mime_shutdown ();
#endif
moo_cleanup ();
}

View File

@ -199,6 +199,7 @@ update_mime = update-mime-database $(DESTDIR)${mimedir}
EXTRA_DIST += moo.xml.in
CLEANFILES += moo.xml
if MOO_ENABLE_GENERATED_FILES
if !MOO_OS_MINGW
install-data-hook:
if echo "Updating mime database... " && $(update_mime); then \
@ -215,7 +216,8 @@ else MOO_OS_MINGW
install-data-hook:
cp /usr/share/mime/packages/freedesktop.org.xml $(DESTDIR)${mimedir}/packages/ && \
$(update_mime)
endif
endif MOO_OS_MINGW
endif MOO_ENABLE_GENERATED_FILES
EXTRA_DIST += \
$(mooedit_tools_DATA) \
@ -259,11 +261,3 @@ mooedit_includedir = $(moo_includedir)/mooedit
mooedit_include_HEADERS = $(mooedit_include_headers)
nodist_mooedit_include_HEADERS = $(nodist_mooedit_include_headers)
endif
if MOO_ENABLE_UNIT_TESTS
AM_CFLAGS += -DSRCDIR=\"$(shell cd $(srcdir) && pwd)\" -DTOP_SRCDIR=\"$(shell cd $(top_srcdir) && pwd)\"
endif
EXTRA_DIST += \
test/gobject.lua \
test/textview.lua \
test/mooedit.lua

View File

@ -397,7 +397,6 @@ moo_lang_mgr_get_lang_for_file (MooLangMgr *mgr,
if (lang)
return lang;
#ifdef MOO_USE_XDGMIME
/* 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);
@ -407,11 +406,6 @@ moo_lang_mgr_get_lang_for_file (MooLangMgr *mgr,
if (lang)
return lang;
#else
#ifdef __GNUC__
#warning "Implement moo_lang_mgr_get_lang_for_file()"
#endif
#endif /* MOO_USE_XDGMIME */
return NULL;
}
@ -437,7 +431,6 @@ get_lang_for_filename (MooLangMgr *mgr,
if (lang)
return lang;
#ifdef MOO_USE_XDGMIME
/* XXX: xdgmime wants utf8-encoded filename here. is it a problem? */
/* It's a big problem! */
@ -448,11 +441,6 @@ get_lang_for_filename (MooLangMgr *mgr,
if (lang)
return lang;
#else
#ifdef __GNUC__
#warning "Implement moo_lang_mgr_get_lang_for_filename()"
#endif
#endif /* MOO_USE_XDGMIME */
lang = lang_mgr_get_lang_for_bak_filename (mgr, filename);
@ -463,7 +451,6 @@ get_lang_for_filename (MooLangMgr *mgr,
}
#ifdef MOO_USE_XDGMIME
static int
check_mime_subclass (const char *base,
const char *mime)
@ -515,17 +502,6 @@ get_lang_for_mime_type (MooLangMgr *mgr,
g_slist_free (langs);
return found ? lang : NULL;
}
#else /* MOO_USE_XDGMIME */
static MooLang *
get_lang_for_mime_type (MooLangMgr *mgr,
const char *mime)
{
g_return_val_if_fail (MOO_IS_LANG_MGR (mgr), NULL);
g_return_val_if_fail (mime != NULL, NULL);
g_warning ("%s: implement me?", G_STRLOC);
return NULL;
}
#endif /* MOO_USE_XDGMIME */
static void

View File

@ -39,9 +39,7 @@
#include <errno.h>
#include <sys/stat.h>
#ifdef MOO_USE_XDGMIME
#include <mooutils/xdgmime/xdgmime.h>
#endif
#ifndef MOO_VERSION
#define MOO_VERSION NULL
@ -293,7 +291,6 @@ moo_file_selector_activate (MooFileView *fileview,
return;
}
#ifdef MOO_USE_XDGMIME
{
const char *mime_type = xdg_mime_get_mime_type_for_file (path, &statbuf);
@ -316,7 +313,6 @@ moo_file_selector_activate (MooFileView *fileview,
xdg_mime_mime_type_subclass (mime_type, "text/plain");
is_exe = !strcmp (mime_type, "application/x-executable");
}
#endif
if (is_text)
moo_editor_open_file (moo_edit_window_get_editor (filesel->window),

View File

@ -710,7 +710,6 @@ create_mime_icon (GtkWidget *widget,
pixbuf = create_mime_icon_exact (icon_theme, mime_type, pixel_size);
#ifdef MOO_USE_XDGMIME
if (!pixbuf)
{
char **parent_types = xdg_mime_list_mime_parents (mime_type);
@ -736,7 +735,6 @@ create_mime_icon (GtkWidget *widget,
g_free (parent_types);
}
#endif
if (!pixbuf)
pixbuf = create_special_icon (widget, MOO_ICON_FILE, size);

View File

@ -22,9 +22,7 @@
#include "mooutils/mooaction.h"
#include "mooutils/mooutils-fs.h"
#include "mooutils/mootype-macros.h"
#ifdef MOO_USE_XDGMIME
#include "mooutils/xdgmime/xdgmime.h"
#endif
#include <string.h>
@ -326,7 +324,6 @@ action_check_one (ToolAction *action,
if (_moo_glob_match_simple (l->data, _moo_file_display_name (file)))
return TRUE;
#ifdef MOO_USE_XDGMIME
mime = _moo_file_get_mime_type (file);
g_return_val_if_fail (mime != NULL, FALSE);
@ -336,7 +333,6 @@ action_check_one (ToolAction *action,
for (l = action->mimetypes; l != NULL; l = l->next)
if (xdg_mime_mime_type_subclass (mime, l->data))
return TRUE;
#endif
return FALSE;
}

View File

@ -6,10 +6,8 @@ if MOO_BUILD_PCRE
subdirs += pcre
libs += pcre/libpcre.la
endif
if MOO_USE_XDGMIME
subdirs += xdgmime
libs += xdgmime/libxdgmime.la
endif
if !GLIB_2_14
subdirs += newgtk
libs += newgtk/libnewgtk.la