[anjuta/git-shell] git: Implement the Diff pane



commit f0856c74ade9b524af0ed167e204063c551606d4
Author: James Liggett <jrliggett cox net>
Date:   Sun Jul 11 00:04:38 2010 -0700

    git: Implement the Diff pane
    
    Simialr to the old diff "dialog," this just diffs uncommitted changes.

 plugins/git/Makefile.am     |    4 ++-
 plugins/git/git-diff-pane.c |   52 +++++++++++++++++++++++++++++++++++++++++++
 plugins/git/git-diff-pane.h |   30 ++++++++++++++++++++++++
 plugins/git/plugin.c        |    9 +++++++
 4 files changed, 94 insertions(+), 1 deletions(-)
---
diff --git a/plugins/git/Makefile.am b/plugins/git/Makefile.am
index 4fc3c54..293124f 100644
--- a/plugins/git/Makefile.am
+++ b/plugins/git/Makefile.am
@@ -185,7 +185,9 @@ libanjuta_git_la_SOURCES = \
 	git-checkout-pane.c \
 	git-checkout-pane.h \
 	git-unstage-pane.c \
-	git-unstage-pane.h
+	git-unstage-pane.h \
+	git-diff-pane.c \
+	git-diff-pane.h
 
 libanjuta_git_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
diff --git a/plugins/git/git-diff-pane.c b/plugins/git/git-diff-pane.c
new file mode 100644
index 0000000..44cbde4
--- /dev/null
+++ b/plugins/git/git-diff-pane.c
@@ -0,0 +1,52 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * git-shell-test
+ * Copyright (C) James Liggett 2010 <jrliggett cox net>
+ * 
+ * git-shell-test is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * git-shell-test is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "git-diff-pane.h"
+
+void
+on_diff_button_clicked (GtkAction *action, Git *plugin)
+{
+	IAnjutaDocumentManager *document_manager;
+	IAnjutaEditor *editor;
+	GitDiffCommand *diff_command;
+
+	document_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
+												   IAnjutaDocumentManager,
+												   NULL);
+	editor = ianjuta_document_manager_add_buffer (document_manager,
+												  "Uncommitted Changes.diff",
+												  "", NULL);
+
+	diff_command = git_diff_command_new (plugin->project_root_directory);
+
+	g_signal_connect (G_OBJECT (diff_command), "data-arrived",
+					  G_CALLBACK (git_pane_send_raw_output_to_editor),
+					  editor);
+
+	g_signal_connect (G_OBJECT (diff_command), "command_finished",
+					  G_CALLBACK (git_pane_report_errors),
+					  plugin);
+
+	g_signal_connect (G_OBJECT (diff_command), "command_finished",
+					  G_CALLBACK (g_object_unref),
+					  NULL);
+
+	anjuta_command_start (ANJUTA_COMMAND (diff_command));
+}
+ 
\ No newline at end of file
diff --git a/plugins/git/git-diff-pane.h b/plugins/git/git-diff-pane.h
new file mode 100644
index 0000000..556ccb1
--- /dev/null
+++ b/plugins/git/git-diff-pane.h
@@ -0,0 +1,30 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * git-shell-test
+ * Copyright (C) James Liggett 2010 <jrliggett cox net>
+ * 
+ * git-shell-test is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * git-shell-test is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _GIT_DIFF_PANE_H_
+#define _GIT_DIFF_PANE_H_
+
+#include <libanjuta/interfaces/ianjuta-document-manager.h>
+#include <libanjuta/interfaces/ianjuta-editor.h>
+#include "git-pane.h"
+#include "git-diff-command.h"
+
+void on_diff_button_clicked (GtkAction *action, Git *plugin);
+
+#endif
\ No newline at end of file
diff --git a/plugins/git/plugin.c b/plugins/git/plugin.c
index a108ec6..ff4f926 100644
--- a/plugins/git/plugin.c
+++ b/plugins/git/plugin.c
@@ -35,6 +35,7 @@
 #include "git-pull-pane.h"
 #include "git-checkout-pane.h"
 #include "git-unstage-pane.h"
+#include "git-diff-pane.h"
 
 AnjutaCommandBarEntry branch_entries[] =
 {
@@ -99,6 +100,14 @@ AnjutaCommandBarEntry status_entries[] =
 		G_CALLBACK (on_commit_button_clicked)
 	},
 	{
+		ANJUTA_COMMAND_BAR_ENTRY_BUTTON,
+		"Diff",
+		N_("Diff uncommitted changes"),
+		N_("Show a diff of uncommitted changes in an editor"),
+		GTK_STOCK_ZOOM_100,
+		G_CALLBACK (on_diff_button_clicked)
+	},
+	{
 		ANJUTA_COMMAND_BAR_ENTRY_FRAME,
 		"NULL",
 		N_("Files"),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]