[anjuta] project-import: Try to fill project name automatically in import project dialog



commit 5c0cd4819b2ac87f1eff736fb65be76ef45c9331
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Tue Jan 15 22:40:36 2013 +0100

    project-import: Try to fill project name automatically in import project dialog

 plugins/project-import/plugin.c                |    4 -
 plugins/project-import/project-import-dialog.c |   13 +++
 plugins/project-import/project-import.ui       |  131 +++++++++++++++---------
 3 files changed, 94 insertions(+), 54 deletions(-)
---
diff --git a/plugins/project-import/plugin.c b/plugins/project-import/plugin.c
index 60f16e1..a4a3c9f 100644
--- a/plugins/project-import/plugin.c
+++ b/plugins/project-import/plugin.c
@@ -488,8 +488,6 @@ activate_plugin (AnjutaPlugin *plugin)
 static gboolean
 deactivate_plugin (AnjutaPlugin *plugin)
 {
-	AnjutaProjectImportPlugin *iplugin;
-	iplugin = ANJUTA_PLUGIN_PROJECT_IMPORT (plugin);
 	return TRUE;
 }
 
@@ -502,8 +500,6 @@ dispose (GObject *obj)
 static void
 finalize (GObject *obj)
 {
-	AnjutaProjectImportPlugin *import_plugin = (AnjutaProjectImportPlugin *)obj;
-
 	G_OBJECT_CLASS (parent_class)->finalize (obj);
 }
 
diff --git a/plugins/project-import/project-import-dialog.c b/plugins/project-import/project-import-dialog.c
index aa20b39..80a69ed 100644
--- a/plugins/project-import/project-import-dialog.c
+++ b/plugins/project-import/project-import-dialog.c
@@ -54,6 +54,19 @@ vcs_entry_changed (GtkEditable *editable, gpointer user_data)
 
 	if (gtk_entry_get_text_length (GTK_ENTRY (editable)))
 	{
+		GFile *file;
+		gchar *basename;
+		
+		/* Automatically set project name */
+		file = g_file_new_for_uri (gtk_entry_get_text (GTK_ENTRY (editable)));
+		basename = g_file_get_basename (file);
+		g_object_unref (file);
+		if (basename != NULL)
+		{
+			gtk_entry_set_text (priv->name_entry, basename);
+			g_free (basename);
+		}
+
 		if (gtk_entry_get_text_length (priv->name_entry))
 		{
 			gtk_widget_set_sensitive (priv->import_button, TRUE);
diff --git a/plugins/project-import/project-import.ui b/plugins/project-import/project-import.ui
index 60a7262..280fd64 100644
--- a/plugins/project-import/project-import.ui
+++ b/plugins/project-import/project-import.ui
@@ -1,11 +1,20 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="2.16"/>
-  <!-- interface-naming-policy project-wide -->
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkListStore" id="vcs_store">
+    <columns>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+      <!-- column-name gchararray2 -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkWindow" id="window1">
+    <property name="can_focus">False</property>
     <child>
       <object class="GtkAlignment" id="top_level">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
         <property name="top_padding">12</property>
         <property name="bottom_padding">12</property>
         <property name="left_padding">12</property>
@@ -13,68 +22,41 @@
         <child>
           <object class="GtkVBox" id="vbox">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <property name="spacing">12</property>
             <child>
-              <object class="GtkFrame" id="frame3">
-                <property name="visible">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">none</property>
-                <child>
-                  <object class="GtkAlignment" id="alignment6">
-                    <property name="visible">True</property>
-                    <property name="top_padding">6</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <object class="GtkEntry" id="name_entry">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">&#x2022;</property>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-                <child type="label">
-                  <object class="GtkLabel" id="label7">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">Project name</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkFrame" id="frame4">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">none</property>
                 <child>
                   <object class="GtkAlignment" id="alignment7">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="top_padding">6</property>
                     <child>
                       <object class="GtkVBox" id="vbox1">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="spacing">12</property>
                         <child>
                           <object class="GtkFrame" id="frame7">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="label_xalign">0</property>
                             <property name="shadow_type">none</property>
                             <child>
                               <object class="GtkAlignment" id="alignment13">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="bottom_padding">6</property>
                                 <property name="left_padding">12</property>
                                 <property name="right_padding">6</property>
                                 <child>
                                   <object class="GtkFileChooserButton" id="source_dir_button">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="action">select-folder</property>
                                     <property name="create_folders">False</property>
                                   </object>
@@ -84,6 +66,7 @@
                             <child type="label">
                               <object class="GtkHBox" id="hbox8">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">6</property>
                                 <child>
                                   <object class="GtkRadioButton" id="folder_radio">
@@ -91,11 +74,13 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="xalign">0.5</property>
                                     <property name="active">True</property>
                                     <property name="draw_indicator">True</property>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
+                                    <property name="fill">True</property>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
@@ -103,30 +88,39 @@
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkFrame" id="frame9">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="label_xalign">0</property>
                             <property name="shadow_type">none</property>
                             <child>
                               <object class="GtkAlignment" id="alignment16">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="bottom_padding">6</property>
                                 <property name="left_padding">12</property>
                                 <property name="right_padding">6</property>
                                 <child>
                                   <object class="GtkTable" id="table4">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="n_rows">2</property>
                                     <property name="n_columns">3</property>
                                     <property name="column_spacing">6</property>
                                     <property name="row_spacing">6</property>
                                     <child>
+                                      <placeholder/>
+                                    </child>
+                                    <child>
                                       <object class="GtkLabel" id="label23">
                                         <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
                                         <property name="xalign">0</property>
                                         <property name="label" translatable="yes">Location:</property>
                                       </object>
@@ -138,6 +132,7 @@
                                     <child>
                                       <object class="GtkLabel" id="label24">
                                         <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
                                         <property name="xalign">0</property>
                                         <property name="label" translatable="yes">Destination:</property>
                                       </object>
@@ -152,6 +147,7 @@
                                       <object class="GtkFileChooserButton" id="dest_dir_button">
                                         <property name="visible">True</property>
                                         <property name="sensitive">False</property>
+                                        <property name="can_focus">False</property>
                                         <property name="action">select-folder</property>
                                       </object>
                                       <packing>
@@ -166,7 +162,7 @@
                                         <property name="visible">True</property>
                                         <property name="sensitive">False</property>
                                         <property name="can_focus">True</property>
-                                        <property name="invisible_char">&#x2022;</property>
+                                        <property name="invisible_char">â</property>
                                         <property name="width_chars">60</property>
                                       </object>
                                       <packing>
@@ -178,8 +174,9 @@
                                       <object class="GtkComboBox" id="vcs_combo">
                                         <property name="visible">True</property>
                                         <property name="sensitive">False</property>
+                                        <property name="can_focus">False</property>
                                         <property name="model">vcs_store</property>
-                                        <signal name="changed" handler="on_vcs_combo_changed"/>
+                                        <signal name="changed" handler="on_vcs_combo_changed" swapped="no"/>
                                         <child>
                                           <object class="GtkCellRendererText" id="cellrenderertext1"/>
                                           <attributes>
@@ -194,9 +191,6 @@
                                         <property name="y_options">GTK_FILL</property>
                                       </packing>
                                     </child>
-                                    <child>
-                                      <placeholder/>
-                                    </child>
                                   </object>
                                 </child>
                               </object>
@@ -204,6 +198,7 @@
                             <child type="label">
                               <object class="GtkHBox" id="hbox10">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">6</property>
                                 <child>
                                   <object class="GtkRadioButton" id="vcs_radio">
@@ -211,11 +206,13 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="xalign">0.5</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">folder_radio</property>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
+                                    <property name="fill">True</property>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
@@ -223,6 +220,8 @@
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
@@ -233,6 +232,7 @@
                 <child type="label">
                   <object class="GtkLabel" id="label12">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label" translatable="yes">Import options</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
@@ -242,6 +242,45 @@
               </object>
               <packing>
                 <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFrame" id="frame3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment6">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkEntry" id="name_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">â</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label7">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Project name</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
                 <property name="position">1</property>
               </packing>
             </child>
@@ -250,12 +289,4 @@
       </object>
     </child>
   </object>
-  <object class="GtkListStore" id="vcs_store">
-    <columns>
-      <!-- column-name gchararray1 -->
-      <column type="gchararray"/>
-      <!-- column-name gchararray2 -->
-      <column type="gchararray"/>
-    </columns>
-  </object>
 </interface>



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