[Goodies-commits] r7634 - in thunar-vcs-plugin/trunk: . po thunar-vcs-plugin tvp-svn-helper
Peter de Ridder
peter at xfce.org
Sun Jun 28 14:10:01 CEST 2009
Author: peter
Date: 2009-06-28 12:10:01 +0000 (Sun, 28 Jun 2009)
New Revision: 7634
Added:
thunar-vcs-plugin/trunk/thunar-vcs-plugin/
thunar-vcs-plugin/trunk/thunar-vcs-plugin/thunar-vcs-plugin.c
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-provider.c
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-provider.h
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-action.c
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-action.h
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-backend.c
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-backend.h
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-property-page.c
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-property-page.h
thunar-vcs-plugin/trunk/tvp-svn-helper/
Removed:
thunar-vcs-plugin/trunk/thunar-svn-plugin/
thunar-vcs-plugin/trunk/thunar-vcs-plugin/thunar-svn-plugin.c
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tsp-provider.c
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tsp-provider.h
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tsp-svn-action.c
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tsp-svn-action.h
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tsp-svn-backend.c
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tsp-svn-backend.h
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tsp-svn-property-page.c
thunar-vcs-plugin/trunk/thunar-vcs-plugin/tsp-svn-property-page.h
thunar-vcs-plugin/trunk/tsp-svn-helper/
Modified:
thunar-vcs-plugin/trunk/Makefile.am
thunar-vcs-plugin/trunk/README
thunar-vcs-plugin/trunk/configure.ac.in
thunar-vcs-plugin/trunk/po/POTFILES.in
thunar-vcs-plugin/trunk/thunar-vcs-plugin/Makefile.am
thunar-vcs-plugin/trunk/tvp-svn-helper/Makefile.am
Log:
Renaming the thunar-svn-plugin to thunar-vcs-plugin.
Project files.
Modified: thunar-vcs-plugin/trunk/Makefile.am
===================================================================
--- thunar-vcs-plugin/trunk/Makefile.am 2009-06-28 11:35:06 UTC (rev 7633)
+++ thunar-vcs-plugin/trunk/Makefile.am 2009-06-28 12:10:01 UTC (rev 7634)
@@ -2,8 +2,8 @@
SUBDIRS = \
icons \
po \
- thunar-svn-plugin \
- tsp-svn-helper
+ thunar-vcs-plugin \
+ tvp-svn-helper
distclean-local:
rm -rf *.spec *.cache *~
Modified: thunar-vcs-plugin/trunk/README
===================================================================
--- thunar-vcs-plugin/trunk/README 2009-06-28 11:35:06 UTC (rev 7633)
+++ thunar-vcs-plugin/trunk/README 2009-06-28 12:10:01 UTC (rev 7634)
@@ -1,8 +1,8 @@
-About Thunar SVN Plugin
+About Thunar VCS Plugin
=======================
-The Thunar SVN Plugin adds Subversion actions to the context menu of thunar.
-This gives a SVN intergration to Thunar.
+The Thunar VCS Plugin adds Subversion actions to the context menu of thunar.
+This gives a VCS intergration to Thunar.
The current features are:
- Most of the svn action: add, checkout, cleanup, commit, copy, delete,
@@ -37,8 +37,8 @@
The file 'INSTALL' contains generic installation instructions. Make sure to
run ./configure --prefix=$(pkg-config --variable prefix thunarx-1) so Thunar
-can find the plugin. For more information, visit the thunar-svn-plugin website
-at http://goodies.xfce.org/projects/thunar-plugins/thunar-svn-plugin
+can find the plugin. For more information, visit the thunar-vcs-plugin website
+at http://goodies.xfce.org/projects/thunar-plugins/thunar-vcs-plugin
How to report bugs?
@@ -46,6 +46,6 @@
Bugs should be reported to the Xfce bug tracking system
(http://bugzilla.xfce.org, product Thunar Plugins, component
-thunar-svn-plugin). You will need to create an account for yourself.
+thunar-vcs-plugin). You will need to create an account for yourself.
# vi:set ts=2 sw=2 et ai nocindent textwidth=78:
Modified: thunar-vcs-plugin/trunk/configure.ac.in
===================================================================
--- thunar-vcs-plugin/trunk/configure.ac.in 2009-06-28 11:35:06 UTC (rev 7633)
+++ thunar-vcs-plugin/trunk/configure.ac.in 2009-06-28 12:10:01 UTC (rev 7634)
@@ -10,23 +10,23 @@
dnl ***************************
dnl *** Version information ***
dnl ***************************
-m4_define([tsp_version_major], [0])
-m4_define([tsp_version_minor], [0])
-m4_define([tsp_version_micro], [4])
-m4_define([tsp_version_build], [r at REVISION@])
-m4_define([tsp_version_tag], [svn]) # Leave empty for releases
-m4_define([tsp_version], [tsp_version_major().tsp_version_minor().tsp_version_micro()ifelse(tsp_version_tag(), [], [], [tsp_version_tag()-tsp_version_build()])])
+m4_define([tvp_version_major], [0])
+m4_define([tvp_version_minor], [0])
+m4_define([tvp_version_micro], [4])
+m4_define([tvp_version_build], [r at REVISION@])
+m4_define([tvp_version_tag], [svn]) # Leave empty for releases
+m4_define([tvp_version], [tvp_version_major().tvp_version_minor().tvp_version_micro()ifelse(tvp_version_tag(), [], [], [tvp_version_tag()-tvp_version_build()])])
dnl *******************************************
dnl *** Debugging support for SVN snapshots ***
dnl *******************************************
-m4_define([tsp_debug_default], [ifelse(tsp_version_tag(), [svn], [yes], [minimum])])
+m4_define([tvp_debug_default], [ifelse(tvp_version_tag(), [svn], [yes], [minimum])])
dnl ***************************
dnl *** Initialize autoconf ***
dnl ***************************
AC_COPYRIGHT([Copyright (c) 2006-2007 Peter de Ridder <peter at xfce.org>.])
-AC_INIT([thunar-svn-plugin], [tsp_version], [thunar-dev at xfce.org])
+AC_INIT([thunar-vcs-plugin], [tvp_version], [thunar-dev at xfce.org])
AC_PREFIX_DEFAULT([$(pkg-config --variable prefix thunarx-1 || echo /usr/local)])
AC_PREREQ([2.50])
AC_CANONICAL_TARGET()
@@ -102,8 +102,8 @@
dnl *** Check for debugging support ***
dnl ***********************************
AC_ARG_ENABLE([debug],
-AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes/full@:>@], [Turn on debugging @<:@default=tsp_debug_default@:>@]),
- [], [enable_debug=tsp_debug_default])
+AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes/full@:>@], [Turn on debugging @<:@default=tvp_debug_default@:>@]),
+ [], [enable_debug=tvp_debug_default])
AC_MSG_CHECKING([whether to enable debugging support])
if test x"$enable_debug" = x"full" -o x"$enable_debug" = x"yes"; then
dnl Check whether the compiler accepts the -fno-strict-aliasing
@@ -173,7 +173,7 @@
icons/24x24/Makefile
icons/48x48/Makefile
po/Makefile.in
-thunar-svn-plugin/Makefile
-tsp-svn-helper/Makefile
+thunar-vcs-plugin/Makefile
+tvp-svn-helper/Makefile
])
Modified: thunar-vcs-plugin/trunk/po/POTFILES.in
===================================================================
--- thunar-vcs-plugin/trunk/po/POTFILES.in 2009-06-28 11:35:06 UTC (rev 7633)
+++ thunar-vcs-plugin/trunk/po/POTFILES.in 2009-06-28 12:10:01 UTC (rev 7634)
@@ -1,41 +1,41 @@
-thunar-svn-plugin/thunar-svn-plugin.c
-thunar-svn-plugin/tsp-provider.c
-thunar-svn-plugin/tsp-svn-action.c
-thunar-svn-plugin/tsp-svn-property-page.c
-thunar-svn-plugin/tsp-svn-backend.c
-tsp-svn-helper/main.c
-tsp-svn-helper/tsh-add.c
-tsp-svn-helper/tsh-blame-dialog.c
-tsp-svn-helper/tsh-blame.c
-tsp-svn-helper/tsh-checkout.c
-tsp-svn-helper/tsh-cleanup.c
-tsp-svn-helper/tsh-commit.c
-tsp-svn-helper/tsh-common.c
-tsp-svn-helper/tsh-copy.c
-tsp-svn-helper/tsh-delete.c
-tsp-svn-helper/tsh-dialog-common.c
-tsp-svn-helper/tsh-export.c
-tsp-svn-helper/tsh-file-dialog.c
-tsp-svn-helper/tsh-file-selection-dialog.c
-tsp-svn-helper/tsh-import.c
-tsp-svn-helper/tsh-lock-dialog.c
-tsp-svn-helper/tsh-lock.c
-tsp-svn-helper/tsh-log-dialog.c
-tsp-svn-helper/tsh-log-message-dialog.c
-tsp-svn-helper/tsh-log.c
-tsp-svn-helper/tsh-login-dialog.c
-tsp-svn-helper/tsh-move.c
-tsp-svn-helper/tsh-notify-dialog.c
-tsp-svn-helper/tsh-properties-dialog.c
-tsp-svn-helper/tsh-properties.c
-tsp-svn-helper/tsh-relocate-dialog.c
-tsp-svn-helper/tsh-relocate.c
-tsp-svn-helper/tsh-resolved.c
-tsp-svn-helper/tsh-revert.c
-tsp-svn-helper/tsh-status-dialog.c
-tsp-svn-helper/tsh-status.c
-tsp-svn-helper/tsh-switch.c
-tsp-svn-helper/tsh-transfer-dialog.c
-tsp-svn-helper/tsh-trust-dialog.c
-tsp-svn-helper/tsh-unlock.c
-tsp-svn-helper/tsh-update.c
+thunar-vcs-plugin/thunar-vcs-plugin.c
+thunar-vcs-plugin/tvp-provider.c
+thunar-vcs-plugin/tvp-svn-action.c
+thunar-vcs-plugin/tvp-svn-property-page.c
+thunar-vcs-plugin/tvp-svn-backend.c
+tvp-svn-helper/main.c
+tvp-svn-helper/tsh-add.c
+tvp-svn-helper/tsh-blame-dialog.c
+tvp-svn-helper/tsh-blame.c
+tvp-svn-helper/tsh-checkout.c
+tvp-svn-helper/tsh-cleanup.c
+tvp-svn-helper/tsh-commit.c
+tvp-svn-helper/tsh-common.c
+tvp-svn-helper/tsh-copy.c
+tvp-svn-helper/tsh-delete.c
+tvp-svn-helper/tsh-dialog-common.c
+tvp-svn-helper/tsh-export.c
+tvp-svn-helper/tsh-file-dialog.c
+tvp-svn-helper/tsh-file-selection-dialog.c
+tvp-svn-helper/tsh-import.c
+tvp-svn-helper/tsh-lock-dialog.c
+tvp-svn-helper/tsh-lock.c
+tvp-svn-helper/tsh-log-dialog.c
+tvp-svn-helper/tsh-log-message-dialog.c
+tvp-svn-helper/tsh-log.c
+tvp-svn-helper/tsh-login-dialog.c
+tvp-svn-helper/tsh-move.c
+tvp-svn-helper/tsh-notify-dialog.c
+tvp-svn-helper/tsh-properties-dialog.c
+tvp-svn-helper/tsh-properties.c
+tvp-svn-helper/tsh-relocate-dialog.c
+tvp-svn-helper/tsh-relocate.c
+tvp-svn-helper/tsh-resolved.c
+tvp-svn-helper/tsh-revert.c
+tvp-svn-helper/tsh-status-dialog.c
+tvp-svn-helper/tsh-status.c
+tvp-svn-helper/tsh-switch.c
+tvp-svn-helper/tsh-transfer-dialog.c
+tvp-svn-helper/tsh-trust-dialog.c
+tvp-svn-helper/tsh-unlock.c
+tvp-svn-helper/tsh-update.c
Modified: thunar-vcs-plugin/trunk/thunar-vcs-plugin/Makefile.am
===================================================================
--- thunar-vcs-plugin/trunk/thunar-svn-plugin/Makefile.am 2009-06-28 11:35:06 UTC (rev 7633)
+++ thunar-vcs-plugin/trunk/thunar-vcs-plugin/Makefile.am 2009-06-28 12:10:01 UTC (rev 7634)
@@ -2,7 +2,7 @@
INCLUDES = \
-I$(top_builddir) \
-I$(top_srcdir) \
- -DG_LOG_DOMAIN=\"thunar-svn-plugin\" \
+ -DG_LOG_DOMAIN=\"thunar-vcs-plugin\" \
-DEXO_API_SUBJECT_TO_CHANGE \
-DLIBEXECDIR=\"$(libexecdir)\" \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
@@ -10,27 +10,27 @@
extensionsdir = $(libdir)/thunarx-1
extensions_LTLIBRARIES = \
- thunar-svn-plugin.la
+ thunar-vcs-plugin.la
-thunar_svn_plugin_la_SOURCES = \
- tsp-svn-backend.c \
- tsp-svn-backend.h \
- tsp-svn-action.c \
- tsp-svn-action.h \
- tsp-svn-property-page.c \
- tsp-svn-property-page.h \
- tsp-provider.c \
- tsp-provider.h \
- thunar-svn-plugin.c
+thunar_vcs_plugin_la_SOURCES = \
+ tvp-svn-backend.c \
+ tvp-svn-backend.h \
+ tvp-svn-action.c \
+ tvp-svn-action.h \
+ tvp-svn-property-page.c \
+ tvp-svn-property-page.h \
+ tvp-provider.c \
+ tvp-provider.h \
+ thunar-vcs-plugin.c
-thunar_svn_plugin_la_CFLAGS = \
+thunar_vcs_plugin_la_CFLAGS = \
$(PLATFORM_CFLAGS) \
$(THUNARX_CFLAGS) \
$(THUNAR_VFS_CFLAGS) \
$(APR_CFLAGS) \
- -DTSP_SVN_HELPER=\"$(libexecdir)/tsp-svn-helper\"
+ -DTVP_SVN_HELPER=\"$(libexecdir)/tvp-svn-helper\"
-thunar_svn_plugin_la_LDFLAGS = \
+thunar_vcs_plugin_la_LDFLAGS = \
-avoid-version \
-export-dynamic \
-module \
Copied: thunar-vcs-plugin/trunk/thunar-vcs-plugin/thunar-vcs-plugin.c (from rev 7633, thunar-vcs-plugin/trunk/thunar-svn-plugin/thunar-svn-plugin.c)
===================================================================
--- thunar-vcs-plugin/trunk/thunar-vcs-plugin/thunar-vcs-plugin.c (rev 0)
+++ thunar-vcs-plugin/trunk/thunar-vcs-plugin/thunar-vcs-plugin.c 2009-06-28 12:10:01 UTC (rev 7634)
@@ -0,0 +1,89 @@
+/*-
+ * Copyright (c) 2006 Peter de Ridder <peter at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <exo/exo.h>
+
+#include <thunar-vcs-plugin/tvp-provider.h>
+#include <thunar-vcs-plugin/tvp-svn-action.h>
+#include <thunar-vcs-plugin/tvp-svn-property-page.h>
+
+
+
+static GType type_list[1];
+
+
+
+G_MODULE_EXPORT void
+thunar_extension_initialize (ThunarxProviderPlugin *plugin)
+{
+ const gchar *mismatch;
+
+ /* verify that the thunarx versions are compatible */
+ mismatch = thunarx_check_version (THUNARX_MAJOR_VERSION, THUNARX_MINOR_VERSION, THUNARX_MICRO_VERSION);
+ if (G_UNLIKELY (mismatch != NULL))
+ {
+ g_warning ("Version mismatch: %s", mismatch);
+ return;
+ }
+
+ /* setup i18n support */
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+
+#ifdef G_ENABLE_DEBUG
+ g_message ("Initializing thunar-vcs-plugin extension");
+#endif
+
+ /* register the types provided by this plugin */
+ tvp_provider_register_type (plugin);
+ tvp_svn_action_register_type (plugin);
+ tvp_svn_property_page_register_type (plugin);
+
+ /* setup the plugin provider type list */
+ type_list[0] = TVP_TYPE_PROVIDER;
+}
+
+
+
+G_MODULE_EXPORT void
+thunar_extension_shutdown (void)
+{
+#ifdef G_ENABLE_DEBUG
+ g_message ("Shutting down thunar-vcs-plugin extension");
+#endif
+}
+
+
+
+G_MODULE_EXPORT void
+thunar_extension_list_types (const GType **types,
+ gint *n_types)
+{
+ *types = type_list;
+ *n_types = G_N_ELEMENTS (type_list);
+}
+
+
+
Copied: thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-provider.c (from rev 7633, thunar-vcs-plugin/trunk/thunar-svn-plugin/tsp-provider.c)
===================================================================
--- thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-provider.c (rev 0)
+++ thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-provider.c 2009-06-28 12:10:01 UTC (rev 7634)
@@ -0,0 +1,592 @@
+/*-
+ * Copyright (c) 2006 Peter de Ridder <peter at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <thunar-vfs/thunar-vfs.h>
+
+#include <subversion-1/svn_types.h>
+
+#include <thunar-vcs-plugin/tvp-svn-backend.h>
+#include <thunar-vcs-plugin/tvp-svn-action.h>
+#include <thunar-vcs-plugin/tvp-svn-property-page.h>
+#include <thunar-vcs-plugin/tvp-provider.h>
+
+/* use g_access() on win32 */
+#if defined(G_OS_WIN32)
+#include <glib/gstdio.h>
+#else
+#define g_access(filename, mode) access((filename), (mode))
+#endif
+
+
+#define TVP_SVN_WORKING_COPY "tvp-svn-working-copy"
+
+
+
+static void tvp_provider_class_init (TvpProviderClass *klass);
+static void tvp_provider_menu_provider_init (ThunarxMenuProviderIface *iface);
+static void tvp_provider_property_page_provider_init (ThunarxPropertyPageProviderIface *iface);
+static void tvp_provider_init (TvpProvider *tvp_provider);
+static void tvp_provider_finalize (GObject *object);
+static GList *tvp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
+ GtkWidget *window,
+ GList *files);
+static GList *tvp_provider_get_folder_actions (ThunarxMenuProvider *menu_provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder);
+static GList *tvp_provider_get_pages (ThunarxPropertyPageProvider *menu_provider,
+ GList *files);
+static void tvp_new_process (TvpSvnAction *action,
+ const GPid *pid,
+ const gchar *path,
+ TvpProvider *tvp_provider);
+
+
+
+typedef struct
+{
+ GPid pid;
+ guint watch_id;
+ gchar *path;
+ TvpProvider *provider;
+} TvpChildWatch;
+
+struct _TvpProviderClass
+{
+ GObjectClass __parent__;
+};
+
+struct _TvpProvider
+{
+ GObject __parent__;
+
+ TvpChildWatch *child_watch;
+
+#if !GTK_CHECK_VERSION(2,9,0)
+ /* GTK+ 2.9.0 and above provide an icon-name property
+ * for GtkActions, so we don't need the icon factory.
+ */
+ GtkIconFactory *icon_factory;
+#endif
+};
+
+
+
+//static GQuark tvp_action_files_quark;
+//static GQuark tvp_action_provider_quark;
+
+
+
+THUNARX_DEFINE_TYPE_WITH_CODE (TvpProvider,
+ tvp_provider,
+ G_TYPE_OBJECT,
+ THUNARX_IMPLEMENT_INTERFACE (THUNARX_TYPE_MENU_PROVIDER,
+ tvp_provider_menu_provider_init)
+ THUNARX_IMPLEMENT_INTERFACE (THUNARX_TYPE_PROPERTY_PAGE_PROVIDER,
+ tvp_provider_property_page_provider_init));
+
+
+static void
+tvp_provider_class_init (TvpProviderClass *klass)
+{
+ GObjectClass *gobject_class;
+
+ /* determine the "tvp-action-files", "tvp-action-folder" and "tvp-action-provider" quarks */
+ //tvp_action_files_quark = g_quark_from_string ("tvp-action-files");
+ //tvp_action_provider_quark = g_quark_from_string ("tvp-action-provider");
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = tvp_provider_finalize;
+}
+
+
+
+static void
+tvp_provider_menu_provider_init (ThunarxMenuProviderIface *iface)
+{
+ iface->get_file_actions = tvp_provider_get_file_actions;
+ iface->get_folder_actions = tvp_provider_get_folder_actions;
+}
+
+
+
+static void
+tvp_provider_property_page_provider_init (ThunarxPropertyPageProviderIface *iface)
+{
+ iface->get_pages = tvp_provider_get_pages;
+}
+
+
+
+static void
+tvp_provider_init (TvpProvider *tvp_provider)
+{
+#if !GTK_CHECK_VERSION(2,9,0)
+ GtkIconSource *icon_source;
+ GtkIconSet *icon_set;
+
+ /* setup our icon factory */
+ tvp_provider->icon_factory = gtk_icon_factory_new ();
+ gtk_icon_factory_add_default (tvp_provider->icon_factory);
+
+ /* add the "subversion" stock icon */
+ icon_set = gtk_icon_set_new ();
+ icon_source = gtk_icon_source_new ();
+ gtk_icon_source_set_icon_name (icon_source, "subversion");
+ gtk_icon_set_add_source (icon_set, icon_source);
+ gtk_icon_factory_add (tvp_provider->icon_factory, "subversion", icon_set);
+ gtk_icon_source_free (icon_source);
+ gtk_icon_set_unref (icon_set);
+#endif /* !GTK_CHECK_VERSION(2,9,0) */
+
+ tvp_svn_backend_init();
+}
+
+
+
+static void
+tvp_provider_finalize (GObject *object)
+{
+ TvpProvider *tvp_provider = TVP_PROVIDER (object);
+
+ if (tvp_provider->child_watch)
+ {
+ GSource *source = g_main_context_find_source_by_id (NULL, tvp_provider->child_watch->watch_id);
+ g_source_set_callback (source, (GSourceFunc) g_spawn_close_pid, NULL, NULL);
+ }
+
+#if !GTK_CHECK_VERSION(2,9,0)
+ /* release our icon factory */
+ gtk_icon_factory_remove_default (tvp_provider->icon_factory);
+ g_object_unref (G_OBJECT (tvp_provider->icon_factory));
+#endif
+
+ tvp_svn_backend_free();
+
+ (*G_OBJECT_CLASS (tvp_provider_parent_class)->finalize) (object);
+}
+
+
+
+static gboolean
+tvp_is_working_copy (ThunarxFileInfo *file_info)
+{
+ gboolean result = FALSE;
+ gchar *filename;
+ gchar *uri;
+
+ /* determine the URI for the file info */
+ uri = thunarx_file_info_get_uri (file_info);
+ if (G_LIKELY (uri != NULL))
+ {
+ /* determine the local filename for the URI */
+ filename = g_filename_from_uri (uri, NULL, NULL);
+ if (G_LIKELY (filename != NULL))
+ {
+ /* check if the folder is a working copy */
+ result = tvp_svn_backend_is_working_copy (filename);
+
+ /* release the filename */
+ g_free (filename);
+ }
+
+ /* release the URI */
+ g_free (uri);
+ }
+
+ return result;
+}
+
+
+
+static gboolean
+tvp_is_parent_working_copy (ThunarxFileInfo *file_info)
+{
+ gboolean result = FALSE;
+ gchar *filename;
+ gchar *uri;
+
+ /* determine the parent URI for the file info */
+ uri = thunarx_file_info_get_parent_uri (file_info);
+ if (G_LIKELY (uri != NULL))
+ {
+ /* determine the local filename for the URI */
+ filename = g_filename_from_uri (uri, NULL, NULL);
+ if (G_LIKELY (filename != NULL))
+ {
+ /* check if the folder is a working copy */
+ result = tvp_svn_backend_is_working_copy (filename);
+
+ /* release the filename */
+ g_free (filename);
+ }
+
+ /* release the URI */
+ g_free (uri);
+ }
+
+ return result;
+}
+
+
+
+static GSList *
+tvp_get_parent_status (ThunarxFileInfo *file_info)
+{
+ GSList *result = NULL;
+ gchar *filename;
+ gchar *uri;
+
+ /* determine the parent URI for the file info */
+ uri = thunarx_file_info_get_parent_uri (file_info);
+ if (G_LIKELY (uri != NULL))
+ {
+ /* determine the local filename for the URI */
+ filename = g_filename_from_uri (uri, NULL, NULL);
+ if (G_LIKELY (filename != NULL))
+ {
+ /* check if the folder is a working copy */
+ result = tvp_svn_backend_get_status (filename);
+
+ /* release the filename */
+ g_free (filename);
+ }
+
+ /* release the URI */
+ g_free (uri);
+ }
+
+ return result;
+}
+
+
+
+gint
+tvp_compare_filename (const gchar *uri1, const gchar *uri2)
+{
+ /* strip the "file://" part of the uri */
+ if (strncmp (uri1, "file://", 7) == 0)
+ {
+ uri1 += 7;
+ }
+
+ /* strip the "file://" part of the uri */
+ if (strncmp (uri2, "file://", 7) == 0)
+ {
+ uri2 += 7;
+ }
+
+ gchar *path1 = g_strdup (uri1);
+ gchar *path2 = g_strdup (uri2);
+
+ /* remove trailing '/' */
+ if (path1[strlen (path1) - 1] == '/')
+ {
+ path1[strlen (path1) - 1] = '\0';
+ }
+
+ /* remove trailing '/'*/
+ if (path2[strlen (path2) - 1] == '/')
+ {
+ path2[strlen (path2) - 1] = '\0';
+ }
+
+ gint result = strcmp (path1, path2);
+
+ g_free (path1);
+ g_free (path2);
+
+ return result;
+}
+
+
+
+static gint
+tvp_compare_path (TvpSvnFileStatus *file_status, ThunarxFileInfo *file_info)
+{
+ gint result = 1;
+ gchar *filename;
+ gchar *uri;
+
+ /* determine the parent URI for the file info */
+ uri = thunarx_file_info_get_uri (file_info);
+ if (G_LIKELY (uri != NULL))
+ {
+ /* determine the local filename for the URI */
+ filename = g_filename_from_uri (uri, NULL, NULL);
+ if (G_LIKELY (filename != NULL))
+ {
+ /* check if the folder is a working copy */
+ result = tvp_compare_filename (file_status->path, filename);
+
+ /* release the filename */
+ g_free (filename);
+ }
+
+ /* release the URI */
+ g_free (uri);
+ }
+
+ return result;
+}
+
+
+
+static GList*
+tvp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
+ GtkWidget *window,
+ GList *files)
+{
+ ThunarVfsPathScheme scheme;
+ ThunarVfsInfo *info;
+ gboolean parent_wc = FALSE;
+ gboolean directory_is_wc = FALSE;
+ gboolean directory_is_not_wc = FALSE;
+ gboolean file_is_vc = FALSE;
+ gboolean file_is_not_vc = FALSE;
+ GtkAction *action;
+ GList *actions = NULL;
+ GList *lp;
+ gint n_files = 0;
+ GSList *file_status;
+ GSList *iter;
+
+ file_status = tvp_get_parent_status (files->data);
+
+ /* check all supplied files */
+ for (lp = files; lp != NULL; lp = lp->next, ++n_files)
+ {
+ /* check if the file is a local file */
+ info = thunarx_file_info_get_vfs_info (lp->data);
+ scheme = thunar_vfs_path_get_scheme (info->path);
+ thunar_vfs_info_unref (info);
+
+ /* unable to handle non-local files */
+ if (G_UNLIKELY (scheme != THUNAR_VFS_PATH_SCHEME_FILE))
+ return NULL;
+
+ /* check if the parent folder is a working copy */
+ if (!parent_wc && tvp_is_parent_working_copy (lp->data))
+ parent_wc = TRUE;
+
+ if (thunarx_file_info_is_directory (lp->data))
+ {
+ if (tvp_is_working_copy (lp->data))
+ {
+ directory_is_wc = TRUE;
+ //g_object_set_data(lp->data, TVP_SVN_WORKING_COPY, GINT_TO_POINTER(TRUE));
+ }
+ else
+ {
+ directory_is_not_wc = TRUE;
+ //g_object_set_data(lp->data, TVP_SVN_WORKING_COPY, GINT_TO_POINTER(FALSE));
+ }
+ }
+ else
+ {
+ for (iter = file_status; iter; iter = iter->next)
+ {
+ if (!tvp_compare_path (iter->data, lp->data))
+ {
+ if (TVP_SVN_FILE_STATUS (iter->data)->flag.version_control)
+ {
+ file_is_vc = TRUE;
+ }
+ else
+ {
+ file_is_not_vc = TRUE;
+ }
+ break;
+ }
+ }
+ if(!iter)
+ file_is_not_vc = TRUE;
+ }
+ }
+
+ /* append the svn submenu action */
+ action = tvp_svn_action_new ("Tvp::svn", _("SVN"), files, window, FALSE, parent_wc, directory_is_wc, directory_is_not_wc, file_is_vc, file_is_not_vc);
+ g_signal_connect(action, "new-process", G_CALLBACK(tvp_new_process), menu_provider);
+ actions = g_list_append (actions, action);
+
+ return actions;
+}
+
+
+
+static GList*
+tvp_provider_get_folder_actions (ThunarxMenuProvider *menu_provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder)
+{
+ GtkAction *action;
+ GList *actions = NULL;
+ ThunarVfsPathScheme scheme;
+ ThunarVfsInfo *info;
+ GList *files;
+
+ /* check if the file is a local file */
+ info = thunarx_file_info_get_vfs_info (folder);
+ scheme = thunar_vfs_path_get_scheme (info->path);
+ thunar_vfs_info_unref (info);
+
+ /* unable to handle non-local files */
+ if (G_UNLIKELY (scheme != THUNAR_VFS_PATH_SCHEME_FILE))
+ return NULL;
+
+ files = g_list_append (NULL, folder);
+
+ /* Lets see if we are dealing with a working copy */
+ action = tvp_svn_action_new ("Tvp::svn", _("SVN"), files, window, TRUE, tvp_is_working_copy (folder), FALSE, FALSE, FALSE, FALSE);
+ g_signal_connect(action, "new-process", G_CALLBACK(tvp_new_process), menu_provider);
+ /* append the svn submenu action */
+ actions = g_list_append (actions, action);
+
+ g_list_free (files);
+
+ return actions;
+}
+
+
+
+static GList*
+tvp_provider_get_pages (ThunarxPropertyPageProvider *page_provider, GList *files)
+{
+ GList *pages = NULL;
+ if (g_list_length (files) == 1)
+ {
+ gboolean is_vc = FALSE;
+ ThunarVfsPathScheme scheme;
+ ThunarVfsInfo *info;
+
+ /* check if the file is a local file */
+ info = thunarx_file_info_get_vfs_info (files->data);
+ scheme = thunar_vfs_path_get_scheme (info->path);
+ thunar_vfs_info_unref (info);
+
+ /* unable to handle non-local files */
+ if (G_UNLIKELY (scheme != THUNAR_VFS_PATH_SCHEME_FILE))
+ return NULL;
+
+ if (thunarx_file_info_is_directory (files->data))
+ {
+ /* Lets see if we are dealing with a working copy */
+ if (tvp_is_working_copy (files->data))
+ {
+ is_vc = TRUE;
+ }
+ }
+ else
+ {
+ GSList *file_status;
+ GSList *iter;
+
+ file_status = tvp_get_parent_status (files->data);
+
+ for (iter = file_status; iter; iter = iter->next)
+ {
+ if (!tvp_compare_path (iter->data, files->data))
+ {
+ if (TVP_SVN_FILE_STATUS (iter->data)->flag.version_control)
+ {
+ is_vc = TRUE;
+ }
+ break;
+ }
+ }
+ }
+ if(is_vc)
+ {
+ pages = g_list_prepend (pages, tvp_svn_property_page_new (files->data));
+ }
+ }
+ return pages;
+}
+
+
+
+static void
+tvp_child_watch (GPid pid, gint status, gpointer data)
+{
+ gchar *watch_path = data;
+
+ if (G_LIKELY (data))
+ {
+ GDK_THREADS_ENTER ();
+
+ ThunarVfsPath *path = thunar_vfs_path_new (watch_path, NULL);
+
+ if (G_LIKELY (path))
+ {
+ ThunarVfsMonitor *monitor = thunar_vfs_monitor_get_default ();
+ thunar_vfs_monitor_feed (monitor, THUNAR_VFS_MONITOR_EVENT_CHANGED, path);
+ g_object_unref (G_OBJECT (monitor));
+ thunar_vfs_path_unref (path);
+ }
+
+ GDK_THREADS_LEAVE ();
+
+ //this is done by destroy callback
+ //g_free (watch_path);
+ }
+
+ g_spawn_close_pid (pid);
+}
+
+
+
+static void
+tvp_child_watch_free (TvpChildWatch *watch)
+{
+ if (watch->provider->child_watch == watch)
+ watch->provider->child_watch = NULL;
+ g_free(watch->path);
+ g_free(watch);
+}
+
+
+
+static void
+tvp_new_process (TvpSvnAction *action, const GPid *pid, const gchar *path, TvpProvider *tvp_provider)
+{
+ TvpChildWatch *watch;
+ if (tvp_provider->child_watch)
+ {
+ GSource *source = g_main_context_find_source_by_id (NULL, tvp_provider->child_watch->watch_id);
+ g_source_set_callback (source, (GSourceFunc) g_spawn_close_pid, NULL, NULL);
+ }
+ watch = g_new(TvpChildWatch, 1);
+ watch->pid = *pid;
+ watch->path = g_strdup (path);
+ watch->provider = tvp_provider;
+ watch->watch_id = g_child_watch_add_full (G_PRIORITY_LOW, *pid, tvp_child_watch, watch, (GDestroyNotify)tvp_child_watch_free);
+ tvp_provider->child_watch = watch;
+}
+
Copied: thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-provider.h (from rev 7633, thunar-vcs-plugin/trunk/thunar-svn-plugin/tsp-provider.h)
===================================================================
--- thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-provider.h (rev 0)
+++ thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-provider.h 2009-06-28 12:10:01 UTC (rev 7634)
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2006 Peter de Ridder <peter at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __TVP_PROVIDER_H__
+#define __TVP_PROVIDER_H__
+
+#include <thunarx/thunarx.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _TvpProviderClass TvpProviderClass;
+typedef struct _TvpProvider TvpProvider;
+
+#define TVP_TYPE_PROVIDER (tvp_provider_get_type ())
+#define TVP_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TVP_TYPE_PROVIDER, TvpProvider))
+#define TVP_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TVP_TYPE_PROVIDER, TvpProviderClass))
+#define TVP_IS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TVP_TYPE_PROVIDER))
+#define TVP_IS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TVP_TYPE_PROVIDER))
+#define TVP_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TVP_TYPE_PROVIDER, TvpProviderClass))
+
+GType tvp_provider_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
+void tvp_provider_register_type (ThunarxProviderPlugin *plugin) G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* !__TVP_PROVIDER_H__ */
Copied: thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-action.c (from rev 7633, thunar-vcs-plugin/trunk/thunar-svn-plugin/tsp-svn-action.c)
===================================================================
--- thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-action.c (rev 0)
+++ thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-action.c 2009-06-28 12:10:01 UTC (rev 7634)
@@ -0,0 +1,589 @@
+/*-
+ * Copyright (c) 2006 Peter de Ridder <peter at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <thunarx/thunarx.h>
+
+#include <thunar-vfs/thunar-vfs.h>
+
+#include <thunar-vcs-plugin/tvp-svn-action.h>
+
+#include <string.h>
+
+#include <sys/wait.h>
+
+
+
+static void tsh_cclosure_marshal_VOID__POINTER_STRING (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data);
+
+
+
+struct _TvpSvnActionClass
+{
+ GtkActionClass __parent__;
+};
+
+
+
+struct _TvpSvnAction
+{
+ GtkAction __parent__;
+
+ struct {
+ unsigned is_parent : 1;
+ unsigned parent_version_control : 1;
+ unsigned directory_version_control : 1;
+ unsigned directory_no_version_control : 1;
+ unsigned file_version_control : 1;
+ unsigned file_no_version_control : 1;
+ } property;
+
+ GList *files;
+ GtkWidget *window;
+};
+
+
+
+enum {
+ PROPERTY_IS_PARENT = 1,
+ PROPERTY_PARENT_VERSION_CONTROL,
+ PROPERTY_DIRECTORY_VERSION_CONTROL,
+ PROPERTY_DIRECTORY_NO_VERSION_CONTROL,
+ PROPERTY_FILE_VERSION_CONTROL,
+ PROPERTY_FILE_NO_VERSION_CONTROL
+};
+
+
+
+enum {
+ SIGNAL_NEW_PROCESS = 0,
+ SIGNAL_COUNT
+};
+
+
+
+static guint action_signal[SIGNAL_COUNT];
+
+
+
+static GtkWidget *tvp_svn_action_create_menu_item (GtkAction *action);
+
+
+
+static void tvp_svn_action_finalize (GObject*);
+
+static void tvp_svn_action_set_property (GObject*, guint, const GValue*, GParamSpec*);
+
+
+static GQuark tvp_action_arg_quark = 0;
+
+
+static void tvp_action_exec (GtkAction *item, TvpSvnAction *tvp_action);
+
+static void tvp_action_unimplemented (GtkAction *, const gchar *);
+
+
+
+THUNARX_DEFINE_TYPE (TvpSvnAction, tvp_svn_action, GTK_TYPE_ACTION)
+
+
+
+static void
+tvp_svn_action_class_init (TvpSvnActionClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GtkActionClass *gtkaction_class = GTK_ACTION_CLASS (klass);
+
+ gobject_class->finalize = tvp_svn_action_finalize;
+ gobject_class->set_property = tvp_svn_action_set_property;
+
+ gtkaction_class->create_menu_item = tvp_svn_action_create_menu_item;
+
+ g_object_class_install_property (gobject_class, PROPERTY_IS_PARENT,
+ g_param_spec_boolean ("is-parent", "", "", FALSE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
+
+ g_object_class_install_property (gobject_class, PROPERTY_PARENT_VERSION_CONTROL,
+ g_param_spec_boolean ("parent-version-control", "", "", FALSE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
+
+ g_object_class_install_property (gobject_class, PROPERTY_DIRECTORY_VERSION_CONTROL,
+ g_param_spec_boolean ("directory-version-control", "", "", FALSE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
+
+ g_object_class_install_property (gobject_class, PROPERTY_DIRECTORY_NO_VERSION_CONTROL,
+ g_param_spec_boolean ("directory-no-version-control", "", "", FALSE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
+
+ g_object_class_install_property (gobject_class, PROPERTY_FILE_VERSION_CONTROL,
+ g_param_spec_boolean ("file-version-control", "", "", FALSE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
+
+ g_object_class_install_property (gobject_class, PROPERTY_FILE_NO_VERSION_CONTROL,
+ g_param_spec_boolean ("file-no-version-control", "", "", FALSE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
+
+ action_signal[SIGNAL_NEW_PROCESS] = g_signal_new("new-process", G_OBJECT_CLASS_TYPE(gobject_class), G_SIGNAL_RUN_FIRST,
+ 0, NULL, NULL, tsh_cclosure_marshal_VOID__POINTER_STRING, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_STRING);
+
+ tvp_action_arg_quark = g_quark_from_static_string ("tvp-action-arg");
+}
+
+
+
+static void
+tvp_svn_action_init (TvpSvnAction *self)
+{
+ self->property.is_parent = 0;
+ self->property.parent_version_control = 0;
+ self->property.directory_version_control = 0;
+ self->property.directory_no_version_control = 0;
+ self->property.file_version_control = 0;
+ self->property.file_no_version_control = 0;
+ self->files = NULL;
+ self->window = NULL;
+}
+
+
+
+GtkAction *
+tvp_svn_action_new (const gchar *name,
+ const gchar *label,
+ GList *files,
+ GtkWidget *window,
+ gboolean is_parent,
+ gboolean parent_version_control,
+ gboolean directory_version_control,
+ gboolean directory_no_version_control,
+ gboolean file_version_control,
+ gboolean file_no_version_control)
+{
+ g_return_val_if_fail(name, NULL);
+ g_return_val_if_fail(label, NULL);
+
+ GtkAction *action = g_object_new (TVP_TYPE_SVN_ACTION,
+ "hide-if-empty", FALSE,
+ "name", name,
+ "label", label,
+ "is-parent", is_parent,
+ "parent-version-control", parent_version_control,
+ "directory-version-control", directory_version_control,
+ "directory-no-version-control", directory_no_version_control,
+ "file-version-control", file_version_control,
+ "file-no-version-control", file_no_version_control,
+#if !GTK_CHECK_VERSION(2,9,0)
+ "stock-id", "subversion",
+#else
+ "icon-name", "subversion",
+#endif
+ NULL);
+ TVP_SVN_ACTION (action)->files = thunarx_file_info_list_copy (files);
+// TVP_SVN_ACTION (action)->window = gtk_widget_ref (window);
+ TVP_SVN_ACTION (action)->window = window;
+ return action;
+}
+
+
+
+static void
+tvp_svn_action_finalize (GObject *object)
+{
+ thunarx_file_info_list_free (TVP_SVN_ACTION (object)->files);
+ TVP_SVN_ACTION (object)->files = NULL;
+// gtk_widget_unref (TVP_SVN_ACTION (object)->window);
+ TVP_SVN_ACTION (object)->window = NULL;
+
+ G_OBJECT_CLASS (tvp_svn_action_parent_class)->finalize (object);
+}
+
+
+
+static void
+tvp_svn_action_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ switch (property_id)
+ {
+ case PROPERTY_IS_PARENT:
+ TVP_SVN_ACTION (object)->property.is_parent = g_value_get_boolean (value)?1:0;
+ break;
+ case PROPERTY_PARENT_VERSION_CONTROL:
+ TVP_SVN_ACTION (object)->property.parent_version_control = g_value_get_boolean (value)?1:0;
+ break;
+ case PROPERTY_DIRECTORY_VERSION_CONTROL:
+ TVP_SVN_ACTION (object)->property.directory_version_control = g_value_get_boolean (value)?1:0;
+ break;
+ case PROPERTY_DIRECTORY_NO_VERSION_CONTROL:
+ TVP_SVN_ACTION (object)->property.directory_no_version_control = g_value_get_boolean (value)?1:0;
+ break;
+ case PROPERTY_FILE_VERSION_CONTROL:
+ TVP_SVN_ACTION (object)->property.file_version_control = g_value_get_boolean (value)?1:0;
+ break;
+ case PROPERTY_FILE_NO_VERSION_CONTROL:
+ TVP_SVN_ACTION (object)->property.file_no_version_control = g_value_get_boolean (value)?1:0;
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void
+add_subaction (GtkAction *action, GtkMenuShell *menu, const gchar *name, const gchar *text, const gchar *tooltip, const gchar *stock, gchar *arg)
+{
+ GtkAction *subaction;
+ GtkWidget *subitem;
+
+ subaction = gtk_action_new (name, text, tooltip, stock);
+ g_object_set_qdata (G_OBJECT (subaction), tvp_action_arg_quark, arg);
+ g_signal_connect_after (subaction, "activate", G_CALLBACK (tvp_action_exec), action);
+
+ subitem = gtk_action_create_menu_item (subaction);
+ g_object_get (G_OBJECT (subaction), "tooltip", &tooltip, NULL);
+ gtk_widget_set_tooltip_text(subitem, tooltip);
+ gtk_menu_shell_append (menu, subitem);
+ gtk_widget_show(subitem);
+}
+
+
+static void
+add_subaction_u (GtkMenuShell *menu, const gchar *name, const gchar *text, const gchar *tooltip, const gchar *stock, gchar *arg)
+{
+ GtkAction *subaction;
+ GtkWidget *subitem;
+
+ subaction = gtk_action_new (name, text, tooltip, stock);
+ g_signal_connect_after (subaction, "activate", G_CALLBACK (tvp_action_unimplemented), arg);
+
+ subitem = gtk_action_create_menu_item (subaction);
+ g_object_get (G_OBJECT (subaction), "tooltip", &tooltip, NULL);
+ gtk_widget_set_tooltip_text(subitem, tooltip);
+ gtk_menu_shell_append (menu, subitem);
+ gtk_widget_show(subitem);
+}
+
+
+static GtkWidget *
+tvp_svn_action_create_menu_item (GtkAction *action)
+{
+ GtkWidget *item;
+ GtkWidget *menu;
+ TvpSvnAction *tvp_action = TVP_SVN_ACTION (action);
+
+ item = GTK_ACTION_CLASS(tvp_svn_action_parent_class)->create_menu_item (action);
+
+ menu = gtk_menu_new ();
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
+ /* No version control */
+ if (!tvp_action->property.is_parent && tvp_action->property.parent_version_control && (tvp_action->property.directory_no_version_control || tvp_action->property.file_no_version_control))
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::add", Q_("Menu|Add"), _("Add"), GTK_STOCK_ADD, "--add");
+ }
+ /* Version control (file) */
+ if (tvp_action->property.file_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::blame", Q_("Menu|Blame"), _("Blame"), GTK_STOCK_INDEX, "--blame");
+ }
+/* No need
+ subitem = gtk_menu_item_new_with_label (_("Cat"));
+ g_signal_connect_after (subitem, "activate", G_CALLBACK (tvp_action_unimplemented), "Cat");
+ g_object_get (G_OBJECT (subaction), "tooltip", &tooltip, NULL);
+ gtk_widget_set_tooltip_text(subitem, tooltip);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), subitem);
+ gtk_widget_show(subitem);
+*//* Version control (file) */
+ if (tvp_action->property.file_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::changelist", Q_("Menu|Changelist"), _("Changelist"), GTK_STOCK_INDEX, "--changelist");
+ }
+ /* No version control (parent) */
+ if (tvp_action->property.is_parent && !tvp_action->property.parent_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::checkout", Q_("Menu|Checkout"), _("Checkout"), GTK_STOCK_CONNECT, "--checkout");
+ }
+ /* Version control (parent) */
+ if (tvp_action->property.is_parent && tvp_action->property.parent_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::cleanup", Q_("Menu|Cleanup"), _("Cleanup"), GTK_STOCK_CLEAR, "--cleanup");
+ }
+ /* Version control (all) */
+ if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::commit", Q_("Menu|Commit"), _("Commit"), GTK_STOCK_APPLY, "--commit");
+ }
+ /* Version control (no parent) */
+ if (!tvp_action->property.is_parent && tvp_action->property.parent_version_control && (tvp_action->property.directory_version_control || tvp_action->property.file_version_control))
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::copy", Q_("Menu|Copy"), _("Copy"), GTK_STOCK_COPY, "--copy");
+ }
+ /* Version control (no parent) */
+ if (!tvp_action->property.is_parent && tvp_action->property.parent_version_control && (tvp_action->property.directory_version_control || tvp_action->property.file_version_control))
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::delete", Q_("Menu|Delete"), _("Delete"), GTK_STOCK_DELETE, "--delete");
+ }
+ /* Version control (file) */
+ if (tvp_action->property.file_version_control)
+ {
+ add_subaction_u (GTK_MENU_SHELL (menu), "tvp::diff", Q_("Menu|Diff"), _("Diff"), GTK_STOCK_FIND_AND_REPLACE, _("Diff"));
+ }
+ /* Version control and No version control (parent) */
+ if (tvp_action->property.is_parent || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::export", Q_("Menu|Export"), _("Export"), GTK_STOCK_SAVE, "--export");
+ }
+ /* No version control (all) */
+ if (!tvp_action->property.parent_version_control && (tvp_action->property.is_parent || tvp_action->property.directory_no_version_control || tvp_action->property.file_no_version_control))
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::import", Q_("Menu|Import"), _("Import"), GTK_STOCK_NETWORK, "--import");
+ }
+ /* Version control (all) */
+ if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
+ {
+ add_subaction_u (GTK_MENU_SHELL (menu), "tvp::info", Q_("Menu|Info"), _("Info"), GTK_STOCK_INFO, _("Info"));
+ }
+/* Ehmm...
+ subitem = gtk_menu_item_new_with_label (_("List"));
+ g_signal_connect_after (subitem, "activate", G_CALLBACK (tvp_action_unimplemented), "List");
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), subitem);
+ gtk_widget_show(subitem);
+*//* Version control (all) */
+ if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::lock", Q_("Menu|Lock"), _("Lock"), GTK_STOCK_DIALOG_AUTHENTICATION, "--lock");
+ }
+ /* Version control (all) */
+ if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::log", Q_("Menu|Log"), _("Log"), GTK_STOCK_INDEX, "--log");
+ }
+/* Ehmm ...
+ subitem = gtk_menu_item_new_with_label (_("Merge"));
+ g_signal_connect_after (subitem, "activate", G_CALLBACK (tvp_action_unimplemented), "Merge");
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), subitem);
+ gtk_widget_show(subitem);
+*//* No need
+ subitem = gtk_menu_item_new_with_label (_("Make Dir"));
+ g_signal_connect_after (subitem, "activate", G_CALLBACK (tvp_action_unimplemented), "Make Dir");
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), subitem);
+ gtk_widget_show(subitem);
+*//* Version control (no parent) */
+ if (!tvp_action->property.is_parent && tvp_action->property.parent_version_control && (tvp_action->property.directory_version_control || tvp_action->property.file_version_control))
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::move", Q_("Menu|Move"), _("Move"), GTK_STOCK_DND_MULTIPLE, "--move");
+ }
+/* Merged
+ subitem = gtk_menu_item_new_with_label (_("Delete Properties"));
+ subitem = gtk_menu_item_new_with_label (_("Edit Properties"));
+ subitem = gtk_menu_item_new_with_label (_("Get Properties"));
+ subitem = gtk_menu_item_new_with_label (_("List Properties"));
+ subitem = gtk_menu_item_new_with_label (_("Set Properties"));
+*//* Version control */
+ if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::properties", Q_("Menu|Edit Properties"), _("Edit Properties"), GTK_STOCK_EDIT, "--properties");
+ }
+ /* Version control (parent) */
+ if (tvp_action->property.is_parent && tvp_action->property.parent_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::relocate", Q_("Menu|Relocate"), _("Relocate"), GTK_STOCK_FIND_AND_REPLACE, "--relocate");
+ }
+/* Changed
+ subitem = gtk_menu_item_new_with_label (_("Mark Resolved"));
+*/if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::resolved", Q_("Menu|Resolved"), _("Resolved"), GTK_STOCK_YES, "--resolved");
+ }/*
+*//* Version control (file) */
+ if (tvp_action->property.file_version_control)
+ {
+ add_subaction_u (GTK_MENU_SHELL (menu), "tvp::resolve", Q_("Menu|Resolve"), _("Resolve"), GTK_STOCK_YES, _("Resolve"));
+ }
+ /* Version control (all) */
+ if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::revert", Q_("Menu|Revert"), _("Revert"), GTK_STOCK_UNDO, "--revert");
+ }
+ /* Version control (all) */
+ if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::status", Q_("Menu|Status"), _("Status"), GTK_STOCK_DIALOG_INFO, "--status");
+ }
+ /* Version control (parent) */
+ if (tvp_action->property.is_parent && tvp_action->property.parent_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::switch", Q_("Menu|Switch"), _("Switch"), GTK_STOCK_JUMP_TO, "--switch");
+ }
+ /* Version control (all) */
+ if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::unlock", Q_("Menu|Unlock"), _("Unlock"), NULL, "--unlock");
+ }
+ /* Version control (all) */
+ if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
+ {
+ add_subaction (action, GTK_MENU_SHELL (menu), "tvp::update", Q_("Menu|Update"), _("Update"), GTK_STOCK_REFRESH, "--update");
+ }
+
+ return item;
+}
+
+
+
+static void tvp_action_unimplemented (GtkAction *item, const gchar *tvp_action)
+{
+ GtkWidget *dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, _("Action %s is unimplemented"), tvp_action);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy(dialog);
+}
+
+
+
+static void tvp_action_exec (GtkAction *item, TvpSvnAction *tvp_action)
+{
+ guint size, i;
+ gchar **argv;
+ GList *iter;
+ gchar *uri;
+ gchar *filename;
+ gchar *file;
+ gchar *watch_path = NULL;
+ gint pid;
+ GError *error = NULL;
+ GdkScreen *screen = gtk_window_get_screen (GTK_WINDOW (tvp_action->window));
+
+ iter = tvp_action->files;
+
+ size = g_list_length (iter);
+
+ argv = g_new (gchar *, size + 3);
+
+ argv[0] = g_strdup (TVP_SVN_HELPER);
+ argv[1] = g_strdup (g_object_get_qdata (G_OBJECT (item), tvp_action_arg_quark));
+ argv[size + 2] = NULL;
+
+ if(iter)
+ {
+ if(tvp_action->property.is_parent)
+ {
+ uri = thunarx_file_info_get_uri (iter->data);
+ watch_path = g_filename_from_uri (uri, NULL, NULL);
+ g_free (uri);
+ }
+ else
+ {
+ uri = thunarx_file_info_get_parent_uri (iter->data);
+ watch_path = g_filename_from_uri (uri, NULL, NULL);
+ g_free (uri);
+ }
+ }
+
+ for (i = 0; i < size; i++)
+ {
+ /* determine the URI for the file info */
+ uri = thunarx_file_info_get_uri (iter->data);
+ if (G_LIKELY (uri != NULL))
+ {
+ /* determine the local filename for the URI */
+ filename = g_filename_from_uri (uri, NULL, NULL);
+ if (G_LIKELY (filename != NULL))
+ {
+ file = filename;
+ /* strip the "file://" part of the uri */
+ if (strncmp (file, "file://", 7) == 0)
+ {
+ file += 7;
+ }
+
+ file = g_strdup (file);
+
+ /* remove trailing '/' cause svn can't handle that */
+ if (file[strlen (file) - 1] == '/')
+ {
+ file[strlen (file) - 1] = '\0';
+ }
+
+ argv[i+2] = file;
+
+ /* release the filename */
+ g_free (filename);
+ }
+
+ /* release the URI */
+ g_free (uri);
+ }
+
+ iter = g_list_next (iter);
+ }
+ pid = 0;
+ if (!gdk_spawn_on_screen (screen, NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, &error))
+ {
+ GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (tvp_action->window), GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Could not spawn \'" TVP_SVN_HELPER "\'");
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s.", error->message);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ g_error_free (error);
+ }
+ else
+ {
+ g_signal_emit(tvp_action, action_signal[SIGNAL_NEW_PROCESS], 0, &pid, watch_path);
+ }
+ g_free (watch_path);
+ g_strfreev (argv);
+}
+
+
+
+static void
+tsh_cclosure_marshal_VOID__POINTER_STRING (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef void (*TshMarshalFunc_VOID__POINTER_STRING) (gpointer data1,
+ gconstpointer arg_1,
+ gconstpointer arg_2,
+ gpointer data2);
+ register TshMarshalFunc_VOID__POINTER_STRING callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+
+ g_return_if_fail (n_param_values == 3);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (TshMarshalFunc_VOID__POINTER_STRING) (marshal_data ? marshal_data : cc->callback);
+
+ callback (data1,
+ g_value_get_pointer (param_values + 1),
+ g_value_get_string (param_values + 2),
+ data2);
+}
+
Copied: thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-action.h (from rev 7633, thunar-vcs-plugin/trunk/thunar-svn-plugin/tsp-svn-action.h)
===================================================================
--- thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-action.h (rev 0)
+++ thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-action.h 2009-06-28 12:10:01 UTC (rev 7634)
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 2006 Peter de Ridder <peter at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __TVP_SVN_ACTION_H__
+#define __TVP_SVN_ACTION_H__
+
+#include <gtk/gtk.h>
+#include <thunarx/thunarx.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _TvpSvnActionClass TvpSvnActionClass;
+typedef struct _TvpSvnAction TvpSvnAction;
+
+#define TVP_TYPE_SVN_ACTION (tvp_svn_action_get_type ())
+#define TVP_SVN_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TVP_TYPE_SVN_ACTION, TvpSvnAction))
+#define TVP_SVN_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TVP_TYPE_SVN_ACTION, TvpSvnActionClass))
+#define TVP_IS_SVN_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TVP_TYPE_SVN_ACTION))
+#define TVP_IS_SVN_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TVP_TYPE_SVN_ACTION))
+#define TVP_SVN_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TVP_TYPE_SVN_ACTION, TvpSvnActionClass))
+
+GType tvp_svn_action_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
+void tvp_svn_action_register_type (ThunarxProviderPlugin *) G_GNUC_INTERNAL;
+
+GtkAction *tvp_svn_action_new (const gchar*,
+ const gchar*,
+ GList *,
+ GtkWidget *,
+ gboolean,
+ gboolean,
+ gboolean,
+ gboolean,
+ gboolean,
+ gboolean) G_GNUC_MALLOC G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* !__TVP_SVN_ACTION_H__ */
Copied: thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-backend.c (from rev 7633, thunar-vcs-plugin/trunk/thunar-svn-plugin/tsp-svn-backend.c)
===================================================================
--- thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-backend.c (rev 0)
+++ thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-backend.c 2009-06-28 12:10:01 UTC (rev 7634)
@@ -0,0 +1,330 @@
+/*-
+ * Copyright (c) 2006 Peter de Ridder <peter at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+#include <subversion-1/svn_cmdline.h>
+#include <subversion-1/svn_client.h>
+#include <subversion-1/svn_pools.h>
+#include <subversion-1/svn_fs.h>
+
+#include <thunar-vcs-plugin/tvp-svn-backend.h>
+
+
+
+static apr_pool_t *pool = NULL;
+static svn_client_ctx_t *ctx = NULL;
+
+
+gboolean
+tvp_svn_backend_init ()
+{
+ if (pool)
+ return TRUE;
+
+ svn_error_t *err;
+
+ if (svn_cmdline_init (NULL, NULL) == EXIT_FAILURE)
+ return FALSE;
+
+ /* Create top-level memory pool */
+ pool = svn_pool_create (NULL);
+
+ /* Initialize the FS library */
+ err = svn_fs_initialize (pool);
+ if(err)
+ {
+ svn_error_clear (err);
+ return FALSE;
+ }
+
+ /* Make sure the ~/.subversion run-time config files exist */
+ err = svn_config_ensure (NULL, pool);
+ if(err)
+ {
+ svn_error_clear (err);
+ return FALSE;
+ }
+
+#ifdef G_OS_WIN32
+ /* Set the working copy administrative directory name */
+ if (getenv ("SVN_ASP_DOT_NET_HACK"))
+ {
+ err = svn_wc_set_adm_dir ("_svn", pool);
+ if(err)
+ {
+ svn_error_clear (err);
+ return FALSE;
+ }
+ }
+#endif
+
+ err = svn_client_create_context (&ctx, pool);
+ if(err)
+ {
+ svn_error_clear (err);
+ return FALSE;
+ }
+
+ err = svn_config_get_config (&(ctx->config), NULL, pool);
+ if(err)
+ {
+ svn_error_clear (err);
+ return FALSE;
+ }
+
+ /* We are ready now */
+
+ return TRUE;
+}
+
+
+
+void
+tvp_svn_backend_free ()
+{
+ if (pool)
+ svn_pool_destroy (pool);
+}
+
+
+
+gboolean
+tvp_svn_backend_is_working_copy (const gchar *uri)
+{
+ apr_pool_t *subpool;
+ svn_error_t *err;
+ int wc_format;
+
+ /* strip the "file://" part of the uri */
+ if (strncmp (uri, "file://", 7) == 0)
+ {
+ uri += 7;
+ }
+
+ gchar *path = g_strdup (uri);
+
+ /* remove trailing '/' cause svn_wc_check_wc can't handle that */
+ if (path[strlen (path) - 1] == '/')
+ {
+ path[strlen (path) - 1] = '\0';
+ }
+
+ subpool = svn_pool_create (pool);
+
+ /* check for the path is a working copy */
+ err = svn_wc_check_wc (path, &wc_format, subpool);
+
+ svn_pool_destroy (subpool);
+
+ g_free (path);
+
+ /* if an error occured or wc_format in not set it is no working copy */
+ if(err || !wc_format)
+ {
+ svn_error_clear (err);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+
+static void
+status_callback2 (void *baton, const char *path, svn_wc_status2_t *status)
+{
+ GSList **list = baton;
+ TvpSvnFileStatus *entry = g_new (TvpSvnFileStatus, 1);
+
+ entry->path = g_strdup (path);
+ switch (status->text_status)
+ {
+ case svn_wc_status_normal:
+ case svn_wc_status_added:
+ case svn_wc_status_missing:
+ case svn_wc_status_deleted:
+ case svn_wc_status_replaced:
+ case svn_wc_status_modified:
+ case svn_wc_status_merged:
+ case svn_wc_status_conflicted:
+ case svn_wc_status_incomplete:
+ entry->flag.version_control = 1;
+ break;
+ default:
+ entry->flag.version_control = 0;
+ break;
+ }
+
+ *list = g_slist_prepend (*list, entry);
+}
+
+
+static svn_error_t *
+status_callback3 (void *baton, const char *path, svn_wc_status2_t *status, apr_pool_t *pool)
+{
+ status_callback2(baton, path, status);
+ return SVN_NO_ERROR;
+}
+
+
+
+GSList *
+tvp_svn_backend_get_status (const gchar *uri)
+{
+ apr_pool_t *subpool;
+ svn_error_t *err;
+ svn_opt_revision_t revision = {svn_opt_revision_working};
+ GSList *list = NULL;
+
+ /* strip the "file://" part of the uri */
+ if (strncmp (uri, "file://", 7) == 0)
+ {
+ uri += 7;
+ }
+
+ gchar *path = g_strdup (uri);
+
+ /* remove trailing '/' cause svn_client_status2 can't handle that */
+ if (path[strlen (path) - 1] == '/')
+ {
+ path[strlen (path) - 1] = '\0';
+ }
+
+ subpool = svn_pool_create (pool);
+
+ /* get the status of all files in the directory */
+#if CHECK_SVN_VERSION(1,5)
+ err = svn_client_status3 (NULL, path, &revision, status_callback2, &list, svn_depth_immediates, TRUE, FALSE, TRUE, TRUE, NULL, ctx, subpool);
+#else /* CHECK_SVN_VERSION(1,6) */
+ err = svn_client_status4 (NULL, path, &revision, status_callback3, &list, svn_depth_immediates, TRUE, FALSE, TRUE, TRUE, NULL, ctx, subpool);
+#endif
+
+ svn_pool_destroy (subpool);
+
+ g_free (path);
+
+ if (err)
+ {
+ GSList *iter;
+ for (iter = list; iter; iter = iter->next)
+ {
+ g_free (iter->data);
+ }
+ g_slist_free (list);
+ svn_error_clear (err);
+ return NULL;
+ }
+
+ return list;
+}
+
+
+
+static svn_error_t *
+info_callback (void *baton, const char *path, const svn_info_t *info, apr_pool_t *pool)
+{
+ TvpSvnInfo **pinfo = baton;
+ g_return_val_if_fail (*pinfo == NULL, SVN_NO_ERROR);
+
+ *pinfo = g_new0 (TvpSvnInfo, 1);
+ (*pinfo)->path = g_strdup (path);
+ (*pinfo)->url = g_strdup (info->URL);
+ (*pinfo)->revision = info->rev;
+ (*pinfo)->repository = g_strdup (info->repos_root_URL);
+ (*pinfo)->modrev = info->last_changed_rev;
+ apr_ctime (((*pinfo)->moddate = g_new0(gchar, APR_CTIME_LEN)), info->last_changed_date);
+ (*pinfo)->modauthor = g_strdup (info->last_changed_author);
+ if (((*pinfo)->has_wc_info = info->has_wc_info))
+ {
+ (*pinfo)->changelist = g_strdup (info->changelist);
+ (*pinfo)->depth = info->depth;
+ }
+
+ return SVN_NO_ERROR;
+}
+
+
+
+TvpSvnInfo *
+tvp_svn_backend_get_info (const gchar *uri)
+{
+ apr_pool_t *subpool;
+ svn_error_t *err;
+ svn_opt_revision_t revision = {svn_opt_revision_unspecified};
+ TvpSvnInfo *info = NULL;
+
+ /* strip the "file://" part of the uri */
+ if (strncmp (uri, "file://", 7) == 0)
+ {
+ uri += 7;
+ }
+
+ gchar *path = g_strdup (uri);
+
+ /* remove trailing '/' cause svn_client_info can't handle that */
+ if (path[strlen (path) - 1] == '/')
+ {
+ path[strlen (path) - 1] = '\0';
+ }
+
+ subpool = svn_pool_create (pool);
+
+ /* get svn info for this file or directory */
+ err = svn_client_info2 (path, &revision, &revision, info_callback, &info, svn_depth_empty, NULL, ctx, subpool);
+
+ svn_pool_destroy (subpool);
+
+ g_free (path);
+
+ if (err)
+ {
+ tvp_svn_info_free (info);
+ svn_error_clear (err);
+ return NULL;
+ }
+
+ return info;
+}
+
+
+
+void
+tvp_svn_info_free (TvpSvnInfo *info)
+{
+ if (!info)
+ return;
+
+ g_free (info->path);
+ g_free (info->url);
+ g_free (info->repository);
+ g_free (info->moddate);
+ g_free (info->modauthor);
+ if(info->has_wc_info)
+ {
+ g_free (info->changelist);
+ }
+
+ g_free (info);
+}
+
Copied: thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-backend.h (from rev 7633, thunar-vcs-plugin/trunk/thunar-svn-plugin/tsp-svn-backend.h)
===================================================================
--- thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-backend.h (rev 0)
+++ thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-backend.h 2009-06-28 12:10:01 UTC (rev 7634)
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (c) 2006 Peter de Ridder <peter at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __TVP_SVN_BACKEND_H__
+#define __TVP_SVN_BACKEND_H__
+
+G_BEGIN_DECLS;
+
+typedef struct
+{
+ gchar *path;
+ struct {
+ unsigned version_control : 1;
+ } flag;
+} TvpSvnFileStatus;
+
+#define TVP_SVN_FILE_STATUS(p) ((TvpSvnFileStatus*)p)
+
+typedef struct
+{
+ gchar *path;
+ gchar *url;
+ svn_revnum_t revision;
+ gchar *repository;
+ svn_revnum_t modrev;
+ gchar *moddate;
+ gchar *modauthor;
+ gboolean has_wc_info;
+ gchar *changelist;
+ svn_depth_t depth;
+} TvpSvnInfo;
+
+#define TVP_SVN_INFO(p) ((TvpSvnInfo*)p)
+
+gboolean tvp_svn_backend_init();
+void tvp_svn_backend_free();
+
+gboolean tvp_svn_backend_is_working_copy (const gchar *uri);
+
+GSList *tvp_svn_backend_get_status (const gchar *uri);
+
+TvpSvnInfo *tvp_svn_backend_get_info (const gchar *uri);
+
+void tvp_svn_info_free (TvpSvnInfo *info);
+
+#define CHECK_SVN_VERSION(major, minor) ((major == SVN_VER_MAJOR) && (minor == SVN_VER_MINOR))
+
+G_END_DECLS;
+
+#endif /* !__TVP_SVN_BACKEND_H__ */
Copied: thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-property-page.c (from rev 7633, thunar-vcs-plugin/trunk/thunar-svn-plugin/tsp-svn-property-page.c)
===================================================================
--- thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-property-page.c (rev 0)
+++ thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-property-page.c 2009-06-28 12:10:01 UTC (rev 7634)
@@ -0,0 +1,423 @@
+/*-
+ * Copyright (c) 2006 Peter de Ridder <peter at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <thunarx/thunarx.h>
+
+#include <thunar-vfs/thunar-vfs.h>
+
+#include <subversion-1/svn_types.h>
+
+#include <thunar-vcs-plugin/tvp-svn-backend.h>
+#include <thunar-vcs-plugin/tvp-svn-property-page.h>
+
+#include <string.h>
+
+
+
+struct _TvpSvnPropertyPageClass
+{
+ ThunarxPropertyPageClass __parent__;
+};
+
+
+
+struct _TvpSvnPropertyPage
+{
+ ThunarxPropertyPage __parent__;
+
+ ThunarxFileInfo *file;
+ GtkWidget *url;
+ GtkWidget *revision;
+ GtkWidget *repository;
+ GtkWidget *modrev;
+ GtkWidget *moddate;
+ GtkWidget *modauthor;
+ GtkWidget *changelist;
+ GtkWidget *depth;
+};
+
+
+
+enum {
+ PROPERTY_FILE = 1
+};
+
+
+
+static void tvp_svn_property_page_finalize (GObject*);
+
+static void tvp_svn_property_page_set_property (GObject*, guint, const GValue*, GParamSpec*);
+
+static void tvp_svn_property_page_get_property (GObject*, guint, GValue*, GParamSpec*);
+
+
+
+THUNARX_DEFINE_TYPE (TvpSvnPropertyPage, tvp_svn_property_page, THUNARX_TYPE_PROPERTY_PAGE)
+
+
+
+static void
+tvp_svn_property_page_class_init (TvpSvnPropertyPageClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->finalize = tvp_svn_property_page_finalize;
+ gobject_class->set_property = tvp_svn_property_page_set_property;
+ gobject_class->get_property = tvp_svn_property_page_get_property;
+
+ g_object_class_install_property (gobject_class, PROPERTY_FILE,
+ g_param_spec_object ("file", "file", "file", THUNARX_TYPE_FILE_INFO, G_PARAM_READWRITE));
+}
+
+
+
+static void
+tvp_svn_property_page_init (TvpSvnPropertyPage *self)
+{
+ GtkWidget *table;
+ GtkWidget *label;
+ GtkWidget *spacer;
+ PangoAttrList *attr_list;
+ PangoAttribute *attribute;
+
+ attribute = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
+ /* allocate a new attribute list */
+ attr_list = pango_attr_list_new ();
+
+ /* add all specified attributes */
+ attribute->start_index = 0;
+ attribute->end_index = -1;
+ pango_attr_list_insert (attr_list, attribute);
+
+ gtk_container_set_border_width (GTK_CONTAINER (self), 12);
+
+ table = gtk_table_new (9, 2, FALSE);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+
+ label = gtk_label_new (_("URL:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f);
+ gtk_label_set_attributes (GTK_LABEL (label), attr_list);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ self->url = label = gtk_label_new(_("Unknown"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_START);
+ gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ label = gtk_label_new (_("Revision:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f);
+ gtk_label_set_attributes (GTK_LABEL (label), attr_list);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ self->revision = label = gtk_label_new(_("Unknown"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_table_attach (GTK_TABLE (table), label, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ label = gtk_label_new (_("Repository:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f);
+ gtk_label_set_attributes (GTK_LABEL (label), attr_list);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ self->repository = label = gtk_label_new(_("Unknown"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
+ gtk_table_attach (GTK_TABLE (table), label, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ /* Alignment in the most simple widget to find, for just doing a size request */
+ spacer = g_object_new (GTK_TYPE_ALIGNMENT, "height-request", 12, NULL);
+ gtk_table_attach (GTK_TABLE (table), spacer, 0, 2, 3, 4, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (spacer);
+
+ label = gtk_label_new (_("Modified revision:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f);
+ gtk_label_set_attributes (GTK_LABEL (label), attr_list);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ self->modrev = label = gtk_label_new(_("Unknown"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_table_attach (GTK_TABLE (table), label, 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ label = gtk_label_new (_("Modified date:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f);
+ gtk_label_set_attributes (GTK_LABEL (label), attr_list);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ self->moddate = label = gtk_label_new(_("Unknown"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
+ gtk_table_attach (GTK_TABLE (table), label, 1, 2, 5, 6, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ label = gtk_label_new (_("Author:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f);
+ gtk_label_set_attributes (GTK_LABEL (label), attr_list);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 6, 7, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ self->modauthor = label = gtk_label_new(_("Unknown"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_table_attach (GTK_TABLE (table), label, 1, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ /* Alignment in the most simple widget to find, for just doing a size request */
+ spacer = g_object_new (GTK_TYPE_ALIGNMENT, "height-request", 12, NULL);
+ gtk_table_attach (GTK_TABLE (table), spacer, 0, 2, 7, 8, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (spacer);
+
+ label = gtk_label_new (_("Changelist:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f);
+ gtk_label_set_attributes (GTK_LABEL (label), attr_list);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 8, 9, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ self->changelist = label = gtk_label_new("");
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_table_attach (GTK_TABLE (table), label, 1, 2, 8, 9, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ /* Translators: Depth as in depth of recursion */
+ label = gtk_label_new (_("Depth:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f);
+ gtk_label_set_attributes (GTK_LABEL (label), attr_list);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 9, 10, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ self->depth = label = gtk_label_new(_("Unknown"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_table_attach (GTK_TABLE (table), label, 1, 2, 9, 10, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ /*TODO: kind, repos UUID, lock
+ * wc info: size, schedule, copy from, text time, prop time, checksum, confilct, prejfile, working size */
+
+ gtk_container_add (GTK_CONTAINER (self), table);
+ gtk_widget_show (GTK_WIDGET (table));
+}
+
+
+
+GtkAction *
+tvp_svn_property_page_new (ThunarxFileInfo *file)
+{
+ GtkAction *action = g_object_new (TVP_TYPE_SVN_PROPERTY_PAGE,
+ "label", "Subversion",
+ "file", file,
+ NULL);
+ return action;
+}
+
+
+
+static void
+tvp_svn_property_page_finalize (GObject *object)
+{
+ tvp_svn_property_page_set_file (TVP_SVN_PROPERTY_PAGE (object), NULL);
+
+ G_OBJECT_CLASS (tvp_svn_property_page_parent_class)->finalize (object);
+}
+
+
+
+static void
+tvp_svn_property_page_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ switch (property_id)
+ {
+ case PROPERTY_FILE:
+ tvp_svn_property_page_set_file (TVP_SVN_PROPERTY_PAGE (object), g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+
+static void
+tvp_svn_property_page_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ switch (property_id)
+ {
+ case PROPERTY_FILE:
+ g_value_set_object (value, tvp_svn_property_page_get_file (TVP_SVN_PROPERTY_PAGE (object)));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+
+const gchar *
+depth_to_string(svn_depth_t depth)
+{
+ const gchar *depth_string;
+
+ switch(depth)
+ {
+ default:
+ case svn_depth_unknown:
+ depth_string = _("Unknown");
+ break;
+ case svn_depth_exclude:
+ /* Translators: svn recursion depth infotmation
+ * Exclude should not apear client side
+ */
+ depth_string = _("Exclude");
+ break;
+ case svn_depth_empty:
+ /* Translators: svn recursion depth infotmation
+ * Empty depth means only this file/direcotry is checked out
+ */
+ depth_string = _("Empty");
+ break;
+ case svn_depth_files:
+ /* Translators: svn recursion depth infotmation
+ * Files depth means this file/direcotry and all of it's files are checked out
+ */
+ depth_string = _("Files");
+ break;
+ case svn_depth_immediates:
+ /* Translators: svn recursion depth infotmation
+ * Immediates depth means this file/direcotry and all of it's files and subdirectories are checked out
+ */
+ depth_string = _("Immediates");
+ break;
+ case svn_depth_infinity:
+ /* Translators: svn recursion depth infotmation
+ * Infinity depth means this file/direcotry is checked out with full recursion
+ */
+ depth_string = _("Infinity");
+ break;
+ }
+ return depth_string;
+}
+
+
+
+static void
+tvp_svn_property_page_file_changed (ThunarxFileInfo *file, TvpSvnPropertyPage *page)
+{
+ TvpSvnInfo *info = NULL;
+ gchar *filename;
+ gchar *uri;
+
+ /* determine the parent URI for the file info */
+ uri = thunarx_file_info_get_uri (file);
+ if (G_LIKELY (uri != NULL))
+ {
+ /* determine the local filename for the URI */
+ filename = g_filename_from_uri (uri, NULL, NULL);
+ if (G_LIKELY (filename != NULL))
+ {
+ /* check if the folder is a working copy */
+ info = tvp_svn_backend_get_info (filename);
+
+ /* release the filename */
+ g_free (filename);
+ }
+
+ /* release the URI */
+ g_free (uri);
+ }
+
+ if (info)
+ {
+ gchar *tmpstr;
+ gtk_label_set_text (GTK_LABEL (page->url), info->url);
+ tmpstr = g_strdup_printf ("%"SVN_REVNUM_T_FMT, info->revision);
+ gtk_label_set_text (GTK_LABEL (page->revision), tmpstr);
+ g_free (tmpstr);
+ gtk_label_set_text (GTK_LABEL (page->repository), info->repository);
+ tmpstr = g_strdup_printf ("%"SVN_REVNUM_T_FMT, info->modrev);
+ gtk_label_set_text (GTK_LABEL (page->modrev), tmpstr);
+ g_free (tmpstr);
+ gtk_label_set_text (GTK_LABEL (page->moddate), info->moddate);
+ gtk_label_set_text (GTK_LABEL (page->modauthor), info->modauthor);
+ if(info->has_wc_info)
+ {
+ if(info->changelist)
+ gtk_label_set_text (GTK_LABEL (page->changelist), info->changelist);
+ if(info->depth)
+ gtk_label_set_text (GTK_LABEL (page->depth), depth_to_string(info->depth));
+ }
+
+ tvp_svn_info_free (info);
+ }
+}
+
+
+
+void
+tvp_svn_property_page_set_file (TvpSvnPropertyPage *page, ThunarxFileInfo *file)
+{
+ g_return_if_fail (TVP_IS_SVN_PROPERTY_PAGE (page));
+ g_return_if_fail (file == NULL || THUNARX_IS_FILE_INFO (file));
+
+ if (page->file != NULL)
+ {
+ g_signal_handlers_disconnect_by_func (page->file, tvp_svn_property_page_file_changed, page);
+ g_object_unref (G_OBJECT (page->file));
+ }
+
+ page->file = file;
+
+ if (file != NULL)
+ {
+ g_object_ref (file);
+ tvp_svn_property_page_file_changed (file, page);
+ g_signal_connect (file, "changed", G_CALLBACK (tvp_svn_property_page_file_changed), page);
+ }
+
+ g_object_notify (G_OBJECT (page), "file");
+}
+
+
+
+ThunarxFileInfo*
+tvp_svn_property_page_get_file (TvpSvnPropertyPage *page)
+{
+ g_return_val_if_fail (TVP_IS_SVN_PROPERTY_PAGE (page), NULL);
+ return page->file;
+}
+
Copied: thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-property-page.h (from rev 7633, thunar-vcs-plugin/trunk/thunar-svn-plugin/tsp-svn-property-page.h)
===================================================================
--- thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-property-page.h (rev 0)
+++ thunar-vcs-plugin/trunk/thunar-vcs-plugin/tvp-svn-property-page.h 2009-06-28 12:10:01 UTC (rev 7634)
@@ -0,0 +1,47 @@
+/*-
+ * Copyright (c) 2006 Peter de Ridder <peter at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __TVP_SVN_PROPERTY_PAGE_H__
+#define __TVP_SVN_PROPERTY_PAGE_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _TvpSvnPropertyPageClass TvpSvnPropertyPageClass;
+typedef struct _TvpSvnPropertyPage TvpSvnPropertyPage;
+
+#define TVP_TYPE_SVN_PROPERTY_PAGE (tvp_svn_property_page_get_type ())
+#define TVP_SVN_PROPERTY_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TVP_TYPE_SVN_PROPERTY_PAGE, TvpSvnPropertyPage))
+#define TVP_SVN_PROPERTY_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TVP_TYPE_SVN_PROPERTY_PAGE, TvpSvnPropertyPageClass))
+#define TVP_IS_SVN_PROPERTY_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TVP_TYPE_SVN_PROPERTY_PAGE))
+#define TVP_IS_SVN_PROPERTY_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TVP_TYPE_SVN_PROPERTY_PAGE))
+#define TVP_SVN_PROPERTY_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TVP_TYPE_SVN_PROPERTY_PAGE, TvpSvnPropertyPageClass))
+
+GType tvp_svn_property_page_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
+void tvp_svn_property_page_register_type (ThunarxProviderPlugin *) G_GNUC_INTERNAL;
+
+GtkAction *tvp_svn_property_page_new (ThunarxFileInfo *) G_GNUC_MALLOC G_GNUC_INTERNAL;
+
+ThunarxFileInfo *tvp_svn_property_page_get_file (TvpSvnPropertyPage *) G_GNUC_INTERNAL;
+void tvp_svn_property_page_set_file (TvpSvnPropertyPage *, ThunarxFileInfo *) G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* !__TVP_SVN_PROPERTY_PAGE_H__ */
Modified: thunar-vcs-plugin/trunk/tvp-svn-helper/Makefile.am
===================================================================
--- thunar-vcs-plugin/trunk/tsp-svn-helper/Makefile.am 2009-06-28 11:35:06 UTC (rev 7633)
+++ thunar-vcs-plugin/trunk/tvp-svn-helper/Makefile.am 2009-06-28 12:10:01 UTC (rev 7634)
@@ -10,9 +10,9 @@
$(PLATFORM_CPPFLAGS)
libexec_PROGRAMS = \
- tsp-svn-helper
+ tvp-svn-helper
-tsp_svn_helper_SOURCES = \
+tvp_svn_helper_SOURCES = \
main.c \
tsh-common.h \
tsh-common.c \
@@ -85,10 +85,10 @@
tsh-trust-dialog.h \
tsh-trust-dialog.c
-tsp_svn_helper_CPPFLAGS = \
- -DG_LOG_DOMAIN=\"tsp-svn-helper\"
+tvp_svn_helper_CPPFLAGS = \
+ -DG_LOG_DOMAIN=\"tvp-svn-helper\"
-tsp_svn_helper_CFLAGS = \
+tvp_svn_helper_CFLAGS = \
$(PLATFORM_CFLAGS) \
$(THUNAR_VFS_CFLAGS) \
$(GTK_CFLAGS) \
@@ -96,7 +96,7 @@
$(GOBJECT_CFLAGS) \
$(APR_CFLAGS)
-tsp_svn_helper_LDFLAGS = \
+tvp_svn_helper_LDFLAGS = \
$(PLATFORM_LIBS) \
$(THUNAR_VFS_LIBS) \
$(GTK_LIBS) \
More information about the Goodies-commits
mailing list