Commit fdb0add5 authored by Benedikt Meurer's avatar Benedikt Meurer

2005-08-10 Benedikt Meurer <benny@xfce.org>

	* thunar-vfs/thunar-vfs-jobs.{c,h}, thunar-vfs/Makefile.am,
	  thunar-vfs/thunar-vfs.{c,h}: Merge thunar-vfs-jobs.[ch] into
	  thunar-vfs.[ch].
	* thunar-vfs/thunar-vfs-mime-database.c, thunar/thunar-local-folder.c,
	  thunar-vfs/thunar-vfs-monitor.{c,h}, thunar/thunar-local-file.c:
	  Rename thunar_vfs_monitor_get() to thunar_vfs_monitor_get_default().
	* thunar-vfs/thunar-vfs-mime-database.{c,h},
	  thunar-vfs/thunar-vfs-mime.c, thunar-vfs/thunar-vfs-info.c,
	  thunar/thunar-launcher.c, thunar/thunar-open-with-action.c,
	  thunar/thunar-trash-folder.c: Rename thunar_vfs_mime_database_get()
	  to thunar_vfs_mime_database_get_default().
	* thunar-vfs/, thunar/Makefile.am, tests/Makefile.am, configure.in.in:
	  Turn libthunar-vfs into a shared library, so we can use it in other
	  applications/plugins as well.




(Old svn revision: 16849)
parent f2316439
2005-08-10 Benedikt Meurer <benny@xfce.org>
* thunar-vfs/thunar-vfs-jobs.{c,h}, thunar-vfs/Makefile.am,
thunar-vfs/thunar-vfs.{c,h}: Merge thunar-vfs-jobs.[ch] into
thunar-vfs.[ch].
* thunar-vfs/thunar-vfs-mime-database.c, thunar/thunar-local-folder.c,
thunar-vfs/thunar-vfs-monitor.{c,h}, thunar/thunar-local-file.c:
Rename thunar_vfs_monitor_get() to thunar_vfs_monitor_get_default().
* thunar-vfs/thunar-vfs-mime-database.{c,h},
thunar-vfs/thunar-vfs-mime.c, thunar-vfs/thunar-vfs-info.c,
thunar/thunar-launcher.c, thunar/thunar-open-with-action.c,
thunar/thunar-trash-folder.c: Rename thunar_vfs_mime_database_get()
to thunar_vfs_mime_database_get_default().
* thunar-vfs/, thunar/Makefile.am, tests/Makefile.am, configure.in.in:
Turn libthunar-vfs into a shared library, so we can use it in other
applications/plugins as well.
2005-08-10 Benedikt Meurer <benny@xfce.org>
* configure.in.in: Bump version to 0.1.1.
......
......@@ -9,6 +9,8 @@ dnl
dnl ***************************
dnl *** Version information ***
dnl ***************************
m4_define([thunar_verinfo], [0:0:0])
m4_define([thunar_version_api], [1])
m4_define([thunar_version_major], [0])
m4_define([thunar_version_minor], [1])
m4_define([thunar_version_micro], [1])
......@@ -48,8 +50,22 @@ dnl ********************************
AC_PROG_CC()
AC_PROG_LD()
AC_PROG_INSTALL()
AC_CHECK_PROGS([PERL], [perl5 perl])
dnl **************************
dnl *** Initialize libtool ***
dnl **************************
AC_DISABLE_STATIC()
AC_PROG_LIBTOOL()
dnl **************************************
dnl *** Substitute version information ***
dnl **************************************
THUNAR_VERINFO=thunar_verinfo()
THUNAR_VERSION_API=thunar_version_api()
AC_SUBST([THUNAR_VERINFO])
AC_SUBST([THUNAR_VERSION_API])
dnl **********************************
dnl *** Check for standard headers ***
dnl **********************************
......@@ -183,6 +199,46 @@ else
esac
fi
dnl ****************************************
dnl *** Check for ELF visibility support ***
dnl ****************************************
AC_ARG_ENABLE([visibility], AC_HELP_STRING([--disable-visibility], [Don't use ELF visibility attributes]), [], [enable_visibility=yes])
have_gnuc_visibility=no
if test x"$enable_visibility" != x"no"; then
dnl Check whether the compiler supports the visibility attribute
AC_MSG_CHECKING([whether $CC supports the GNUC visibility attribute])
AC_COMPILE_IFELSE(AC_LANG_SOURCE(
[
void __attribute__ ((visibility("default"))) test_default (void) {}
void __attribute__ ((visibility("hidden"))) test_hidden (void) {}
int main (int argc, char **argv) { test_default (); test_hidden (); return 0; }
]),
[
AC_MSG_RESULT([yes])
dnl Check if the compiler supports -fvisibility=hidden
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden"
AC_MSG_CHECKING([whether $CC accepts -fvisibility=hidden])
AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]),
[
have_gnuc_visibility=yes
AC_MSG_RESULT([yes])
],
[
AC_MSG_RESULT([no])
])
CFLAGS="$save_CFLAGS"
],
[
AC_MSG_RESULT([no])
])
fi
if test x"$have_gnuc_visibility" = x"yes"; then
CFLAGS="$CFLAGS -fvisibility=hidden"
CPPFLAGS="$CPPFLAGS -DHAVE_GNUC_VISIBILITY"
fi
AM_CONDITIONAL([HAVE_GNUC_VISIBILITY], [test x"$have_gnuc_visibility" = x"yes"])
AC_OUTPUT([
Makefile
docs/Makefile
......@@ -193,5 +249,6 @@ tests/Makefile
tests/data/Makefile
thunar/Makefile
thunar-vfs/Makefile
thunar-vfs/thunar-vfs-1.pc
thunarx/Makefile
])
......@@ -25,19 +25,19 @@ test_thunar_vfs_uri_SOURCES = \
test-thunar-vfs-uri.c
test_thunar_vfs_uri_DEPENDENCIES = \
$(top_builddir)/thunar-vfs/libthunar-vfs.la
$(top_builddir)/thunar-vfs/libthunar-vfs-$(THUNAR_VERSION_API).la
test_thunar_vfs_uri_LDADD = \
$(top_builddir)/thunar-vfs/libthunar-vfs.la
$(top_builddir)/thunar-vfs/libthunar-vfs-$(THUNAR_VERSION_API).la
test_thunar_vfs_volume_bsd_SOURCES = \
test-thunar-vfs-volume-bsd.c
test_thunar_vfs_volume_bsd_DEPENDENCIES = \
$(top_builddir)/thunar-vfs/libthunar-vfs.la
$(top_builddir)/thunar-vfs/libthunar-vfs-$(THUNAR_VERSION_API).la
test_thunar_vfs_volume_bsd_LDADD = \
$(top_builddir)/thunar-vfs/libthunar-vfs.la
$(top_builddir)/thunar-vfs/libthunar-vfs-$(THUNAR_VERSION_API).la
clean-local:
rm -f *.core core core.*
......
......@@ -6,20 +6,13 @@ INCLUDES = \
-DEXO_DISABLE_DEPRECATED \
-DG_LOG_DOMAIN=\"thunar-vfs\"
noinst_LTLIBRARIES = \
libthunar-vfs.la
libthunar_vfs_built_sources = \
thunar-vfs-enum-types.c \
thunar-vfs-enum-types.h \
thunar-vfs-marshal.c \
thunar-vfs-marshal.h
lib_LTLIBRARIES = \
libthunar-vfs-1.la
libthunar_vfs_headers = \
thunar-vfs-info.h \
thunar-vfs-interactive-job.h \
thunar-vfs-job.h \
thunar-vfs-jobs.h \
thunar-vfs-mime.h \
thunar-vfs-mime-application.h \
thunar-vfs-mime-database.h \
......@@ -29,16 +22,32 @@ libthunar_vfs_headers = \
thunar-vfs-user.h \
thunar-vfs-util.h \
thunar-vfs-uri.h \
thunar-vfs-volume.h \
thunar-vfs-volume.h
libthunar_vfs_public_built_sources = \
thunar-vfs-enum-types.h
libthunar_vfs_built_sources = \
$(libthunar_vfs_public_built_sources) \
thunar-vfs-alias.h \
thunar-vfs-aliasdef.c \
thunar-vfs-enum-types.c \
thunar-vfs-marshal.c \
thunar-vfs-marshal.h
libthunar_vfs_includedir = \
$(includedir)/thunar-vfs-$(THUNAR_VERSION_API)/thunar-vfs
libthunar_vfs_include_HEADERS = \
$(libthunar_vfs_headers) \
$(libthunar_vfs_public_built_sources) \
thunar-vfs.h
libthunar_vfs_la_SOURCES = \
libthunar_vfs_1_la_SOURCES = \
$(libthunar_vfs_built_sources) \
$(libthunar_vfs_headers) \
thunar-vfs-info.c \
thunar-vfs-interactive-job.c \
thunar-vfs-job.c \
thunar-vfs-jobs.c \
thunar-vfs-listdir-job.c \
thunar-vfs-listdir-job.h \
thunar-vfs-mime.c \
......@@ -69,20 +78,30 @@ libthunar_vfs_la_SOURCES = \
thunar-vfs-volume-impl.h \
thunar-vfs.c
libthunar_vfs_la_CFLAGS = \
libthunar_vfs_1_la_CFLAGS = \
$(EXO_CFLAGS) \
$(GTHREAD_CFLAGS) \
$(LIBFAM_CFLAGS)
libthunar_vfs_la_LDFLAGS = \
-no-undefined
libthunar_vfs_1_la_LDFLAGS = \
-export-dynamic \
-export-symbols-regex "^[^_].*" \
-version-info $(THUNAR_VERINFO)
libthunar_vfs_la_LIBADD = \
libthunar_vfs_1_la_LIBADD = \
$(EXO_LIBS) \
$(GTHREADS_LIBS) \
$(LIBFAM_LIBS)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = thunar-vfs-1.pc
EXTRA_DIST = \
abicheck.sh \
make-thunar-vfs-alias.pl \
thunar-vfs.symbols \
thunar-vfs-alias.h \
thunar-vfs-aliasdef.c \
thunar-vfs-marshal.list \
thunar-vfs-volume-bsd.c \
thunar-vfs-volume-bsd.h \
......@@ -100,6 +119,8 @@ EXTRA_DIST = \
##
if MAINTAINER_MODE
CLEANFILES = \
actual-abi \
expected-abi \
xgen-tvetc \
xgen-tveth \
xgen-tvmc \
......@@ -113,25 +134,37 @@ DISTCLEANFILES = \
BUILT_SOURCES = \
$(libthunar_vfs_built_sources)
if HAVE_GNUC_VISIBILITY
TESTS = \
abicheck.sh
endif
thunar-vfs-alias.h: make-thunar-vfs-alias.pl thunar-vfs.symbols
$(PERL) $(srcdir)/make-thunar-vfs-alias.pl < $(srcdir)/thunar-vfs.symbols > thunar-vfs-alias.h
thunar-vfs-aliasdef.c: make-thunar-vfs-alias.pl thunar-vfs.symbols
$(PERL) $(srcdir)/make-thunar-vfs-alias.pl -def < $(srcdir)/thunar-vfs.symbols > thunar-vfs-aliasdef.c
thunar-vfs-enum-types.h: stamp-thunar-vfs-enum-types.h
@true
stamp-thunar-vfs-enum-types.h: $(libthunar_vfs_headers) Makefile
( cd $(srcdir) && glib-mkenums \
--fhead "#ifndef __THUNAR_VFS_ENUM_TYPES_H__\n#define __THUNAR_VFS_ENUM_TYPES_H__\n#include <exo/exo.h>\nG_BEGIN_DECLS\n" \
--fprod "/* enumerations from \"@filename@\" */\n" \
--vhead "GType @enum_name@_get_type (void);\n#define THUNAR_VFS_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
--vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define THUNAR_VFS_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
--ftail "G_END_DECLS\n\n#endif /* !__THUNAR_VFS_ENUM_TYPES_H__ */" \
$(libthunar_vfs_headers) ) >> xgen-tveth \
&& (cmp -s xgen-tveth thunar-vfs-enum-types.h || cp xgen-tveth thunar-vfs-enum-types.h ) \
&& ( cmp -s xgen-tveth thunar-vfs-enum-types.h || cp xgen-tveth thunar-vfs-enum-types.h ) \
&& rm -f xgen-tveth \
&& echo timestamp > $(@F)
thunar-vfs-enum-types.c: $(libthunar_vfs_headers) Makefile
( cd $(srcdir) && glib-mkenums \
--fhead "#undef GTK_DISABLE_DEPRECATED\n#define GTK_ENABLE_BROKEN\n#include <thunar-vfs/thunar-vfs.h>" \
--fhead "#undef GTK_DISABLE_DEPRECATED\n#define GTK_ENABLE_BROKEN\n#include <thunar-vfs/thunar-vfs.h>\n#include <thunar-vfs/thunar-vfs-alias.h>" \
--fprod "\n/* enumerations from \"@filename@\" */" \
--vhead "GType\n@enum_name@_get_type (void)\n{\n\tstatic GType type = 0;\n\tif (type == 0) {\n\tstatic const G@Type@Value values[] = {"\
--vprod "\t{ @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail "\t{ 0, NULL, NULL }\n\t};\n\ttype = g_@type@_register_static (\"@EnumName@\", values);\n }\n\treturn type;\n}\n" \
--ftail "\n#define __THUNAR_VFS_ENUM_TYPES_C__\n#include \"thunar-vfs-aliasdef.c\"\n" \
$(libthunar_vfs_headers) ) >> xgen-tvetc \
&& cp xgen-tvetc thunar-vfs-enum-types.c \
&& rm -f xgen-tvetc
......
#!/bin/sh
#
# Copyright (c) 2004 The GLib Development Team.
# Copyright (c) 2005 Benedikt Meurer <benny@xfce.org>.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
cpp -P -DALL_FILES ${srcdir:-.}/thunar-vfs.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' -e 's/ PRIVATE//' | sort > expected-abi
nm -D .libs/libthunar-vfs-1.so | grep " T " | cut -d ' ' -f 3 | grep -v '^_.*' | sort > actual-abi
diff -u expected-abi actual-abi && rm expected-abi actual-abi
#!/usr/bin/env perl -w
#
# Copyright (c) 2004 The GLib Development Team.
# Copyright (c) 2005 Benedikt Meurer <benny@xfce.org>.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
my $option_def = 0;
if (($#ARGV >= 0) && ($ARGV[0] eq "-def"))
{
shift;
$option_def = 1;
}
print <<EOF;
/* Generated by make-thunar-vfs-alias.pl. Do not edit this file. */
#ifdef HAVE_GNUC_VISIBILITY
#include <glib.h>
EOF
if ($option_def)
{
print <<EOF
#undef IN_HEADER
#define IN_HEADER(x) 1
#undef IN_SOURCE
#define IN_SOURCE defined
EOF
}
else
{
print <<EOF
#define IN_HEADER defined
#define IN_SOURCE(x) 1
EOF
}
my $in_comment = 0;
my $in_skipped_section = 0;
while (<>)
{
# ignore empty lines
next if /^\s*$/;
# skip comments
if ($_ =~ /^\s*\/\*/)
{
$in_comment = 1;
}
if ($in_comment)
{
if ($_ =~ /\*\/\s$/)
{
$in_comment = 0;
}
next;
}
# handle ifdefs
if ($_ =~ /^\#endif/)
{
if (!$in_skipped_section)
{
print $_;
}
$in_skipped_section = 0;
next;
}
if ($_ =~ /^\#ifdef\s+(INCLUDE_VARIABLES|INCLUDE_INTERNAL_SYMBOLS|ALL_FILES)/)
{
$in_skipped_section = 1;
}
if ($in_skipped_section)
{
next;
}
if ($_ =~ /^\#ifn?def\s+G/)
{
print $_;
next;
}
if ($_ =~ /^\#if.*(IN_SOURCE|IN_HEADER)/)
{
print $_;
next;
}
chop;
my $line = $_;
my @words;
my $attributes = "";
@words = split (/ /, $line);
my $symbol = shift (@words);
chomp ($symbol);
my $alias = "IA__".$symbol;
# Drop any Win32 specific .def file syntax, but keep attributes
foreach $word (@words)
{
$attributes = "$attributes $word" unless $word eq "PRIVATE";
}
if (!$option_def)
{
print <<EOF
extern __typeof ($symbol) $alias __attribute((visibility("hidden")))$attributes;
\#define $symbol $alias
EOF
}
else
{
print <<EOF
\#undef $symbol
extern __typeof ($symbol) $symbol __attribute((alias("$alias"), visibility("default")));
EOF
}
}
print <<EOF;
#endif /* HAVE_GNUC_VISIBILITY */
EOF
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: thunar-vfs
Description: ThunarVFS library
Requires: exo-0.3
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lthunar-vfs-@THUNAR_VERSION_API@
Cflags: -I${includedir}/thunar-vfs-@THUNAR_VERSION_API@
......@@ -38,6 +38,7 @@
#include <thunar-vfs/thunar-vfs-info.h>
#include <thunar-vfs/thunar-vfs-mime-database.h>
#include <thunar-vfs/thunar-vfs-alias.h>
......@@ -126,7 +127,7 @@ thunar_vfs_info_new_for_uri (ThunarVfsURI *uri,
}
}
database = thunar_vfs_mime_database_get ();
database = thunar_vfs_mime_database_get_default ();
switch (info->type)
{
case THUNAR_VFS_FILE_TYPE_SOCKET:
......@@ -278,3 +279,7 @@ thunar_vfs_info_list_free (GSList *info_list)
return NULL;
}
#define __THUNAR_VFS_INFO_C__
#include <thunar-vfs/thunar-vfs-aliasdef.c>
......@@ -29,6 +29,7 @@
#include <thunar-vfs/thunar-vfs-enum-types.h>
#include <thunar-vfs/thunar-vfs-interactive-job.h>
#include <thunar-vfs/thunar-vfs-marshal.h>
#include <thunar-vfs/thunar-vfs-alias.h>
......@@ -367,3 +368,7 @@ thunar_vfs_interactive_job_skip (ThunarVfsInteractiveJob *interactive_job,
}
}
#define __THUNAR_VFS_INTERACTIVE_JOB_C__
#include <thunar-vfs/thunar-vfs-aliasdef.c>
......@@ -32,6 +32,7 @@
#include <gobject/gvaluecollector.h>
#include <thunar-vfs/thunar-vfs-job.h>
#include <thunar-vfs/thunar-vfs-alias.h>
......@@ -404,3 +405,7 @@ _thunar_vfs_job_shutdown (void)
job_pool = NULL;
}
#define __THUNAR_VFS_JOB_C__
#include <thunar-vfs/thunar-vfs-aliasdef.c>
/* $Id$ */
/*-
* Copyright (c) 2005 Benedikt Meurer <benny@xfce.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <thunar-vfs/thunar-vfs-jobs.h>
#include <thunar-vfs/thunar-vfs-listdir-job.h>
#include <thunar-vfs/thunar-vfs-transfer-job.h>
#include <thunar-vfs/thunar-vfs-unlink-job.h>
/**
* thunar_vfs_listdir:
* @uri : the #ThunarVfsURI for the folder that should be listed.
* @error : return location for errors or %NULL.
*
* Generates a #ThunarVfsListdirJob, which can be used to list the
* contents of a directory (as specified by @uri). If the creation
* of the job failes for some reason, %NULL will be returned and
* @error will be set to point to a #GError describing the cause.
* Else the newly allocated #ThunarVfsListdirJob will be returned
* and the caller is responsible to call #thunar_vfs_job_unref().
*
* Note, that the returned job is launched right away, so you
* don't need to call #thunar_vfs_job_launch() on it.
*
* Return value: the newly allocated #ThunarVfsListdirJob or %NULL
* if an error occurs while creating the job.
**/
ThunarVfsJob*
thunar_vfs_listdir (ThunarVfsURI *uri,
GError **error)
{
g_return_val_if_fail (THUNAR_VFS_IS_URI (uri), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
/* verify that we have a 'file://'-URI here */
if (G_UNLIKELY (thunar_vfs_uri_get_scheme (uri) != THUNAR_VFS_URI_SCHEME_FILE))
{
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL,
_("Only local directories can be listed"));
return NULL;
}
/* allocate the job */
return thunar_vfs_job_launch (thunar_vfs_listdir_job_new (uri));
}
/**
* thunar_vfs_copy:
* @source_uri_list : the list of #ThunarVfsURI<!---->s that should be copied.
* @target_uri : the #ThunarVfsURI of the target directory.
* @error : return location for errors or %NULL.
*
* Generates a #ThunarVfsTransferJob, which can be used to copy
* the files referenced by @source_uri_list to the directory referred
* to by @target_uri. If the creation of the job failes for some reason,
* %NULL will be returned and @error will be set to point to a #GError
* describing the cause. Else the newly allocated #ThunarVfsTransferJob
* will be returned and the caller is responsible to call
* #thunar_vfs_job_unref().
*
* Note, that the returned job is launched right away, so you don't
* need to call #thunar_vfs_job_launch() on it.
*
* Return value: the newly allocated #ThunarVfsTransferJob or %NULL
* if an error occurs while creating the job.
**/
ThunarVfsJob*
thunar_vfs_copy (GList *source_uri_list,
ThunarVfsURI *target_uri,
GError **error)
{
ThunarVfsJob *job;
g_return_val_if_fail (THUNAR_VFS_IS_URI (target_uri), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
/* allocate/launch the job */
job = thunar_vfs_transfer_job_new (source_uri_list, target_uri, FALSE, error);
if (G_LIKELY (job != NULL))
thunar_vfs_job_launch (job);
return job;