[Xfce4-commits] <thunar-vcs-plugin:master> Expose --show-copies-as-adds option in svn diff dialog.

Stefan Sperling noreply at xfce.org
Thu Sep 6 23:48:02 CEST 2012


Updating branch refs/heads/master
         to cc6576a67296eb3a5063af7ca5d17257ef9eb17f (commit)
       from 625cd0d62b04de2e3858bf1608e3ebbc6046b5b5 (commit)

commit cc6576a67296eb3a5063af7ca5d17257ef9eb17f
Author: Stefan Sperling <stsp at stsp.name>
Date:   Wed Sep 5 21:38:10 2012 +0200

    Expose --show-copies-as-adds option in svn diff dialog.

 tvp-svn-helper/tsh-diff-dialog.c |   27 ++++++++++++++++++++++++++-
 tvp-svn-helper/tsh-diff-dialog.h |    1 +
 tvp-svn-helper/tsh-diff.c        |    3 ++-
 3 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/tvp-svn-helper/tsh-diff-dialog.c b/tvp-svn-helper/tsh-diff-dialog.c
index 6ba1692..4f7def7 100644
--- a/tvp-svn-helper/tsh-diff-dialog.c
+++ b/tvp-svn-helper/tsh-diff-dialog.c
@@ -26,6 +26,7 @@
 
 #include <subversion-1/svn_client.h>
 #include <subversion-1/svn_pools.h>
+#include <subversion-1/svn_version.h>
 
 #include "tsh-common.h"
 #include "tsh-diff-dialog.h"
@@ -46,6 +47,9 @@ struct _TshDiffDialog
   GtkWidget *refresh;
   gint current_line;
   GtkWidget *depth;
+#if CHECK_SVN_VERSION_S(1,7)
+  GtkWidget *show_copies_as_adds;
+#endif
 };
 
 struct _TshDiffDialogClass
@@ -91,6 +95,9 @@ tsh_diff_dialog_init (TshDiffDialog *dialog)
   GtkWidget *table;
   GtkTreeModel *model;
   GtkWidget *depth;
+#if CHECK_SVN_VERSION_S(1,7)
+  GtkWidget *show_copies_as_adds;
+#endif
   GtkCellRenderer *renderer;
   GtkTreeIter iter;
 
@@ -138,7 +145,7 @@ tsh_diff_dialog_init (TshDiffDialog *dialog)
   g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (refresh_clicked), dialog);
   gtk_widget_hide (button);
 
-  table = gtk_table_new (1, 1, FALSE);
+  table = gtk_table_new (2, 1, FALSE);
   model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
   dialog->depth = depth = gtk_combo_box_new_with_model (model);
 
@@ -189,6 +196,12 @@ tsh_diff_dialog_init (TshDiffDialog *dialog)
   gtk_table_attach (GTK_TABLE (table), depth, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
   gtk_widget_show (depth);
 
+#if CHECK_SVN_VERSION_S(1,7)
+  dialog->show_copies_as_adds = show_copies_as_adds = gtk_check_button_new_with_label (_("Show copies as additions"));
+  gtk_table_attach (GTK_TABLE (table), show_copies_as_adds, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+  gtk_widget_show (show_copies_as_adds);
+#endif
+
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table, FALSE, FALSE, 0);
   gtk_widget_show (table);
 
@@ -310,3 +323,15 @@ tsh_diff_dialog_get_depth (TshDiffDialog *dialog)
 
   return depth;
 }
+
+gboolean
+tsh_diff_dialog_get_show_copies_as_adds (TshDiffDialog *dialog)
+{
+#if CHECK_SVN_VERSION_S(1,7)
+  g_return_val_if_fail (TSH_IS_DIFF_DIALOG (dialog), FALSE);
+
+  return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->show_copies_as_adds));
+#else /* 1.6 or earlier */
+  return FALSE;
+#endif
+}
diff --git a/tvp-svn-helper/tsh-diff-dialog.h b/tvp-svn-helper/tsh-diff-dialog.h
index b0e0d76..63d06b7 100644
--- a/tvp-svn-helper/tsh-diff-dialog.h
+++ b/tvp-svn-helper/tsh-diff-dialog.h
@@ -46,6 +46,7 @@ void       tsh_diff_dialog_add       (TshDiffDialog *dialog,
 void       tsh_diff_dialog_done      (TshDiffDialog *dialog);
 
 svn_depth_t tsh_diff_dialog_get_depth (TshDiffDialog *dialog);
+gboolean   tsh_diff_dialog_get_show_copies_as_adds (TshDiffDialog *dialog);
 
 G_END_DECLS;
 
diff --git a/tvp-svn-helper/tsh-diff.c b/tvp-svn-helper/tsh-diff.c
index ff1d7ab..8304af4 100644
--- a/tvp-svn-helper/tsh-diff.c
+++ b/tvp-svn-helper/tsh-diff.c
@@ -60,6 +60,7 @@ static gpointer diff_thread (gpointer user_data)
   apr_pool_t *subpool, *pool = args->pool;
   TshDiffDialog *dialog = args->dialog;
   svn_depth_t depth = tsh_diff_dialog_get_depth(dialog);
+  svn_boolean_t show_copies_as_adds = tsh_diff_dialog_get_show_copies_as_adds(dialog);
   gchar **files = args->files;
   gint size, i;
   GtkWidget *error;
@@ -121,7 +122,7 @@ static gpointer diff_thread (gpointer user_data)
 #else /* CHECK_SVN_VERSION(1,7) */
     if ((err = svn_client_diff5(NULL, path, &revision1, path, &revision2,
                                 NULL, depth, FALSE, FALSE,
-                                FALSE, FALSE, FALSE, APR_LOCALE_CHARSET,
+                                show_copies_as_adds, FALSE, FALSE, APR_LOCALE_CHARSET,
                                 outfile, errfile, NULL, ctx, subpool))) 
 #endif
     {


More information about the Xfce4-commits mailing list