[anjuta/newproject] Add options for group and target (not loaded nor saved currently)



commit d63507729d8d1fe459f9489c1f4779a85623e450
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Sun Feb 7 23:04:16 2010 +0100

    Add options for group and target (not loaded nor saved currently)

 libanjuta/anjuta-project.c         |    7 ++
 libanjuta/anjuta-project.h         |    1 +
 plugins/am-project/am-dialogs.c    |   12 ++--
 plugins/am-project/am-project.c    |  155 +++++++++++++++++++-----------------
 plugins/am-project/am-project.ui   |    9 ++
 plugins/am-project/am-properties.c |   37 ++++++---
 6 files changed, 131 insertions(+), 90 deletions(-)
---
diff --git a/libanjuta/anjuta-project.c b/libanjuta/anjuta-project.c
index 2063706..1d6f3c9 100644
--- a/libanjuta/anjuta-project.c
+++ b/libanjuta/anjuta-project.c
@@ -151,6 +151,13 @@ anjuta_project_property_remove (AnjutaProjectPropertyList *list, AnjutaProjectPr
 	return list;
 }
 
+void
+anjuta_project_property_foreach (AnjutaProjectPropertyList *list, GFunc func, gpointer user_data)
+{
+	g_list_foreach (list, func, user_data);
+}
+
+
 /* Node access functions
  *---------------------------------------------------------------------------*/
 
diff --git a/libanjuta/anjuta-project.h b/libanjuta/anjuta-project.h
index 1934ec8..943b9d4 100644
--- a/libanjuta/anjuta-project.h
+++ b/libanjuta/anjuta-project.h
@@ -127,6 +127,7 @@ AnjutaProjectPropertyInfo *anjuta_project_property_get_info (AnjutaProjectProper
 AnjutaProjectPropertyInfo *anjuta_project_property_lookup (AnjutaProjectPropertyList *list, AnjutaProjectPropertyItem *prop);
 AnjutaProjectPropertyList *anjuta_project_property_insert (AnjutaProjectPropertyList *list, AnjutaProjectPropertyItem *prop, AnjutaProjectPropertyInfo *info);
 AnjutaProjectPropertyList *anjuta_project_property_remove (AnjutaProjectPropertyList *list, AnjutaProjectPropertyItem *prop);
+void anjuta_project_property_foreach (AnjutaProjectPropertyList *list, GFunc func, gpointer user_data);
 
 
 AnjutaProjectNode *anjuta_project_node_parent (AnjutaProjectNode *node);
diff --git a/plugins/am-project/am-dialogs.c b/plugins/am-project/am-dialogs.c
index 81d0052..13a54b2 100644
--- a/plugins/am-project/am-dialogs.c
+++ b/plugins/am-project/am-dialogs.c
@@ -184,7 +184,7 @@ amp_configure_group_dialog (AmpProject *project, AmpGroup *group, GError **error
 
 	main_pos = 1;
 	extra_pos = 0;
-	list = amp_project_get_property_list (project);
+	list = anjuta_project_node_get_property_list ((AnjutaProjectNode *)group);
 	for (prop = anjuta_project_property_first (list); prop != NULL; prop = anjuta_project_property_next (prop))
 	{
 		AnjutaProjectPropertyInfo *info;
@@ -192,12 +192,12 @@ amp_configure_group_dialog (AmpProject *project, AmpGroup *group, GError **error
 		info = anjuta_project_property_lookup (list, prop);
 		if (info != NULL)
 		{
-			add_entry (project, (AnjutaProjectNode *)group, info, extra_table, extra_pos++);
+			add_entry (project, (AnjutaProjectNode *)group, info, main_table, main_pos++);
 		}
 		else
 		{
 			info = anjuta_project_property_get_info (prop);
-			add_entry (project, (AnjutaProjectNode *)group, info, main_table, main_pos++);
+			add_entry (project, (AnjutaProjectNode *)group, info, extra_table, extra_pos++);
 		}
 	}
 	
@@ -242,7 +242,7 @@ amp_configure_target_dialog (AmpProject *project, AmpTarget *target, GError **er
 
 	main_pos = 2;
 	extra_pos = 0;
-	list = amp_project_get_property_list (project);
+	list = anjuta_project_node_get_property_list ((AnjutaProjectNode *)target);
 	for (prop = anjuta_project_property_first (list); prop != NULL; prop = anjuta_project_property_next (prop))
 	{
 		AnjutaProjectPropertyInfo *info;
@@ -250,12 +250,12 @@ amp_configure_target_dialog (AmpProject *project, AmpTarget *target, GError **er
 		info = anjuta_project_property_lookup (list, prop);
 		if (info != NULL)
 		{
-			add_entry (project, (AnjutaProjectNode *)target, info, extra_table, extra_pos++);
+			add_entry (project, (AnjutaProjectNode *)target, info, main_table, main_pos++);
 		}
 		else
 		{
 			info = anjuta_project_property_get_info (prop);
-			add_entry (project, (AnjutaProjectNode *)target, info, main_table, main_pos++);
+			add_entry (project, (AnjutaProjectNode *)target, info, extra_table, extra_pos++);
 		}
 	}
 	
diff --git a/plugins/am-project/am-project.c b/plugins/am-project/am-project.c
index fcad899..71f2e62 100644
--- a/plugins/am-project/am-project.c
+++ b/plugins/am-project/am-project.c
@@ -565,6 +565,79 @@ amp_project_free_module_hash (AmpProject *project)
 	}
 }
 
+/* Properties objects
+ *---------------------------------------------------------------------------*/
+
+static AmpProjectPropertyInfo *
+amp_project_property_new (AnjutaToken *ac_init)
+{
+	AmpProjectPropertyInfo *prop;
+
+	prop = g_slice_new0(AmpProjectPropertyInfo);
+	prop->ac_init = ac_init;
+
+	return prop;
+}
+
+static void
+amp_project_property_free (AmpProjectPropertyInfo *prop)
+{
+	if (prop->base.override != NULL)
+	{
+		if ((prop->base.value != NULL) && (prop->base.value != ((AmpProjectPropertyInfo *)(prop->base.override->data))->base.value))
+		{
+			g_free (prop->base.value);
+		}
+		g_slice_free (AmpProjectPropertyInfo, prop);
+	}
+}
+
+static AmpGroupPropertyInfo *
+amp_group_property_new (void)
+{
+	AmpGroupPropertyInfo *prop;
+
+	prop = g_slice_new0(AmpGroupPropertyInfo);
+
+	return prop;
+}
+
+static void
+amp_group_property_free (AmpGroupPropertyInfo *prop)
+{
+	if (prop->base.override != NULL)
+	{
+		if ((prop->base.value != NULL) && (prop->base.value != ((AmpGroupPropertyInfo *)(prop->base.override->data))->base.value))
+		{
+			g_free (prop->base.value);
+		}
+		g_slice_free (AmpGroupPropertyInfo, prop);
+	}
+}
+
+static AmpTargetPropertyInfo *
+amp_target_property_new (void)
+{
+	AmpTargetPropertyInfo *prop;
+
+	prop = g_slice_new0(AmpTargetPropertyInfo);
+
+	return prop;
+}
+
+static void
+amp_target_property_free (AmpTargetPropertyInfo *prop)
+{
+	if (prop->base.override != NULL)
+	{
+		if ((prop->base.value != NULL) && (prop->base.value != ((AmpTargetPropertyInfo *)(prop->base.override->data))->base.value))
+		{
+			g_free (prop->base.value);
+		}
+		g_slice_free (AmpTargetPropertyInfo, prop);
+	}
+}
+
 /* Group objects
  *---------------------------------------------------------------------------*/
 
@@ -653,6 +726,7 @@ amp_group_new (GFile *file, gboolean dist_only)
 	
 	group = g_slice_new0(AmpGroupData); 
 	group->base.node.type = ANJUTA_PROJECT_GROUP;
+	group->base.node.properties = amp_get_group_property_list();
 	group->base.directory = g_object_ref (file);
 	group->dist_only = dist_only;
 
@@ -666,6 +740,7 @@ amp_group_free (AmpGroup *node)
 	gint i;
 	
 	if (group->base.directory) g_object_unref (group->base.directory);
+	anjuta_project_property_foreach (group->base.node.properties, (GFunc)amp_project_property_free, NULL);
 	if (group->tfile) anjuta_token_file_free (group->tfile);
 	if (group->makefile) g_object_unref (group->makefile);
 	for (i = 0; i < AM_GROUP_TOKEN_LAST; i++)
@@ -673,6 +748,7 @@ amp_group_free (AmpGroup *node)
 		if (group->tokens[i] != NULL) g_list_free (group->tokens[i]);
 	}
     g_slice_free (AmpGroupData, group);
+	
 
 	g_node_destroy (node);
 }
@@ -710,6 +786,7 @@ amp_target_new (const gchar *name, AnjutaProjectTargetType type, const gchar *in
 
 	target = g_slice_new0(AmpTargetData); 
 	target->base.node.type = ANJUTA_PROJECT_TARGET;
+	target->base.node.properties = amp_get_target_property_list();
 	target->base.name = g_strdup (name);
 	target->base.type = type;
 	target->install = g_strdup (install);
@@ -724,6 +801,7 @@ amp_target_free (AmpTarget *node)
     AmpTargetData *target = AMP_TARGET_DATA (node);
 	
     g_free (target->base.name);
+	anjuta_project_property_foreach (target->base.node.properties, (GFunc)amp_project_property_free, NULL);
     g_free (target->install);
     g_slice_free (AmpTargetData, target);
 
@@ -740,6 +818,7 @@ amp_source_new (GFile *file)
 
 	source = g_slice_new0(AmpSourceData); 
 	source->base.node.type = ANJUTA_PROJECT_SOURCE;
+	source->base.node.properties = amp_get_source_property_list();
 	source->base.file = g_object_ref (file);
 
     return g_node_new (source);
@@ -751,84 +830,12 @@ amp_source_free (AmpSource *node)
     AmpSourceData *source = AMP_SOURCE_DATA (node);
 	
     g_object_unref (source->base.file);
+	anjuta_project_property_foreach (source->base.node.properties, (GFunc)amp_project_property_free, NULL);
     g_slice_free (AmpSourceData, source);
 
 	g_node_destroy (node);
 }
 
-/* Properties objects
- *---------------------------------------------------------------------------*/
-
-static AmpProjectPropertyInfo *
-amp_project_property_new (AnjutaToken *ac_init)
-{
-	AmpProjectPropertyInfo *prop;
-
-	prop = g_slice_new0(AmpProjectPropertyInfo);
-	prop->ac_init = ac_init;
-
-	return prop;
-}
-
-static void
-amp_project_property_free (AmpProjectPropertyInfo *prop)
-{
-	if (prop->base.override != NULL)
-	{
-		if ((prop->base.value != NULL) && (prop->base.value != ((AmpProjectPropertyInfo *)(prop->base.override->data))->base.value))
-		{
-			g_free (prop->base.value);
-		}
-		g_slice_free (AmpProjectPropertyInfo, prop);
-	}
-}
-
-static AmpGroupPropertyInfo *
-amp_group_property_new (void)
-{
-	AmpGroupPropertyInfo *prop;
-
-	prop = g_slice_new0(AmpGroupPropertyInfo);
-
-	return prop;
-}
-
-static void
-amp_group_property_free (AmpGroupPropertyInfo *prop)
-{
-	if (prop->base.override != NULL)
-	{
-		if ((prop->base.value != NULL) && (prop->base.value != ((AmpGroupPropertyInfo *)(prop->base.override->data))->base.value))
-		{
-			g_free (prop->base.value);
-		}
-		g_slice_free (AmpGroupPropertyInfo, prop);
-	}
-}
-
-static AmpTargetPropertyInfo *
-amp_target_property_new (void)
-{
-	AmpTargetPropertyInfo *prop;
-
-	prop = g_slice_new0(AmpTargetPropertyInfo);
-
-	return prop;
-}
-
-static void
-amp_target_property_free (AmpTargetPropertyInfo *prop)
-{
-	if (prop->base.override != NULL)
-	{
-		if ((prop->base.value != NULL) && (prop->base.value != ((AmpTargetPropertyInfo *)(prop->base.override->data))->base.value))
-		{
-			g_free (prop->base.value);
-		}
-		g_slice_free (AmpTargetPropertyInfo, prop);
-	}
-}
-
 /*
  * File monitoring support --------------------------------
  * FIXME: review these
@@ -1698,7 +1705,7 @@ amp_project_unload (AmpProject *project)
 	if (project->root_file) g_object_unref (project->root_file);
 	project->root_file = NULL;
 
-	g_list_foreach (project->properties, (GFunc)amp_project_property_free, NULL);
+	anjuta_project_property_foreach (project->properties, (GFunc)amp_project_property_free, NULL);
 	project->properties = amp_get_project_property_list ();
 	
 	/* shortcut hash tables */
diff --git a/plugins/am-project/am-project.ui b/plugins/am-project/am-project.ui
index 288626b..56aa7fe 100644
--- a/plugins/am-project/am-project.ui
+++ b/plugins/am-project/am-project.ui
@@ -614,6 +614,8 @@
         </child>
       </object>
       <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
         <property name="position">0</property>
       </packing>
     </child>
@@ -621,6 +623,7 @@
       <object class="GtkExpander" id="expander1">
         <property name="visible">True</property>
         <property name="can_focus">True</property>
+        <property name="spacing">6</property>
         <child>
           <object class="GtkTable" id="extra_table">
             <property name="visible">True</property>
@@ -651,13 +654,19 @@
         <child type="label">
           <object class="GtkLabel" id="label13">
             <property name="visible">True</property>
+            <property name="yalign">1</property>
             <property name="label" translatable="yes">More options:</property>
           </object>
         </child>
       </object>
       <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
         <property name="position">1</property>
       </packing>
     </child>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>
diff --git a/plugins/am-project/am-properties.c b/plugins/am-project/am-properties.c
index ba0a90d..b7ed100 100644
--- a/plugins/am-project/am-properties.c
+++ b/plugins/am-project/am-properties.c
@@ -49,22 +49,39 @@ static GList* AmpProjectPropertyList = NULL;
 
 
 static AmpGroupPropertyInfo AmpGroupProperties[] = {
-	{{N_("Name:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 0},
-	{{N_("Version:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 1},
-	{{N_("Bug report URL:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 2},
-	{{N_("Package name:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 3},
-	{{N_("URL:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Linker flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("C preprocessor flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("C compiler flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("C++ compiler flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Java Compiler flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Fortan compiler flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Objective C compiler flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Lex/Flex flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Yacc/Bison flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Ratfor compiler flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
 	{{NULL, ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 0}};
 
 static GList* AmpGroupPropertyList = NULL;
 
 
 static AmpTargetPropertyInfo AmpTargetProperties[] = {
-	{{N_("Name:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 0},
-	{{N_("Version:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 1},
-	{{N_("Bug report URL:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 2},
-	{{N_("Package name:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 3},
-	{{N_("URL:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Installation directory:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Include in distribution:"), ANJUTA_PROJECT_PROPERTY_BOOLEAN, NULL, NULL}, NULL, 2},
+	{{N_("Linker flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("C preprocessor flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("C compiler flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("C++ compiler flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Java Compiler flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Fortan compiler flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Objective C compiler flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Lex/Flex flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Yacc/Bison flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Ratfor compiler flags:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Additional dependencies:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
+	{{N_("Build for check only:"), ANJUTA_PROJECT_PROPERTY_BOOLEAN, NULL, NULL}, NULL, 3},
+	{{N_("Do not use prefix:"), ANJUTA_PROJECT_PROPERTY_BOOLEAN, NULL, NULL}, NULL, 1},
+	{{N_("Keep target path:"), ANJUTA_PROJECT_PROPERTY_BOOLEAN, NULL, NULL}, NULL, 0},
+	{{N_("Manual section:"), ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 4},
 	{{NULL, ANJUTA_PROJECT_PROPERTY_STRING, NULL, NULL}, NULL, 0}};
 
 static GList* AmpTargetPropertyList = NULL;



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