anjuta r3479 - in trunk: . libanjuta plugins/file-manager



Author: jhs
Date: Wed Jan 16 14:25:04 2008
New Revision: 3479
URL: http://svn.gnome.org/viewvc/anjuta?rev=3479&view=rev

Log:
2008-01-16  Johannes Schmid <jhs gnome org>

	* libanjuta/anjuta-plugin-manager.c:
	Fixed #508399 â When you enable a plugin, preferences don\'t show up

2008-01-16  Rob Bradford  <rob openedhand com>

	Reviewed by: Johannes Schmid <jhs gnome org>

	* libanjuta/anjuta-preferences.c: (get_object_type_from_string),
	(get_property_value_as_string), (set_property_value_as_string),
	(register_callbacks):
	* libanjuta/anjuta-preferences.h:
	Add support for both file and folder preferences (originally only
	folder choosers were supported. (Fixes bug: #508805.)

	* plugins/file-manager/file-manager.glade:
	Update the only in-tree use of the ANJUTA_PROPERTY_OBJECT_TYPE_FILE
	type of property.


Modified:
   trunk/ChangeLog
   trunk/libanjuta/anjuta-plugin-manager.c
   trunk/libanjuta/anjuta-preferences.c
   trunk/libanjuta/anjuta-preferences.h
   trunk/plugins/file-manager/file-manager.glade

Modified: trunk/libanjuta/anjuta-plugin-manager.c
==============================================================================
--- trunk/libanjuta/anjuta-plugin-manager.c	(original)
+++ trunk/libanjuta/anjuta-plugin-manager.c	Wed Jan 16 14:25:04 2008
@@ -39,6 +39,7 @@
 #include <libanjuta/anjuta-plugin.h>
 #include <libanjuta/anjuta-c-plugin-factory.h>
 #include <libanjuta/interfaces/ianjuta-plugin-factory.h>
+#include <libanjuta/interfaces/ianjuta-preferences.h>
 
 
 enum
@@ -791,6 +792,7 @@
 	AnjutaPluginHandle *plugin;
 	gboolean enabled;
 	GHashTable *activated_plugins;
+	AnjutaPlugin* plugin_object;
 	
 	path = gtk_tree_path_new_from_string (path_str);
 	
@@ -803,9 +805,34 @@
 			    COL_PLUGIN, &plugin,
 			    -1);
 	
+	if (enabled)
+	{
+		plugin_object = g_hash_table_lookup (priv->activated_plugins, plugin);
+		if (plugin_object &&
+			IANJUTA_IS_PREFERENCES(plugin_object))
+		{
+			ianjuta_preferences_unmerge (IANJUTA_PREFERENCES (plugin_object),
+									   anjuta_shell_get_preferences (ANJUTA_SHELL (priv->shell), NULL),
+									   NULL);
+		}
+	}
 	enabled = !enabled;
 
 	activated_plugins = plugin_set_update (plugin_manager, plugin, enabled);
+	plugin_object = g_hash_table_lookup (priv->activated_plugins, plugin);
+	
+	/* Make sure that it appears in the preferences. This method
+		can only be called when the preferences dialog is active so
+		it should be save
+	*/
+	if (plugin_object &&
+		IANJUTA_IS_PREFERENCES(plugin_object))
+	{
+		ianjuta_preferences_merge (IANJUTA_PREFERENCES (plugin_object),
+								   anjuta_shell_get_preferences (ANJUTA_SHELL (priv->shell), NULL),
+								   NULL);
+	}
+	
 	update_enabled (GTK_TREE_MODEL (store), activated_plugins);
 	gtk_tree_path_free (path);
 }

Modified: trunk/libanjuta/anjuta-preferences.c
==============================================================================
--- trunk/libanjuta/anjuta-preferences.c	(original)
+++ trunk/libanjuta/anjuta-preferences.c	Wed Jan 16 14:25:04 2008
@@ -522,6 +522,8 @@
 		return ANJUTA_PROPERTY_OBJECT_TYPE_FONT;
 	else if (strcmp (object_type, "file") == 0)
 		return ANJUTA_PROPERTY_OBJECT_TYPE_FILE;
+	else if (strcmp (object_type, "folder") == 0)
+		return ANJUTA_PROPERTY_OBJECT_TYPE_FOLDER;
 	else
 		return (AnjutaPropertyObjectType)(-1);
 }
@@ -616,12 +618,12 @@
 			text_value = g_strdup (font);
 		}
 		break;
+	case ANJUTA_PROPERTY_OBJECT_TYPE_FOLDER:
+		text_value = gtk_file_chooser_get_current_folder (
+				GTK_FILE_CHOOSER (prop->object));
+		break;
 	case ANJUTA_PROPERTY_OBJECT_TYPE_FILE:
-		{
-			const gchar *filename;
-			filename = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (prop->object));
-			text_value = g_strdup (filename);
-		}
+		text_value = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (prop->object));
 		break;
 	}
 	if (text_value && (strlen (text_value) == 0))
@@ -767,13 +769,15 @@
 		}*/
 		break;
 		
+	case ANJUTA_PROPERTY_OBJECT_TYPE_FOLDER:
+		if (value)
+			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (prop->object), value);
+		break;
 	case ANJUTA_PROPERTY_OBJECT_TYPE_FILE:
-		{	
-			if (value)
-			{
-				gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (prop->object),
-																 value);
-			}
+		if (value)
+		{
+			gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (prop->object),
+															 value);
 		}
 		break;
 	}
@@ -980,6 +984,10 @@
 							  G_CALLBACK (update_property_on_change_color), p);
 			break;
 		case ANJUTA_PROPERTY_OBJECT_TYPE_FILE:
+			g_signal_connect (G_OBJECT(p->object), "file-set",
+							  G_CALLBACK (update_property_on_change_str), p);
+			break;
+		case ANJUTA_PROPERTY_OBJECT_TYPE_FOLDER:
 			g_signal_connect (G_OBJECT(p->object), "current-folder-changed",
 							  G_CALLBACK (update_property_on_change_str), p);
 			break;

Modified: trunk/libanjuta/anjuta-preferences.h
==============================================================================
--- trunk/libanjuta/anjuta-preferences.h	(original)
+++ trunk/libanjuta/anjuta-preferences.h	Wed Jan 16 14:25:04 2008
@@ -38,7 +38,8 @@
 	ANJUTA_PROPERTY_OBJECT_TYPE_TEXT,
 	ANJUTA_PROPERTY_OBJECT_TYPE_COLOR,
 	ANJUTA_PROPERTY_OBJECT_TYPE_FONT,
-	ANJUTA_PROPERTY_OBJECT_TYPE_FILE
+	ANJUTA_PROPERTY_OBJECT_TYPE_FILE,
+	ANJUTA_PROPERTY_OBJECT_TYPE_FOLDER
 } AnjutaPropertyObjectType;
 
 typedef enum

Modified: trunk/plugins/file-manager/file-manager.glade
==============================================================================
--- trunk/plugins/file-manager/file-manager.glade	(original)
+++ trunk/plugins/file-manager/file-manager.glade	Wed Jan 16 14:25:04 2008
@@ -36,7 +36,7 @@
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkFileChooserButton" id="preferences_file:text:/:0:filemanager.root">
+                      <widget class="GtkFileChooserButton" id="preferences_folder:text:/:0:filemanager.root">
                         <property name="visible">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="use_preview_label">False</property>



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