From f05bcc640f666acf756e7501ceefe1ad3cbf7e64 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Tue, 27 Mar 2012 03:10:35 +0200 Subject: run migrate script --- COPYING | 2 +- Makefile.in | 6 +- README | 12 +- config.h.in | 12 +- configure | 140 ++-- configure.in | 52 +- data/Makefile.in | 6 +- data/emblems/Makefile.in | 6 +- data/icons/Makefile.in | 6 +- data/icons/hicolor/16x16/Makefile.in | 6 +- data/icons/hicolor/16x16/apps/Makefile.in | 6 +- data/icons/hicolor/22x22/Makefile.in | 6 +- data/icons/hicolor/22x22/apps/Makefile.in | 6 +- data/icons/hicolor/24x24/Makefile.in | 6 +- data/icons/hicolor/24x24/apps/Makefile.in | 6 +- data/icons/hicolor/256x256/Makefile.in | 6 +- data/icons/hicolor/256x256/apps/Makefile.in | 6 +- data/icons/hicolor/32x32/Makefile.in | 6 +- data/icons/hicolor/32x32/apps/Makefile.in | 6 +- data/icons/hicolor/48x48/Makefile.in | 6 +- data/icons/hicolor/48x48/apps/Makefile.in | 6 +- data/icons/hicolor/64x64/Makefile.in | 6 +- data/icons/hicolor/64x64/apps/Makefile.in | 6 +- data/icons/hicolor/Makefile.in | 6 +- dropbox.in | 8 +- src/Makefile.am | 26 +- src/Makefile.in | 174 ++--- src/async-io-coroutine.h | 8 +- src/caja-dropbox-hooks.c | 337 ++++++++++ src/caja-dropbox-hooks.h | 79 +++ src/caja-dropbox.c | 960 ++++++++++++++++++++++++++++ src/caja-dropbox.h | 69 ++ src/dropbox-client-util.c | 8 +- src/dropbox-client-util.h | 8 +- src/dropbox-client.c | 24 +- src/dropbox-client.h | 12 +- src/dropbox-command-client.c | 28 +- src/dropbox-command-client.h | 28 +- src/dropbox.c | 28 +- src/g-util.h | 8 +- src/nautilus-dropbox-hooks.c | 337 ---------- src/nautilus-dropbox-hooks.h | 79 --- src/nautilus-dropbox.c | 960 ---------------------------- src/nautilus-dropbox.h | 69 -- 44 files changed, 1791 insertions(+), 1791 deletions(-) create mode 100644 src/caja-dropbox-hooks.c create mode 100644 src/caja-dropbox-hooks.h create mode 100644 src/caja-dropbox.c create mode 100644 src/caja-dropbox.h delete mode 100644 src/nautilus-dropbox-hooks.c delete mode 100644 src/nautilus-dropbox-hooks.h delete mode 100644 src/nautilus-dropbox.c delete mode 100644 src/nautilus-dropbox.h diff --git a/COPYING b/COPYING index d6667bc..a169c38 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -nautilus-dropbox is copyright 2008-2011 Dropbox, Inc. +caja-dropbox is copyright 2008-2011 Dropbox, Inc. All images included in this package constitute data and are licensed under the Creative Commons Attribution-No Derivative Works 3.0 Unported License [1]. This diff --git a/Makefile.in b/Makefile.in index 6991151..867c204 100644 --- a/Makefile.in +++ b/Makefile.in @@ -171,9 +171,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/README b/README index 3e9fd87..f9f68df 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ Hi Friend! -This is *the* Dropbox extension for Nautilus!!! +This is *the* Dropbox extension for Caja!!! Now you can use your favorite sync, versioning, and backup software with GNU/Linux! Yes!! Radical!!! Gnarly!!!! @@ -10,18 +10,18 @@ Check us out at http://www.dropbox.com/ <3, Rian Hunter and the rest of the Dropbox Team -Building Dropbox Nautilus Extension From Source Tarball +Building Dropbox Caja Extension From Source Tarball -------------------------------------------------- You will need the following packages (or equivalent): -libnautilus-extension-dev +libcaja-extension-dev -In the nautilus-dropbox dir just do: +In the caja-dropbox dir just do: $ ./configure $ make $ sudo make install -After installing the package you must restart Nautilus. You can do that by issuing the following command (note: if you're running compiz, doing so may lock up your computer - log out and log back in instead): +After installing the package you must restart Caja. You can do that by issuing the following command (note: if you're running compiz, doing so may lock up your computer - log out and log back in instead): -$ killall nautilus +$ killall caja diff --git a/config.h.in b/config.h.in index eb68673..80ae2fd 100644 --- a/config.h.in +++ b/config.h.in @@ -34,14 +34,14 @@ */ #undef LT_OBJDIR -/* nautilus version major */ -#undef NAUTILUS_VERSION_MAJOR +/* caja version major */ +#undef CAJA_VERSION_MAJOR -/* nautilus version micro */ -#undef NAUTILUS_VERSION_MICRO +/* caja version micro */ +#undef CAJA_VERSION_MICRO -/* nautilus version minor */ -#undef NAUTILUS_VERSION_MINOR +/* caja version minor */ +#undef CAJA_VERSION_MINOR /* Name of package */ #undef PACKAGE diff --git a/configure b/configure index 8226d1d..2bc2368 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64 for nautilus-dropbox 0.7.1. +# Generated by GNU Autoconf 2.64 for caja-dropbox 0.7.1. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software @@ -693,10 +693,10 @@ MFLAGS= MAKEFLAGS= # Identity of this package. -PACKAGE_NAME='nautilus-dropbox' -PACKAGE_TARNAME='nautilus-dropbox' +PACKAGE_NAME='caja-dropbox' +PACKAGE_TARNAME='caja-dropbox' PACKAGE_VERSION='0.7.1' -PACKAGE_STRING='nautilus-dropbox 0.7.1' +PACKAGE_STRING='caja-dropbox 0.7.1' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -742,15 +742,15 @@ am__EXEEXT_TRUE LTLIBOBJS LIBOBJS EMBLEM_DIR -NAUTILUS_EXTENSION_DIR +CAJA_EXTENSION_DIR DEBUG_FALSE DEBUG_TRUE RST2MAN PYTHON GLIB_LIBS GLIB_CFLAGS -NAUTILUS_LIBS -NAUTILUS_CFLAGS +CAJA_LIBS +CAJA_CFLAGS PKG_CONFIG HAVE_PKGCONFIG CPP @@ -869,7 +869,7 @@ enable_fast_install with_gnu_ld enable_libtool_lock enable_debug -with_nautilus_extension_dir +with_caja_extension_dir ' ac_precious_vars='build_alias host_alias @@ -881,8 +881,8 @@ LIBS CPPFLAGS CPP PKG_CONFIG -NAUTILUS_CFLAGS -NAUTILUS_LIBS +CAJA_CFLAGS +CAJA_LIBS GLIB_CFLAGS GLIB_LIBS' @@ -1426,7 +1426,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures nautilus-dropbox 0.7.1 to adapt to many kinds of systems. +\`configure' configures caja-dropbox 0.7.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1475,7 +1475,7 @@ Fine tuning of the installation directories: --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root - [DATAROOTDIR/doc/nautilus-dropbox] + [DATAROOTDIR/doc/caja-dropbox] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1497,7 +1497,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of nautilus-dropbox 0.7.1:";; + short | recursive ) echo "Configuration of caja-dropbox 0.7.1:";; esac cat <<\_ACEOF @@ -1520,8 +1520,8 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-nautilus-extension-dir - specify the nautilus extension directory + --with-caja-extension-dir + specify the caja extension directory Some influential environment variables: CC C compiler command @@ -1533,10 +1533,10 @@ Some influential environment variables: you have headers in a nonstandard directory CPP C preprocessor PKG_CONFIG path to pkg-config utility - NAUTILUS_CFLAGS - C compiler flags for NAUTILUS, overriding pkg-config - NAUTILUS_LIBS - linker flags for NAUTILUS, overriding pkg-config + CAJA_CFLAGS + C compiler flags for CAJA, overriding pkg-config + CAJA_LIBS + linker flags for CAJA, overriding pkg-config GLIB_CFLAGS C compiler flags for GLIB, overriding pkg-config GLIB_LIBS linker flags for GLIB, overriding pkg-config @@ -1606,7 +1606,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -nautilus-dropbox configure 0.7.1 +caja-dropbox configure 0.7.1 generated by GNU Autoconf 2.64 Copyright (C) 2009 Free Software Foundation, Inc. @@ -1884,7 +1884,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by nautilus-dropbox $as_me 0.7.1, which was +It was created by caja-dropbox $as_me 0.7.1, which was generated by GNU Autoconf 2.64. Invocation command line was $ $0 $@ @@ -2692,7 +2692,7 @@ fi # Define the identity of the package. - PACKAGE=nautilus-dropbox + PACKAGE=caja-dropbox VERSION=0.7.1 @@ -2743,7 +2743,7 @@ ac_config_headers="$ac_config_headers config.h" #AC_PROG_INTLTOOL([0.29]) # Dependency checks -NAUTILUS_REQUIRED=2.16.0 +CAJA_REQUIRED=2.16.0 GLIB_REQUIRED=2.14.0 # Used programs @@ -10529,20 +10529,20 @@ $as_echo "no" >&6; } fi pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NAUTILUS" >&5 -$as_echo_n "checking for NAUTILUS... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CAJA" >&5 +$as_echo_n "checking for CAJA... " >&6; } if test -n "$PKG_CONFIG"; then - if test -n "$NAUTILUS_CFLAGS"; then - pkg_cv_NAUTILUS_CFLAGS="$NAUTILUS_CFLAGS" + if test -n "$CAJA_CFLAGS"; then + pkg_cv_CAJA_CFLAGS="$CAJA_CFLAGS" else if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnautilus-extension >= \$NAUTILUS_REQUIRED\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libnautilus-extension >= $NAUTILUS_REQUIRED") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcaja-extension >= \$CAJA_REQUIRED\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libcaja-extension >= $CAJA_REQUIRED") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_NAUTILUS_CFLAGS=`$PKG_CONFIG --cflags "libnautilus-extension >= $NAUTILUS_REQUIRED" 2>/dev/null` + pkg_cv_CAJA_CFLAGS=`$PKG_CONFIG --cflags "libcaja-extension >= $CAJA_REQUIRED" 2>/dev/null` else pkg_failed=yes fi @@ -10551,16 +10551,16 @@ else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then - if test -n "$NAUTILUS_LIBS"; then - pkg_cv_NAUTILUS_LIBS="$NAUTILUS_LIBS" + if test -n "$CAJA_LIBS"; then + pkg_cv_CAJA_LIBS="$CAJA_LIBS" else if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnautilus-extension >= \$NAUTILUS_REQUIRED\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libnautilus-extension >= $NAUTILUS_REQUIRED") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcaja-extension >= \$CAJA_REQUIRED\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libcaja-extension >= $CAJA_REQUIRED") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_NAUTILUS_LIBS=`$PKG_CONFIG --libs "libnautilus-extension >= $NAUTILUS_REQUIRED" 2>/dev/null` + pkg_cv_CAJA_LIBS=`$PKG_CONFIG --libs "libcaja-extension >= $CAJA_REQUIRED" 2>/dev/null` else pkg_failed=yes fi @@ -10579,22 +10579,22 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - NAUTILUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libnautilus-extension >= $NAUTILUS_REQUIRED"` + CAJA_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libcaja-extension >= $CAJA_REQUIRED"` else - NAUTILUS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libnautilus-extension >= $NAUTILUS_REQUIRED"` + CAJA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libcaja-extension >= $CAJA_REQUIRED"` fi # Put the nasty error message in config.log where it belongs - echo "$NAUTILUS_PKG_ERRORS" >&5 + echo "$CAJA_PKG_ERRORS" >&5 - as_fn_error "Package requirements (libnautilus-extension >= $NAUTILUS_REQUIRED) were not met: + as_fn_error "Package requirements (libcaja-extension >= $CAJA_REQUIRED) were not met: -$NAUTILUS_PKG_ERRORS +$CAJA_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -Alternatively, you may set the environment variables NAUTILUS_CFLAGS -and NAUTILUS_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables CAJA_CFLAGS +and CAJA_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " "$LINENO" 5 elif test $pkg_failed = untried; then @@ -10604,15 +10604,15 @@ as_fn_error "The pkg-config script could not be found or is too old. Make sure is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -Alternatively, you may set the environment variables NAUTILUS_CFLAGS -and NAUTILUS_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables CAJA_CFLAGS +and CAJA_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details." "$LINENO" 5; } else - NAUTILUS_CFLAGS=$pkg_cv_NAUTILUS_CFLAGS - NAUTILUS_LIBS=$pkg_cv_NAUTILUS_LIBS + CAJA_CFLAGS=$pkg_cv_CAJA_CFLAGS + CAJA_LIBS=$pkg_cv_CAJA_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } : @@ -10890,52 +10890,52 @@ fi -# Check whether --with-nautilus-extension-dir was given. -if test "${with_nautilus_extension_dir+set}" = set; then : - withval=$with_nautilus_extension_dir; +# Check whether --with-caja-extension-dir was given. +if test "${with_caja_extension_dir+set}" = set; then : + withval=$with_caja_extension_dir; fi -# Get nautilus extensions directory -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for nautilus extension directory" >&5 -$as_echo_n "checking for nautilus extension directory... " >&6; } -if test -n "$with_nautilus_extension_dir"; then - NAUTILUS_EXTENSION_DIR=$with_nautilus_extension_dir +# Get caja extensions directory +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for caja extension directory" >&5 +$as_echo_n "checking for caja extension directory... " >&6; } +if test -n "$with_caja_extension_dir"; then + CAJA_EXTENSION_DIR=$with_caja_extension_dir else - NAUTILUS_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extension` + CAJA_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libcaja-extension` fi -if test -z "$NAUTILUS_EXTENSION_DIR"; then - NAUTILUS_EXTENSION_DIR='${exec_prefix}/lib/nautilus/extension-1.0' +if test -z "$CAJA_EXTENSION_DIR"; then + CAJA_EXTENSION_DIR='${exec_prefix}/lib/caja/extension-1.0' fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${NAUTILUS_EXTENSION_DIR}" >&5 -$as_echo "${NAUTILUS_EXTENSION_DIR}" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CAJA_EXTENSION_DIR}" >&5 +$as_echo "${CAJA_EXTENSION_DIR}" >&6; } -NAUTILUS_VERSION=`$PKG_CONFIG --modversion libnautilus-extension` -if test -n "$NAUTILUS_VERSION"; then - NAUTILUS_VERSION_MAJOR=`echo -n $NAUTILUS_VERSION | cut -d . -f 1` - NAUTILUS_VERSION_MINOR=`echo -n $NAUTILUS_VERSION | cut -d . -f 2` - NAUTILUS_VERSION_MICRO=`echo -n $NAUTILUS_VERSION | cut -d . -f 3` +CAJA_VERSION=`$PKG_CONFIG --modversion libcaja-extension` +if test -n "$CAJA_VERSION"; then + CAJA_VERSION_MAJOR=`echo -n $CAJA_VERSION | cut -d . -f 1` + CAJA_VERSION_MINOR=`echo -n $CAJA_VERSION | cut -d . -f 2` + CAJA_VERSION_MICRO=`echo -n $CAJA_VERSION | cut -d . -f 3` fi cat >>confdefs.h <<_ACEOF -#define NAUTILUS_VERSION_MAJOR $NAUTILUS_VERSION_MAJOR +#define CAJA_VERSION_MAJOR $CAJA_VERSION_MAJOR _ACEOF cat >>confdefs.h <<_ACEOF -#define NAUTILUS_VERSION_MINOR $NAUTILUS_VERSION_MINOR +#define CAJA_VERSION_MINOR $CAJA_VERSION_MINOR _ACEOF cat >>confdefs.h <<_ACEOF -#define NAUTILUS_VERSION_MICRO $NAUTILUS_VERSION_MICRO +#define CAJA_VERSION_MICRO $CAJA_VERSION_MICRO _ACEOF -EMBLEM_DIR='${datadir}/nautilus-dropbox/emblems' +EMBLEM_DIR='${datadir}/caja-dropbox/emblems' ac_config_files="$ac_config_files Makefile src/Makefile data/Makefile data/icons/Makefile data/icons/hicolor/Makefile data/icons/hicolor/16x16/Makefile data/icons/hicolor/16x16/apps/Makefile data/icons/hicolor/22x22/Makefile data/icons/hicolor/22x22/apps/Makefile data/icons/hicolor/24x24/Makefile data/icons/hicolor/24x24/apps/Makefile data/icons/hicolor/32x32/Makefile data/icons/hicolor/32x32/apps/Makefile data/icons/hicolor/48x48/Makefile data/icons/hicolor/48x48/apps/Makefile data/icons/hicolor/64x64/Makefile data/icons/hicolor/64x64/apps/Makefile data/icons/hicolor/256x256/Makefile data/icons/hicolor/256x256/apps/Makefile data/emblems/Makefile" @@ -11466,7 +11466,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by nautilus-dropbox $as_me 0.7.1, which was +This file was extended by caja-dropbox $as_me 0.7.1, which was generated by GNU Autoconf 2.64. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11530,7 +11530,7 @@ Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -nautilus-dropbox config.status 0.7.1 +caja-dropbox config.status 0.7.1 configured by $0, generated by GNU Autoconf 2.64, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.in b/configure.in index eeaccea..b326a3d 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ # Initialization -AC_INIT([nautilus-dropbox],0.7.1) +AC_INIT([caja-dropbox],0.7.1) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) @@ -12,7 +12,7 @@ AM_CONFIG_HEADER(config.h) #AC_PROG_INTLTOOL([0.29]) # Dependency checks -NAUTILUS_REQUIRED=2.16.0 +CAJA_REQUIRED=2.16.0 GLIB_REQUIRED=2.14.0 # Used programs @@ -26,7 +26,7 @@ if test "x$HAVE_PKGCONFIG" = "xno"; then AC_MSG_ERROR(you need to have pkgconfig installed !) fi -PKG_CHECK_MODULES(NAUTILUS, libnautilus-extension >= $NAUTILUS_REQUIRED) +PKG_CHECK_MODULES(CAJA, libcaja-extension >= $CAJA_REQUIRED) PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED) AC_PATH_PROG([PYTHON], [python]) @@ -60,8 +60,8 @@ PYTHON_CHECK_MODULE(gobject, gobject) PYTHON_CHECK_MODULE(docutils, docutils) # Make dependency CFLAGS and LIBS available -AC_SUBST(NAUTILUS_CFLAGS) -AC_SUBST(NAUTILUS_LIBS) +AC_SUBST(CAJA_CFLAGS) +AC_SUBST(CAJA_LIBS) AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) @@ -75,36 +75,36 @@ no) debug=false ;; esac],[debug=false]) AM_CONDITIONAL([DEBUG], [test x$debug = xtrue]) -AC_ARG_WITH(nautilus-extension-dir, - [AS_HELP_STRING([--with-nautilus-extension-dir], - [specify the nautilus extension directory])]) +AC_ARG_WITH(caja-extension-dir, + [AS_HELP_STRING([--with-caja-extension-dir], + [specify the caja extension directory])]) -# Get nautilus extensions directory -AC_MSG_CHECKING([for nautilus extension directory]) -if test -n "$with_nautilus_extension_dir"; then - NAUTILUS_EXTENSION_DIR=$with_nautilus_extension_dir +# Get caja extensions directory +AC_MSG_CHECKING([for caja extension directory]) +if test -n "$with_caja_extension_dir"; then + CAJA_EXTENSION_DIR=$with_caja_extension_dir else - NAUTILUS_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extension` + CAJA_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libcaja-extension` fi -if test -z "$NAUTILUS_EXTENSION_DIR"; then - NAUTILUS_EXTENSION_DIR='${exec_prefix}/lib/nautilus/extension-1.0' +if test -z "$CAJA_EXTENSION_DIR"; then + CAJA_EXTENSION_DIR='${exec_prefix}/lib/caja/extension-1.0' fi -AC_MSG_RESULT([${NAUTILUS_EXTENSION_DIR}]) -AC_SUBST(NAUTILUS_EXTENSION_DIR) +AC_MSG_RESULT([${CAJA_EXTENSION_DIR}]) +AC_SUBST(CAJA_EXTENSION_DIR) -NAUTILUS_VERSION=`$PKG_CONFIG --modversion libnautilus-extension` -if test -n "$NAUTILUS_VERSION"; then - NAUTILUS_VERSION_MAJOR=`echo -n $NAUTILUS_VERSION | cut -d . -f 1` - NAUTILUS_VERSION_MINOR=`echo -n $NAUTILUS_VERSION | cut -d . -f 2` - NAUTILUS_VERSION_MICRO=`echo -n $NAUTILUS_VERSION | cut -d . -f 3` +CAJA_VERSION=`$PKG_CONFIG --modversion libcaja-extension` +if test -n "$CAJA_VERSION"; then + CAJA_VERSION_MAJOR=`echo -n $CAJA_VERSION | cut -d . -f 1` + CAJA_VERSION_MINOR=`echo -n $CAJA_VERSION | cut -d . -f 2` + CAJA_VERSION_MICRO=`echo -n $CAJA_VERSION | cut -d . -f 3` fi -AC_DEFINE_UNQUOTED(NAUTILUS_VERSION_MAJOR, [$NAUTILUS_VERSION_MAJOR], [ nautilus version major]) -AC_DEFINE_UNQUOTED(NAUTILUS_VERSION_MINOR, [$NAUTILUS_VERSION_MINOR], [ nautilus version minor]) -AC_DEFINE_UNQUOTED(NAUTILUS_VERSION_MICRO, [$NAUTILUS_VERSION_MICRO], [ nautilus version micro]) +AC_DEFINE_UNQUOTED(CAJA_VERSION_MAJOR, [$CAJA_VERSION_MAJOR], [ caja version major]) +AC_DEFINE_UNQUOTED(CAJA_VERSION_MINOR, [$CAJA_VERSION_MINOR], [ caja version minor]) +AC_DEFINE_UNQUOTED(CAJA_VERSION_MICRO, [$CAJA_VERSION_MICRO], [ caja version micro]) -EMBLEM_DIR='${datadir}/nautilus-dropbox/emblems' +EMBLEM_DIR='${datadir}/caja-dropbox/emblems' AC_SUBST(EMBLEM_DIR) AC_CONFIG_FILES([ diff --git a/data/Makefile.in b/data/Makefile.in index 2e302ed..458d43d 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -153,9 +153,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/emblems/Makefile.in b/data/emblems/Makefile.in index 48c2e8e..d08c0de 100644 --- a/data/emblems/Makefile.in +++ b/data/emblems/Makefile.in @@ -113,9 +113,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/Makefile.in b/data/icons/Makefile.in index 81c5c7f..178c5ef 100644 --- a/data/icons/Makefile.in +++ b/data/icons/Makefile.in @@ -129,9 +129,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/16x16/Makefile.in b/data/icons/hicolor/16x16/Makefile.in index 7d1ad28..b42b91b 100644 --- a/data/icons/hicolor/16x16/Makefile.in +++ b/data/icons/hicolor/16x16/Makefile.in @@ -129,9 +129,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/16x16/apps/Makefile.in b/data/icons/hicolor/16x16/apps/Makefile.in index 1b1ffc7..a311d04 100644 --- a/data/icons/hicolor/16x16/apps/Makefile.in +++ b/data/icons/hicolor/16x16/apps/Makefile.in @@ -113,9 +113,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/22x22/Makefile.in b/data/icons/hicolor/22x22/Makefile.in index 880a1e5..3d99f9e 100644 --- a/data/icons/hicolor/22x22/Makefile.in +++ b/data/icons/hicolor/22x22/Makefile.in @@ -129,9 +129,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/22x22/apps/Makefile.in b/data/icons/hicolor/22x22/apps/Makefile.in index 38e63c0..fcacfbd 100644 --- a/data/icons/hicolor/22x22/apps/Makefile.in +++ b/data/icons/hicolor/22x22/apps/Makefile.in @@ -113,9 +113,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/24x24/Makefile.in b/data/icons/hicolor/24x24/Makefile.in index 94507e0..e965768 100644 --- a/data/icons/hicolor/24x24/Makefile.in +++ b/data/icons/hicolor/24x24/Makefile.in @@ -129,9 +129,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/24x24/apps/Makefile.in b/data/icons/hicolor/24x24/apps/Makefile.in index b267f9f..ba7c717 100644 --- a/data/icons/hicolor/24x24/apps/Makefile.in +++ b/data/icons/hicolor/24x24/apps/Makefile.in @@ -113,9 +113,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/256x256/Makefile.in b/data/icons/hicolor/256x256/Makefile.in index 0b56b2c..a9a6496 100644 --- a/data/icons/hicolor/256x256/Makefile.in +++ b/data/icons/hicolor/256x256/Makefile.in @@ -129,9 +129,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/256x256/apps/Makefile.in b/data/icons/hicolor/256x256/apps/Makefile.in index 006c2e5..19626dd 100644 --- a/data/icons/hicolor/256x256/apps/Makefile.in +++ b/data/icons/hicolor/256x256/apps/Makefile.in @@ -113,9 +113,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/32x32/Makefile.in b/data/icons/hicolor/32x32/Makefile.in index fb33fb6..7d76928 100644 --- a/data/icons/hicolor/32x32/Makefile.in +++ b/data/icons/hicolor/32x32/Makefile.in @@ -129,9 +129,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/32x32/apps/Makefile.in b/data/icons/hicolor/32x32/apps/Makefile.in index 26d3c16..31889ac 100644 --- a/data/icons/hicolor/32x32/apps/Makefile.in +++ b/data/icons/hicolor/32x32/apps/Makefile.in @@ -113,9 +113,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/48x48/Makefile.in b/data/icons/hicolor/48x48/Makefile.in index d66807e..4a2dd63 100644 --- a/data/icons/hicolor/48x48/Makefile.in +++ b/data/icons/hicolor/48x48/Makefile.in @@ -129,9 +129,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/48x48/apps/Makefile.in b/data/icons/hicolor/48x48/apps/Makefile.in index 7611970..85783e6 100644 --- a/data/icons/hicolor/48x48/apps/Makefile.in +++ b/data/icons/hicolor/48x48/apps/Makefile.in @@ -113,9 +113,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/64x64/Makefile.in b/data/icons/hicolor/64x64/Makefile.in index 7ddcd19..2f7d475 100644 --- a/data/icons/hicolor/64x64/Makefile.in +++ b/data/icons/hicolor/64x64/Makefile.in @@ -129,9 +129,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/64x64/apps/Makefile.in b/data/icons/hicolor/64x64/apps/Makefile.in index bea5991..9777202 100644 --- a/data/icons/hicolor/64x64/apps/Makefile.in +++ b/data/icons/hicolor/64x64/apps/Makefile.in @@ -113,9 +113,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/data/icons/hicolor/Makefile.in b/data/icons/hicolor/Makefile.in index 5c66b46..532aa69 100644 --- a/data/icons/hicolor/Makefile.in +++ b/data/icons/hicolor/Makefile.in @@ -129,9 +129,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/dropbox.in b/dropbox.in index ee357ec..abf7e82 100755 --- a/dropbox.in +++ b/dropbox.in @@ -4,20 +4,20 @@ # # dropbox # Dropbox frontend script -# This file is part of nautilus-dropbox @PACKAGE_VERSION@. +# This file is part of caja-dropbox @PACKAGE_VERSION@. # -# nautilus-dropbox is free software: you can redistribute it and/or modify +# caja-dropbox is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# nautilus-dropbox is distributed in the hope that it will be useful, +# caja-dropbox 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 General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with nautilus-dropbox. If not, see . +# along with caja-dropbox. If not, see . # from __future__ import with_statement diff --git a/src/Makefile.am b/src/Makefile.am index 54fb06a..016ecb9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,30 +2,30 @@ INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir) -nautilus_extensiondir=$(NAUTILUS_EXTENSION_DIR) +caja_extensiondir=$(CAJA_EXTENSION_DIR) -nautilus_extension_LTLIBRARIES=libnautilus-dropbox.la +caja_extension_LTLIBRARIES=libcaja-dropbox.la -libnautilus_dropbox_la_CFLAGS = \ +libcaja_dropbox_la_CFLAGS = \ -DDATADIR=\"$(datadir)\" \ -DEMBLEMDIR=\"$(EMBLEM_DIR)\" \ -Wall \ $(WARN_CFLAGS) \ $(DISABLE_DEPRECATED_CFLAGS) \ - $(NAUTILUS_CFLAGS) \ + $(CAJA_CFLAGS) \ $(GLIB_CFLAGS) if DEBUG -libnautilus_dropbox_la_CFLAGS += -DND_DEBUG +libcaja_dropbox_la_CFLAGS += -DND_DEBUG else -libnautilus_dropbox_la_CFLAGS += -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS +libcaja_dropbox_la_CFLAGS += -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS endif -libnautilus_dropbox_la_SOURCES = \ - nautilus-dropbox.c \ - nautilus-dropbox.h \ - nautilus-dropbox-hooks.h \ - nautilus-dropbox-hooks.c \ +libcaja_dropbox_la_SOURCES = \ + caja-dropbox.c \ + caja-dropbox.h \ + caja-dropbox-hooks.h \ + caja-dropbox-hooks.c \ dropbox-command-client.h \ dropbox-command-client.c \ dropbox-client.c dropbox-client.h \ @@ -35,5 +35,5 @@ libnautilus_dropbox_la_SOURCES = \ dropbox-client-util.h \ dropbox.c -libnautilus_dropbox_la_LDFLAGS = -module -avoid-version -libnautilus_dropbox_la_LIBADD = $(NAUTILUS_LIBS) $(GLIB_LIBS) +libcaja_dropbox_la_LDFLAGS = -module -avoid-version +libcaja_dropbox_la_LIBADD = $(CAJA_LIBS) $(GLIB_LIBS) diff --git a/src/Makefile.in b/src/Makefile.in index 548e911..6813623 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -67,23 +67,23 @@ am__nobase_list = $(am__nobase_strip_setup); \ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(nautilus_extensiondir)" -LTLIBRARIES = $(nautilus_extension_LTLIBRARIES) +am__installdirs = "$(DESTDIR)$(caja_extensiondir)" +LTLIBRARIES = $(caja_extension_LTLIBRARIES) am__DEPENDENCIES_1 = -libnautilus_dropbox_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +libcaja_dropbox_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) -am_libnautilus_dropbox_la_OBJECTS = \ - libnautilus_dropbox_la-nautilus-dropbox.lo \ - libnautilus_dropbox_la-nautilus-dropbox-hooks.lo \ - libnautilus_dropbox_la-dropbox-command-client.lo \ - libnautilus_dropbox_la-dropbox-client.lo \ - libnautilus_dropbox_la-dropbox-client-util.lo \ - libnautilus_dropbox_la-dropbox.lo -libnautilus_dropbox_la_OBJECTS = $(am_libnautilus_dropbox_la_OBJECTS) -libnautilus_dropbox_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ +am_libcaja_dropbox_la_OBJECTS = \ + libcaja_dropbox_la-caja-dropbox.lo \ + libcaja_dropbox_la-caja-dropbox-hooks.lo \ + libcaja_dropbox_la-dropbox-command-client.lo \ + libcaja_dropbox_la-dropbox-client.lo \ + libcaja_dropbox_la-dropbox-client-util.lo \ + libcaja_dropbox_la-dropbox.lo +libcaja_dropbox_la_OBJECTS = $(am_libcaja_dropbox_la_OBJECTS) +libcaja_dropbox_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) \ - $(libnautilus_dropbox_la_LDFLAGS) $(LDFLAGS) -o $@ + $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) \ + $(libcaja_dropbox_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -97,8 +97,8 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(libnautilus_dropbox_la_SOURCES) -DIST_SOURCES = $(libnautilus_dropbox_la_SOURCES) +SOURCES = $(libcaja_dropbox_la_SOURCES) +DIST_SOURCES = $(libcaja_dropbox_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -145,9 +145,9 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NAUTILUS_CFLAGS = @NAUTILUS_CFLAGS@ -NAUTILUS_EXTENSION_DIR = @NAUTILUS_EXTENSION_DIR@ -NAUTILUS_LIBS = @NAUTILUS_LIBS@ +CAJA_CFLAGS = @CAJA_CFLAGS@ +CAJA_EXTENSION_DIR = @CAJA_EXTENSION_DIR@ +CAJA_LIBS = @CAJA_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -227,17 +227,17 @@ INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir) -nautilus_extensiondir = $(NAUTILUS_EXTENSION_DIR) -nautilus_extension_LTLIBRARIES = libnautilus-dropbox.la -libnautilus_dropbox_la_CFLAGS = -DDATADIR=\"$(datadir)\" \ +caja_extensiondir = $(CAJA_EXTENSION_DIR) +caja_extension_LTLIBRARIES = libcaja-dropbox.la +libcaja_dropbox_la_CFLAGS = -DDATADIR=\"$(datadir)\" \ -DEMBLEMDIR=\"$(EMBLEM_DIR)\" -Wall $(WARN_CFLAGS) \ - $(DISABLE_DEPRECATED_CFLAGS) $(NAUTILUS_CFLAGS) $(GLIB_CFLAGS) \ + $(DISABLE_DEPRECATED_CFLAGS) $(CAJA_CFLAGS) $(GLIB_CFLAGS) \ $(am__append_1) $(am__append_2) -libnautilus_dropbox_la_SOURCES = \ - nautilus-dropbox.c \ - nautilus-dropbox.h \ - nautilus-dropbox-hooks.h \ - nautilus-dropbox-hooks.c \ +libcaja_dropbox_la_SOURCES = \ + caja-dropbox.c \ + caja-dropbox.h \ + caja-dropbox-hooks.h \ + caja-dropbox-hooks.c \ dropbox-command-client.h \ dropbox-command-client.c \ dropbox-client.c dropbox-client.h \ @@ -247,8 +247,8 @@ libnautilus_dropbox_la_SOURCES = \ dropbox-client-util.h \ dropbox.c -libnautilus_dropbox_la_LDFLAGS = -module -avoid-version -libnautilus_dropbox_la_LIBADD = $(NAUTILUS_LIBS) $(GLIB_LIBS) +libcaja_dropbox_la_LDFLAGS = -module -avoid-version +libcaja_dropbox_la_LIBADD = $(CAJA_LIBS) $(GLIB_LIBS) all: all-am .SUFFIXES: @@ -283,39 +283,39 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -install-nautilus_extensionLTLIBRARIES: $(nautilus_extension_LTLIBRARIES) +install-caja_extensionLTLIBRARIES: $(caja_extension_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(nautilus_extensiondir)" || $(MKDIR_P) "$(DESTDIR)$(nautilus_extensiondir)" - @list='$(nautilus_extension_LTLIBRARIES)'; test -n "$(nautilus_extensiondir)" || list=; \ + test -z "$(caja_extensiondir)" || $(MKDIR_P) "$(DESTDIR)$(caja_extensiondir)" + @list='$(caja_extension_LTLIBRARIES)'; test -n "$(caja_extensiondir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(nautilus_extensiondir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(nautilus_extensiondir)"; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(caja_extensiondir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(caja_extensiondir)"; \ } -uninstall-nautilus_extensionLTLIBRARIES: +uninstall-caja_extensionLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(nautilus_extension_LTLIBRARIES)'; test -n "$(nautilus_extensiondir)" || list=; \ + @list='$(caja_extension_LTLIBRARIES)'; test -n "$(caja_extensiondir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(nautilus_extensiondir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(nautilus_extensiondir)/$$f"; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(caja_extensiondir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(caja_extensiondir)/$$f"; \ done -clean-nautilus_extensionLTLIBRARIES: - -test -z "$(nautilus_extension_LTLIBRARIES)" || rm -f $(nautilus_extension_LTLIBRARIES) - @list='$(nautilus_extension_LTLIBRARIES)'; for p in $$list; do \ +clean-caja_extensionLTLIBRARIES: + -test -z "$(caja_extension_LTLIBRARIES)" || rm -f $(caja_extension_LTLIBRARIES) + @list='$(caja_extension_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libnautilus-dropbox.la: $(libnautilus_dropbox_la_OBJECTS) $(libnautilus_dropbox_la_DEPENDENCIES) - $(libnautilus_dropbox_la_LINK) -rpath $(nautilus_extensiondir) $(libnautilus_dropbox_la_OBJECTS) $(libnautilus_dropbox_la_LIBADD) $(LIBS) +libcaja-dropbox.la: $(libcaja_dropbox_la_OBJECTS) $(libcaja_dropbox_la_DEPENDENCIES) + $(libcaja_dropbox_la_LINK) -rpath $(caja_extensiondir) $(libcaja_dropbox_la_OBJECTS) $(libcaja_dropbox_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -323,12 +323,12 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnautilus_dropbox_la-dropbox-client-util.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnautilus_dropbox_la-dropbox-client.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnautilus_dropbox_la-dropbox-command-client.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnautilus_dropbox_la-dropbox.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnautilus_dropbox_la-nautilus-dropbox-hooks.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnautilus_dropbox_la-nautilus-dropbox.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcaja_dropbox_la-dropbox-client-util.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcaja_dropbox_la-dropbox-client.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcaja_dropbox_la-dropbox-command-client.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcaja_dropbox_la-dropbox.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcaja_dropbox_la-caja-dropbox-hooks.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcaja_dropbox_la-caja-dropbox.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -351,47 +351,47 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< -libnautilus_dropbox_la-nautilus-dropbox.lo: nautilus-dropbox.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) -MT libnautilus_dropbox_la-nautilus-dropbox.lo -MD -MP -MF $(DEPDIR)/libnautilus_dropbox_la-nautilus-dropbox.Tpo -c -o libnautilus_dropbox_la-nautilus-dropbox.lo `test -f 'nautilus-dropbox.c' || echo '$(srcdir)/'`nautilus-dropbox.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnautilus_dropbox_la-nautilus-dropbox.Tpo $(DEPDIR)/libnautilus_dropbox_la-nautilus-dropbox.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nautilus-dropbox.c' object='libnautilus_dropbox_la-nautilus-dropbox.lo' libtool=yes @AMDEPBACKSLASH@ +libcaja_dropbox_la-caja-dropbox.lo: caja-dropbox.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) -MT libcaja_dropbox_la-caja-dropbox.lo -MD -MP -MF $(DEPDIR)/libcaja_dropbox_la-caja-dropbox.Tpo -c -o libcaja_dropbox_la-caja-dropbox.lo `test -f 'caja-dropbox.c' || echo '$(srcdir)/'`caja-dropbox.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcaja_dropbox_la-caja-dropbox.Tpo $(DEPDIR)/libcaja_dropbox_la-caja-dropbox.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='caja-dropbox.c' object='libcaja_dropbox_la-caja-dropbox.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) -c -o libnautilus_dropbox_la-nautilus-dropbox.lo `test -f 'nautilus-dropbox.c' || echo '$(srcdir)/'`nautilus-dropbox.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) -c -o libcaja_dropbox_la-caja-dropbox.lo `test -f 'caja-dropbox.c' || echo '$(srcdir)/'`caja-dropbox.c -libnautilus_dropbox_la-nautilus-dropbox-hooks.lo: nautilus-dropbox-hooks.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) -MT libnautilus_dropbox_la-nautilus-dropbox-hooks.lo -MD -MP -MF $(DEPDIR)/libnautilus_dropbox_la-nautilus-dropbox-hooks.Tpo -c -o libnautilus_dropbox_la-nautilus-dropbox-hooks.lo `test -f 'nautilus-dropbox-hooks.c' || echo '$(srcdir)/'`nautilus-dropbox-hooks.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnautilus_dropbox_la-nautilus-dropbox-hooks.Tpo $(DEPDIR)/libnautilus_dropbox_la-nautilus-dropbox-hooks.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nautilus-dropbox-hooks.c' object='libnautilus_dropbox_la-nautilus-dropbox-hooks.lo' libtool=yes @AMDEPBACKSLASH@ +libcaja_dropbox_la-caja-dropbox-hooks.lo: caja-dropbox-hooks.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) -MT libcaja_dropbox_la-caja-dropbox-hooks.lo -MD -MP -MF $(DEPDIR)/libcaja_dropbox_la-caja-dropbox-hooks.Tpo -c -o libcaja_dropbox_la-caja-dropbox-hooks.lo `test -f 'caja-dropbox-hooks.c' || echo '$(srcdir)/'`caja-dropbox-hooks.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcaja_dropbox_la-caja-dropbox-hooks.Tpo $(DEPDIR)/libcaja_dropbox_la-caja-dropbox-hooks.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='caja-dropbox-hooks.c' object='libcaja_dropbox_la-caja-dropbox-hooks.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) -c -o libnautilus_dropbox_la-nautilus-dropbox-hooks.lo `test -f 'nautilus-dropbox-hooks.c' || echo '$(srcdir)/'`nautilus-dropbox-hooks.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) -c -o libcaja_dropbox_la-caja-dropbox-hooks.lo `test -f 'caja-dropbox-hooks.c' || echo '$(srcdir)/'`caja-dropbox-hooks.c -libnautilus_dropbox_la-dropbox-command-client.lo: dropbox-command-client.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) -MT libnautilus_dropbox_la-dropbox-command-client.lo -MD -MP -MF $(DEPDIR)/libnautilus_dropbox_la-dropbox-command-client.Tpo -c -o libnautilus_dropbox_la-dropbox-command-client.lo `test -f 'dropbox-command-client.c' || echo '$(srcdir)/'`dropbox-command-client.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnautilus_dropbox_la-dropbox-command-client.Tpo $(DEPDIR)/libnautilus_dropbox_la-dropbox-command-client.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dropbox-command-client.c' object='libnautilus_dropbox_la-dropbox-command-client.lo' libtool=yes @AMDEPBACKSLASH@ +libcaja_dropbox_la-dropbox-command-client.lo: dropbox-command-client.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) -MT libcaja_dropbox_la-dropbox-command-client.lo -MD -MP -MF $(DEPDIR)/libcaja_dropbox_la-dropbox-command-client.Tpo -c -o libcaja_dropbox_la-dropbox-command-client.lo `test -f 'dropbox-command-client.c' || echo '$(srcdir)/'`dropbox-command-client.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcaja_dropbox_la-dropbox-command-client.Tpo $(DEPDIR)/libcaja_dropbox_la-dropbox-command-client.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dropbox-command-client.c' object='libcaja_dropbox_la-dropbox-command-client.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) -c -o libnautilus_dropbox_la-dropbox-command-client.lo `test -f 'dropbox-command-client.c' || echo '$(srcdir)/'`dropbox-command-client.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) -c -o libcaja_dropbox_la-dropbox-command-client.lo `test -f 'dropbox-command-client.c' || echo '$(srcdir)/'`dropbox-command-client.c -libnautilus_dropbox_la-dropbox-client.lo: dropbox-client.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) -MT libnautilus_dropbox_la-dropbox-client.lo -MD -MP -MF $(DEPDIR)/libnautilus_dropbox_la-dropbox-client.Tpo -c -o libnautilus_dropbox_la-dropbox-client.lo `test -f 'dropbox-client.c' || echo '$(srcdir)/'`dropbox-client.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnautilus_dropbox_la-dropbox-client.Tpo $(DEPDIR)/libnautilus_dropbox_la-dropbox-client.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dropbox-client.c' object='libnautilus_dropbox_la-dropbox-client.lo' libtool=yes @AMDEPBACKSLASH@ +libcaja_dropbox_la-dropbox-client.lo: dropbox-client.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) -MT libcaja_dropbox_la-dropbox-client.lo -MD -MP -MF $(DEPDIR)/libcaja_dropbox_la-dropbox-client.Tpo -c -o libcaja_dropbox_la-dropbox-client.lo `test -f 'dropbox-client.c' || echo '$(srcdir)/'`dropbox-client.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcaja_dropbox_la-dropbox-client.Tpo $(DEPDIR)/libcaja_dropbox_la-dropbox-client.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dropbox-client.c' object='libcaja_dropbox_la-dropbox-client.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) -c -o libnautilus_dropbox_la-dropbox-client.lo `test -f 'dropbox-client.c' || echo '$(srcdir)/'`dropbox-client.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) -c -o libcaja_dropbox_la-dropbox-client.lo `test -f 'dropbox-client.c' || echo '$(srcdir)/'`dropbox-client.c -libnautilus_dropbox_la-dropbox-client-util.lo: dropbox-client-util.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) -MT libnautilus_dropbox_la-dropbox-client-util.lo -MD -MP -MF $(DEPDIR)/libnautilus_dropbox_la-dropbox-client-util.Tpo -c -o libnautilus_dropbox_la-dropbox-client-util.lo `test -f 'dropbox-client-util.c' || echo '$(srcdir)/'`dropbox-client-util.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnautilus_dropbox_la-dropbox-client-util.Tpo $(DEPDIR)/libnautilus_dropbox_la-dropbox-client-util.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dropbox-client-util.c' object='libnautilus_dropbox_la-dropbox-client-util.lo' libtool=yes @AMDEPBACKSLASH@ +libcaja_dropbox_la-dropbox-client-util.lo: dropbox-client-util.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) -MT libcaja_dropbox_la-dropbox-client-util.lo -MD -MP -MF $(DEPDIR)/libcaja_dropbox_la-dropbox-client-util.Tpo -c -o libcaja_dropbox_la-dropbox-client-util.lo `test -f 'dropbox-client-util.c' || echo '$(srcdir)/'`dropbox-client-util.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcaja_dropbox_la-dropbox-client-util.Tpo $(DEPDIR)/libcaja_dropbox_la-dropbox-client-util.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dropbox-client-util.c' object='libcaja_dropbox_la-dropbox-client-util.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) -c -o libnautilus_dropbox_la-dropbox-client-util.lo `test -f 'dropbox-client-util.c' || echo '$(srcdir)/'`dropbox-client-util.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) -c -o libcaja_dropbox_la-dropbox-client-util.lo `test -f 'dropbox-client-util.c' || echo '$(srcdir)/'`dropbox-client-util.c -libnautilus_dropbox_la-dropbox.lo: dropbox.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) -MT libnautilus_dropbox_la-dropbox.lo -MD -MP -MF $(DEPDIR)/libnautilus_dropbox_la-dropbox.Tpo -c -o libnautilus_dropbox_la-dropbox.lo `test -f 'dropbox.c' || echo '$(srcdir)/'`dropbox.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnautilus_dropbox_la-dropbox.Tpo $(DEPDIR)/libnautilus_dropbox_la-dropbox.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dropbox.c' object='libnautilus_dropbox_la-dropbox.lo' libtool=yes @AMDEPBACKSLASH@ +libcaja_dropbox_la-dropbox.lo: dropbox.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) -MT libcaja_dropbox_la-dropbox.lo -MD -MP -MF $(DEPDIR)/libcaja_dropbox_la-dropbox.Tpo -c -o libcaja_dropbox_la-dropbox.lo `test -f 'dropbox.c' || echo '$(srcdir)/'`dropbox.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcaja_dropbox_la-dropbox.Tpo $(DEPDIR)/libcaja_dropbox_la-dropbox.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dropbox.c' object='libcaja_dropbox_la-dropbox.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnautilus_dropbox_la_CFLAGS) $(CFLAGS) -c -o libnautilus_dropbox_la-dropbox.lo `test -f 'dropbox.c' || echo '$(srcdir)/'`dropbox.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcaja_dropbox_la_CFLAGS) $(CFLAGS) -c -o libcaja_dropbox_la-dropbox.lo `test -f 'dropbox.c' || echo '$(srcdir)/'`dropbox.c mostlyclean-libtool: -rm -f *.lo @@ -485,7 +485,7 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: - for dir in "$(DESTDIR)$(nautilus_extensiondir)"; do \ + for dir in "$(DESTDIR)$(caja_extensiondir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -516,7 +516,7 @@ maintainer-clean-generic: clean: clean-am clean-am: clean-generic clean-libtool \ - clean-nautilus_extensionLTLIBRARIES mostlyclean-am + clean-caja_extensionLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -536,7 +536,7 @@ info: info-am info-am: -install-data-am: install-nautilus_extensionLTLIBRARIES +install-data-am: install-caja_extensionLTLIBRARIES install-dvi: install-dvi-am @@ -582,25 +582,25 @@ ps: ps-am ps-am: -uninstall-am: uninstall-nautilus_extensionLTLIBRARIES +uninstall-am: uninstall-caja_extensionLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-nautilus_extensionLTLIBRARIES ctags \ + clean-libtool clean-caja_extensionLTLIBRARIES ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man \ - install-nautilus_extensionLTLIBRARIES install-pdf \ + install-caja_extensionLTLIBRARIES install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am \ - uninstall-nautilus_extensionLTLIBRARIES + uninstall-caja_extensionLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/src/async-io-coroutine.h b/src/async-io-coroutine.h index 125d84e..3e27bf4 100644 --- a/src/async-io-coroutine.h +++ b/src/async-io-coroutine.h @@ -4,20 +4,20 @@ * async-io-coroutine.h * Macros to simplify writing coroutines for the glib main loop. * - * This file is part of nautilus-dropbox. + * This file is part of caja-dropbox. * - * nautilus-dropbox is free software: you can redistribute it and/or modify + * caja-dropbox is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * nautilus-dropbox is distributed in the hope that it will be useful, + * caja-dropbox 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 General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . + * along with caja-dropbox. If not, see . * */ diff --git a/src/caja-dropbox-hooks.c b/src/caja-dropbox-hooks.c new file mode 100644 index 0000000..86cb07d --- /dev/null +++ b/src/caja-dropbox-hooks.c @@ -0,0 +1,337 @@ +/* + * Copyright 2008 Evenflow, Inc. + * + * caja-dropbox-hooks.c + * Implements connection handling and C interface for the Dropbox hook socket. + * + * This file is part of caja-dropbox. + * + * caja-dropbox is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * caja-dropbox 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with caja-dropbox. If not, see . + * + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "g-util.h" +#include "async-io-coroutine.h" +#include "dropbox-client-util.h" +#include "caja-dropbox-hooks.h" + +typedef struct { + DropboxUpdateHook hook; + gpointer ud; +} HookData; + +static gboolean +try_to_connect(CajaDropboxHookserv *hookserv); + +static gboolean +handle_hook_server_input(GIOChannel *chan, + GIOCondition cond, + CajaDropboxHookserv *hookserv) { + /*debug_enter(); */ + + /* we have some sweet macros defined that allow us to write this + async event handler like a microthread yeahh, watch out for context */ + CRBEGIN(hookserv->hhsi.line); + while (1) { + hookserv->hhsi.command_args = + g_hash_table_new_full((GHashFunc) g_str_hash, + (GEqualFunc) g_str_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) g_strfreev); + hookserv->hhsi.numargs = 0; + + /* read the command name */ + { + gchar *line; + CRREADLINE(hookserv->hhsi.line, chan, line); + hookserv->hhsi.command_name = dropbox_client_util_desanitize(line); + g_free(line); + } + + /*debug("got a hook name: %s", hookserv->hhsi.command_name); */ + + /* now read each arg line (until a certain limit) until we receive "done" */ + while (1) { + gchar *line; + + /* if too many arguments, this connection seems malicious */ + if (hookserv->hhsi.numargs >= 20) { + CRHALT; + } + + CRREADLINE(hookserv->hhsi.line, chan, line); + + if (strcmp("done", line) == 0) { + g_free(line); + break; + } + else { + gboolean parse_result; + + parse_result = + dropbox_client_util_command_parse_arg(line, + hookserv->hhsi.command_args); + g_free(line); + + if (FALSE == parse_result) { + debug("bad parse"); + CRHALT; + } + } + + hookserv->hhsi.numargs += 1; + } + + { + HookData *hd; + hd = (HookData *) + g_hash_table_lookup(hookserv->dispatch_table, + hookserv->hhsi.command_name); + if (hd != NULL) { + (hd->hook)(hookserv->hhsi.command_args, hd->ud); + } + } + + g_free(hookserv->hhsi.command_name); + g_hash_table_unref(hookserv->hhsi.command_args); + hookserv->hhsi.command_name = NULL; + hookserv->hhsi.command_args = NULL; + } + CREND; +} + +static void +watch_killer(CajaDropboxHookserv *hookserv) { + debug("hook client disconnected"); + + hookserv->connected = FALSE; + + g_hook_list_invoke(&(hookserv->ondisconnect_hooklist), FALSE); + + /* we basically just have to free the memory allocated in the + handle_hook_server_init ctx */ + if (hookserv->hhsi.command_name != NULL) { + g_free(hookserv->hhsi.command_name); + hookserv->hhsi.command_name = NULL; + } + + if (hookserv->hhsi.command_args != NULL) { + g_hash_table_unref(hookserv->hhsi.command_args); + hookserv->hhsi.command_args = NULL; + } + + g_io_channel_unref(hookserv->chan); + hookserv->chan = NULL; + hookserv->event_source = 0; + hookserv->socket = 0; + + /* lol we also have to start a new connection */ + try_to_connect(hookserv); +} + +static gboolean +try_to_connect(CajaDropboxHookserv *hookserv) { + /* create socket */ + hookserv->socket = socket(PF_UNIX, SOCK_STREAM, 0); + + /* set native non-blocking, for connect timeout */ + { + unsigned int flags; + + if ((flags = fcntl(hookserv->socket, F_GETFL, 0)) < 0) { + goto FAIL_CLEANUP; + } + + if (fcntl(hookserv->socket, F_SETFL, flags | O_NONBLOCK) < 0) { + goto FAIL_CLEANUP; + } + } + + /* connect to server, might fail of course */ + { + struct sockaddr_un addr; + socklen_t addr_len; + + /* intialize address structure */ + addr.sun_family = AF_UNIX; + g_snprintf(addr.sun_path, + sizeof(addr.sun_path), + "%s/.dropbox/iface_socket", + g_get_home_dir()); + addr_len = sizeof(addr) - sizeof(addr.sun_path) + strlen(addr.sun_path); + + /* if there was an error we have to try again later */ + if (connect(hookserv->socket, (struct sockaddr *) &addr, addr_len) < 0) { + if (errno == EINPROGRESS) { + fd_set writers; + struct timeval tv = {1, 0}; + FD_ZERO(&writers); + FD_SET(hookserv->socket, &writers); + + /* if nothing was ready after 3 seconds, fail out homie */ + if (select(hookserv->socket+1, NULL, &writers, NULL, &tv) == 0) { + goto FAIL_CLEANUP; + } + + if (connect(hookserv->socket, (struct sockaddr *) &addr, addr_len) < 0) { + debug("couldn't connect to hook server after 1 second"); + goto FAIL_CLEANUP; + } + } + else { + goto FAIL_CLEANUP; + } + } + } + + /* lol sometimes i write funny codez */ + if (FALSE) { + FAIL_CLEANUP: + close(hookserv->socket); + g_timeout_add_seconds(1, (GSourceFunc) try_to_connect, hookserv); + return FALSE; + } + + /* great we connected!, let's create the channel and wait on it */ + hookserv->chan = g_io_channel_unix_new(hookserv->socket); + g_io_channel_set_line_term(hookserv->chan, "\n", -1); + g_io_channel_set_close_on_unref(hookserv->chan, TRUE); + + /*debug("create channel"); */ + + /* Set non-blocking ;) (again just in case) */ + { + GIOFlags flags; + GIOStatus iostat; + + flags = g_io_channel_get_flags(hookserv->chan); + iostat = g_io_channel_set_flags(hookserv->chan, flags | G_IO_FLAG_NONBLOCK, + NULL); + if (iostat == G_IO_STATUS_ERROR) { + g_io_channel_unref(hookserv->chan); + g_timeout_add_seconds(1, (GSourceFunc) try_to_connect, hookserv); + return FALSE; + } + } + + /*debug("set non blocking"); */ + + /* this is fun, async io watcher */ + hookserv->hhsi.line = 0; + hookserv->hhsi.command_args = NULL; + hookserv->hhsi.command_name = NULL; + hookserv->event_source = + g_io_add_watch_full(hookserv->chan, G_PRIORITY_DEFAULT, + G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP | G_IO_NVAL, + (GIOFunc) handle_hook_server_input, hookserv, + (GDestroyNotify) watch_killer); + + debug("hook client connected"); + hookserv->connected = TRUE; + g_hook_list_invoke(&(hookserv->onconnect_hooklist), FALSE); + + /*debug("added watch");*/ + return FALSE; +} + +/* should only be called in glib main loop */ +/* returns a gboolean because it is a GSourceFunc */ +gboolean caja_dropbox_hooks_force_reconnect(CajaDropboxHookserv *hookserv) { + debug_enter(); + + if (hookserv->connected == FALSE) { + return FALSE; + } + + debug("forcing hook to reconnect"); + + g_assert(hookserv->event_source >= 0); + + if (hookserv->event_source > 0) { + g_source_remove(hookserv->event_source); + } + else if (hookserv->event_source == 0) { + debug("event source was zero!!!!!"); + } + + return FALSE; +} + +gboolean +caja_dropbox_hooks_is_connected(CajaDropboxHookserv *hookserv) { + return hookserv->connected; +} + +void +caja_dropbox_hooks_setup(CajaDropboxHookserv *hookserv) { + hookserv->dispatch_table = g_hash_table_new_full((GHashFunc) g_str_hash, + (GEqualFunc) g_str_equal, + g_free, g_free); + hookserv->connected = FALSE; + + g_hook_list_init(&(hookserv->ondisconnect_hooklist), sizeof(GHook)); + g_hook_list_init(&(hookserv->onconnect_hooklist), sizeof(GHook)); +} + +void +caja_dropbox_hooks_add_on_disconnect_hook(CajaDropboxHookserv *hookserv, + DropboxHookClientConnectHook dhcch, + gpointer ud) { + GHook *newhook; + + newhook = g_hook_alloc(&(hookserv->ondisconnect_hooklist)); + newhook->func = dhcch; + newhook->data = ud; + + g_hook_append(&(hookserv->ondisconnect_hooklist), newhook); +} + +void +caja_dropbox_hooks_add_on_connect_hook(CajaDropboxHookserv *hookserv, + DropboxHookClientConnectHook dhcch, + gpointer ud) { + GHook *newhook; + + newhook = g_hook_alloc(&(hookserv->onconnect_hooklist)); + newhook->func = dhcch; + newhook->data = ud; + + g_hook_append(&(hookserv->onconnect_hooklist), newhook); +} + +void caja_dropbox_hooks_add(CajaDropboxHookserv *ndhs, + const gchar *hook_name, + DropboxUpdateHook hook, gpointer ud) { + HookData *hd; + hd = g_new(HookData, 1); + hd->hook = hook; + hd->ud = ud; + g_hash_table_insert(ndhs->dispatch_table, g_strdup(hook_name), hd); +} + +void +caja_dropbox_hooks_start(CajaDropboxHookserv *hookserv) { + try_to_connect(hookserv); +} diff --git a/src/caja-dropbox-hooks.h b/src/caja-dropbox-hooks.h new file mode 100644 index 0000000..7e5c2a9 --- /dev/null +++ b/src/caja-dropbox-hooks.h @@ -0,0 +1,79 @@ +/* + * Copyright 2008 Evenflow, Inc. + * + * caja-dropbox-hooks.h + * Header file for caja-dropbox-hooks.c + * + * This file is part of caja-dropbox. + * + * caja-dropbox is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * caja-dropbox 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with caja-dropbox. If not, see . + * + */ + +#ifndef CAJA_DROPBOX_HOOKS_H +#define CAJA_DROPBOX_HOOKS_H + +#include + +G_BEGIN_DECLS + +typedef void (*DropboxUpdateHook)(GHashTable *, gpointer); +typedef void (*DropboxHookClientConnectHook)(gpointer); + +typedef struct { + GIOChannel *chan; + int socket; + struct { + int line; + gchar *command_name; + GHashTable *command_args; + int numargs; + } hhsi; + gboolean connected; + guint event_source; + GHashTable *dispatch_table; + GHookList ondisconnect_hooklist; + GHookList onconnect_hooklist; +} CajaDropboxHookserv; + +void +caja_dropbox_hooks_setup(CajaDropboxHookserv *); + +void +caja_dropbox_hooks_start(CajaDropboxHookserv *); + +gboolean +caja_dropbox_hooks_is_connected(CajaDropboxHookserv *); + +gboolean +caja_dropbox_hooks_force_reconnect(CajaDropboxHookserv *); + +void +caja_dropbox_hooks_add(CajaDropboxHookserv *ndhs, + const gchar *hook_name, + DropboxUpdateHook hook, gpointer ud); +void +caja_dropbox_hooks_add_on_disconnect_hook(CajaDropboxHookserv *hookserv, + DropboxHookClientConnectHook dhcch, + gpointer ud); + +void +caja_dropbox_hooks_add_on_connect_hook(CajaDropboxHookserv *hookserv, + DropboxHookClientConnectHook dhcch, + gpointer ud); + + +G_END_DECLS + +#endif diff --git a/src/caja-dropbox.c b/src/caja-dropbox.c new file mode 100644 index 0000000..6451015 --- /dev/null +++ b/src/caja-dropbox.c @@ -0,0 +1,960 @@ +/* + * Copyright 2008 Evenflow, Inc. + * + * caja-dropbox.c + * Implements the Caja extension API for Dropbox. + * + * This file is part of caja-dropbox. + * + * caja-dropbox is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * caja-dropbox 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with caja-dropbox. If not, see . + * + */ + +#ifdef HAVE_CONFIG_H +#include /* for GETTEXT_PACKAGE */ +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "g-util.h" +#include "dropbox-command-client.h" +#include "caja-dropbox.h" +#include "caja-dropbox-hooks.h" + +static char *emblems[] = {"dropbox-uptodate", "dropbox-syncing", "dropbox-unsyncable"}; +gchar *DEFAULT_EMBLEM_PATHS[2] = { EMBLEMDIR , NULL }; + +gboolean dropbox_use_caja_submenu_workaround; +gboolean dropbox_use_operation_in_progress_workaround; + +static GType dropbox_type = 0; + +/* for old versions of glib */ +#if 0 // Silence Warnings. +static void my_g_hash_table_get_keys_helper(gpointer key, + gpointer value, + GList **ud) { + *ud = g_list_append(*ud, key); +} + +static GList *my_g_hash_table_get_keys(GHashTable *ght) { + GList *list = NULL; + g_hash_table_foreach(ght, (GHFunc) my_g_hash_table_get_keys_helper, &list); + return list; +} +#endif + +/* probably my favorite function */ +static gchar * +canonicalize_path(gchar *path) { + int i, j = 0; + gchar *toret, **cpy, **elts; + + g_assert(path != NULL); + g_assert(path[0] == '/'); + + elts = g_strsplit(path, "/", 0); + cpy = g_new(gchar *, g_strv_length(elts)+1); + cpy[j++] = "/"; + for (i = 0; elts[i] != NULL; i++) { + if (strcmp(elts[i], "..") == 0) { + j--; + } + else if (strcmp(elts[i], ".") != 0 && elts[i][0] != '\0') { + cpy[j++] = elts[i]; + } + } + + cpy[j] = NULL; + toret = g_build_filenamev(cpy); + g_free(cpy); + g_strfreev(elts); + + return toret; +} + +static void +reset_file(CajaFileInfo *file) { + debug("resetting file %p", (void *) file); + caja_file_info_invalidate_extension_info(file); +} + +gboolean +reset_all_files(CajaDropbox *cvs) { + /* Only run this on the main loop or you'll cause problems. */ + + /* this works because you can call a function pointer with + more arguments than it takes */ + g_hash_table_foreach(cvs->obj2filename, (GHFunc) reset_file, NULL); + return FALSE; +} + + +static void +when_file_dies(CajaDropbox *cvs, CajaFileInfo *address) { + gchar *filename; + + filename = g_hash_table_lookup(cvs->obj2filename, address); + + /* we never got a change to view this file */ + if (filename == NULL) { + return; + } + + /* too chatty */ + /* debug("removing %s <-> 0x%p", filename, address); */ + + g_hash_table_remove(cvs->filename2obj, filename); + g_hash_table_remove(cvs->obj2filename, address); +} + +static void +changed_cb(CajaFileInfo *file, CajaDropbox *cvs) { + /* check if this file's path has changed, if so update the hash and invalidate + the file */ + gchar *filename, *pfilename; + gchar *filename2; + gchar *uri; + + uri = caja_file_info_get_uri(file); + pfilename = g_filename_from_uri(uri, NULL, NULL); + filename = pfilename ? canonicalize_path(pfilename) : NULL; + filename2 = g_hash_table_lookup(cvs->obj2filename, file); + + g_free(pfilename); + g_free(uri); + + /* if filename2 is NULL we've never seen this file in update_file_info */ + if (filename2 == NULL) { + g_free(filename); + return; + } + + if (filename == NULL) { + /* A file has moved to offline storage. Lets remove it from our tables. */ + g_object_weak_unref(G_OBJECT(file), (GWeakNotify) when_file_dies, cvs); + g_hash_table_remove(cvs->filename2obj, filename2); + g_hash_table_remove(cvs->obj2filename, file); + g_signal_handlers_disconnect_by_func(file, G_CALLBACK(changed_cb), cvs); + reset_file(file); + return; + } + + /* this is a hack, because caja doesn't do this for us, for some reason + the file's path has changed */ + if (strcmp(filename, filename2) != 0) { + debug("shifty old: %s, new %s", filename2, filename); + + /* gotta do this first, the call after this frees filename2 */ + g_hash_table_remove(cvs->filename2obj, filename2); + + g_hash_table_replace(cvs->obj2filename, file, g_strdup(filename)); + + { + CajaFileInfo *f2; + /* we shouldn't have another mapping from filename to an object */ + f2 = g_hash_table_lookup(cvs->filename2obj, filename); + if (f2 != NULL) { + /* lets fix it if it's true, just remove the mapping */ + g_hash_table_remove(cvs->filename2obj, filename); + g_hash_table_remove(cvs->obj2filename, f2); + } + } + + g_hash_table_insert(cvs->filename2obj, g_strdup(filename), file); + reset_file(file); + } + + g_free(filename); +} + +static CajaOperationResult +caja_dropbox_update_file_info(CajaInfoProvider *provider, + CajaFileInfo *file, + GClosure *update_complete, + CajaOperationHandle **handle) { + CajaDropbox *cvs; + + cvs = CAJA_DROPBOX(provider); + + /* this code adds this file object to our two-way hash of file objects + so we can shell touch these files later */ + { + gchar *pfilename, *uri; + + uri = caja_file_info_get_uri(file); + pfilename = g_filename_from_uri(uri, NULL, NULL); + g_free(uri); + if (pfilename == NULL) { + return CAJA_OPERATION_COMPLETE; + } + else { + int cmp = 0; + gchar *stored_filename; + gchar *filename; + + filename = canonicalize_path(pfilename); + g_free(pfilename); + stored_filename = g_hash_table_lookup(cvs->obj2filename, file); + + /* don't worry about the dup checks, gcc is smart enough to optimize this + GCSE ftw */ + if ((stored_filename != NULL && (cmp = strcmp(stored_filename, filename)) != 0) || + stored_filename == NULL) { + + if (stored_filename != NULL && cmp != 0) { + /* this happens when the filename changes name on a file obj + but changed_cb isn't called */ + g_object_weak_unref(G_OBJECT(file), (GWeakNotify) when_file_dies, cvs); + g_hash_table_remove(cvs->obj2filename, file); + g_hash_table_remove(cvs->filename2obj, stored_filename); + g_signal_handlers_disconnect_by_func(file, G_CALLBACK(changed_cb), cvs); + } + else if (stored_filename == NULL) { + CajaFileInfo *f2; + + if ((f2 = g_hash_table_lookup(cvs->filename2obj, filename)) != NULL) { + /* if the filename exists in the filename2obj hash + but the file obj doesn't exist in the obj2filename hash: + + this happens when caja allocates another file object + for a filename without first deleting the original file object + + just remove the association to the older file object, it's obsolete + */ + g_object_weak_unref(G_OBJECT(f2), (GWeakNotify) when_file_dies, cvs); + g_signal_handlers_disconnect_by_func(f2, G_CALLBACK(changed_cb), cvs); + g_hash_table_remove(cvs->filename2obj, filename); + g_hash_table_remove(cvs->obj2filename, f2); + } + } + + /* too chatty */ + /* debug("adding %s <-> 0x%p", filename, file);*/ + g_object_weak_ref(G_OBJECT(file), (GWeakNotify) when_file_dies, cvs); + g_hash_table_insert(cvs->filename2obj, g_strdup(filename), file); + g_hash_table_insert(cvs->obj2filename, file, g_strdup(filename)); + g_signal_connect(file, "changed", G_CALLBACK(changed_cb), cvs); + } + + g_free(filename); + } + } + + if (dropbox_client_is_connected(&(cvs->dc)) == FALSE || + caja_file_info_is_gone(file)) { + return CAJA_OPERATION_COMPLETE; + } + + { + DropboxFileInfoCommand *dfic = g_new0(DropboxFileInfoCommand, 1); + + dfic->cancelled = FALSE; + dfic->provider = provider; + dfic->dc.request_type = GET_FILE_INFO; + dfic->update_complete = g_closure_ref(update_complete); + dfic->file = g_object_ref(file); + + dropbox_command_client_request(&(cvs->dc.dcc), (DropboxCommand *) dfic); + + *handle = (CajaOperationHandle *) dfic; + + return dropbox_use_operation_in_progress_workaround + ? CAJA_OPERATION_COMPLETE + : CAJA_OPERATION_IN_PROGRESS; + } +} + +static void +handle_shell_touch(GHashTable *args, CajaDropbox *cvs) { + gchar **path; + + // debug_enter(); + + if ((path = g_hash_table_lookup(args, "path")) != NULL && + path[0][0] == '/') { + CajaFileInfo *file; + gchar *filename; + + filename = canonicalize_path(path[0]); + + debug("shell touch for %s", filename); + + file = g_hash_table_lookup(cvs->filename2obj, filename); + + if (file != NULL) { + debug("gonna reset %s", filename); + reset_file(file); + } + g_free(filename); + } + + return; +} + +gboolean +caja_dropbox_finish_file_info_command(DropboxFileInfoCommandResponse *dficr) { + + //debug_enter(); + CajaOperationResult result = CAJA_OPERATION_FAILED; + + if (!dficr->dfic->cancelled) { + gchar **status = NULL; + gboolean isdir; + + isdir = caja_file_info_is_directory(dficr->dfic->file) ; + + /* if we have emblems just use them. */ + if (dficr->emblems_response != NULL && + (status = g_hash_table_lookup(dficr->emblems_response, "emblems")) != NULL) { + int i; + for ( i = 0; status[i] != NULL; i++) { + if (status[i][0]) + caja_file_info_add_emblem(dficr->dfic->file, status[i]); + } + result = CAJA_OPERATION_COMPLETE; + } + /* if the file status command went okay */ + else if ((dficr->file_status_response != NULL && + (status = + g_hash_table_lookup(dficr->file_status_response, "status")) != NULL) && + ((isdir == TRUE && + dficr->folder_tag_response != NULL) || isdir == FALSE)) { + gchar **tag = NULL; + + /* set the tag emblem */ + if (isdir && + (tag = g_hash_table_lookup(dficr->folder_tag_response, "tag")) != NULL) { + if (strcmp("public", tag[0]) == 0) { + caja_file_info_add_emblem(dficr->dfic->file, "web"); + } + else if (strcmp("shared", tag[0]) == 0) { + caja_file_info_add_emblem(dficr->dfic->file, "people"); + } + else if (strcmp("photos", tag[0]) == 0) { + caja_file_info_add_emblem(dficr->dfic->file, "photos"); + } + else if (strcmp("sandbox", tag[0]) == 0) { + caja_file_info_add_emblem(dficr->dfic->file, "star"); + } + } + + /* set the status emblem */ + { + int emblem_code = 0; + + if (strcmp("up to date", status[0]) == 0) { + emblem_code = 1; + } + else if (strcmp("syncing", status[0]) == 0) { + emblem_code = 2; + } + else if (strcmp("unsyncable", status[0]) == 0) { + emblem_code = 3; + } + + if (emblem_code > 0) { + /* + debug("%s to %s", emblems[emblem_code-1], + g_filename_from_uri(caja_file_info_get_uri(dficr->dfic->file), + NULL, NULL)); + */ + caja_file_info_add_emblem(dficr->dfic->file, emblems[emblem_code-1]); + } + } + result = CAJA_OPERATION_COMPLETE; + } + } + + /* complete the info request */ + if (!dropbox_use_operation_in_progress_workaround) { + caja_info_provider_update_complete_invoke(dficr->dfic->update_complete, + dficr->dfic->provider, + (CajaOperationHandle*) dficr->dfic, + result); + } + + /* destroy the objects we created */ + if (dficr->file_status_response != NULL) + g_hash_table_unref(dficr->file_status_response); + if (dficr->folder_tag_response != NULL) + g_hash_table_unref(dficr->folder_tag_response); + if (dficr->emblems_response != NULL) + g_hash_table_unref(dficr->emblems_response); + + /* unref the objects we didn't create */ + g_closure_unref(dficr->dfic->update_complete); + g_object_unref(dficr->dfic->file); + + /* now free the structs */ + g_free(dficr->dfic); + g_free(dficr); + + return FALSE; +} + +static void +caja_dropbox_cancel_update(CajaInfoProvider *provider, + CajaOperationHandle *handle) { + DropboxFileInfoCommand *dfic = (DropboxFileInfoCommand *) handle; + dfic->cancelled = TRUE; + return; +} + +static void +menu_item_cb(CajaMenuItem *item, + CajaDropbox *cvs) { + gchar *verb; + GList *files; + DropboxGeneralCommand *dcac; + + dcac = g_new(DropboxGeneralCommand, 1); + + /* maybe these would be better passed in a container + struct used as the userdata pointer, oh well this + is how dave camp does it */ + files = g_object_get_data(G_OBJECT(item), "caja_dropbox_files"); + verb = g_object_get_data(G_OBJECT(item), "caja_dropbox_verb"); + + dcac->dc.request_type = GENERAL_COMMAND; + + /* build the argument list */ + dcac->command_args = g_hash_table_new_full((GHashFunc) g_str_hash, + (GEqualFunc) g_str_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) g_strfreev); + { + gchar **arglist; + guint i; + GList *li; + + arglist = g_new0(gchar *,g_list_length(files) + 1); + + for (li = files, i = 0; li != NULL; li = g_list_next(li)) { + char *uri = caja_file_info_get_uri(CAJA_FILE_INFO(li->data)); + char *path = g_filename_from_uri(uri, NULL, NULL); + g_free(uri); + if (!path) + continue; + arglist[i] = path; + i++; + } + + g_hash_table_insert(dcac->command_args, + g_strdup("paths"), + arglist); + } + + { + gchar **arglist; + arglist = g_new(gchar *, 2); + arglist[0] = g_strdup(verb); + arglist[1] = NULL; + g_hash_table_insert(dcac->command_args, g_strdup("verb"), arglist); + } + + dcac->command_name = g_strdup("icon_overlay_context_action"); + dcac->handler = NULL; + dcac->handler_ud = NULL; + + dropbox_command_client_request(&(cvs->dc.dcc), (DropboxCommand *) dcac); +} + +static char from_hex(gchar ch) { + return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10; +} + +// decode in --> out, but dont fill more than n chars into out +// returns len of out if thing went well, -1 if n wasn't big enough +// can be used in place (whoa!) +int GhettoURLDecode(gchar* out, gchar* in, int n) { + char *out_initial; + + for(out_initial = out; out-out_initial < n && *in != '\0'; out++) { + if (*in == '%') { + *out = from_hex(in[1]) << 4 | from_hex(in[2]); + in += 3; + } + else { + *out = *in; + in++; + } + } + + if (out-out_initial < n) { + *out = '\0'; + return out-out_initial; + } + return -1; +} + +static int +caja_dropbox_parse_menu(gchar **options, + CajaMenu *menu, + GString *old_action_string, + GList *toret, + CajaMenuProvider *provider, + GList *files) +{ + int ret = 0; + int i; + + for ( i = 0; options[i] != NULL; i++) { + gchar **option_info = g_strsplit(options[i], "~", 3); + /* if this is a valid string */ + if (option_info[0] == NULL || option_info[1] == NULL || + option_info[2] == NULL || option_info[3] != NULL) { + g_strfreev(option_info); + continue; + } + + gchar* item_name = option_info[0]; + gchar* item_inner = option_info[1]; + gchar* verb = option_info[2]; + + GhettoURLDecode(item_name, item_name, strlen(item_name)); + GhettoURLDecode(verb, verb, strlen(verb)); + GhettoURLDecode(item_inner, item_inner, strlen(item_inner)); + + // If the inner section has a menu in it then we create a submenu. The verb will be ignored. + // Otherwise add the verb to our map and add the menu item to the list. + if (strchr(item_inner, '~') != NULL) { + GString *new_action_string = g_string_new(old_action_string->str); + gchar **suboptions = g_strsplit(item_inner, "|", -1); + CajaMenuItem *item; + CajaMenu *submenu = caja_menu_new(); + + g_string_append(new_action_string, item_name); + g_string_append(new_action_string, "::"); + + ret += caja_dropbox_parse_menu(suboptions, submenu, new_action_string, + toret, provider, files); + + item = caja_menu_item_new(new_action_string->str, + item_name, "", NULL); + caja_menu_item_set_submenu(item, submenu); + caja_menu_append_item(menu, item); + + g_strfreev(suboptions); + g_object_unref(item); + g_object_unref(submenu); + g_string_free(new_action_string, TRUE); + } else { + CajaMenuItem *item; + GString *new_action_string = g_string_new(old_action_string->str); + gboolean grayed_out = FALSE; + + g_string_append(new_action_string, verb); + + if (item_name[0] == '!') { + item_name++; + grayed_out = TRUE; + } + + item = caja_menu_item_new(new_action_string->str, item_name, item_inner, NULL); + + caja_menu_append_item(menu, item); + /* add the file metadata to this item */ + g_object_set_data_full (G_OBJECT(item), "caja_dropbox_files", + caja_file_info_list_copy (files), + (GDestroyNotify) caja_file_info_list_free); + /* add the verb metadata */ + g_object_set_data_full (G_OBJECT(item), "caja_dropbox_verb", + g_strdup(verb), + (GDestroyNotify) g_free); + g_signal_connect (item, "activate", G_CALLBACK (menu_item_cb), provider); + + if (grayed_out) { + GValue sensitive = { 0 }; + g_value_init (&sensitive, G_TYPE_BOOLEAN); + g_value_set_boolean (&sensitive, FALSE); + g_object_set_property (G_OBJECT(item), "sensitive", &sensitive); + } + + /* taken from caja-file-repairer (http://repairer.kldp.net/): + * this code is a workaround for a bug of caja + * See: http://bugzilla.gnome.org/show_bug.cgi?id=508878 */ + if (dropbox_use_caja_submenu_workaround) { + toret = g_list_append(toret, item); + } + + g_object_unref(item); + g_string_free(new_action_string, TRUE); + ret++; + } + g_strfreev(option_info); + } + return ret; +} + +static void +get_file_items_callback(GHashTable *response, gpointer ud) +{ + GAsyncQueue *reply_queue = ud; + + /* queue_push doesn't accept NULL as a value so we create an empty hash table + * if we got no response. */ + g_async_queue_push(reply_queue, response ? g_hash_table_ref(response) : + g_hash_table_new((GHashFunc) g_str_hash, (GEqualFunc) g_str_equal)); + g_async_queue_unref(reply_queue); +} + + +static GList * +caja_dropbox_get_file_items(CajaMenuProvider *provider, + GtkWidget *window, + GList *files) +{ + /* + * 1. Convert files to filenames. + */ + int file_count = g_list_length(files); + + if (file_count < 1) + return NULL; + + gchar **paths = g_new0(gchar *, file_count + 1); + int i = 0; + GList* elem; + + for (elem = files; elem; elem = elem->next, i++) { + gchar *uri = caja_file_info_get_uri(elem->data); + gchar *filename_un = uri ? g_filename_from_uri(uri, NULL, NULL) : NULL; + gchar *filename = filename_un ? g_filename_to_utf8(filename_un, -1, NULL, NULL, NULL) : NULL; + + g_free(uri); + g_free(filename_un); + + if (filename == NULL) { + /* oooh, filename wasn't correctly encoded, or isn't a local file. */ + g_strfreev(paths); + return NULL; + } + + paths[i] = filename; + } + + GAsyncQueue *reply_queue = g_async_queue_new_full((GDestroyNotify)g_hash_table_unref); + + /* + * 2. Create a DropboxGeneralCommand to call "icon_overlay_context_options" + */ + + DropboxGeneralCommand *dgc = g_new0(DropboxGeneralCommand, 1); + dgc->dc.request_type = GENERAL_COMMAND; + dgc->command_name = g_strdup("icon_overlay_context_options"); + dgc->command_args = g_hash_table_new_full((GHashFunc) g_str_hash, + (GEqualFunc) g_str_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) g_strfreev); + g_hash_table_insert(dgc->command_args, g_strdup("paths"), paths); + dgc->handler = get_file_items_callback; + dgc->handler_ud = g_async_queue_ref(reply_queue); + + /* + * 3. Queue it up for the helper thread to run it. + */ + CajaDropbox *cvs = CAJA_DROPBOX(provider); + dropbox_command_client_request(&(cvs->dc.dcc), (DropboxCommand *) dgc); + + GTimeVal gtv; + + /* + * 4. We have to block until it's done because caja expects a reply. But we will + * only block for 50 ms for a reply. + */ + + g_get_current_time(>v); + g_time_val_add(>v, 50000); + + GHashTable *context_options_response = g_async_queue_timed_pop(reply_queue, >v); + g_async_queue_unref(reply_queue); + + if (!context_options_response) { + return NULL; + } + + /* + * 5. Parse the reply. + */ + + char **options = g_hash_table_lookup(context_options_response, "options"); + GList *toret = NULL; + + if (options && *options && **options) { + /* build the menu */ + CajaMenuItem *root_item; + CajaMenu *root_menu; + + root_menu = caja_menu_new(); + root_item = caja_menu_item_new("CajaDropbox::root_item", + "Dropbox", "Dropbox Options", "dropbox"); + + toret = g_list_append(toret, root_item); + GString *action_string = g_string_new("CajaDropbox::"); + + if (!caja_dropbox_parse_menu(options, root_menu, action_string, + toret, provider, files)) { + g_object_unref(toret); + toret = NULL; + } + + caja_menu_item_set_submenu(root_item, root_menu); + + g_string_free(action_string, TRUE); + g_object_unref(root_menu); + } + + g_hash_table_unref(context_options_response); + + return toret; +} + +gboolean +add_emblem_paths(GHashTable* emblem_paths_response) +{ + /* Only run this on the main loop or you'll cause problems. */ + if (!emblem_paths_response) + return FALSE; + + gchar **emblem_paths_list; + int i; + + GtkIconTheme *theme = gtk_icon_theme_get_default(); + + if (emblem_paths_response && + (emblem_paths_list = g_hash_table_lookup(emblem_paths_response, "path"))) { + for (i = 0; emblem_paths_list[i] != NULL; i++) { + if (emblem_paths_list[i][0]) + gtk_icon_theme_append_search_path(theme, emblem_paths_list[i]); + } + } + g_hash_table_unref(emblem_paths_response); + return FALSE; +} + +gboolean +remove_emblem_paths(GHashTable* emblem_paths_response) +{ + /* Only run this on the main loop or you'll cause problems. */ + if (!emblem_paths_response) + return FALSE; + + gchar **emblem_paths_list = g_hash_table_lookup(emblem_paths_response, "path"); + if (!emblem_paths_list) + goto exit; + + // We need to remove the old paths. + GtkIconTheme * icon_theme = gtk_icon_theme_get_default(); + gchar ** paths; + gint path_count; + + gtk_icon_theme_get_search_path(icon_theme, &paths, &path_count); + + gint i, j, out = 0; + gboolean found = FALSE; + for (i = 0; i < path_count; i++) { + gboolean keep = TRUE; + for (j = 0; emblem_paths_list[j] != NULL; j++) { + if (emblem_paths_list[j][0]) { + if (!g_strcmp0(paths[i], emblem_paths_list[j])) { + found = TRUE; + keep = FALSE; + g_free(paths[i]); + break; + } + } + } + if (keep) { + paths[out] = paths[i]; + out++; + } + } + + /* If we found one we need to reset the path to + accomodate the changes */ + if (found) { + paths[out] = NULL; /* Clear the last one */ + gtk_icon_theme_set_search_path(icon_theme, (const gchar **)paths, out); + } + + g_strfreev(paths); +exit: + g_hash_table_unref(emblem_paths_response); + return FALSE; +} + +void get_emblem_paths_cb(GHashTable *emblem_paths_response, CajaDropbox *cvs) +{ + if (!emblem_paths_response) { + emblem_paths_response = g_hash_table_new((GHashFunc) g_str_hash, + (GEqualFunc) g_str_equal); + g_hash_table_insert(emblem_paths_response, "path", DEFAULT_EMBLEM_PATHS); + } else { + /* Increase the ref so that finish_general_command doesn't delete it. */ + g_hash_table_ref(emblem_paths_response); + } + + g_mutex_lock(cvs->emblem_paths_mutex); + if (cvs->emblem_paths) { + g_idle_add((GSourceFunc) remove_emblem_paths, cvs->emblem_paths); + cvs->emblem_paths = NULL; + } + cvs->emblem_paths = emblem_paths_response; + g_mutex_unlock(cvs->emblem_paths_mutex); + + g_idle_add((GSourceFunc) add_emblem_paths, g_hash_table_ref(emblem_paths_response)); + g_idle_add((GSourceFunc) reset_all_files, cvs); +} + +static void +on_connect(CajaDropbox *cvs) { + reset_all_files(cvs); + + dropbox_command_client_send_command(&(cvs->dc.dcc), + (CajaDropboxCommandResponseHandler) get_emblem_paths_cb, + cvs, "get_emblem_paths", NULL); +} + +static void +on_disconnect(CajaDropbox *cvs) { + reset_all_files(cvs); + + g_mutex_lock(cvs->emblem_paths_mutex); + /* This call will free the data too. */ + g_idle_add((GSourceFunc) remove_emblem_paths, cvs->emblem_paths); + cvs->emblem_paths = NULL; + g_mutex_unlock(cvs->emblem_paths_mutex); +} + + +static void +caja_dropbox_menu_provider_iface_init (CajaMenuProviderIface *iface) { + iface->get_file_items = caja_dropbox_get_file_items; + return; +} + +static void +caja_dropbox_info_provider_iface_init (CajaInfoProviderIface *iface) { + iface->update_file_info = caja_dropbox_update_file_info; + iface->cancel_update = caja_dropbox_cancel_update; + return; +} + +static void +caja_dropbox_instance_init (CajaDropbox *cvs) { + cvs->filename2obj = g_hash_table_new_full((GHashFunc) g_str_hash, + (GEqualFunc) g_str_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) NULL); + cvs->obj2filename = g_hash_table_new_full((GHashFunc) g_direct_hash, + (GEqualFunc) g_direct_equal, + (GDestroyNotify) NULL, + (GDestroyNotify) g_free); + cvs->emblem_paths_mutex = g_mutex_new(); + cvs->emblem_paths = NULL; + + /* setup the connection obj*/ + dropbox_client_setup(&(cvs->dc)); + + /* our hooks */ + caja_dropbox_hooks_add(&(cvs->dc.hookserv), "shell_touch", + (DropboxUpdateHook) handle_shell_touch, cvs); + + /* add connection handlers */ + dropbox_client_add_on_connect_hook(&(cvs->dc), + (DropboxClientConnectHook) on_connect, + cvs); + dropbox_client_add_on_disconnect_hook(&(cvs->dc), + (DropboxClientConnectHook) on_disconnect, + cvs); + + /* now start the connection */ + debug("about to start client connection"); + dropbox_client_start(&(cvs->dc)); + + return; +} + +static void +caja_dropbox_class_init (CajaDropboxClass *class) { +} + +static void +caja_dropbox_class_finalize (CajaDropboxClass *class) { + debug("just checking"); + /* kill threads here? */ +} + +GType +caja_dropbox_get_type (void) { + return dropbox_type; +} + +void +caja_dropbox_register_type (GTypeModule *module) { + static const GTypeInfo info = { + sizeof (CajaDropboxClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) caja_dropbox_class_init, + (GClassFinalizeFunc) caja_dropbox_class_finalize, + NULL, + sizeof (CajaDropbox), + 0, + (GInstanceInitFunc) caja_dropbox_instance_init, + }; + + static const GInterfaceInfo menu_provider_iface_info = { + (GInterfaceInitFunc) caja_dropbox_menu_provider_iface_init, + NULL, + NULL + }; + + static const GInterfaceInfo info_provider_iface_info = { + (GInterfaceInitFunc) caja_dropbox_info_provider_iface_init, + NULL, + NULL + }; + + dropbox_type = + g_type_module_register_type(module, + G_TYPE_OBJECT, + "CajaDropbox", + &info, 0); + + g_type_module_add_interface (module, + dropbox_type, + CAJA_TYPE_MENU_PROVIDER, + &menu_provider_iface_info); + + g_type_module_add_interface (module, + dropbox_type, + CAJA_TYPE_INFO_PROVIDER, + &info_provider_iface_info); +} diff --git a/src/caja-dropbox.h b/src/caja-dropbox.h new file mode 100644 index 0000000..b0b3c59 --- /dev/null +++ b/src/caja-dropbox.h @@ -0,0 +1,69 @@ +/* + * Copyright 2008 Evenflow, Inc. + * + * caja-dropbox.h + * Header file for caja-dropbox.c + * + * This file is part of caja-dropbox. + * + * caja-dropbox is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * caja-dropbox 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with caja-dropbox. If not, see . + * + */ + +#ifndef CAJA_DROPBOX_H +#define CAJA_DROPBOX_H + +#include +#include + +#include + +#include "dropbox-command-client.h" +#include "caja-dropbox-hooks.h" +#include "dropbox-client.h" + +G_BEGIN_DECLS + +/* Declarations for the dropbox extension object. This object will be + * instantiated by caja. It implements the GInterfaces + * exported by libcaja. */ + +#define CAJA_TYPE_DROPBOX (caja_dropbox_get_type ()) +#define CAJA_DROPBOX(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CAJA_TYPE_DROPBOX, CajaDropbox)) +#define CAJA_IS_DROPBOX(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CAJA_TYPE_DROPBOX)) +typedef struct _CajaDropbox CajaDropbox; +typedef struct _CajaDropboxClass CajaDropboxClass; + +struct _CajaDropbox { + GObject parent_slot; + GHashTable *filename2obj; + GHashTable *obj2filename; + GMutex *emblem_paths_mutex; + GHashTable *emblem_paths; + DropboxClient dc; +}; + +struct _CajaDropboxClass { + GObjectClass parent_slot; +}; + +GType caja_dropbox_get_type(void); +void caja_dropbox_register_type(GTypeModule *module); + +extern gboolean dropbox_use_caja_submenu_workaround; +extern gboolean dropbox_use_operation_in_progress_workaround; + +G_END_DECLS + +#endif diff --git a/src/dropbox-client-util.c b/src/dropbox-client-util.c index 2351c81..8419957 100644 --- a/src/dropbox-client-util.c +++ b/src/dropbox-client-util.c @@ -4,20 +4,20 @@ * dropbox-client-util.c * Utility functions for implementing dropbox clients. * - * This file is part of nautilus-dropbox. + * This file is part of caja-dropbox. * - * nautilus-dropbox is free software: you can redistribute it and/or modify + * caja-dropbox is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * nautilus-dropbox is distributed in the hope that it will be useful, + * caja-dropbox 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 General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . + * along with caja-dropbox. If not, see . * */ diff --git a/src/dropbox-client-util.h b/src/dropbox-client-util.h index 7813a3f..4f44530 100644 --- a/src/dropbox-client-util.h +++ b/src/dropbox-client-util.h @@ -4,20 +4,20 @@ * dropbox-client-util.h * Header file for dropbox-client-util.c * - * This file is part of nautilus-dropbox. + * This file is part of caja-dropbox. * - * nautilus-dropbox is free software: you can redistribute it and/or modify + * caja-dropbox is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * nautilus-dropbox is distributed in the hope that it will be useful, + * caja-dropbox 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 General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . + * along with caja-dropbox. If not, see . * */ diff --git a/src/dropbox-client.c b/src/dropbox-client.c index dbd4f77..8563197 100644 --- a/src/dropbox-client.c +++ b/src/dropbox-client.c @@ -4,20 +4,20 @@ * dropbox-client.c * Implements connection handling and C interface for interfacing with the Dropbox daemon. * - * This file is part of nautilus-dropbox. + * This file is part of caja-dropbox. * - * nautilus-dropbox is free software: you can redistribute it and/or modify + * caja-dropbox is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * nautilus-dropbox is distributed in the hope that it will be useful, + * caja-dropbox 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 General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . + * along with caja-dropbox. If not, see . * */ @@ -25,7 +25,7 @@ #include "g-util.h" #include "dropbox-command-client.h" -#include "nautilus-dropbox-hooks.h" +#include "caja-dropbox-hooks.h" #include "dropbox-client.h" static void @@ -63,7 +63,7 @@ command_on_disconnect(DropboxClient *dc) { dc->hook_disconnect_called = dc->command_disconnect_called = FALSE; } else { - nautilus_dropbox_hooks_force_reconnect(&(dc->hookserv)); + caja_dropbox_hooks_force_reconnect(&(dc->hookserv)); } } @@ -85,7 +85,7 @@ hook_on_disconnect(DropboxClient *dc) { gboolean dropbox_client_is_connected(DropboxClient *dc) { return (dropbox_command_client_is_connected(&(dc->dcc)) && - nautilus_dropbox_hooks_is_connected(&(dc->hookserv))); + caja_dropbox_hooks_is_connected(&(dc->hookserv))); } void @@ -93,14 +93,14 @@ dropbox_client_force_reconnect(DropboxClient *dc) { if (dropbox_client_is_connected(dc) == TRUE) { debug("forcing client to reconnect"); dropbox_command_client_force_reconnect(&(dc->dcc)); - nautilus_dropbox_hooks_force_reconnect(&(dc->hookserv)); + caja_dropbox_hooks_force_reconnect(&(dc->hookserv)); } } /* should only be called once on initialization */ void dropbox_client_setup(DropboxClient *dc) { - nautilus_dropbox_hooks_setup(&(dc->hookserv)); + caja_dropbox_hooks_setup(&(dc->hookserv)); dropbox_command_client_setup(&(dc->dcc)); g_hook_list_init(&(dc->ondisconnect_hooklist), sizeof(GHook)); @@ -109,7 +109,7 @@ dropbox_client_setup(DropboxClient *dc) { dc->hook_disconnect_called = dc->command_disconnect_called = FALSE; dc->hook_connect_called = dc->command_connect_called = FALSE; - nautilus_dropbox_hooks_add_on_connect_hook(&(dc->hookserv), + caja_dropbox_hooks_add_on_connect_hook(&(dc->hookserv), (DropboxHookClientConnectHook) hook_on_connect, dc); @@ -117,7 +117,7 @@ dropbox_client_setup(DropboxClient *dc) { (DropboxCommandClientConnectHook) command_on_connect, dc); - nautilus_dropbox_hooks_add_on_disconnect_hook(&(dc->hookserv), + caja_dropbox_hooks_add_on_disconnect_hook(&(dc->hookserv), (DropboxHookClientConnectHook) hook_on_disconnect, dc); @@ -169,6 +169,6 @@ dropbox_client_add_connection_attempt_hook(DropboxClient *dc, void dropbox_client_start(DropboxClient *dc) { debug("starting connections"); - nautilus_dropbox_hooks_start(&(dc->hookserv)); + caja_dropbox_hooks_start(&(dc->hookserv)); dropbox_command_client_start(&(dc->dcc)); } diff --git a/src/dropbox-client.h b/src/dropbox-client.h index c981c44..29c7eb4 100644 --- a/src/dropbox-client.h +++ b/src/dropbox-client.h @@ -4,20 +4,20 @@ * dropbox-client.h * Header file for dropbox-client.c * - * This file is part of nautilus-dropbox. + * This file is part of caja-dropbox. * - * nautilus-dropbox is free software: you can redistribute it and/or modify + * caja-dropbox is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * nautilus-dropbox is distributed in the hope that it will be useful, + * caja-dropbox 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 General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . + * along with caja-dropbox. If not, see . * */ @@ -26,13 +26,13 @@ #include #include "dropbox-command-client.h" -#include "nautilus-dropbox-hooks.h" +#include "caja-dropbox-hooks.h" G_BEGIN_DECLS typedef struct { DropboxCommandClient dcc; - NautilusDropboxHookserv hookserv; + CajaDropboxHookserv hookserv; GHookList onconnect_hooklist; GHookList ondisconnect_hooklist; gboolean hook_connect_called; diff --git a/src/dropbox-command-client.c b/src/dropbox-command-client.c index bdec125..dd02fd0 100644 --- a/src/dropbox-command-client.c +++ b/src/dropbox-command-client.c @@ -4,20 +4,20 @@ * dropbox-command-client.c * Implements connection handling and C interface for the Dropbox command socket. * - * This file is part of nautilus-dropbox. + * This file is part of caja-dropbox. * - * nautilus-dropbox is free software: you can redistribute it and/or modify + * caja-dropbox is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * nautilus-dropbox is distributed in the hope that it will be useful, + * caja-dropbox 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 General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . + * along with caja-dropbox. If not, see . * */ @@ -36,18 +36,18 @@ #include "g-util.h" #include "dropbox-client-util.h" #include "dropbox-command-client.h" -#include "nautilus-dropbox.h" -#include "nautilus-dropbox-hooks.h" +#include "caja-dropbox.h" +#include "caja-dropbox-hooks.h" /* TODO: make this asynchronous ;) */ /* this is a tiny hack, necessitated by the fact that - finish_file info command is in nautilus_dropbox, + finish_file info command is in caja_dropbox, this can be cleaned up once the file_info_command isn't a special case anylonger */ -gboolean nautilus_dropbox_finish_file_info_command(DropboxFileInfoCommandResponse *); +gboolean caja_dropbox_finish_file_info_command(DropboxFileInfoCommandResponse *); typedef struct { DropboxCommandClient *dcc; @@ -351,7 +351,7 @@ do_file_info_command(GIOChannel *chan, DropboxFileInfoCommand *dfic, GError **ge { gchar *filename_un, *uri; - uri = nautilus_file_info_get_uri(dfic->file); + uri = caja_file_info_get_uri(dfic->file); filename_un = uri ? g_filename_from_uri(uri, NULL, NULL): NULL; g_free(uri); if (filename_un) { @@ -400,7 +400,7 @@ do_file_info_command(GIOChannel *chan, DropboxFileInfoCommand *dfic, GError **ge return; } - if (nautilus_file_info_is_directory(dfic->file)) { + if (caja_file_info_is_directory(dfic->file)) { args = g_hash_table_new_full((GHashFunc) g_str_hash, (GEqualFunc) g_str_equal, (GDestroyNotify) g_free, @@ -435,7 +435,7 @@ exit: dficr->folder_tag_response = folder_tag_response; dficr->file_status_response = file_status_response; dficr->emblems_response = emblems_response; - g_idle_add((GSourceFunc) nautilus_dropbox_finish_file_info_command, dficr); + g_idle_add((GSourceFunc) caja_dropbox_finish_file_info_command, dficr); g_free(filename); @@ -532,7 +532,7 @@ end_request(DropboxCommand *dc) { dficr->dfic = dfic; dficr->file_status_response = NULL; dficr->emblems_response = NULL; - g_idle_add((GSourceFunc) nautilus_dropbox_finish_file_info_command, dficr); + g_idle_add((GSourceFunc) caja_dropbox_finish_file_info_command, dficr); } break; case GENERAL_COMMAND: { @@ -678,7 +678,7 @@ dropbox_command_client_thread(DropboxCommandClient *dcc) { g_get_current_time(>v); g_time_val_add(>v, G_USEC_PER_SEC / 10); - /* get a request from nautilus */ + /* get a request from caja */ dc = g_async_queue_timed_pop(dcc->command_queue, >v); if (dc != NULL) { break; @@ -854,7 +854,7 @@ void dropbox_command_client_send_simple_command(DropboxCommandClient *dcc, /* this is the C API, there is another send_command_to_db that is more the actual over the wire command */ void dropbox_command_client_send_command(DropboxCommandClient *dcc, - NautilusDropboxCommandResponseHandler h, + CajaDropboxCommandResponseHandler h, gpointer ud, const char *command, ...) { va_list ap; diff --git a/src/dropbox-command-client.h b/src/dropbox-command-client.h index c1ea3bc..a06f777 100644 --- a/src/dropbox-command-client.h +++ b/src/dropbox-command-client.h @@ -2,45 +2,45 @@ * Copyright 2008 Evenflow, Inc. * * dropbox-command-client.h - * Header file for nautilus-dropbox-command.c + * Header file for caja-dropbox-command.c * - * This file is part of nautilus-dropbox. + * This file is part of caja-dropbox. * - * nautilus-dropbox is free software: you can redistribute it and/or modify + * caja-dropbox is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * nautilus-dropbox is distributed in the hope that it will be useful, + * caja-dropbox 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 General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . + * along with caja-dropbox. If not, see . * */ #ifndef DROPBOX_COMMAND_CLIENT_H #define DROPBOX_COMMAND_CLIENT_H -#include -#include +#include +#include G_BEGIN_DECLS /* command structs */ -typedef enum {GET_FILE_INFO, GENERAL_COMMAND} NautilusDropboxRequestType; +typedef enum {GET_FILE_INFO, GENERAL_COMMAND} CajaDropboxRequestType; typedef struct { - NautilusDropboxRequestType request_type; + CajaDropboxRequestType request_type; } DropboxCommand; typedef struct { DropboxCommand dc; - NautilusInfoProvider *provider; + CajaInfoProvider *provider; GClosure *update_complete; - NautilusFileInfo *file; + CajaFileInfo *file; gboolean cancelled; } DropboxFileInfoCommand; @@ -51,13 +51,13 @@ typedef struct { GHashTable *emblems_response; } DropboxFileInfoCommandResponse; -typedef void (*NautilusDropboxCommandResponseHandler)(GHashTable *, gpointer); +typedef void (*CajaDropboxCommandResponseHandler)(GHashTable *, gpointer); typedef struct { DropboxCommand dc; gchar *command_name; GHashTable *command_args; - NautilusDropboxCommandResponseHandler handler; + CajaDropboxCommandResponseHandler handler; gpointer handler_ud; } DropboxGeneralCommand; @@ -90,7 +90,7 @@ void dropbox_command_client_send_simple_command(DropboxCommandClient *dcc, const char *command); void dropbox_command_client_send_command(DropboxCommandClient *dcc, - NautilusDropboxCommandResponseHandler h, + CajaDropboxCommandResponseHandler h, gpointer ud, const char *command, ...); void diff --git a/src/dropbox.c b/src/dropbox.c index 0d59559..e5782e3 100644 --- a/src/dropbox.c +++ b/src/dropbox.c @@ -2,22 +2,22 @@ * Copyright 2008 Evenflow, Inc. * * dropbox.c - * Nautilus module registering functions for the Dropbox extension. + * Caja module registering functions for the Dropbox extension. * - * This file is part of nautilus-dropbox. + * This file is part of caja-dropbox. * - * nautilus-dropbox is free software: you can redistribute it and/or modify + * caja-dropbox is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * nautilus-dropbox is distributed in the hope that it will be useful, + * caja-dropbox 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 General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . + * along with caja-dropbox. If not, see . * */ @@ -30,30 +30,30 @@ #include #include -#include "nautilus-dropbox.h" +#include "caja-dropbox.h" static GType type_list[1]; void -nautilus_module_initialize (GTypeModule *module) { +caja_module_initialize (GTypeModule *module) { g_print ("Initializing %s\n", PACKAGE_STRING); - nautilus_dropbox_register_type (module); - type_list[0] = NAUTILUS_TYPE_DROPBOX; + caja_dropbox_register_type (module); + type_list[0] = CAJA_TYPE_DROPBOX; - dropbox_use_nautilus_submenu_workaround - = (NAUTILUS_VERSION_MAJOR < 2 || - (NAUTILUS_VERSION_MAJOR == 2 && NAUTILUS_VERSION_MINOR <= 22)); + dropbox_use_caja_submenu_workaround + = (CAJA_VERSION_MAJOR < 2 || + (CAJA_VERSION_MAJOR == 2 && CAJA_VERSION_MINOR <= 22)); dropbox_use_operation_in_progress_workaround = TRUE; } void -nautilus_module_shutdown (void) { +caja_module_shutdown (void) { g_print ("Shutting down dropbox extension\n"); } void -nautilus_module_list_types (const GType **types, +caja_module_list_types (const GType **types, int *num_types) { *types = type_list; *num_types = G_N_ELEMENTS (type_list); diff --git a/src/g-util.h b/src/g-util.h index 73d3d81..671a6ca 100644 --- a/src/g-util.h +++ b/src/g-util.h @@ -4,20 +4,20 @@ * g-util.h * Helper macros. * - * This file is part of nautilus-dropbox. + * This file is part of caja-dropbox. * - * nautilus-dropbox is free software: you can redistribute it and/or modify + * caja-dropbox is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * nautilus-dropbox is distributed in the hope that it will be useful, + * caja-dropbox 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 General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . + * along with caja-dropbox. If not, see . * */ diff --git a/src/nautilus-dropbox-hooks.c b/src/nautilus-dropbox-hooks.c deleted file mode 100644 index f37dbbb..0000000 --- a/src/nautilus-dropbox-hooks.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright 2008 Evenflow, Inc. - * - * nautilus-dropbox-hooks.c - * Implements connection handling and C interface for the Dropbox hook socket. - * - * This file is part of nautilus-dropbox. - * - * nautilus-dropbox is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * nautilus-dropbox 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . - * - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "g-util.h" -#include "async-io-coroutine.h" -#include "dropbox-client-util.h" -#include "nautilus-dropbox-hooks.h" - -typedef struct { - DropboxUpdateHook hook; - gpointer ud; -} HookData; - -static gboolean -try_to_connect(NautilusDropboxHookserv *hookserv); - -static gboolean -handle_hook_server_input(GIOChannel *chan, - GIOCondition cond, - NautilusDropboxHookserv *hookserv) { - /*debug_enter(); */ - - /* we have some sweet macros defined that allow us to write this - async event handler like a microthread yeahh, watch out for context */ - CRBEGIN(hookserv->hhsi.line); - while (1) { - hookserv->hhsi.command_args = - g_hash_table_new_full((GHashFunc) g_str_hash, - (GEqualFunc) g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) g_strfreev); - hookserv->hhsi.numargs = 0; - - /* read the command name */ - { - gchar *line; - CRREADLINE(hookserv->hhsi.line, chan, line); - hookserv->hhsi.command_name = dropbox_client_util_desanitize(line); - g_free(line); - } - - /*debug("got a hook name: %s", hookserv->hhsi.command_name); */ - - /* now read each arg line (until a certain limit) until we receive "done" */ - while (1) { - gchar *line; - - /* if too many arguments, this connection seems malicious */ - if (hookserv->hhsi.numargs >= 20) { - CRHALT; - } - - CRREADLINE(hookserv->hhsi.line, chan, line); - - if (strcmp("done", line) == 0) { - g_free(line); - break; - } - else { - gboolean parse_result; - - parse_result = - dropbox_client_util_command_parse_arg(line, - hookserv->hhsi.command_args); - g_free(line); - - if (FALSE == parse_result) { - debug("bad parse"); - CRHALT; - } - } - - hookserv->hhsi.numargs += 1; - } - - { - HookData *hd; - hd = (HookData *) - g_hash_table_lookup(hookserv->dispatch_table, - hookserv->hhsi.command_name); - if (hd != NULL) { - (hd->hook)(hookserv->hhsi.command_args, hd->ud); - } - } - - g_free(hookserv->hhsi.command_name); - g_hash_table_unref(hookserv->hhsi.command_args); - hookserv->hhsi.command_name = NULL; - hookserv->hhsi.command_args = NULL; - } - CREND; -} - -static void -watch_killer(NautilusDropboxHookserv *hookserv) { - debug("hook client disconnected"); - - hookserv->connected = FALSE; - - g_hook_list_invoke(&(hookserv->ondisconnect_hooklist), FALSE); - - /* we basically just have to free the memory allocated in the - handle_hook_server_init ctx */ - if (hookserv->hhsi.command_name != NULL) { - g_free(hookserv->hhsi.command_name); - hookserv->hhsi.command_name = NULL; - } - - if (hookserv->hhsi.command_args != NULL) { - g_hash_table_unref(hookserv->hhsi.command_args); - hookserv->hhsi.command_args = NULL; - } - - g_io_channel_unref(hookserv->chan); - hookserv->chan = NULL; - hookserv->event_source = 0; - hookserv->socket = 0; - - /* lol we also have to start a new connection */ - try_to_connect(hookserv); -} - -static gboolean -try_to_connect(NautilusDropboxHookserv *hookserv) { - /* create socket */ - hookserv->socket = socket(PF_UNIX, SOCK_STREAM, 0); - - /* set native non-blocking, for connect timeout */ - { - unsigned int flags; - - if ((flags = fcntl(hookserv->socket, F_GETFL, 0)) < 0) { - goto FAIL_CLEANUP; - } - - if (fcntl(hookserv->socket, F_SETFL, flags | O_NONBLOCK) < 0) { - goto FAIL_CLEANUP; - } - } - - /* connect to server, might fail of course */ - { - struct sockaddr_un addr; - socklen_t addr_len; - - /* intialize address structure */ - addr.sun_family = AF_UNIX; - g_snprintf(addr.sun_path, - sizeof(addr.sun_path), - "%s/.dropbox/iface_socket", - g_get_home_dir()); - addr_len = sizeof(addr) - sizeof(addr.sun_path) + strlen(addr.sun_path); - - /* if there was an error we have to try again later */ - if (connect(hookserv->socket, (struct sockaddr *) &addr, addr_len) < 0) { - if (errno == EINPROGRESS) { - fd_set writers; - struct timeval tv = {1, 0}; - FD_ZERO(&writers); - FD_SET(hookserv->socket, &writers); - - /* if nothing was ready after 3 seconds, fail out homie */ - if (select(hookserv->socket+1, NULL, &writers, NULL, &tv) == 0) { - goto FAIL_CLEANUP; - } - - if (connect(hookserv->socket, (struct sockaddr *) &addr, addr_len) < 0) { - debug("couldn't connect to hook server after 1 second"); - goto FAIL_CLEANUP; - } - } - else { - goto FAIL_CLEANUP; - } - } - } - - /* lol sometimes i write funny codez */ - if (FALSE) { - FAIL_CLEANUP: - close(hookserv->socket); - g_timeout_add_seconds(1, (GSourceFunc) try_to_connect, hookserv); - return FALSE; - } - - /* great we connected!, let's create the channel and wait on it */ - hookserv->chan = g_io_channel_unix_new(hookserv->socket); - g_io_channel_set_line_term(hookserv->chan, "\n", -1); - g_io_channel_set_close_on_unref(hookserv->chan, TRUE); - - /*debug("create channel"); */ - - /* Set non-blocking ;) (again just in case) */ - { - GIOFlags flags; - GIOStatus iostat; - - flags = g_io_channel_get_flags(hookserv->chan); - iostat = g_io_channel_set_flags(hookserv->chan, flags | G_IO_FLAG_NONBLOCK, - NULL); - if (iostat == G_IO_STATUS_ERROR) { - g_io_channel_unref(hookserv->chan); - g_timeout_add_seconds(1, (GSourceFunc) try_to_connect, hookserv); - return FALSE; - } - } - - /*debug("set non blocking"); */ - - /* this is fun, async io watcher */ - hookserv->hhsi.line = 0; - hookserv->hhsi.command_args = NULL; - hookserv->hhsi.command_name = NULL; - hookserv->event_source = - g_io_add_watch_full(hookserv->chan, G_PRIORITY_DEFAULT, - G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP | G_IO_NVAL, - (GIOFunc) handle_hook_server_input, hookserv, - (GDestroyNotify) watch_killer); - - debug("hook client connected"); - hookserv->connected = TRUE; - g_hook_list_invoke(&(hookserv->onconnect_hooklist), FALSE); - - /*debug("added watch");*/ - return FALSE; -} - -/* should only be called in glib main loop */ -/* returns a gboolean because it is a GSourceFunc */ -gboolean nautilus_dropbox_hooks_force_reconnect(NautilusDropboxHookserv *hookserv) { - debug_enter(); - - if (hookserv->connected == FALSE) { - return FALSE; - } - - debug("forcing hook to reconnect"); - - g_assert(hookserv->event_source >= 0); - - if (hookserv->event_source > 0) { - g_source_remove(hookserv->event_source); - } - else if (hookserv->event_source == 0) { - debug("event source was zero!!!!!"); - } - - return FALSE; -} - -gboolean -nautilus_dropbox_hooks_is_connected(NautilusDropboxHookserv *hookserv) { - return hookserv->connected; -} - -void -nautilus_dropbox_hooks_setup(NautilusDropboxHookserv *hookserv) { - hookserv->dispatch_table = g_hash_table_new_full((GHashFunc) g_str_hash, - (GEqualFunc) g_str_equal, - g_free, g_free); - hookserv->connected = FALSE; - - g_hook_list_init(&(hookserv->ondisconnect_hooklist), sizeof(GHook)); - g_hook_list_init(&(hookserv->onconnect_hooklist), sizeof(GHook)); -} - -void -nautilus_dropbox_hooks_add_on_disconnect_hook(NautilusDropboxHookserv *hookserv, - DropboxHookClientConnectHook dhcch, - gpointer ud) { - GHook *newhook; - - newhook = g_hook_alloc(&(hookserv->ondisconnect_hooklist)); - newhook->func = dhcch; - newhook->data = ud; - - g_hook_append(&(hookserv->ondisconnect_hooklist), newhook); -} - -void -nautilus_dropbox_hooks_add_on_connect_hook(NautilusDropboxHookserv *hookserv, - DropboxHookClientConnectHook dhcch, - gpointer ud) { - GHook *newhook; - - newhook = g_hook_alloc(&(hookserv->onconnect_hooklist)); - newhook->func = dhcch; - newhook->data = ud; - - g_hook_append(&(hookserv->onconnect_hooklist), newhook); -} - -void nautilus_dropbox_hooks_add(NautilusDropboxHookserv *ndhs, - const gchar *hook_name, - DropboxUpdateHook hook, gpointer ud) { - HookData *hd; - hd = g_new(HookData, 1); - hd->hook = hook; - hd->ud = ud; - g_hash_table_insert(ndhs->dispatch_table, g_strdup(hook_name), hd); -} - -void -nautilus_dropbox_hooks_start(NautilusDropboxHookserv *hookserv) { - try_to_connect(hookserv); -} diff --git a/src/nautilus-dropbox-hooks.h b/src/nautilus-dropbox-hooks.h deleted file mode 100644 index fb69c3b..0000000 --- a/src/nautilus-dropbox-hooks.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2008 Evenflow, Inc. - * - * nautilus-dropbox-hooks.h - * Header file for nautilus-dropbox-hooks.c - * - * This file is part of nautilus-dropbox. - * - * nautilus-dropbox is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * nautilus-dropbox 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . - * - */ - -#ifndef NAUTILUS_DROPBOX_HOOKS_H -#define NAUTILUS_DROPBOX_HOOKS_H - -#include - -G_BEGIN_DECLS - -typedef void (*DropboxUpdateHook)(GHashTable *, gpointer); -typedef void (*DropboxHookClientConnectHook)(gpointer); - -typedef struct { - GIOChannel *chan; - int socket; - struct { - int line; - gchar *command_name; - GHashTable *command_args; - int numargs; - } hhsi; - gboolean connected; - guint event_source; - GHashTable *dispatch_table; - GHookList ondisconnect_hooklist; - GHookList onconnect_hooklist; -} NautilusDropboxHookserv; - -void -nautilus_dropbox_hooks_setup(NautilusDropboxHookserv *); - -void -nautilus_dropbox_hooks_start(NautilusDropboxHookserv *); - -gboolean -nautilus_dropbox_hooks_is_connected(NautilusDropboxHookserv *); - -gboolean -nautilus_dropbox_hooks_force_reconnect(NautilusDropboxHookserv *); - -void -nautilus_dropbox_hooks_add(NautilusDropboxHookserv *ndhs, - const gchar *hook_name, - DropboxUpdateHook hook, gpointer ud); -void -nautilus_dropbox_hooks_add_on_disconnect_hook(NautilusDropboxHookserv *hookserv, - DropboxHookClientConnectHook dhcch, - gpointer ud); - -void -nautilus_dropbox_hooks_add_on_connect_hook(NautilusDropboxHookserv *hookserv, - DropboxHookClientConnectHook dhcch, - gpointer ud); - - -G_END_DECLS - -#endif diff --git a/src/nautilus-dropbox.c b/src/nautilus-dropbox.c deleted file mode 100644 index 86a0e8a..0000000 --- a/src/nautilus-dropbox.c +++ /dev/null @@ -1,960 +0,0 @@ -/* - * Copyright 2008 Evenflow, Inc. - * - * nautilus-dropbox.c - * Implements the Nautilus extension API for Dropbox. - * - * This file is part of nautilus-dropbox. - * - * nautilus-dropbox is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * nautilus-dropbox 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . - * - */ - -#ifdef HAVE_CONFIG_H -#include /* for GETTEXT_PACKAGE */ -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include "g-util.h" -#include "dropbox-command-client.h" -#include "nautilus-dropbox.h" -#include "nautilus-dropbox-hooks.h" - -static char *emblems[] = {"dropbox-uptodate", "dropbox-syncing", "dropbox-unsyncable"}; -gchar *DEFAULT_EMBLEM_PATHS[2] = { EMBLEMDIR , NULL }; - -gboolean dropbox_use_nautilus_submenu_workaround; -gboolean dropbox_use_operation_in_progress_workaround; - -static GType dropbox_type = 0; - -/* for old versions of glib */ -#if 0 // Silence Warnings. -static void my_g_hash_table_get_keys_helper(gpointer key, - gpointer value, - GList **ud) { - *ud = g_list_append(*ud, key); -} - -static GList *my_g_hash_table_get_keys(GHashTable *ght) { - GList *list = NULL; - g_hash_table_foreach(ght, (GHFunc) my_g_hash_table_get_keys_helper, &list); - return list; -} -#endif - -/* probably my favorite function */ -static gchar * -canonicalize_path(gchar *path) { - int i, j = 0; - gchar *toret, **cpy, **elts; - - g_assert(path != NULL); - g_assert(path[0] == '/'); - - elts = g_strsplit(path, "/", 0); - cpy = g_new(gchar *, g_strv_length(elts)+1); - cpy[j++] = "/"; - for (i = 0; elts[i] != NULL; i++) { - if (strcmp(elts[i], "..") == 0) { - j--; - } - else if (strcmp(elts[i], ".") != 0 && elts[i][0] != '\0') { - cpy[j++] = elts[i]; - } - } - - cpy[j] = NULL; - toret = g_build_filenamev(cpy); - g_free(cpy); - g_strfreev(elts); - - return toret; -} - -static void -reset_file(NautilusFileInfo *file) { - debug("resetting file %p", (void *) file); - nautilus_file_info_invalidate_extension_info(file); -} - -gboolean -reset_all_files(NautilusDropbox *cvs) { - /* Only run this on the main loop or you'll cause problems. */ - - /* this works because you can call a function pointer with - more arguments than it takes */ - g_hash_table_foreach(cvs->obj2filename, (GHFunc) reset_file, NULL); - return FALSE; -} - - -static void -when_file_dies(NautilusDropbox *cvs, NautilusFileInfo *address) { - gchar *filename; - - filename = g_hash_table_lookup(cvs->obj2filename, address); - - /* we never got a change to view this file */ - if (filename == NULL) { - return; - } - - /* too chatty */ - /* debug("removing %s <-> 0x%p", filename, address); */ - - g_hash_table_remove(cvs->filename2obj, filename); - g_hash_table_remove(cvs->obj2filename, address); -} - -static void -changed_cb(NautilusFileInfo *file, NautilusDropbox *cvs) { - /* check if this file's path has changed, if so update the hash and invalidate - the file */ - gchar *filename, *pfilename; - gchar *filename2; - gchar *uri; - - uri = nautilus_file_info_get_uri(file); - pfilename = g_filename_from_uri(uri, NULL, NULL); - filename = pfilename ? canonicalize_path(pfilename) : NULL; - filename2 = g_hash_table_lookup(cvs->obj2filename, file); - - g_free(pfilename); - g_free(uri); - - /* if filename2 is NULL we've never seen this file in update_file_info */ - if (filename2 == NULL) { - g_free(filename); - return; - } - - if (filename == NULL) { - /* A file has moved to offline storage. Lets remove it from our tables. */ - g_object_weak_unref(G_OBJECT(file), (GWeakNotify) when_file_dies, cvs); - g_hash_table_remove(cvs->filename2obj, filename2); - g_hash_table_remove(cvs->obj2filename, file); - g_signal_handlers_disconnect_by_func(file, G_CALLBACK(changed_cb), cvs); - reset_file(file); - return; - } - - /* this is a hack, because nautilus doesn't do this for us, for some reason - the file's path has changed */ - if (strcmp(filename, filename2) != 0) { - debug("shifty old: %s, new %s", filename2, filename); - - /* gotta do this first, the call after this frees filename2 */ - g_hash_table_remove(cvs->filename2obj, filename2); - - g_hash_table_replace(cvs->obj2filename, file, g_strdup(filename)); - - { - NautilusFileInfo *f2; - /* we shouldn't have another mapping from filename to an object */ - f2 = g_hash_table_lookup(cvs->filename2obj, filename); - if (f2 != NULL) { - /* lets fix it if it's true, just remove the mapping */ - g_hash_table_remove(cvs->filename2obj, filename); - g_hash_table_remove(cvs->obj2filename, f2); - } - } - - g_hash_table_insert(cvs->filename2obj, g_strdup(filename), file); - reset_file(file); - } - - g_free(filename); -} - -static NautilusOperationResult -nautilus_dropbox_update_file_info(NautilusInfoProvider *provider, - NautilusFileInfo *file, - GClosure *update_complete, - NautilusOperationHandle **handle) { - NautilusDropbox *cvs; - - cvs = NAUTILUS_DROPBOX(provider); - - /* this code adds this file object to our two-way hash of file objects - so we can shell touch these files later */ - { - gchar *pfilename, *uri; - - uri = nautilus_file_info_get_uri(file); - pfilename = g_filename_from_uri(uri, NULL, NULL); - g_free(uri); - if (pfilename == NULL) { - return NAUTILUS_OPERATION_COMPLETE; - } - else { - int cmp = 0; - gchar *stored_filename; - gchar *filename; - - filename = canonicalize_path(pfilename); - g_free(pfilename); - stored_filename = g_hash_table_lookup(cvs->obj2filename, file); - - /* don't worry about the dup checks, gcc is smart enough to optimize this - GCSE ftw */ - if ((stored_filename != NULL && (cmp = strcmp(stored_filename, filename)) != 0) || - stored_filename == NULL) { - - if (stored_filename != NULL && cmp != 0) { - /* this happens when the filename changes name on a file obj - but changed_cb isn't called */ - g_object_weak_unref(G_OBJECT(file), (GWeakNotify) when_file_dies, cvs); - g_hash_table_remove(cvs->obj2filename, file); - g_hash_table_remove(cvs->filename2obj, stored_filename); - g_signal_handlers_disconnect_by_func(file, G_CALLBACK(changed_cb), cvs); - } - else if (stored_filename == NULL) { - NautilusFileInfo *f2; - - if ((f2 = g_hash_table_lookup(cvs->filename2obj, filename)) != NULL) { - /* if the filename exists in the filename2obj hash - but the file obj doesn't exist in the obj2filename hash: - - this happens when nautilus allocates another file object - for a filename without first deleting the original file object - - just remove the association to the older file object, it's obsolete - */ - g_object_weak_unref(G_OBJECT(f2), (GWeakNotify) when_file_dies, cvs); - g_signal_handlers_disconnect_by_func(f2, G_CALLBACK(changed_cb), cvs); - g_hash_table_remove(cvs->filename2obj, filename); - g_hash_table_remove(cvs->obj2filename, f2); - } - } - - /* too chatty */ - /* debug("adding %s <-> 0x%p", filename, file);*/ - g_object_weak_ref(G_OBJECT(file), (GWeakNotify) when_file_dies, cvs); - g_hash_table_insert(cvs->filename2obj, g_strdup(filename), file); - g_hash_table_insert(cvs->obj2filename, file, g_strdup(filename)); - g_signal_connect(file, "changed", G_CALLBACK(changed_cb), cvs); - } - - g_free(filename); - } - } - - if (dropbox_client_is_connected(&(cvs->dc)) == FALSE || - nautilus_file_info_is_gone(file)) { - return NAUTILUS_OPERATION_COMPLETE; - } - - { - DropboxFileInfoCommand *dfic = g_new0(DropboxFileInfoCommand, 1); - - dfic->cancelled = FALSE; - dfic->provider = provider; - dfic->dc.request_type = GET_FILE_INFO; - dfic->update_complete = g_closure_ref(update_complete); - dfic->file = g_object_ref(file); - - dropbox_command_client_request(&(cvs->dc.dcc), (DropboxCommand *) dfic); - - *handle = (NautilusOperationHandle *) dfic; - - return dropbox_use_operation_in_progress_workaround - ? NAUTILUS_OPERATION_COMPLETE - : NAUTILUS_OPERATION_IN_PROGRESS; - } -} - -static void -handle_shell_touch(GHashTable *args, NautilusDropbox *cvs) { - gchar **path; - - // debug_enter(); - - if ((path = g_hash_table_lookup(args, "path")) != NULL && - path[0][0] == '/') { - NautilusFileInfo *file; - gchar *filename; - - filename = canonicalize_path(path[0]); - - debug("shell touch for %s", filename); - - file = g_hash_table_lookup(cvs->filename2obj, filename); - - if (file != NULL) { - debug("gonna reset %s", filename); - reset_file(file); - } - g_free(filename); - } - - return; -} - -gboolean -nautilus_dropbox_finish_file_info_command(DropboxFileInfoCommandResponse *dficr) { - - //debug_enter(); - NautilusOperationResult result = NAUTILUS_OPERATION_FAILED; - - if (!dficr->dfic->cancelled) { - gchar **status = NULL; - gboolean isdir; - - isdir = nautilus_file_info_is_directory(dficr->dfic->file) ; - - /* if we have emblems just use them. */ - if (dficr->emblems_response != NULL && - (status = g_hash_table_lookup(dficr->emblems_response, "emblems")) != NULL) { - int i; - for ( i = 0; status[i] != NULL; i++) { - if (status[i][0]) - nautilus_file_info_add_emblem(dficr->dfic->file, status[i]); - } - result = NAUTILUS_OPERATION_COMPLETE; - } - /* if the file status command went okay */ - else if ((dficr->file_status_response != NULL && - (status = - g_hash_table_lookup(dficr->file_status_response, "status")) != NULL) && - ((isdir == TRUE && - dficr->folder_tag_response != NULL) || isdir == FALSE)) { - gchar **tag = NULL; - - /* set the tag emblem */ - if (isdir && - (tag = g_hash_table_lookup(dficr->folder_tag_response, "tag")) != NULL) { - if (strcmp("public", tag[0]) == 0) { - nautilus_file_info_add_emblem(dficr->dfic->file, "web"); - } - else if (strcmp("shared", tag[0]) == 0) { - nautilus_file_info_add_emblem(dficr->dfic->file, "people"); - } - else if (strcmp("photos", tag[0]) == 0) { - nautilus_file_info_add_emblem(dficr->dfic->file, "photos"); - } - else if (strcmp("sandbox", tag[0]) == 0) { - nautilus_file_info_add_emblem(dficr->dfic->file, "star"); - } - } - - /* set the status emblem */ - { - int emblem_code = 0; - - if (strcmp("up to date", status[0]) == 0) { - emblem_code = 1; - } - else if (strcmp("syncing", status[0]) == 0) { - emblem_code = 2; - } - else if (strcmp("unsyncable", status[0]) == 0) { - emblem_code = 3; - } - - if (emblem_code > 0) { - /* - debug("%s to %s", emblems[emblem_code-1], - g_filename_from_uri(nautilus_file_info_get_uri(dficr->dfic->file), - NULL, NULL)); - */ - nautilus_file_info_add_emblem(dficr->dfic->file, emblems[emblem_code-1]); - } - } - result = NAUTILUS_OPERATION_COMPLETE; - } - } - - /* complete the info request */ - if (!dropbox_use_operation_in_progress_workaround) { - nautilus_info_provider_update_complete_invoke(dficr->dfic->update_complete, - dficr->dfic->provider, - (NautilusOperationHandle*) dficr->dfic, - result); - } - - /* destroy the objects we created */ - if (dficr->file_status_response != NULL) - g_hash_table_unref(dficr->file_status_response); - if (dficr->folder_tag_response != NULL) - g_hash_table_unref(dficr->folder_tag_response); - if (dficr->emblems_response != NULL) - g_hash_table_unref(dficr->emblems_response); - - /* unref the objects we didn't create */ - g_closure_unref(dficr->dfic->update_complete); - g_object_unref(dficr->dfic->file); - - /* now free the structs */ - g_free(dficr->dfic); - g_free(dficr); - - return FALSE; -} - -static void -nautilus_dropbox_cancel_update(NautilusInfoProvider *provider, - NautilusOperationHandle *handle) { - DropboxFileInfoCommand *dfic = (DropboxFileInfoCommand *) handle; - dfic->cancelled = TRUE; - return; -} - -static void -menu_item_cb(NautilusMenuItem *item, - NautilusDropbox *cvs) { - gchar *verb; - GList *files; - DropboxGeneralCommand *dcac; - - dcac = g_new(DropboxGeneralCommand, 1); - - /* maybe these would be better passed in a container - struct used as the userdata pointer, oh well this - is how dave camp does it */ - files = g_object_get_data(G_OBJECT(item), "nautilus_dropbox_files"); - verb = g_object_get_data(G_OBJECT(item), "nautilus_dropbox_verb"); - - dcac->dc.request_type = GENERAL_COMMAND; - - /* build the argument list */ - dcac->command_args = g_hash_table_new_full((GHashFunc) g_str_hash, - (GEqualFunc) g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) g_strfreev); - { - gchar **arglist; - guint i; - GList *li; - - arglist = g_new0(gchar *,g_list_length(files) + 1); - - for (li = files, i = 0; li != NULL; li = g_list_next(li)) { - char *uri = nautilus_file_info_get_uri(NAUTILUS_FILE_INFO(li->data)); - char *path = g_filename_from_uri(uri, NULL, NULL); - g_free(uri); - if (!path) - continue; - arglist[i] = path; - i++; - } - - g_hash_table_insert(dcac->command_args, - g_strdup("paths"), - arglist); - } - - { - gchar **arglist; - arglist = g_new(gchar *, 2); - arglist[0] = g_strdup(verb); - arglist[1] = NULL; - g_hash_table_insert(dcac->command_args, g_strdup("verb"), arglist); - } - - dcac->command_name = g_strdup("icon_overlay_context_action"); - dcac->handler = NULL; - dcac->handler_ud = NULL; - - dropbox_command_client_request(&(cvs->dc.dcc), (DropboxCommand *) dcac); -} - -static char from_hex(gchar ch) { - return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10; -} - -// decode in --> out, but dont fill more than n chars into out -// returns len of out if thing went well, -1 if n wasn't big enough -// can be used in place (whoa!) -int GhettoURLDecode(gchar* out, gchar* in, int n) { - char *out_initial; - - for(out_initial = out; out-out_initial < n && *in != '\0'; out++) { - if (*in == '%') { - *out = from_hex(in[1]) << 4 | from_hex(in[2]); - in += 3; - } - else { - *out = *in; - in++; - } - } - - if (out-out_initial < n) { - *out = '\0'; - return out-out_initial; - } - return -1; -} - -static int -nautilus_dropbox_parse_menu(gchar **options, - NautilusMenu *menu, - GString *old_action_string, - GList *toret, - NautilusMenuProvider *provider, - GList *files) -{ - int ret = 0; - int i; - - for ( i = 0; options[i] != NULL; i++) { - gchar **option_info = g_strsplit(options[i], "~", 3); - /* if this is a valid string */ - if (option_info[0] == NULL || option_info[1] == NULL || - option_info[2] == NULL || option_info[3] != NULL) { - g_strfreev(option_info); - continue; - } - - gchar* item_name = option_info[0]; - gchar* item_inner = option_info[1]; - gchar* verb = option_info[2]; - - GhettoURLDecode(item_name, item_name, strlen(item_name)); - GhettoURLDecode(verb, verb, strlen(verb)); - GhettoURLDecode(item_inner, item_inner, strlen(item_inner)); - - // If the inner section has a menu in it then we create a submenu. The verb will be ignored. - // Otherwise add the verb to our map and add the menu item to the list. - if (strchr(item_inner, '~') != NULL) { - GString *new_action_string = g_string_new(old_action_string->str); - gchar **suboptions = g_strsplit(item_inner, "|", -1); - NautilusMenuItem *item; - NautilusMenu *submenu = nautilus_menu_new(); - - g_string_append(new_action_string, item_name); - g_string_append(new_action_string, "::"); - - ret += nautilus_dropbox_parse_menu(suboptions, submenu, new_action_string, - toret, provider, files); - - item = nautilus_menu_item_new(new_action_string->str, - item_name, "", NULL); - nautilus_menu_item_set_submenu(item, submenu); - nautilus_menu_append_item(menu, item); - - g_strfreev(suboptions); - g_object_unref(item); - g_object_unref(submenu); - g_string_free(new_action_string, TRUE); - } else { - NautilusMenuItem *item; - GString *new_action_string = g_string_new(old_action_string->str); - gboolean grayed_out = FALSE; - - g_string_append(new_action_string, verb); - - if (item_name[0] == '!') { - item_name++; - grayed_out = TRUE; - } - - item = nautilus_menu_item_new(new_action_string->str, item_name, item_inner, NULL); - - nautilus_menu_append_item(menu, item); - /* add the file metadata to this item */ - g_object_set_data_full (G_OBJECT(item), "nautilus_dropbox_files", - nautilus_file_info_list_copy (files), - (GDestroyNotify) nautilus_file_info_list_free); - /* add the verb metadata */ - g_object_set_data_full (G_OBJECT(item), "nautilus_dropbox_verb", - g_strdup(verb), - (GDestroyNotify) g_free); - g_signal_connect (item, "activate", G_CALLBACK (menu_item_cb), provider); - - if (grayed_out) { - GValue sensitive = { 0 }; - g_value_init (&sensitive, G_TYPE_BOOLEAN); - g_value_set_boolean (&sensitive, FALSE); - g_object_set_property (G_OBJECT(item), "sensitive", &sensitive); - } - - /* taken from nautilus-file-repairer (http://repairer.kldp.net/): - * this code is a workaround for a bug of nautilus - * See: http://bugzilla.gnome.org/show_bug.cgi?id=508878 */ - if (dropbox_use_nautilus_submenu_workaround) { - toret = g_list_append(toret, item); - } - - g_object_unref(item); - g_string_free(new_action_string, TRUE); - ret++; - } - g_strfreev(option_info); - } - return ret; -} - -static void -get_file_items_callback(GHashTable *response, gpointer ud) -{ - GAsyncQueue *reply_queue = ud; - - /* queue_push doesn't accept NULL as a value so we create an empty hash table - * if we got no response. */ - g_async_queue_push(reply_queue, response ? g_hash_table_ref(response) : - g_hash_table_new((GHashFunc) g_str_hash, (GEqualFunc) g_str_equal)); - g_async_queue_unref(reply_queue); -} - - -static GList * -nautilus_dropbox_get_file_items(NautilusMenuProvider *provider, - GtkWidget *window, - GList *files) -{ - /* - * 1. Convert files to filenames. - */ - int file_count = g_list_length(files); - - if (file_count < 1) - return NULL; - - gchar **paths = g_new0(gchar *, file_count + 1); - int i = 0; - GList* elem; - - for (elem = files; elem; elem = elem->next, i++) { - gchar *uri = nautilus_file_info_get_uri(elem->data); - gchar *filename_un = uri ? g_filename_from_uri(uri, NULL, NULL) : NULL; - gchar *filename = filename_un ? g_filename_to_utf8(filename_un, -1, NULL, NULL, NULL) : NULL; - - g_free(uri); - g_free(filename_un); - - if (filename == NULL) { - /* oooh, filename wasn't correctly encoded, or isn't a local file. */ - g_strfreev(paths); - return NULL; - } - - paths[i] = filename; - } - - GAsyncQueue *reply_queue = g_async_queue_new_full((GDestroyNotify)g_hash_table_unref); - - /* - * 2. Create a DropboxGeneralCommand to call "icon_overlay_context_options" - */ - - DropboxGeneralCommand *dgc = g_new0(DropboxGeneralCommand, 1); - dgc->dc.request_type = GENERAL_COMMAND; - dgc->command_name = g_strdup("icon_overlay_context_options"); - dgc->command_args = g_hash_table_new_full((GHashFunc) g_str_hash, - (GEqualFunc) g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) g_strfreev); - g_hash_table_insert(dgc->command_args, g_strdup("paths"), paths); - dgc->handler = get_file_items_callback; - dgc->handler_ud = g_async_queue_ref(reply_queue); - - /* - * 3. Queue it up for the helper thread to run it. - */ - NautilusDropbox *cvs = NAUTILUS_DROPBOX(provider); - dropbox_command_client_request(&(cvs->dc.dcc), (DropboxCommand *) dgc); - - GTimeVal gtv; - - /* - * 4. We have to block until it's done because nautilus expects a reply. But we will - * only block for 50 ms for a reply. - */ - - g_get_current_time(>v); - g_time_val_add(>v, 50000); - - GHashTable *context_options_response = g_async_queue_timed_pop(reply_queue, >v); - g_async_queue_unref(reply_queue); - - if (!context_options_response) { - return NULL; - } - - /* - * 5. Parse the reply. - */ - - char **options = g_hash_table_lookup(context_options_response, "options"); - GList *toret = NULL; - - if (options && *options && **options) { - /* build the menu */ - NautilusMenuItem *root_item; - NautilusMenu *root_menu; - - root_menu = nautilus_menu_new(); - root_item = nautilus_menu_item_new("NautilusDropbox::root_item", - "Dropbox", "Dropbox Options", "dropbox"); - - toret = g_list_append(toret, root_item); - GString *action_string = g_string_new("NautilusDropbox::"); - - if (!nautilus_dropbox_parse_menu(options, root_menu, action_string, - toret, provider, files)) { - g_object_unref(toret); - toret = NULL; - } - - nautilus_menu_item_set_submenu(root_item, root_menu); - - g_string_free(action_string, TRUE); - g_object_unref(root_menu); - } - - g_hash_table_unref(context_options_response); - - return toret; -} - -gboolean -add_emblem_paths(GHashTable* emblem_paths_response) -{ - /* Only run this on the main loop or you'll cause problems. */ - if (!emblem_paths_response) - return FALSE; - - gchar **emblem_paths_list; - int i; - - GtkIconTheme *theme = gtk_icon_theme_get_default(); - - if (emblem_paths_response && - (emblem_paths_list = g_hash_table_lookup(emblem_paths_response, "path"))) { - for (i = 0; emblem_paths_list[i] != NULL; i++) { - if (emblem_paths_list[i][0]) - gtk_icon_theme_append_search_path(theme, emblem_paths_list[i]); - } - } - g_hash_table_unref(emblem_paths_response); - return FALSE; -} - -gboolean -remove_emblem_paths(GHashTable* emblem_paths_response) -{ - /* Only run this on the main loop or you'll cause problems. */ - if (!emblem_paths_response) - return FALSE; - - gchar **emblem_paths_list = g_hash_table_lookup(emblem_paths_response, "path"); - if (!emblem_paths_list) - goto exit; - - // We need to remove the old paths. - GtkIconTheme * icon_theme = gtk_icon_theme_get_default(); - gchar ** paths; - gint path_count; - - gtk_icon_theme_get_search_path(icon_theme, &paths, &path_count); - - gint i, j, out = 0; - gboolean found = FALSE; - for (i = 0; i < path_count; i++) { - gboolean keep = TRUE; - for (j = 0; emblem_paths_list[j] != NULL; j++) { - if (emblem_paths_list[j][0]) { - if (!g_strcmp0(paths[i], emblem_paths_list[j])) { - found = TRUE; - keep = FALSE; - g_free(paths[i]); - break; - } - } - } - if (keep) { - paths[out] = paths[i]; - out++; - } - } - - /* If we found one we need to reset the path to - accomodate the changes */ - if (found) { - paths[out] = NULL; /* Clear the last one */ - gtk_icon_theme_set_search_path(icon_theme, (const gchar **)paths, out); - } - - g_strfreev(paths); -exit: - g_hash_table_unref(emblem_paths_response); - return FALSE; -} - -void get_emblem_paths_cb(GHashTable *emblem_paths_response, NautilusDropbox *cvs) -{ - if (!emblem_paths_response) { - emblem_paths_response = g_hash_table_new((GHashFunc) g_str_hash, - (GEqualFunc) g_str_equal); - g_hash_table_insert(emblem_paths_response, "path", DEFAULT_EMBLEM_PATHS); - } else { - /* Increase the ref so that finish_general_command doesn't delete it. */ - g_hash_table_ref(emblem_paths_response); - } - - g_mutex_lock(cvs->emblem_paths_mutex); - if (cvs->emblem_paths) { - g_idle_add((GSourceFunc) remove_emblem_paths, cvs->emblem_paths); - cvs->emblem_paths = NULL; - } - cvs->emblem_paths = emblem_paths_response; - g_mutex_unlock(cvs->emblem_paths_mutex); - - g_idle_add((GSourceFunc) add_emblem_paths, g_hash_table_ref(emblem_paths_response)); - g_idle_add((GSourceFunc) reset_all_files, cvs); -} - -static void -on_connect(NautilusDropbox *cvs) { - reset_all_files(cvs); - - dropbox_command_client_send_command(&(cvs->dc.dcc), - (NautilusDropboxCommandResponseHandler) get_emblem_paths_cb, - cvs, "get_emblem_paths", NULL); -} - -static void -on_disconnect(NautilusDropbox *cvs) { - reset_all_files(cvs); - - g_mutex_lock(cvs->emblem_paths_mutex); - /* This call will free the data too. */ - g_idle_add((GSourceFunc) remove_emblem_paths, cvs->emblem_paths); - cvs->emblem_paths = NULL; - g_mutex_unlock(cvs->emblem_paths_mutex); -} - - -static void -nautilus_dropbox_menu_provider_iface_init (NautilusMenuProviderIface *iface) { - iface->get_file_items = nautilus_dropbox_get_file_items; - return; -} - -static void -nautilus_dropbox_info_provider_iface_init (NautilusInfoProviderIface *iface) { - iface->update_file_info = nautilus_dropbox_update_file_info; - iface->cancel_update = nautilus_dropbox_cancel_update; - return; -} - -static void -nautilus_dropbox_instance_init (NautilusDropbox *cvs) { - cvs->filename2obj = g_hash_table_new_full((GHashFunc) g_str_hash, - (GEqualFunc) g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) NULL); - cvs->obj2filename = g_hash_table_new_full((GHashFunc) g_direct_hash, - (GEqualFunc) g_direct_equal, - (GDestroyNotify) NULL, - (GDestroyNotify) g_free); - cvs->emblem_paths_mutex = g_mutex_new(); - cvs->emblem_paths = NULL; - - /* setup the connection obj*/ - dropbox_client_setup(&(cvs->dc)); - - /* our hooks */ - nautilus_dropbox_hooks_add(&(cvs->dc.hookserv), "shell_touch", - (DropboxUpdateHook) handle_shell_touch, cvs); - - /* add connection handlers */ - dropbox_client_add_on_connect_hook(&(cvs->dc), - (DropboxClientConnectHook) on_connect, - cvs); - dropbox_client_add_on_disconnect_hook(&(cvs->dc), - (DropboxClientConnectHook) on_disconnect, - cvs); - - /* now start the connection */ - debug("about to start client connection"); - dropbox_client_start(&(cvs->dc)); - - return; -} - -static void -nautilus_dropbox_class_init (NautilusDropboxClass *class) { -} - -static void -nautilus_dropbox_class_finalize (NautilusDropboxClass *class) { - debug("just checking"); - /* kill threads here? */ -} - -GType -nautilus_dropbox_get_type (void) { - return dropbox_type; -} - -void -nautilus_dropbox_register_type (GTypeModule *module) { - static const GTypeInfo info = { - sizeof (NautilusDropboxClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) nautilus_dropbox_class_init, - (GClassFinalizeFunc) nautilus_dropbox_class_finalize, - NULL, - sizeof (NautilusDropbox), - 0, - (GInstanceInitFunc) nautilus_dropbox_instance_init, - }; - - static const GInterfaceInfo menu_provider_iface_info = { - (GInterfaceInitFunc) nautilus_dropbox_menu_provider_iface_init, - NULL, - NULL - }; - - static const GInterfaceInfo info_provider_iface_info = { - (GInterfaceInitFunc) nautilus_dropbox_info_provider_iface_init, - NULL, - NULL - }; - - dropbox_type = - g_type_module_register_type(module, - G_TYPE_OBJECT, - "NautilusDropbox", - &info, 0); - - g_type_module_add_interface (module, - dropbox_type, - NAUTILUS_TYPE_MENU_PROVIDER, - &menu_provider_iface_info); - - g_type_module_add_interface (module, - dropbox_type, - NAUTILUS_TYPE_INFO_PROVIDER, - &info_provider_iface_info); -} diff --git a/src/nautilus-dropbox.h b/src/nautilus-dropbox.h deleted file mode 100644 index 65734be..0000000 --- a/src/nautilus-dropbox.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2008 Evenflow, Inc. - * - * nautilus-dropbox.h - * Header file for nautilus-dropbox.c - * - * This file is part of nautilus-dropbox. - * - * nautilus-dropbox is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * nautilus-dropbox 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with nautilus-dropbox. If not, see . - * - */ - -#ifndef NAUTILUS_DROPBOX_H -#define NAUTILUS_DROPBOX_H - -#include -#include - -#include - -#include "dropbox-command-client.h" -#include "nautilus-dropbox-hooks.h" -#include "dropbox-client.h" - -G_BEGIN_DECLS - -/* Declarations for the dropbox extension object. This object will be - * instantiated by nautilus. It implements the GInterfaces - * exported by libnautilus. */ - -#define NAUTILUS_TYPE_DROPBOX (nautilus_dropbox_get_type ()) -#define NAUTILUS_DROPBOX(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NAUTILUS_TYPE_DROPBOX, NautilusDropbox)) -#define NAUTILUS_IS_DROPBOX(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NAUTILUS_TYPE_DROPBOX)) -typedef struct _NautilusDropbox NautilusDropbox; -typedef struct _NautilusDropboxClass NautilusDropboxClass; - -struct _NautilusDropbox { - GObject parent_slot; - GHashTable *filename2obj; - GHashTable *obj2filename; - GMutex *emblem_paths_mutex; - GHashTable *emblem_paths; - DropboxClient dc; -}; - -struct _NautilusDropboxClass { - GObjectClass parent_slot; -}; - -GType nautilus_dropbox_get_type(void); -void nautilus_dropbox_register_type(GTypeModule *module); - -extern gboolean dropbox_use_nautilus_submenu_workaround; -extern gboolean dropbox_use_operation_in_progress_workaround; - -G_END_DECLS - -#endif -- cgit v1.2.1