Skip to content

Commit

Permalink
Add properties dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
sgranjoux committed Jan 27, 2010
1 parent fa7f15c commit 7b86632
Show file tree
Hide file tree
Showing 4 changed files with 321 additions and 4 deletions.
2 changes: 1 addition & 1 deletion projectparser.anjuta
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
value="IAnjutaProjectBackend"/>
<require group="Project"
attribute="Supported-Project-Types"
value="automake2"/>
value="automake"/>
</plugin>
<plugin name="Symbol Browser"
url="http://anjuta.org/plugins/"
Expand Down
60 changes: 58 additions & 2 deletions src/am-dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down
17 changes: 17 additions & 0 deletions src/am-project.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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
Expand Down
246 changes: 245 additions & 1 deletion src/am-project.ui
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -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>

0 comments on commit 7b86632

Please sign in to comment.