anjuta r3933 - in branches/anjuta-2-4: . libanjuta src



Author: sgranjoux
Date: Sat May 17 10:40:43 2008
New Revision: 3933
URL: http://svn.gnome.org/viewvc/anjuta?rev=3933&view=rev

Log:
	* src/anjuta.glade,
	libanjuta/anjuta-preferences.c:
	Fix #531940: Can't change the default project directory


Modified:
   branches/anjuta-2-4/ChangeLog
   branches/anjuta-2-4/libanjuta/anjuta-preferences.c
   branches/anjuta-2-4/src/anjuta.glade

Modified: branches/anjuta-2-4/libanjuta/anjuta-preferences.c
==============================================================================
--- branches/anjuta-2-4/libanjuta/anjuta-preferences.c	(original)
+++ branches/anjuta-2-4/libanjuta/anjuta-preferences.c	Sat May 17 10:40:43 2008
@@ -67,6 +67,7 @@
 
 #include <glade/glade-parser.h>
 #include <gconf/gconf-client.h>
+#include <libgnomevfs/gnome-vfs.h>
 
 #include <libanjuta/anjuta-preferences.h>
 #include <libanjuta/anjuta-utils.h>
@@ -551,6 +552,7 @@
 	gint  int_value;
 	gchar** values;
 	gchar *text_value = NULL;
+	gchar *uri;
 	
 	if (prop->custom)
 	{
@@ -619,8 +621,10 @@
 		}
 		break;
 	case ANJUTA_PROPERTY_OBJECT_TYPE_FOLDER:
-		text_value = gtk_file_chooser_get_current_folder (
-				GTK_FILE_CHOOSER (prop->object));
+		uri = gtk_file_chooser_get_uri (
+ 				GTK_FILE_CHOOSER (prop->object));
+		text_value = gnome_vfs_get_local_path_from_uri (uri);
+		g_free (uri);
 		break;
 	case ANJUTA_PROPERTY_OBJECT_TYPE_FILE:
 		text_value = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (prop->object));
@@ -771,7 +775,27 @@
 		
 	case ANJUTA_PROPERTY_OBJECT_TYPE_FOLDER:
 		if (value)
-			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (prop->object), value);
+		{
+			gchar *old_folder;
+
+			/* When the user change the folder, the
+			 * current-folder-changed signal is emitted the
+			 * gconf key is updated and this function is called.
+			 * But setting the current folder here emits
+			 * the current-folder-changed signal too.
+			 * Moreover this signal is emitted asynchronously so
+			 * it is not possible to block it here.
+			 * 
+			 * The solution here is to update the widget only
+			 * if it is really needed.
+			 */
+			old_folder = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (prop->object));
+			if ((old_folder == NULL) || strcmp (old_folder, value))
+			{
+				gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (prop->object), value);
+			}
+			g_free (old_folder);
+		}
 		break;
 	case ANJUTA_PROPERTY_OBJECT_TYPE_FILE:
 		if (value)

Modified: branches/anjuta-2-4/src/anjuta.glade
==============================================================================
--- branches/anjuta-2-4/src/anjuta.glade	(original)
+++ branches/anjuta-2-4/src/anjuta.glade	Sat May 17 10:40:43 2008
@@ -2,7 +2,6 @@
 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
 <!--*- mode: xml -*-->
 <glade-interface>
-  <requires lib="gnome"/>
   <widget class="GtkWindow" id="anjuta_preferences_window">
     <child>
       <widget class="GtkNotebook" id="General">
@@ -86,34 +85,26 @@
                           </packing>
                         </child>
                         <child>
-                          <widget class="GnomeFileEntry" id="fileentry1">
+                          <widget class="GtkLabel" id="label2">
                             <property name="visible">True</property>
-                            <property name="directory_entry">True</property>
-                            <property name="use_filechooser">True</property>
-                            <property name="filechooser_action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
-                            <property name="max_saved">10</property>
-                            <child internal-child="entry">
-                              <widget class="GtkEntry" id="fileentry1-entry3">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="invisible_char">*</property>
-                              </widget>
-                            </child>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Default project directory:</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label2">
+                          <widget class="GtkFileChooserButton" id="preferences_folder:text::0:anjuta.project.directory">
                             <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Default project directory:</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
+                            <property name="title" translatable="yes">Select projects directory</property>
                           </widget>
                           <packing>
-                            <property name="x_options">GTK_FILL</property>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>



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