diff --git a/ChangeLog b/ChangeLog index 4fa15397e78a4af47b41090d0b6c3341d12c9e5d..8ac666bde02e35f3e338d87253b5b9b4b6defe9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +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. diff --git a/configure.in.in b/configure.in.in index a9ee669be0eaae55ee5e71f8244e5c310ccb8616..6629b591187b2aadc9eb0ce830a1bd41b2dcdc20 100644 --- a/configure.in.in +++ b/configure.in.in @@ -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 ]) diff --git a/tests/Makefile.am b/tests/Makefile.am index 09e2141fed814990860e2fdc802e27146af23696..a3105b326fca8af6cbb1c212595b9bc7ea40c041 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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.* diff --git a/thunar-vfs/Makefile.am b/thunar-vfs/Makefile.am index 09b40e8219a71e3f5848eadfbb929d8bcc72f012..d766648e717769482e3cd71c19d1974b251ef46f 100644 --- a/thunar-vfs/Makefile.am +++ b/thunar-vfs/Makefile.am @@ -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 diff --git a/thunar-vfs/abicheck.sh b/thunar-vfs/abicheck.sh new file mode 100755 index 0000000000000000000000000000000000000000..5c19443f2559349958562c24346b6607745b8d9d --- /dev/null +++ b/thunar-vfs/abicheck.sh @@ -0,0 +1,24 @@ +#!/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 diff --git a/thunar-vfs/make-thunar-vfs-alias.pl b/thunar-vfs/make-thunar-vfs-alias.pl new file mode 100755 index 0000000000000000000000000000000000000000..566ba6d665cbf14f51990a5ed0768c4801530476 --- /dev/null +++ b/thunar-vfs/make-thunar-vfs-alias.pl @@ -0,0 +1,155 @@ +#!/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 + + diff --git a/thunar-vfs/thunar-vfs-1.pc.in b/thunar-vfs/thunar-vfs-1.pc.in new file mode 100644 index 0000000000000000000000000000000000000000..fd0a3d04b42bd77e29f20f2add431d2eb38b143e --- /dev/null +++ b/thunar-vfs/thunar-vfs-1.pc.in @@ -0,0 +1,11 @@ +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@ diff --git a/thunar-vfs/thunar-vfs-info.c b/thunar-vfs/thunar-vfs-info.c index da5291e17ab70d6139ef6c721dd7273d97b8b01a..ad5e0640e5a529814df832c4ac128972200e7603 100644 --- a/thunar-vfs/thunar-vfs-info.c +++ b/thunar-vfs/thunar-vfs-info.c @@ -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> diff --git a/thunar-vfs/thunar-vfs-interactive-job.c b/thunar-vfs/thunar-vfs-interactive-job.c index e9be5ef84fc36a44c6494208ef151fc452339f47..eab2138b9711c735fcd6ff610258e7ba2b3f8dbc 100644 --- a/thunar-vfs/thunar-vfs-interactive-job.c +++ b/thunar-vfs/thunar-vfs-interactive-job.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> diff --git a/thunar-vfs/thunar-vfs-job.c b/thunar-vfs/thunar-vfs-job.c index 20137f1c9f2cbdbddf1aad0aca1a41444d8b5440..45135aac532a8981017b70442e52abdf39726972 100644 --- a/thunar-vfs/thunar-vfs-job.c +++ b/thunar-vfs/thunar-vfs-job.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> diff --git a/thunar-vfs/thunar-vfs-jobs.c b/thunar-vfs/thunar-vfs-jobs.c deleted file mode 100644 index 635abe278e7c5b085c47ee54d04aa1ffcda979ac..0000000000000000000000000000000000000000 --- a/thunar-vfs/thunar-vfs-jobs.c +++ /dev/null @@ -1,186 +0,0 @@ -/* $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; -} - - - -/** - * thunar_vfs_move: - * @source_uri_list : the list of #ThunarVfsURI<!---->s that should be moved. - * @target_uri : the #ThunarVfsURI of the target directory. - * @error : return location for errors or %NULL. - * - * Generates a #ThunarVfsTransferJob, which can be used to move - * 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_move (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, TRUE, error); - if (G_LIKELY (job != NULL)) - thunar_vfs_job_launch (job); - - return job; -} - - - -/** - * thunar_vfs_unlink: - * @uri_list : a list of #ThunarVfsURI<!---->s, that should be unlinked. - * @error : return location for errors or %NULL. - * - * Generates a #ThunarVfsInteractiveJob, which can be used to unlink - * all files referenced by the @uris. 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 #ThunarVfsUnlinkJob 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 #ThunarVfsUnlinkJob or %NULL - * if an error occurs while creating the job. - **/ -ThunarVfsJob* -thunar_vfs_unlink (GList *uri_list, - GError **error) -{ - ThunarVfsJob *job; - - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - - /* try to allocate the job */ - job = thunar_vfs_unlink_job_new (uri_list, error); - if (G_LIKELY (job != NULL)) - thunar_vfs_job_launch (job); - - return job; -} - - - diff --git a/thunar-vfs/thunar-vfs-jobs.h b/thunar-vfs/thunar-vfs-jobs.h deleted file mode 100644 index cd94e0cc79712baad0eabaf19435efb8d885f254..0000000000000000000000000000000000000000 --- a/thunar-vfs/thunar-vfs-jobs.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $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. - */ - -#ifndef __THUNAR_VFS_JOBS_H__ -#define __THUNAR_VFS_JOBS_H__ - -#include <thunar-vfs/thunar-vfs-job.h> - -G_BEGIN_DECLS; - -ThunarVfsJob *thunar_vfs_listdir (ThunarVfsURI *uri, - GError **error); - -ThunarVfsJob *thunar_vfs_copy (GList *source_uri_list, - ThunarVfsURI *target_uri, - GError **error); - -ThunarVfsJob *thunar_vfs_move (GList *source_uri_list, - ThunarVfsURI *target_uri, - GError **error); - -ThunarVfsJob *thunar_vfs_unlink (GList *uri_list, - GError **error); - -G_END_DECLS; - -#endif /* !__THUNAR_VFS_JOBS_H__ */ diff --git a/thunar-vfs/thunar-vfs-mime-application.c b/thunar-vfs/thunar-vfs-mime-application.c index 4bf15514aba59b2d98ce2102cbdb13e9167ffa4a..0f0da2b38959e41455e0d6c91154404502eea6d4 100644 --- a/thunar-vfs/thunar-vfs-mime-application.c +++ b/thunar-vfs/thunar-vfs-mime-application.c @@ -30,6 +30,7 @@ #endif #include <thunar-vfs/thunar-vfs-mime-application.h> +#include <thunar-vfs/thunar-vfs-alias.h> @@ -614,3 +615,7 @@ thunar_vfs_mime_application_equal (gconstpointer a, return (strcmp (THUNAR_VFS_MIME_APPLICATION (a)->desktop_id, THUNAR_VFS_MIME_APPLICATION (b)->desktop_id) == 0); } + + +#define __THUNAR_VFS_MIME_APPLICATION_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-mime-application.h b/thunar-vfs/thunar-vfs-mime-application.h index f5d7b2d0fe3d49266bf91cd1d2a4a5e0d7c31672..3784d8815a55e0a01330bc290400f0648e583b64 100644 --- a/thunar-vfs/thunar-vfs-mime-application.h +++ b/thunar-vfs/thunar-vfs-mime-application.h @@ -50,7 +50,7 @@ GType thunar_vfs_mime_application_get_type (void) #define thunar_vfs_mime_application_ref exo_object_ref #define thunar_vfs_mime_application_unref exo_object_unref -ThunarVfsMimeApplication *thunar_vfs_mime_application_new_from_desktop_id (const gchar *desktop_id) EXO_GNUC_MALLOC; +ThunarVfsMimeApplication *thunar_vfs_mime_application_new_from_desktop_id (const gchar *desktop_id) G_GNUC_MALLOC; const gchar *thunar_vfs_mime_application_get_desktop_id (const ThunarVfsMimeApplication *application); const gchar *thunar_vfs_mime_application_get_name (const ThunarVfsMimeApplication *application); diff --git a/thunar-vfs/thunar-vfs-mime-cache.h b/thunar-vfs/thunar-vfs-mime-cache.h index 0c68c519b3e42ceb7b0544f31a1b741c341e62bc..47f49b61147ee18b9552c6f1292efe51cdb8f133 100644 --- a/thunar-vfs/thunar-vfs-mime-cache.h +++ b/thunar-vfs/thunar-vfs-mime-cache.h @@ -37,7 +37,7 @@ typedef struct _ThunarVfsMimeCache ThunarVfsMimeCache; GType thunar_vfs_mime_cache_get_type (void) G_GNUC_CONST; -ThunarVfsMimeProvider *thunar_vfs_mime_cache_new (const gchar *directory) EXO_GNUC_MALLOC; +ThunarVfsMimeProvider *thunar_vfs_mime_cache_new (const gchar *directory) G_GNUC_MALLOC; G_END_DECLS; diff --git a/thunar-vfs/thunar-vfs-mime-database.c b/thunar-vfs/thunar-vfs-mime-database.c index 1d82d4539da46d6d5238d6d7dceba67fa9b86457..fb553fe29561878abd68d13b3a09a435681c7024 100644 --- a/thunar-vfs/thunar-vfs-mime-database.c +++ b/thunar-vfs/thunar-vfs-mime-database.c @@ -52,6 +52,7 @@ #include <thunar-vfs/thunar-vfs-mime-database.h> #include <thunar-vfs/thunar-vfs-mime-legacy.h> #include <thunar-vfs/thunar-vfs-monitor.h> +#include <thunar-vfs/thunar-vfs-alias.h> #if GLIB_CHECK_VERSION(2,6,0) #include <glib/gstdio.h> @@ -176,7 +177,7 @@ thunar_vfs_mime_database_init (ThunarVfsMimeDatabase *database) database->lock = g_mutex_new (); /* acquire a reference on the file alteration monitor */ - database->monitor = thunar_vfs_monitor_get (); + database->monitor = thunar_vfs_monitor_get_default (); /* allocate the hash table for the mime infos */ database->infos = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, exo_object_unref); @@ -808,7 +809,7 @@ thunar_vfs_mime_database_store_parse_file (ThunarVfsMimeDatabase *database, /** - * thunar_vfs_mime_database_get: + * thunar_vfs_mime_database_get_default: * * Returns a reference on the shared #ThunarVfsMimeDatabase * instance. The caller is responsible to call #exo_object_unref() @@ -817,7 +818,7 @@ thunar_vfs_mime_database_store_parse_file (ThunarVfsMimeDatabase *database, * Return value: the shared #ThunarVfsMimeDatabase. **/ ThunarVfsMimeDatabase* -thunar_vfs_mime_database_get (void) +thunar_vfs_mime_database_get_default (void) { if (G_UNLIKELY (thunar_vfs_mime_database_shared_instance == NULL)) thunar_vfs_mime_database_shared_instance = exo_object_new (THUNAR_VFS_TYPE_MIME_DATABASE); @@ -1213,3 +1214,6 @@ thunar_vfs_mime_database_get_default_application (ThunarVfsMimeDatabase *databas } + +#define __THUNAR_VFS_MIME_DATABASE_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-mime-database.h b/thunar-vfs/thunar-vfs-mime-database.h index efeb416a2ee7f3c378db59ec99dacff2f5994c8b..ec4d0aaae4d6e3d3a64819400bacc0ab585f5575 100644 --- a/thunar-vfs/thunar-vfs-mime-database.h +++ b/thunar-vfs/thunar-vfs-mime-database.h @@ -38,7 +38,7 @@ typedef struct _ThunarVfsMimeDatabase ThunarVfsMimeDatabase; GType thunar_vfs_mime_database_get_type (void) G_GNUC_CONST; -ThunarVfsMimeDatabase *thunar_vfs_mime_database_get (void); +ThunarVfsMimeDatabase *thunar_vfs_mime_database_get_default (void); ThunarVfsMimeInfo *thunar_vfs_mime_database_get_info (ThunarVfsMimeDatabase *database, const gchar *mime_type); diff --git a/thunar-vfs/thunar-vfs-mime-info.c b/thunar-vfs/thunar-vfs-mime-info.c index e70b862544381a701bd147f3434d3b0d8ac8f767..b8717e8f71e1886d42661ff658d462e6a33889e6 100644 --- a/thunar-vfs/thunar-vfs-mime-info.c +++ b/thunar-vfs/thunar-vfs-mime-info.c @@ -31,6 +31,7 @@ #include <thunar-vfs/thunar-vfs-mime-info.h> #include <thunar-vfs/thunar-vfs-mime-parser.h> +#include <thunar-vfs/thunar-vfs-alias.h> @@ -426,3 +427,5 @@ thunar_vfs_mime_info_list_free (GList *info_list) +#define __THUNAR_VFS_MIME_INFO_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-mime-legacy.h b/thunar-vfs/thunar-vfs-mime-legacy.h index bd5d4ceb11a2f8dfb7fb4a353df6a578eacbab98..9a4bd712b69ae95116ec4fa869684ee9fa61893f 100644 --- a/thunar-vfs/thunar-vfs-mime-legacy.h +++ b/thunar-vfs/thunar-vfs-mime-legacy.h @@ -37,7 +37,7 @@ typedef struct _ThunarVfsMimeLegacy ThunarVfsMimeLegacy; GType thunar_vfs_mime_legacy_get_type (void) G_GNUC_CONST; -ThunarVfsMimeProvider *thunar_vfs_mime_legacy_new (const gchar *directory) EXO_GNUC_MALLOC; +ThunarVfsMimeProvider *thunar_vfs_mime_legacy_new (const gchar *directory) G_GNUC_MALLOC; G_END_DECLS; diff --git a/thunar-vfs/thunar-vfs-mime.c b/thunar-vfs/thunar-vfs-mime.c index 4ffff4f128637a9f3cda073d98d1d72d5463b2d1..044754e634c69f43ec533665a361f3b1b8532824 100644 --- a/thunar-vfs/thunar-vfs-mime.c +++ b/thunar-vfs/thunar-vfs-mime.c @@ -42,7 +42,7 @@ _thunar_vfs_mime_init (void) { g_return_if_fail (mime_database == NULL); - mime_database = thunar_vfs_mime_database_get (); + mime_database = thunar_vfs_mime_database_get_default (); } diff --git a/thunar-vfs/thunar-vfs-monitor.c b/thunar-vfs/thunar-vfs-monitor.c index 49cd902034121c7f5490502c01d2b8cd48a3b414..54aea11869139827e7b2b7e441f376df4fe057a2 100644 --- a/thunar-vfs/thunar-vfs-monitor.c +++ b/thunar-vfs/thunar-vfs-monitor.c @@ -35,6 +35,7 @@ #include <gdk/gdk.h> #include <thunar-vfs/thunar-vfs-monitor.h> +#include <thunar-vfs/thunar-vfs-alias.h> @@ -282,7 +283,7 @@ error: /** - * thunar_vfs_monitor_get: + * thunar_vfs_monitor_get_default: * * Returns the shared #ThunarVfsMonitor instance. The caller * is responsible to call #g_object_unref() on the returned @@ -292,7 +293,7 @@ error: * instance. **/ ThunarVfsMonitor* -thunar_vfs_monitor_get (void) +thunar_vfs_monitor_get_default (void) { static ThunarVfsMonitor *monitor = NULL; @@ -530,4 +531,5 @@ thunar_vfs_monitor_feed (ThunarVfsMonitor *monitor, - +#define __THUNAR_VFS_MONITOR_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-monitor.h b/thunar-vfs/thunar-vfs-monitor.h index cf28f2f6f6da05c0ce38cebca0a3d74c5a78352b..676348256cbcc47912400c76a139ebc772c54808 100644 --- a/thunar-vfs/thunar-vfs-monitor.h +++ b/thunar-vfs/thunar-vfs-monitor.h @@ -80,7 +80,7 @@ typedef void (*ThunarVfsMonitorCallback) (ThunarVfsMonitor *monitor, GType thunar_vfs_monitor_get_type (void) G_GNUC_CONST; -ThunarVfsMonitor *thunar_vfs_monitor_get (void); +ThunarVfsMonitor *thunar_vfs_monitor_get_default (void); ThunarVfsMonitorHandle *thunar_vfs_monitor_add_directory (ThunarVfsMonitor *monitor, ThunarVfsURI *uri, diff --git a/thunar-vfs/thunar-vfs-trash.c b/thunar-vfs/thunar-vfs-trash.c index 8721ae4f9dfc7f79562d340f977774b72419625a..5b073d97c9c4d7b44f29640030602aaf09803a97 100644 --- a/thunar-vfs/thunar-vfs-trash.c +++ b/thunar-vfs/thunar-vfs-trash.c @@ -47,6 +47,7 @@ #include <exo/exo.h> #include <thunar-vfs/thunar-vfs-trash.h> +#include <thunar-vfs/thunar-vfs-alias.h> /* we use g_stat() if possible */ #if GLIB_CHECK_VERSION(2,6,0) @@ -928,3 +929,6 @@ thunar_vfs_trash_manager_resolve_uri (ThunarVfsTrashManager *manager, } + +#define __THUNAR_VFS_TRASH_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-trash.h b/thunar-vfs/thunar-vfs-trash.h index 38f7cdb4b2776ed874e7a049c9ef74df6bf8db93..035faa97318f0203115746bb3113f53a946cc203 100644 --- a/thunar-vfs/thunar-vfs-trash.h +++ b/thunar-vfs/thunar-vfs-trash.h @@ -30,7 +30,7 @@ typedef struct _ThunarVfsTrashInfo ThunarVfsTrashInfo; GType thunar_vfs_trash_info_get_type (void) G_GNUC_CONST; -ThunarVfsTrashInfo *thunar_vfs_trash_info_copy (const ThunarVfsTrashInfo *info); +ThunarVfsTrashInfo *thunar_vfs_trash_info_copy (const ThunarVfsTrashInfo *info) G_GNUC_MALLOC; void thunar_vfs_trash_info_free (ThunarVfsTrashInfo *info); const gchar *thunar_vfs_trash_info_get_path (const ThunarVfsTrashInfo *info); diff --git a/thunar-vfs/thunar-vfs-uri.c b/thunar-vfs/thunar-vfs-uri.c index 08d7cd34cdb6650b705cf2f57c32d09e84c5e0c5..327ce26bf5bac37d067afe2050bf2c7541b184f2 100644 --- a/thunar-vfs/thunar-vfs-uri.c +++ b/thunar-vfs/thunar-vfs-uri.c @@ -30,6 +30,7 @@ #endif #include <thunar-vfs/thunar-vfs-uri.h> +#include <thunar-vfs/thunar-vfs-alias.h> @@ -959,3 +960,5 @@ thunar_vfs_uri_list_free (GList *uri_list) +#define __THUNAR_VFS_URI_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-uri.h b/thunar-vfs/thunar-vfs-uri.h index 3fb02e9de9524d4c563dff986409efc592db85e7..bd1337b951ee682f3c1c27346a7c1a8e4be45eaf 100644 --- a/thunar-vfs/thunar-vfs-uri.h +++ b/thunar-vfs/thunar-vfs-uri.h @@ -73,8 +73,8 @@ gboolean thunar_vfs_uri_is_home (const ThunarVfsURI *uri gboolean thunar_vfs_uri_is_local (const ThunarVfsURI *uri); gboolean thunar_vfs_uri_is_root (const ThunarVfsURI *uri); -gchar *thunar_vfs_uri_get_display_name (const ThunarVfsURI *uri); -gchar *thunar_vfs_uri_get_md5sum (const ThunarVfsURI *uri); +gchar *thunar_vfs_uri_get_display_name (const ThunarVfsURI *uri) G_GNUC_MALLOC; +gchar *thunar_vfs_uri_get_md5sum (const ThunarVfsURI *uri) G_GNUC_MALLOC; const gchar *thunar_vfs_uri_get_host (const ThunarVfsURI *uri); const gchar *thunar_vfs_uri_get_name (const ThunarVfsURI *uri); const gchar *thunar_vfs_uri_get_path (const ThunarVfsURI *uri); @@ -85,7 +85,7 @@ ThunarVfsURI *thunar_vfs_uri_relative (const ThunarVfsURI *uri const gchar *name) G_GNUC_MALLOC; gchar *thunar_vfs_uri_to_string (const ThunarVfsURI *uri, - ThunarVfsURIHideOptions hide_options); + ThunarVfsURIHideOptions hide_options) G_GNUC_MALLOC; guint thunar_vfs_uri_hash (gconstpointer uri); gboolean thunar_vfs_uri_equal (gconstpointer a, @@ -114,10 +114,10 @@ gboolean thunar_vfs_uri_equal (gconstpointer a, GList *thunar_vfs_uri_list_from_string (const gchar *string, - GError **error); + GError **error) G_GNUC_MALLOC; gchar *thunar_vfs_uri_list_to_string (GList *uri_list, - ThunarVfsURIHideOptions hide_options); -GList *thunar_vfs_uri_list_copy (GList *uri_list); + ThunarVfsURIHideOptions hide_options) G_GNUC_MALLOC; +GList *thunar_vfs_uri_list_copy (GList *uri_list) G_GNUC_MALLOC; void thunar_vfs_uri_list_free (GList *uri_list); #define thunar_vfs_uri_list_append(uri_list, uri) \ diff --git a/thunar-vfs/thunar-vfs-user.c b/thunar-vfs/thunar-vfs-user.c index 52157d838d86d72c5e216889de6cdfbe8e6d5399..4e9f0a9f358b3d54ca6c367a2b95a4026e91e2af 100644 --- a/thunar-vfs/thunar-vfs-user.c +++ b/thunar-vfs/thunar-vfs-user.c @@ -46,6 +46,7 @@ #endif #include <thunar-vfs/thunar-vfs-user.h> +#include <thunar-vfs/thunar-vfs-alias.h> @@ -938,3 +939,8 @@ thunar_vfs_user_manager_get_user_by_id (ThunarVfsUserManager *manager, return user; } + + + +#define __THUNAR_VFS_USER_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-util.c b/thunar-vfs/thunar-vfs-util.c index 84e0c544ada9f0bc3c92c42c707687003f836bd8..9a240a4a2f1071af3df019ba9d75263ee54da02c 100644 --- a/thunar-vfs/thunar-vfs-util.c +++ b/thunar-vfs/thunar-vfs-util.c @@ -23,6 +23,7 @@ #endif #include <thunar-vfs/thunar-vfs-util.h> +#include <thunar-vfs/thunar-vfs-alias.h> @@ -56,3 +57,8 @@ thunar_vfs_humanize_size (ThunarVfsFileSize size, return buffer; } + + + +#define __THUNAR_VFS_UTIL_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-volume.c b/thunar-vfs/thunar-vfs-volume.c index 0904ed1d3ae4ba3e39a3b9c58579b9932e4acd49..1caad1b80cfc0d9afa8b91963d2afdf249bd7e1c 100644 --- a/thunar-vfs/thunar-vfs-volume.c +++ b/thunar-vfs/thunar-vfs-volume.c @@ -26,6 +26,7 @@ #include <thunar-vfs/thunar-vfs-enum-types.h> #include <thunar-vfs/thunar-vfs-volume.h> +#include <thunar-vfs/thunar-vfs-alias.h> @@ -593,3 +594,6 @@ thunar_vfs_volume_manager_volumes_removed (ThunarVfsVolumeManager *manager, } + +#define __THUNAR_VFS_VOLUME_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs.c b/thunar-vfs/thunar-vfs.c index ef0e3f5b41e15422c8a8ac43dee8fe9f4a55c345..942c568bf7146c0929b749dbc2647653345328c7 100644 --- a/thunar-vfs/thunar-vfs.c +++ b/thunar-vfs/thunar-vfs.c @@ -23,6 +23,11 @@ #endif #include <thunar-vfs/thunar-vfs.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> + +#include <thunar-vfs/thunar-vfs-alias.h> @@ -38,8 +43,8 @@ static gint thunar_vfs_ref_count = 0; void thunar_vfs_init (void) { - extern void _thunar_vfs_job_init (void); - extern void _thunar_vfs_mime_init (void); + extern void _thunar_vfs_job_init (); + extern void _thunar_vfs_mime_init (); if (g_atomic_int_exchange_and_add (&thunar_vfs_ref_count, 1) == 0) { @@ -58,8 +63,8 @@ thunar_vfs_init (void) void thunar_vfs_shutdown (void) { - extern void _thunar_vfs_job_shutdown (void); - extern void _thunar_vfs_mime_shutdown (void); + extern void _thunar_vfs_job_shutdown (); + extern void _thunar_vfs_mime_shutdown (); if (g_atomic_int_dec_and_test (&thunar_vfs_ref_count)) { @@ -70,3 +75,160 @@ thunar_vfs_shutdown (void) +/** + * 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; +} + + + +/** + * thunar_vfs_move: + * @source_uri_list : the list of #ThunarVfsURI<!---->s that should be moved. + * @target_uri : the #ThunarVfsURI of the target directory. + * @error : return location for errors or %NULL. + * + * Generates a #ThunarVfsTransferJob, which can be used to move + * 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_move (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, TRUE, error); + if (G_LIKELY (job != NULL)) + thunar_vfs_job_launch (job); + + return job; +} + + + +/** + * thunar_vfs_unlink: + * @uri_list : a list of #ThunarVfsURI<!---->s, that should be unlinked. + * @error : return location for errors or %NULL. + * + * Generates a #ThunarVfsInteractiveJob, which can be used to unlink + * all files referenced by the @uris. 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 #ThunarVfsUnlinkJob 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 #ThunarVfsUnlinkJob or %NULL + * if an error occurs while creating the job. + **/ +ThunarVfsJob* +thunar_vfs_unlink (GList *uri_list, + GError **error) +{ + ThunarVfsJob *job; + + g_return_val_if_fail (error == NULL || *error == NULL, NULL); + + /* try to allocate the job */ + job = thunar_vfs_unlink_job_new (uri_list, error); + if (G_LIKELY (job != NULL)) + thunar_vfs_job_launch (job); + + return job; +} + + + +#define __THUNAR_VFS_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs.h b/thunar-vfs/thunar-vfs.h index c2453d82a03657b32eb67846e516bcd551097cc8..c977b1532fcba08d7914363478361f18101ec937 100644 --- a/thunar-vfs/thunar-vfs.h +++ b/thunar-vfs/thunar-vfs.h @@ -25,7 +25,7 @@ #include <thunar-vfs/thunar-vfs-info.h> #include <thunar-vfs/thunar-vfs-interactive-job.h> #include <thunar-vfs/thunar-vfs-job.h> -#include <thunar-vfs/thunar-vfs-jobs.h> +#include <thunar-vfs/thunar-vfs-mime-application.h> #include <thunar-vfs/thunar-vfs-mime-database.h> #include <thunar-vfs/thunar-vfs-mime-info.h> #include <thunar-vfs/thunar-vfs-mime.h> @@ -38,8 +38,22 @@ G_BEGIN_DECLS; -void thunar_vfs_init (void); -void thunar_vfs_shutdown (void); +void thunar_vfs_init (void); +void thunar_vfs_shutdown (void); + +ThunarVfsJob *thunar_vfs_listdir (ThunarVfsURI *uri, + GError **error); + +ThunarVfsJob *thunar_vfs_copy (GList *source_uri_list, + ThunarVfsURI *target_uri, + GError **error); + +ThunarVfsJob *thunar_vfs_move (GList *source_uri_list, + ThunarVfsURI *target_uri, + GError **error); + +ThunarVfsJob *thunar_vfs_unlink (GList *uri_list, + GError **error); G_END_DECLS; diff --git a/thunar-vfs/thunar-vfs.symbols b/thunar-vfs/thunar-vfs.symbols new file mode 100644 index 0000000000000000000000000000000000000000..2129682517208f500779d27cb77d65861e99c718 --- /dev/null +++ b/thunar-vfs/thunar-vfs.symbols @@ -0,0 +1,245 @@ +/* $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. + */ + +/* This file lists all exported symbols. It is used to generate + * the gobject.def file used to control exports on Windows and the + * thunar-vfs-alias.h/thunar-vfs-aliasdef.c files used to avoid PLT + * entries for * internal uses of exported functions (see + * make-thunar-vfs-alias.pl). + * + * Every symbol must be included in the right + * #ifdef IN_HEADER(sym) #endif and + * #ifdef IN_SOURCE(sym) #endif sections. + */ + +#ifdef ALL_FILES +#define IN_SOURCE(x) 1 +#define IN_HEADER(x) 1 +#endif + +/* thunar-vfs functions */ +#if IN_HEADER(__THUNAR_VFS_H__) +#if IN_SOURCE(__THUNAR_VFS_C__) +thunar_vfs_init +thunar_vfs_shutdown +thunar_vfs_listdir +thunar_vfs_copy +thunar_vfs_move +thunar_vfs_unlink +#endif +#endif + +/* ThunarVfsInfo methods */ +#if IN_HEADER(__THUNAR_VFS_INFO_H__) +#if IN_SOURCE(__THUNAR_VFS_INFO_C__) +thunar_vfs_info_new_for_uri +thunar_vfs_info_ref +thunar_vfs_info_unref +thunar_vfs_info_matches +thunar_vfs_info_list_free +#endif +#endif + +/* thunar-vfs-enum-types functions */ +#if IN_HEADER(__THUNAR_VFS_ENUM_TYPES_H__) +#if IN_SOURCE(__THUNAR_VFS_ENUM_TYPES_C__) +thunar_vfs_file_flags_get_type G_GNUC_CONST +thunar_vfs_file_mode_get_type G_GNUC_CONST +thunar_vfs_file_type_get_type G_GNUC_CONST +thunar_vfs_interactive_job_response_get_type G_GNUC_CONST +thunar_vfs_mime_application_error_get_type G_GNUC_CONST +thunar_vfs_monitor_event_get_type G_GNUC_CONST +thunar_vfs_uri_hide_options_get_type G_GNUC_CONST +thunar_vfs_volume_kind_get_type G_GNUC_CONST +thunar_vfs_volume_status_get_type G_GNUC_CONST +#endif +#endif + +/* ThunarVfsInteractiveJob methods */ +#if IN_HEADER(__THUNAR_VFS_INTERACTIVE_JOB_H__) +#if IN_SOURCE(__THUNAR_VFS_INTERACTIVE_JOB_C__) +thunar_vfs_interactive_job_get_type G_GNUC_CONST +#endif +#endif + +/* ThunarVfsJob methods */ +#if IN_HEADER(__THUNAR_VFS_JOB_H__) +#if IN_SOURCE(__THUNAR_VFS_JOB_C__) +thunar_vfs_job_get_type G_GNUC_CONST +thunar_vfs_job_launch +thunar_vfs_job_cancel +thunar_vfs_job_cancelled +#endif +#endif + +/* ThunarVfsMimeApplication methods */ +#if IN_HEADER(__THUNAR_VFS_MIME_APPLICATION_H__) +#if IN_SOURCE(__THUNAR_VFS_MIME_APPLICATION_C__) +thunar_vfs_mime_application_error_quark G_GNUC_CONST +thunar_vfs_mime_application_get_type G_GNUC_CONST +thunar_vfs_mime_application_new_from_desktop_id +thunar_vfs_mime_application_get_desktop_id +thunar_vfs_mime_application_get_name +thunar_vfs_mime_application_exec +thunar_vfs_mime_application_exec_with_env +thunar_vfs_mime_application_lookup_icon_name +thunar_vfs_mime_application_hash +thunar_vfs_mime_application_equal +#endif +#endif + +/* ThunarVfsMimeDatabase methods */ +#if IN_HEADER(__THUNAR_VFS_MIME_DATABASE_H__) +#if IN_SOURCE(__THUNAR_VFS_MIME_DATABASE_C__) +thunar_vfs_mime_database_get_type G_GNUC_CONST +thunar_vfs_mime_database_get_default +thunar_vfs_mime_database_get_info +thunar_vfs_mime_database_get_info_for_data +thunar_vfs_mime_database_get_info_for_name +thunar_vfs_mime_database_get_info_for_file +thunar_vfs_mime_database_get_applications +thunar_vfs_mime_database_get_default_application +#endif +#endif + +/* ThunarVfsMimeInfo methods */ +#if IN_HEADER(__THUNAR_VFS_MIME_INFO_H__) +#if IN_SOURCE(__THUNAR_VFS_MIME_INFO_C__) +thunar_vfs_mime_info_get_type G_GNUC_CONST +thunar_vfs_mime_info_get_comment G_GNUC_PURE +thunar_vfs_mime_info_get_name G_GNUC_PURE +thunar_vfs_mime_info_get_media G_GNUC_PURE +thunar_vfs_mime_info_get_subtype G_GNUC_PURE +thunar_vfs_mime_info_hash +thunar_vfs_mime_info_equal +thunar_vfs_mime_info_lookup_icon_name +thunar_vfs_mime_info_list_free +#endif +#endif + +/* ThunarVfsMonitor methods */ +#if IN_HEADER(__THUNAR_VFS_MONITOR_H__) +#if IN_SOURCE(__THUNAR_VFS_MONITOR_C__) +thunar_vfs_monitor_get_type G_GNUC_CONST +thunar_vfs_monitor_get_default +thunar_vfs_monitor_add_directory +thunar_vfs_monitor_add_file +thunar_vfs_monitor_remove +thunar_vfs_monitor_feed +#endif +#endif + +/* ThunarVfsTrashInfo/ThunarVfsTrash/ThunarVfsTrashManager methods */ +#if IN_HEADER(__THUNAR_VFS_TRASH_H__) +#if IN_SOURCE(__THUNAR_VFS_TRASH_C__) +thunar_vfs_trash_info_get_type G_GNUC_CONST +thunar_vfs_trash_info_copy G_GNUC_MALLOC +thunar_vfs_trash_info_free +thunar_vfs_trash_info_get_path +thunar_vfs_trash_info_get_deletion_date +thunar_vfs_trash_get_type G_GNUC_CONST +thunar_vfs_trash_get_id +thunar_vfs_trash_get_files +thunar_vfs_trash_get_info +thunar_vfs_trash_get_info_path +thunar_vfs_trash_get_uri +thunar_vfs_trash_get_path +thunar_vfs_trash_manager_get_type G_GNUC_CONST +thunar_vfs_trash_manager_get_default +thunar_vfs_trash_manager_is_empty +thunar_vfs_trash_manager_get_trashes +thunar_vfs_trash_manager_resolve_uri +#endif +#endif + +/* ThunarVfsURI methods */ +#if IN_HEADER(__THUNAR_VFS_URI_H__) +#if IN_SOURCE(__THUNAR_VFS_URI_C__) +thunar_vfs_uri_get_type G_GNUC_CONST +thunar_vfs_uri_new G_GNUC_MALLOC +thunar_vfs_uri_new_for_path G_GNUC_MALLOC +thunar_vfs_uri_is_home +thunar_vfs_uri_is_local +thunar_vfs_uri_is_root +thunar_vfs_uri_get_display_name G_GNUC_MALLOC +thunar_vfs_uri_get_md5sum G_GNUC_MALLOC +thunar_vfs_uri_get_host +thunar_vfs_uri_get_name +thunar_vfs_uri_get_path +thunar_vfs_uri_get_scheme +thunar_vfs_uri_parent G_GNUC_MALLOC +thunar_vfs_uri_relative G_GNUC_MALLOC +thunar_vfs_uri_to_string G_GNUC_MALLOC +thunar_vfs_uri_hash +thunar_vfs_uri_equal +thunar_vfs_uri_list_from_string G_GNUC_MALLOC +thunar_vfs_uri_list_to_string G_GNUC_MALLOC +thunar_vfs_uri_list_copy G_GNUC_MALLOC +thunar_vfs_uri_list_free +#endif +#endif + +/* ThunarVfsGroup/ThunarVfsUser/ThunarVfsUserManager methods */ +#if IN_HEADER(__THUNAR_VFS_USER_H__) +#if IN_SOURCE(__THUNAR_VFS_USER_C__) +thunar_vfs_group_get_type G_GNUC_CONST +thunar_vfs_group_get_id +thunar_vfs_group_get_name +thunar_vfs_user_get_type G_GNUC_CONST +thunar_vfs_user_get_groups +thunar_vfs_user_get_primary_group +thunar_vfs_user_get_id +thunar_vfs_user_get_name +thunar_vfs_user_get_real_name +thunar_vfs_user_is_me +thunar_vfs_user_manager_get_type +thunar_vfs_user_manager_get_default +thunar_vfs_user_manager_get_group_by_id +thunar_vfs_user_manager_get_user_by_id +#endif +#endif + +/* thunar-vfs-util functions */ +#if IN_HEADER(__THUNAR_VFS_UTIL_H__) +#if IN_SOURCE(__THUNAR_VFS_UTIL_C__) +thunar_vfs_humanize_size +#endif +#endif + +/* ThunarVfsVolume/ThunarVfsVolumeManager methods */ +#if IN_HEADER(__THUNAR_VFS_VOLUME_H__) +#if IN_SOURCE(__THUNAR_VFS_VOLUME_C__) +thunar_vfs_volume_get_type G_GNUC_CONST +thunar_vfs_volume_get_kind +thunar_vfs_volume_get_name +thunar_vfs_volume_get_status +thunar_vfs_volume_get_mount_point +thunar_vfs_volume_is_mounted +thunar_vfs_volume_is_present +thunar_vfs_volume_is_removable +thunar_vfs_volume_get_free_space +thunar_vfs_volume_lookup_icon_name +thunar_vfs_volume_manager_get_type G_GNUC_CONST +thunar_vfs_volume_manager_get_default +thunar_vfs_volume_manager_get_volume_by_info +thunar_vfs_volume_manager_get_volumes +#endif +#endif + diff --git a/thunar/Makefile.am b/thunar/Makefile.am index 22026c8360a9125c239893938bf0ca0da681327c..aafaafaab71f04a45115de79b44d94bb62390f46 100644 --- a/thunar/Makefile.am +++ b/thunar/Makefile.am @@ -103,11 +103,11 @@ Thunar_LDFLAGS = \ $(GTHREAD_LIBS) Thunar_LDADD = \ - $(top_builddir)/thunar-vfs/libthunar-vfs.la \ + $(top_builddir)/thunar-vfs/libthunar-vfs-$(THUNAR_VERSION_API).la \ $(top_builddir)/thunarx/libthunarx.la Thunar_DEPENDENCIES = \ - $(top_builddir)/thunar-vfs/libthunar-vfs.la \ + $(top_builddir)/thunar-vfs/libthunar-vfs-$(THUNAR_VERSION_API).la \ $(top_builddir)/thunarx/libthunarx.la # install symlink to 'thunar' diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c index 1226680284419b4acd5a8f29e491899883cca7d6..a49f93e345d8918961215de1b17749f5abc9aeb0 100644 --- a/thunar/thunar-launcher.c +++ b/thunar/thunar-launcher.c @@ -346,7 +346,7 @@ thunar_launcher_open_files (ThunarLauncher *launcher, (GDestroyNotify) thunar_vfs_uri_list_free); /* take a reference on the mime database */ - database = thunar_vfs_mime_database_get (); + database = thunar_vfs_mime_database_get_default (); for (lp = files; lp != NULL; lp = lp->next) { diff --git a/thunar/thunar-local-file.c b/thunar/thunar-local-file.c index 7f32215e9abd674470fef94da6b47bf431f9ea5e..e446a7352c9875727e25ef4163dc19846857ad13 100644 --- a/thunar/thunar-local-file.c +++ b/thunar/thunar-local-file.c @@ -414,7 +414,7 @@ thunar_local_file_watch (ThunarFile *file) /* take a reference on the VFS monitor for this instance */ if (G_UNLIKELY (monitor == NULL)) { - monitor = thunar_vfs_monitor_get (); + monitor = thunar_vfs_monitor_get_default (); g_object_add_weak_pointer (G_OBJECT (monitor), (gpointer) &monitor); } else diff --git a/thunar/thunar-local-folder.c b/thunar/thunar-local-folder.c index 957a9dfba77b401f61453cbf4b899619888d7a66..04b8f4fda6ecabfc2ca3e194a01fa0d94a453170 100644 --- a/thunar/thunar-local-folder.c +++ b/thunar/thunar-local-folder.c @@ -136,7 +136,7 @@ thunar_local_folder_init (ThunarLocalFolder *local_folder) g_closure_sink (local_folder->file_destroy_closure); /* connect to the file alteration monitor */ - local_folder->monitor = thunar_vfs_monitor_get (); + local_folder->monitor = thunar_vfs_monitor_get_default (); } diff --git a/thunar/thunar-open-with-action.c b/thunar/thunar-open-with-action.c index 561c9ae5af2c6ab89cdc4853821221c7a92b3abe..913f86bfa3cd040780e32797b3590593a3cc902a 100644 --- a/thunar/thunar-open-with-action.c +++ b/thunar/thunar-open-with-action.c @@ -169,7 +169,7 @@ thunar_open_with_action_class_init (ThunarOpenWithActionClass *klass) static void thunar_open_with_action_init (ThunarOpenWithAction *open_with_action) { - open_with_action->mime_database = thunar_vfs_mime_database_get (); + open_with_action->mime_database = thunar_vfs_mime_database_get_default (); } diff --git a/thunar/thunar-trash-folder.c b/thunar/thunar-trash-folder.c index c872eacfae7789e4b3dd37a25c6d44b517b8bce4..ca45d2e8f0b147066861fdd555299501c0efc8a7 100644 --- a/thunar/thunar-trash-folder.c +++ b/thunar/thunar-trash-folder.c @@ -221,7 +221,14 @@ thunar_trash_folder_get_uri (ThunarFile *file) static ThunarVfsMimeInfo* thunar_trash_folder_get_mime_info (ThunarFile *file) { - return thunar_vfs_mime_info_get ("inode/directory"); + ThunarVfsMimeDatabase *database; + ThunarVfsMimeInfo *info; + + database = thunar_vfs_mime_database_get_default (); + info = thunar_vfs_mime_database_get_info (database, "inode/directory"); + exo_object_unref (EXO_OBJECT (database)); + + return info; }