[anjuta/git-shell: 11/26] git: Add the dock and command bar



commit 53dfc137fd2b136ae0cf87005a5ac11c58c6cd4b
Author: James Liggett <jrliggett cox net>
Date:   Sat May 15 15:39:42 2010 -0700

    git: Add the dock and command bar

 libanjuta/Makefile.am |   17 +++++++++++--
 libanjuta/libanjuta.h |    3 ++
 plugins/git/plugin.c  |   59 +++++++++++++++++++++++++++++++++++++++++++++---
 plugins/git/plugin.h  |    7 +++++
 4 files changed, 79 insertions(+), 7 deletions(-)
---
diff --git a/libanjuta/Makefile.am b/libanjuta/Makefile.am
index 6a0d9d5..81084cd 100644
--- a/libanjuta/Makefile.am
+++ b/libanjuta/Makefile.am
@@ -11,6 +11,7 @@ AM_CPPFLAGS = \
 	$(GCONF_CFLAGS) \
 	$(GLADE_DEPRECATED_CFLAGS) \
 	$(LIBXML_CFLAGS) \
+	$(GDL_CFLAGS) \
 	-DDATADIR="\"$(datadir)\"" \
 	-DPACKAGE_PIXMAPS_DIR="\"$(datadir)/pixmaps/$(PACKAGE)\"" \
 	-DPACKAGE_DATA_DIR="\"$(datadir)/$(PACKAGE)\"" \
@@ -27,7 +28,8 @@ libanjuta_la_LIBADD = \
 	$(GCONF_LIBS) \
 	$(GLADE_DEPRECATED_LIBS) \
 	$(LIBXML_LIBS) \
-	$(GLIB_LIBS)
+	$(GLIB_LIBS) \
+	$(GDL_CFLAGS)
 
 libanjuta_la_SOURCES= \
 	anjuta-enum-types.h \
@@ -87,7 +89,13 @@ libanjuta_la_SOURCES= \
 	anjuta-drop-entry.c \
 	anjuta-drop-entry.h \
 	anjuta-tabber.c \
-	anjuta-tabber.h
+	anjuta-tabber.h \
+	anjuta-command-bar.c \
+	anjuta-command-bar.h \
+	anjuta-dock.c \
+	anjuta-dock.h \
+	anjuta-dock-pane.c \
+	anjuta-dock-pane.h 
 
 
 if HAVE_PLUGIN_GLADE
@@ -149,7 +157,10 @@ libanjuta_include = \
 	anjuta-project.h \
 	anjuta-command-queue.h \
 	anjuta-drop-entry.h \
-	anjuta-tabber.h
+	anjuta-tabber.h \
+	anjuta-command-bar.h \
+	anjuta-dock.h \
+	anjuta-dock-pane.h
 
 libanjutainclude_HEADERS = \
 	$(libanjuta_include) \
diff --git a/libanjuta/libanjuta.h b/libanjuta/libanjuta.h
index 308e719..af6a5ab 100644
--- a/libanjuta/libanjuta.h
+++ b/libanjuta/libanjuta.h
@@ -52,5 +52,8 @@
 #include <libanjuta/gbf-project.h>
 #include <libanjuta/anjuta-project.h>
 #include <libanjuta/anjuta-command-queue.h>
+#include <libanjuta/anjuta-command-bar.h>
+#include <libanjuta/anjuta-dock.h>
+#include <libanjuta/anjuta-dock-pane.h>
 
 #endif
diff --git a/plugins/git/plugin.c b/plugins/git/plugin.c
index 7ec7c94..73f68c9 100644
--- a/plugins/git/plugin.c
+++ b/plugins/git/plugin.c
@@ -41,6 +41,9 @@ on_project_root_added (AnjutaPlugin *plugin, const gchar *name,
 	g_object_unref (file);
 	
 	g_free (project_root_uri);
+
+	gtk_widget_set_sensitive (git_plugin->dock, TRUE);
+	gtk_widget_set_sensitive (git_plugin->command_bar, TRUE);
 }
 
 static void
@@ -55,6 +58,9 @@ on_project_root_removed (AnjutaPlugin *plugin, const gchar *name,
 	
 	g_free (git_plugin->project_root_directory);
 	git_plugin->project_root_directory = NULL;
+
+	gtk_widget_set_sensitive (git_plugin->dock, FALSE);
+	gtk_widget_set_sensitive (git_plugin->command_bar, FALSE);
 }
 
 static void
@@ -99,10 +105,51 @@ static gboolean
 git_activate_plugin (AnjutaPlugin *plugin)
 {
 	Git *git_plugin;
+	GtkWidget *command_bar_viewport;
+	GtkWidget *dock_viewport;
 	
 	DEBUG_PRINT ("%s", "Git: Activating Git plugin â?¦");
 	
 	git_plugin = ANJUTA_PLUGIN_GIT (plugin);
+
+	/* Command bar and dock */
+	git_plugin->command_bar = anjuta_command_bar_new ();
+	git_plugin->dock = anjuta_dock_new ();
+	command_bar_viewport = gtk_viewport_new (NULL, NULL);
+	dock_viewport = gtk_viewport_new (NULL, NULL);
+	git_plugin->command_bar_window = gtk_scrolled_window_new (NULL, NULL);
+	git_plugin->dock_window = gtk_scrolled_window_new (NULL, NULL);
+
+	gtk_container_add (GTK_CONTAINER (command_bar_viewport), 
+	                   git_plugin->command_bar);
+	gtk_container_add (GTK_CONTAINER (dock_viewport), git_plugin->dock);
+	gtk_container_add (GTK_CONTAINER (git_plugin->command_bar_window), 
+	                   command_bar_viewport);
+	gtk_container_add (GTK_CONTAINER (git_plugin->dock_window), dock_viewport);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (git_plugin->command_bar_window), 
+	                                GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (git_plugin->dock_window),
+	                                GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (git_plugin->command_bar_window),
+	                                     GTK_SHADOW_NONE);
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (git_plugin->dock_window),
+	                                     GTK_SHADOW_NONE);
+	gtk_viewport_set_shadow_type (GTK_VIEWPORT (command_bar_viewport), 
+	                              GTK_SHADOW_NONE);
+	gtk_viewport_set_shadow_type (GTK_VIEWPORT (dock_viewport), 
+	                              GTK_SHADOW_NONE);
+	
+
+	anjuta_dock_set_command_bar (ANJUTA_DOCK (git_plugin->dock), 
+	                             ANJUTA_COMMAND_BAR (git_plugin->command_bar));
+
+	anjuta_shell_add_widget (plugin->shell, git_plugin->command_bar_window, 
+	                         "GitCommandBar", _("Git Tasks"), NULL,
+	                         ANJUTA_SHELL_PLACEMENT_LEFT, NULL);
+
+	anjuta_shell_add_widget (plugin->shell, git_plugin->dock_window, "GitDock", 
+	                         _("Git"), NULL, ANJUTA_SHELL_PLACEMENT_CENTER,
+	                         NULL);
 	
 	/* Add watches */
 	git_plugin->project_root_watch_id = anjuta_plugin_add_watch (plugin,
@@ -118,13 +165,12 @@ git_activate_plugin (AnjutaPlugin *plugin)
 														   NULL);
 	
 	
-	
 	/* Git needs a working directory to work with; it can't take full paths,
 	 * so make sure that Git can't be used if there's no project opened. */
-	
 	if (!git_plugin->project_root_directory)
 	{
-		/* Disable the dock and command bar when they're put in */
+		gtk_widget_set_sensitive (git_plugin->command_bar, FALSE);
+		gtk_widget_set_sensitive (git_plugin->dock, FALSE);	
 	}
 	
 	return TRUE;
@@ -139,12 +185,15 @@ git_deactivate_plugin (AnjutaPlugin *plugin)
 	git_plugin = ANJUTA_PLUGIN_GIT (plugin);
 	status = anjuta_shell_get_status (plugin->shell, NULL);
 	
-	DEBUG_PRINT ("%s", "Git: Dectivating Git plugin â?¦");
+	DEBUG_PRINT ("%s", "Git: Dectivating Git plugin.\n");
 	
 	anjuta_plugin_remove_watch (plugin, git_plugin->project_root_watch_id, 
 								TRUE);
 	anjuta_plugin_remove_watch (plugin, git_plugin->editor_watch_id,
 								TRUE);
+
+	anjuta_shell_remove_widget (plugin->shell, git_plugin->command_bar_window, NULL);
+	anjuta_shell_remove_widget (plugin->shell, git_plugin->dock_window, NULL);
 	
 	g_free (git_plugin->project_root_directory);
 	g_free (git_plugin->current_editor_filename);
@@ -159,6 +208,8 @@ git_finalize (GObject *obj)
 
 	git_plugin = ANJUTA_PLUGIN_GIT (obj);
 
+	g_print ("Finalizing.\n");
+
 	g_object_unref (git_plugin->command_queue);
 	
 	G_OBJECT_CLASS (parent_class)->finalize (obj);
diff --git a/plugins/git/plugin.h b/plugins/git/plugin.h
index bdf0800..925c1d3 100644
--- a/plugins/git/plugin.h
+++ b/plugins/git/plugin.h
@@ -30,6 +30,7 @@
 #include <libanjuta/interfaces/ianjuta-project-manager.h>
 #include <libanjuta/interfaces/ianjuta-file-manager.h>
 #include <libanjuta/anjuta-shell.h>
+#include <libanjuta/anjuta-dock.h>
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/anjuta-command-queue.h>
 
@@ -53,6 +54,12 @@ struct _Git
 	
 	gchar *project_root_directory;
 	gchar *current_editor_filename;
+
+	GtkWidget *command_bar;
+	GtkWidget *dock;
+	GtkWidget *command_bar_window;
+	GtkWidget *dock_window;
+	
 	IAnjutaMessageView *message_view;
 	AnjutaCommandQueue *command_queue;
 	



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