anjuta r3932 - in trunk: . libanjuta src



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

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


Modified:
   trunk/ChangeLog
   trunk/libanjuta/anjuta-preferences.c
   trunk/src/anjuta.glade

Modified: trunk/libanjuta/anjuta-preferences.c
==============================================================================
--- trunk/libanjuta/anjuta-preferences.c	(original)
+++ trunk/libanjuta/anjuta-preferences.c	Sat May 17 10:31:44 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: trunk/src/anjuta.glade
==============================================================================
--- trunk/src/anjuta.glade	(original)
+++ trunk/src/anjuta.glade	Sat May 17 10:31:44 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">
@@ -43,26 +42,6 @@
                           </packing>
                         </child>
                         <child>
-                          <widget class="GnomeFileEntry" id="fileentry1">
-                            <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>
-                              </widget>
-                            </child>
-                          </widget>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
                           <widget class="GtkLabel" id="label3">
                             <property name="visible">True</property>
                             <property name="xalign">0</property>
@@ -114,6 +93,19 @@
                             <property name="y_options"></property>
                           </packing>
                         </child>
+                        <child>
+                          <widget class="GtkFileChooserButton" id="preferences_folder:text::0:anjuta.project.directory">
+                            <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="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
+                            <property name="title" translatable="yes">Select projects directory</property>
+                          </widget>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
                       </widget>
                     </child>
                   </widget>



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