[Xfce4-commits] <thunar-vcs-plugin:master> Expose --depth option in svn diff dialog.
Stefan Sperling
noreply at xfce.org
Thu Sep 6 23:48:01 CEST 2012
Updating branch refs/heads/master
to 625cd0d62b04de2e3858bf1608e3ebbc6046b5b5 (commit)
from e9dbb44b7bb7af9dff789c0e5bcc17f66525ef74 (commit)
commit 625cd0d62b04de2e3858bf1608e3ebbc6046b5b5
Author: Stefan Sperling <stsp at stsp.name>
Date: Wed Sep 5 21:08:49 2012 +0200
Expose --depth option in svn diff dialog.
tvp-svn-helper/tsh-diff-dialog.c | 84 ++++++++++++++++++++++++++++++++++++++
tvp-svn-helper/tsh-diff-dialog.h | 2 +
tvp-svn-helper/tsh-diff.c | 5 +-
3 files changed, 89 insertions(+), 2 deletions(-)
diff --git a/tvp-svn-helper/tsh-diff-dialog.c b/tvp-svn-helper/tsh-diff-dialog.c
index f18eea4..6ba1692 100644
--- a/tvp-svn-helper/tsh-diff-dialog.c
+++ b/tvp-svn-helper/tsh-diff-dialog.c
@@ -45,6 +45,7 @@ struct _TshDiffDialog
GtkWidget *cancel;
GtkWidget *refresh;
gint current_line;
+ GtkWidget *depth;
};
struct _TshDiffDialogClass
@@ -87,6 +88,11 @@ tsh_diff_dialog_init (TshDiffDialog *dialog)
GtkWidget *scroll_window;
GtkWidget *button;
PangoFontDescription *font_desc;
+ GtkWidget *table;
+ GtkTreeModel *model;
+ GtkWidget *depth;
+ GtkCellRenderer *renderer;
+ GtkTreeIter iter;
scroll_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@@ -132,6 +138,60 @@ 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);
+ 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);
+
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ /* Translators: svn recursion selection
+ * Self means only this file/direcotry is shown
+ */
+ 0, _("Self"),
+ 1, svn_depth_empty,
+ -1);
+
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ /* Translators: svn recursion selection
+ * Immediate files means this file/direcotry and the files it contains are shown
+ */
+ 0, _("Immediate files"),
+ 1, svn_depth_files,
+ -1);
+
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ /* Translators: svn recursion selection
+ * Immediates means this file/direcotry and the subdirectories are shown
+ */
+ 0, _("Immediates"),
+ 1, svn_depth_immediates,
+ -1);
+
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ /* Translators: svn recursion selection
+ * Recursive means the list is full recursive
+ */
+ 0, _("Recursive"),
+ 1, svn_depth_infinity,
+ -1);
+
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (depth), &iter);
+
+ g_object_unref (model);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (depth), renderer, TRUE);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (depth), renderer, "text", 0);
+
+ gtk_table_attach (GTK_TABLE (table), depth, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (depth);
+
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table, FALSE, FALSE, 0);
+ gtk_widget_show (table);
+
gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 400);
}
@@ -226,3 +286,27 @@ refresh_clicked(GtkButton *button, gpointer user_data)
g_signal_emit(dialog, signals[SIGNAL_REFRESH], 0);
}
+
+svn_depth_t
+tsh_diff_dialog_get_depth (TshDiffDialog *dialog)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ svn_depth_t depth;
+ GValue value;
+
+ memset(&value, 0, sizeof(GValue));
+
+ g_return_val_if_fail (TSH_IS_DIFF_DIALOG (dialog), svn_depth_unknown);
+
+ g_return_val_if_fail (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (dialog->depth), &iter), svn_depth_unknown);
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->depth));
+ gtk_tree_model_get_value (model, &iter, 1, &value);
+
+ depth = g_value_get_int (&value);
+
+ g_value_unset(&value);
+
+ return depth;
+}
diff --git a/tvp-svn-helper/tsh-diff-dialog.h b/tvp-svn-helper/tsh-diff-dialog.h
index 5e68fde..b0e0d76 100644
--- a/tvp-svn-helper/tsh-diff-dialog.h
+++ b/tvp-svn-helper/tsh-diff-dialog.h
@@ -45,6 +45,8 @@ void tsh_diff_dialog_add (TshDiffDialog *dialog,
gint len);
void tsh_diff_dialog_done (TshDiffDialog *dialog);
+svn_depth_t tsh_diff_dialog_get_depth (TshDiffDialog *dialog);
+
G_END_DECLS;
#endif /* !__TSH_DIFF_DIALOG_H__ */
diff --git a/tvp-svn-helper/tsh-diff.c b/tvp-svn-helper/tsh-diff.c
index d11aaea..ff1d7ab 100644
--- a/tvp-svn-helper/tsh-diff.c
+++ b/tvp-svn-helper/tsh-diff.c
@@ -59,6 +59,7 @@ static gpointer diff_thread (gpointer user_data)
svn_client_ctx_t *ctx = args->ctx;
apr_pool_t *subpool, *pool = args->pool;
TshDiffDialog *dialog = args->dialog;
+ svn_depth_t depth = tsh_diff_dialog_get_depth(dialog);
gchar **files = args->files;
gint size, i;
GtkWidget *error;
@@ -114,12 +115,12 @@ static gpointer diff_thread (gpointer user_data)
#if CHECK_SVN_VERSION_S(1,6)
if ((err = svn_client_diff4(NULL, path, &revision1, path, &revision2,
- NULL, svn_depth_infinity, FALSE,
+ NULL, depth, FALSE,
FALSE, FALSE, APR_LOCALE_CHARSET,
outfile, errfile, NULL, ctx, subpool)))
#else /* CHECK_SVN_VERSION(1,7) */
if ((err = svn_client_diff5(NULL, path, &revision1, path, &revision2,
- NULL, svn_depth_infinity, FALSE, FALSE,
+ NULL, depth, FALSE, FALSE,
FALSE, FALSE, FALSE, APR_LOCALE_CHARSET,
outfile, errfile, NULL, ctx, subpool)))
#endif
More information about the Xfce4-commits
mailing list