anjuta r4440 - in trunk: . plugins/tools



Author: sgranjoux
Date: Thu Dec 11 21:45:17 2008
New Revision: 4440
URL: http://svn.gnome.org/viewvc/anjuta?rev=4440&view=rev

Log:
	* plugins/tools/plugin.c,
	plugins/tools/anjuta-tools.glade,
	plugins/tools/tool.c,
	plugins/tools/tool.h,
	plugins/tools/variable.c,
	plugins/tools/editor.c:
	Partial fix #560857: Remove use of g_mem_chunk in tools plugin
	Partial fix #513156: Get rid of libgnome(ui)


Modified:
   trunk/ChangeLog
   trunk/plugins/tools/anjuta-tools.glade
   trunk/plugins/tools/editor.c
   trunk/plugins/tools/plugin.c
   trunk/plugins/tools/tool.c
   trunk/plugins/tools/tool.h
   trunk/plugins/tools/variable.c

Modified: trunk/plugins/tools/anjuta-tools.glade
==============================================================================
--- trunk/plugins/tools/anjuta-tools.glade	(original)
+++ trunk/plugins/tools/anjuta-tools.glade	Thu Dec 11 21:45:17 2008
@@ -52,7 +52,7 @@
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="label">gtk-preferences</property>
+                        <property name="label">gtk-edit</property>
                         <property name="use_stock">True</property>
                         <property name="response_id">0</property>
                         <signal name="clicked" handler="on_tool_edit"/>
@@ -64,7 +64,7 @@
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="label">gtk-add</property>
+                        <property name="label">gtk-new</property>
                         <property name="use_stock">True</property>
                         <property name="response_id">0</property>
                         <signal name="clicked" handler="on_tool_add"/>
@@ -79,7 +79,7 @@
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="label">gtk-remove</property>
+                        <property name="label">gtk-clear</property>
                         <property name="use_stock">True</property>
                         <property name="response_id">0</property>
                         <signal name="clicked" handler="on_tool_delete"/>

Modified: trunk/plugins/tools/editor.c
==============================================================================
--- trunk/plugins/tools/editor.c	(original)
+++ trunk/plugins/tools/editor.c	Thu Dec 11 21:45:17 2008
@@ -37,9 +37,6 @@
 #include <libanjuta/interfaces/ianjuta-editor.h>
 #include <libanjuta/interfaces/ianjuta-file-loader.h>
 
-#include <libgnomeui/libgnomeui.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
 #include <gtk/gtk.h>
 
 #include <string.h>
@@ -1076,6 +1073,8 @@
 
 	if (this->shortcut != NULL) g_free (this->shortcut);
 
+	if (atp_user_tool_get_name (this->tool) == NULL) atp_user_tool_free(this->tool);
+	
 	if (this->owner == NULL)
 	{
 		/* tool editor is not in a list */

Modified: trunk/plugins/tools/plugin.c
==============================================================================
--- trunk/plugins/tools/plugin.c	(original)
+++ trunk/plugins/tools/plugin.c	Thu Dec 11 21:45:17 2008
@@ -169,7 +169,6 @@
 {
 	ATPPlugin *this = ANJUTA_PLUGIN_ATP (plugin);
 	AnjutaUI *ui;
-	GtkAction *action;
 	
 	DEBUG_PRINT ("%s", "Tools Plugin: Activating tools plugin...");
 

Modified: trunk/plugins/tools/tool.c
==============================================================================
--- trunk/plugins/tools/tool.c	(original)
+++ trunk/plugins/tools/tool.c	Thu Dec 11 21:45:17 2008
@@ -78,7 +78,7 @@
  *---------------------------------------------------------------------------*/
 
 ATPEnumType output_type_list[] = {
- {ATP_TOUT_SAME, N_("Same than output")},
+ {ATP_TOUT_SAME, N_("Same as output")},
  {ATP_TOUT_COMMON_PANE, N_("Existing message pane")},
  {ATP_TOUT_NEW_PANE, N_("New message pane")},
  {ATP_TOUT_NEW_BUFFER, N_("New buffer")},
@@ -383,7 +383,7 @@
 					/* Add tool before */
 					g_return_val_if_fail (tool == first, NULL);
 
-					tool = g_chunk_new0(ATPUserTool, list->data_pool);
+					tool = g_slice_new0(ATPUserTool);
 					tool->over = first;
 					tool->flags = ATP_TOOL_ENABLE;
 					tool->name = first->name;
@@ -393,7 +393,7 @@
 				else if ((tool->over == NULL) || (tool->over->storage > storage)) 
 				{
 					/* Add tool after, using previous values as default */
-					first = g_chunk_new(ATPUserTool, list->data_pool);
+					first = g_slice_new(ATPUserTool);
 					memcpy(first, tool, sizeof (ATPUserTool));
 					first->over = tool->over;
 					tool->over = first;
@@ -406,7 +406,7 @@
 		else
 		{
 			/* Create new tool */
-			tool = g_chunk_new0(ATPUserTool, list->data_pool);
+			tool = g_slice_new0(ATPUserTool);
 			tool->flags = ATP_TOOL_ENABLE;
 			tool->name = g_string_chunk_insert_const (list->string_pool, name);
 			g_hash_table_insert (list->hash, tool->name, tool);
@@ -415,7 +415,7 @@
 	else
 	{
 		/* Create stand alone tool */
-		tool = g_chunk_new0(ATPUserTool, list->data_pool);
+		tool = g_slice_new0(ATPUserTool);
 		tool->flags = ATP_TOOL_ENABLE;
 	}
 		
@@ -434,7 +434,7 @@
 	atp_user_tool_remove (this);
 	atp_user_tool_deactivate (this, this->owner->ui);
 
-	g_chunk_free (this, this->owner->data_pool);
+	g_slice_free (ATPUserTool, this);
 }
 
 
@@ -801,16 +801,29 @@
 	this->list = NULL;
 	this->hash = g_hash_table_new (g_str_hash, g_str_equal);
 	this->string_pool = g_string_chunk_new (STRING_CHUNK_SIZE);
-	this->data_pool = g_mem_chunk_new ("tool pool", sizeof (ATPUserTool), STRING_CHUNK_SIZE * sizeof (ATPUserTool) / 4, G_ALLOC_AND_FREE);
 
 	return this;
 }
 
+static void
+on_remove_tool (gpointer key, gpointer value, gpointer user_data)
+{
+	ATPUserTool* tool = value;
+	
+	do
+	{
+		ATPUserTool* next = tool->over;
+		
+		g_slice_free (ATPUserTool, tool);
+		tool = next;
+	} while (tool != NULL);
+}
+
 void atp_tool_list_destroy (ATPToolList* this)
 {
+	g_hash_table_foreach(this->hash, (GHFunc)on_remove_tool, NULL);
 	g_hash_table_destroy (this->hash);
 	g_string_chunk_free (this->string_pool);
-	g_mem_chunk_destroy (this->data_pool);
 }
 
 /*---------------------------------------------------------------------------*/

Modified: trunk/plugins/tools/tool.h
==============================================================================
--- trunk/plugins/tools/tool.h	(original)
+++ trunk/plugins/tools/tool.h	Thu Dec 11 21:45:17 2008
@@ -93,7 +93,6 @@
 {
 	GHashTable* hash;
 	GStringChunk* string_pool ;
-	GMemChunk* data_pool;
 	AnjutaUI* ui;
 	ATPUserTool* list;
 	ATPPlugin* plugin;

Modified: trunk/plugins/tools/variable.c
==============================================================================
--- trunk/plugins/tools/variable.c	(original)
+++ trunk/plugins/tools/variable.c	Thu Dec 11 21:45:17 2008
@@ -37,9 +37,8 @@
 #include <libanjuta/interfaces/ianjuta-editor-selection.h>
 #include <libanjuta/interfaces/ianjuta-file.h>
 
-#include <libgnomevfs/gnome-vfs.h>
-
 #include <glib/gi18n.h>
+#include <gio/gio.h>
 
 #include <string.h>
 
@@ -115,10 +114,14 @@
 get_path_from_uri (char* uri)
 {
 	gchar* val;
+	GFile *file;
+
 	if (uri == NULL) return NULL;
 
-	val = gnome_vfs_get_local_path_from_uri (uri);
+	file = g_file_new_for_uri (uri);
 	g_free (uri);
+	val = g_file_get_path (file);
+	g_object_unref (file);
 
 	return val;
 }



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