[anjuta/newproject] Start implementing properties dialog (read only for the moment)



commit 4c9e2535d07ec5ec52dc858bc104fa95aca6f8cd
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Wed Jan 27 22:46:14 2010 +0100

    Start implementing properties dialog (read only for the moment)

 plugins/am-project/am-dialogs.c  |   60 +++++++++-
 plugins/am-project/am-project.c  |   17 +++
 plugins/am-project/am-project.ui |  246 +++++++++++++++++++++++++++++++++++++-
 3 files changed, 320 insertions(+), 3 deletions(-)
---
diff --git a/plugins/am-project/am-dialogs.c b/plugins/am-project/am-dialogs.c
index 8a53b9b..441da27 100644
--- a/plugins/am-project/am-dialogs.c
+++ b/plugins/am-project/am-dialogs.c
@@ -143,13 +143,69 @@ amp_configure_project_dialog (AmpProject *project, GError **error)
 GtkWidget *
 amp_configure_group_dialog (AmpProject *project, AmpGroup *group, GError **error)
 {
-	return NULL;
+	GtkBuilder *bxml = gtk_builder_new ();
+	GtkWidget *properties;
+	GtkWidget *main_table;
+	GtkWidget *extra_table;
+	AmpConfigureProjectDialog *dlg;
+	gchar *name;
+
+	bxml = anjuta_util_builder_new (GLADE_FILE, NULL);
+	if (!bxml) return NULL;
+
+	dlg = g_new0 (AmpConfigureProjectDialog, 1);
+	anjuta_util_builder_get_objects (bxml,
+	                                "properties", &properties,
+	    							"main_table", &main_table,
+	    							"extra_table", &extra_table,
+	                                NULL);
+	dlg->top_level = properties;
+	g_object_ref (properties);
+	g_signal_connect (properties, "destroy", G_CALLBACK (on_project_widget_destroy), dlg);
+
+	name = g_file_get_parse_name (amp_group_get_directory (group));
+	add_label (_("Name:"), name, main_table, 0);
+	g_free (name);
+	
+	gtk_widget_show_all (properties);
+	g_object_unref (bxml);
+	
+	return properties;
 }
 
 GtkWidget *
 amp_configure_target_dialog (AmpProject *project, AmpTarget *target, GError **error)
 {
-	return NULL;
+	GtkBuilder *bxml = gtk_builder_new ();
+	GtkWidget *properties;
+	GtkWidget *main_table;
+	GtkWidget *extra_table;
+	AmpConfigureProjectDialog *dlg;
+	AnjutaProjectTargetType type;
+	const gchar *name;
+
+	bxml = anjuta_util_builder_new (GLADE_FILE, NULL);
+	if (!bxml) return NULL;
+
+	dlg = g_new0 (AmpConfigureProjectDialog, 1);
+	anjuta_util_builder_get_objects (bxml,
+	                                "properties", &properties,
+	    							"main_table", &main_table,
+	    							"extra_table", &extra_table,
+	                                NULL);
+	dlg->top_level = properties;
+	g_object_ref (properties);
+	g_signal_connect (properties, "destroy", G_CALLBACK (on_project_widget_destroy), dlg);
+
+	name = amp_target_get_name (target);
+	add_label (_("Name:"), name, main_table, 0);
+	type = anjuta_project_target_get_type (target);
+	add_label (_("Type:"), anjuta_project_target_type_name (type), main_table, 1);
+	
+	gtk_widget_show_all (properties);
+	g_object_unref (bxml);
+	
+	return properties;
 }
 
 GtkWidget *
diff --git a/plugins/am-project/am-project.c b/plugins/am-project/am-project.c
index 17fbc8f..2583099 100644
--- a/plugins/am-project/am-project.c
+++ b/plugins/am-project/am-project.c
@@ -2728,6 +2728,22 @@ iproject_remove_node (IAnjutaProject *obj, AnjutaProjectNode *node, GError **err
 	return TRUE;
 }
 
+static GtkWidget*
+iproject_configure_node (IAnjutaProject *obj, AnjutaProjectNode *node, GError **err)
+{
+	switch (AMP_NODE_DATA (node)->type)
+	{
+		case ANJUTA_PROJECT_GROUP:
+			return amp_configure_group_dialog (AMP_PROJECT (obj), AMP_GROUP (node), err);
+		case ANJUTA_PROJECT_TARGET:
+			return amp_configure_target_dialog (AMP_PROJECT (obj), AMP_TARGET (node), err);
+		case ANJUTA_PROJECT_SOURCE:
+			return amp_configure_source_dialog (AMP_PROJECT (obj), AMP_SOURCE (node), err);
+		default:
+			return NULL;
+	}
+}
+
 static void
 iproject_iface_init(IAnjutaProjectIface* iface)
 {
@@ -2742,6 +2758,7 @@ iproject_iface_init(IAnjutaProjectIface* iface)
 	iface->load = iproject_load;
 	iface->refresh = iproject_refresh;
 	iface->remove_node = iproject_remove_node;
+	iface->configure_node = iproject_configure_node;
 }
 
 /* Group access functions
diff --git a/plugins/am-project/am-project.ui b/plugins/am-project/am-project.ui
index 931f50b..288626b 100644
--- a/plugins/am-project/am-project.ui
+++ b/plugins/am-project/am-project.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <interface>
   <requires lib="gtk+" version="2.16"/>
-  <!-- interface-naming-policy toplevel-contextual -->
+  <!-- interface-naming-policy project-wide -->
   <object class="GtkDialog" id="package_selection_dialog">
     <property name="title" translatable="yes">Select package</property>
     <property name="default_width">600</property>
@@ -416,4 +416,248 @@
       </packing>
     </child>
   </object>
+  <object class="GtkDialog" id="properties_dialog">
+    <property name="title" translatable="yes">Properties</property>
+    <property name="modal">True</property>
+    <property name="default_width">400</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox3">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkTable" id="main_table2">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">5</property>
+            <property name="n_columns">3</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="padding">5</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkExpander" id="expander2">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="border_width">6</property>
+            <child>
+              <object class="GtkTable" id="extra_table2">
+                <property name="visible">True</property>
+                <property name="n_rows">3</property>
+                <property name="n_columns">3</property>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label12">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">More options:</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="position">3</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area3">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="cancel_button">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="ok_button">
+                <property name="label">gtk-apply</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancel_button</action-widget>
+      <action-widget response="-10">ok_button</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkVBox" id="properties">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkTable" id="main_table">
+        <property name="visible">True</property>
+        <property name="n_rows">3</property>
+        <property name="n_columns">2</property>
+        <property name="column_spacing">12</property>
+        <property name="row_spacing">6</property>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkExpander" id="expander1">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkTable" id="extra_table">
+            <property name="visible">True</property>
+            <property name="n_rows">3</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">12</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label13">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">More options:</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
 </interface>



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