[anjuta/git-shell: 5/20] git: Eliminate git.ui-utils.c/.h



commit 06dffd0ad245e25cff9085c584a8a23806ac166a
Author: James Liggett <jrliggett cox net>
Date:   Sat May 22 19:30:58 2010 -0700

    git: Eliminate git.ui-utils.c/.h
    
    These functions will now be folded into GitPane as static methods.

 plugins/git/Makefile.am         |    2 -
 plugins/git/git-pane.c          |   50 +++
 plugins/git/git-pane.h          |    5 +
 plugins/git/git-ui-utils.c      |  863 ---------------------------------------
 plugins/git/git-ui-utils.h      |  123 ------
 plugins/git/git-vcs-interface.c |    4 +-
 plugins/git/git-vcs-interface.h |    2 +-
 plugins/git/plugin.h            |    2 +
 8 files changed, 60 insertions(+), 991 deletions(-)
---
diff --git a/plugins/git/Makefile.am b/plugins/git/Makefile.am
index 2b4f061..9b5309d 100644
--- a/plugins/git/Makefile.am
+++ b/plugins/git/Makefile.am
@@ -46,8 +46,6 @@ libanjuta_git_la_SOURCES = \
 	plugin.h \
 	git-command.c \
 	git-command.h \
-	git-ui-utils.c \
-	git-ui-utils.h \
 	git-diff-command.c \
 	git-diff-command.h \
 	git-status.c \
diff --git a/plugins/git/git-pane.c b/plugins/git/git-pane.c
index c6db9b4..61a8889 100644
--- a/plugins/git/git-pane.c
+++ b/plugins/git/git-pane.c
@@ -48,3 +48,53 @@ git_pane_class_init (GitPaneClass *klass)
 	object_class->finalize = git_pane_finalize;
 }
 
+static void
+on_message_view_destroyed (Git* plugin, gpointer destroyed_view)
+{
+	plugin->message_view = NULL;
+}
+
+void
+git_pane_create_message_view (Git *plugin)
+{
+	IAnjutaMessageManager *message_manager; 
+		
+		
+	message_manager = anjuta_shell_get_interface  (ANJUTA_PLUGIN (plugin)->shell,	
+												   IAnjutaMessageManager, NULL);
+	plugin->message_view =  ianjuta_message_manager_get_view_by_name (message_manager, 
+																	  _("Git"), 
+																	  NULL);
+	if (!plugin->message_view)
+	{
+		plugin->message_view = ianjuta_message_manager_add_view (message_manager, 
+																 _("Git"), 
+																 ICON_FILE, 
+																 NULL);
+		g_object_weak_ref (G_OBJECT (plugin->message_view), 
+						   (GWeakNotify) on_message_view_destroyed, plugin);
+	}
+	
+	ianjuta_message_view_clear (plugin->message_view, NULL);
+	ianjuta_message_manager_set_current_view (message_manager, 
+											  plugin->message_view, 
+											  NULL);
+}
+
+void 
+git_pane_on_command_info_arrived (AnjutaCommand *command, Git *plugin)
+{
+	GQueue *info;
+	gchar *message;
+	
+	info = git_command_get_info_queue (GIT_COMMAND (command));
+	
+	while (g_queue_peek_head (info))
+	{
+		message = g_queue_pop_head (info);
+		ianjuta_message_view_append (plugin->message_view, 
+								     IANJUTA_MESSAGE_VIEW_TYPE_NORMAL,
+									 message, "", NULL);
+		g_free (message);
+	}
+}
\ No newline at end of file
diff --git a/plugins/git/git-pane.h b/plugins/git/git-pane.h
index 41df15f..1003d7e 100644
--- a/plugins/git/git-pane.h
+++ b/plugins/git/git-pane.h
@@ -22,6 +22,7 @@
 
 #include <glib-object.h>
 #include <libanjuta/anjuta-dock-pane.h>
+#include <libanjuta/interfaces/ianjuta-message-manager.h>
 #include "plugin.h"
 
 G_BEGIN_DECLS
@@ -48,6 +49,10 @@ struct _GitPane
 
 GType git_pane_get_type (void) G_GNUC_CONST;
 
+/* Static helper methods */
+void git_pane_create_message_view (Git *plugin);
+void git_pane_on_command_info_arrived (AnjutaCommand *command, Git *plugin);
+
 G_END_DECLS
 
 #endif /* _GIT_PANE_H_ */
diff --git a/plugins/git/git-vcs-interface.c b/plugins/git/git-vcs-interface.c
index 24209c2..3620596 100644
--- a/plugins/git/git-vcs-interface.c
+++ b/plugins/git/git-vcs-interface.c
@@ -91,10 +91,10 @@ git_ivcs_checkout (IAnjutaVcs *obj,
 	g_free (path);
 	g_free (dir_name);
 
-	git_create_message_view (plugin);
+	git_pane_create_message_view (plugin);
 
 	g_signal_connect (G_OBJECT (clone_command), "data-arrived",
-	                  G_CALLBACK (on_git_command_info_arrived),
+	                  G_CALLBACK (git_pane_on_command_info_arrived),
 	                  plugin);
 
 	g_signal_connect (G_OBJECT (clone_command), "command-finished",
diff --git a/plugins/git/git-vcs-interface.h b/plugins/git/git-vcs-interface.h
index c4c6069..d52d6f5 100644
--- a/plugins/git/git-vcs-interface.h
+++ b/plugins/git/git-vcs-interface.h
@@ -34,7 +34,7 @@
 #include "git-remove-command.h"
 #include "git-clone-command.h"
 
-#include "git-ui-utils.h"
+#include "git-pane.h"
 
 void git_ivcs_iface_init (IAnjutaVcsIface *iface);
 void git_ivcs_add (IAnjutaVcs *obj, GList *files, 
diff --git a/plugins/git/plugin.h b/plugins/git/plugin.h
index 3742b43..03a6ce6 100644
--- a/plugins/git/plugin.h
+++ b/plugins/git/plugin.h
@@ -26,6 +26,8 @@
 #include <gio/gio.h>
 #include <libanjuta/anjuta-plugin.h>
 #include <libanjuta/interfaces/ianjuta-message-view.h>
+#include <libanjuta/interfaces/ianjuta-editor.h>
+#include <libanjuta/interfaces/ianjuta-document-manager.h>
 #include <libanjuta/interfaces/ianjuta-file.h>
 #include <libanjuta/interfaces/ianjuta-project-manager.h>
 #include <libanjuta/interfaces/ianjuta-file-manager.h>



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