This commit is contained in:
Martin Willi
2008-03-20 11:38:51 +00:00
parent a86e3ab37a
commit 629e55434a
2 changed files with 87 additions and 15 deletions
+25 -8
View File
@@ -52,6 +52,16 @@ struct private_nm_applet_gui_t {
* name of the connection * name of the connection
*/ */
GtkEntry *name; GtkEntry *name;
/**
* gateway address
*/
GtkEntry *gateway;
/**
* username
*/
GtkEntry *user;
}; };
static const char *get_display_name(private_nm_applet_gui_t *this) static const char *get_display_name(private_nm_applet_gui_t *this)
@@ -70,7 +80,8 @@ static GtkWidget *get_widget(private_nm_applet_gui_t *this, GSList *properties,
GSList *i; GSList *i;
gtk_entry_set_text(this->name, ""); gtk_entry_set_text(this->name, "");
/*gtk_entry_set_text(this->gateway, "");*/ gtk_entry_set_text(this->gateway, "");
gtk_entry_set_text(this->user, "");
if (connection_name) if (connection_name)
{ {
@@ -87,15 +98,17 @@ static GtkWidget *get_widget(private_nm_applet_gui_t *this, GSList *properties,
if (properties) if (properties)
{ {
value = properties->data; value = properties->data;
/*
if (strcmp(key, "gateway") == 0) if (strcmp(key, "gateway") == 0)
{ {
gtk_entry_set_text(this->gateway, value); gtk_entry_set_text(this->gateway, value);
}*/ }
if (strcmp(key, "user") == 0)
{
gtk_entry_set_text(this->user, value);
}
properties = g_slist_next(properties); properties = g_slist_next(properties);
} }
} }
return this->widget; return this->widget;
} }
@@ -103,8 +116,10 @@ static GSList *get_properties(private_nm_applet_gui_t *this)
{ {
GSList *props = NULL; GSList *props = NULL;
/*props = g_slist_append(props, g_strdup("gateway")); props = g_slist_append(props, g_strdup("gateway"));
props = g_slist_append(props, g_strdup(gtk_entry_get_text(this->gateway)));*/ props = g_slist_append(props, g_strdup(gtk_entry_get_text(this->gateway)));
props = g_slist_append(props, g_strdup("user"));
props = g_slist_append(props, g_strdup(gtk_entry_get_text(this->user)));
return props; return props;
} }
@@ -178,14 +193,16 @@ NetworkManagerVpnUI* nm_vpn_properties_factory(void)
this->public.data = NULL; this->public.data = NULL;
this->callback = NULL; this->callback = NULL;
this->xml = glade_xml_new("/home/martin/strongswan/trunk/src/networkmanager/nm_applet_gui.xml", NULL, NULL); this->xml = glade_xml_new("/home/martin/strongswan/trunk/src/charon/plugins/dbus/nm_applet_gui.xml", NULL, NULL);
if (this->xml != NULL) if (this->xml != NULL)
{ {
this->widget = glade_xml_get_widget(this->xml, "main"); this->widget = glade_xml_get_widget(this->xml, "main");
this->name = GTK_ENTRY(glade_xml_get_widget(this->xml, "name")); this->name = GTK_ENTRY(glade_xml_get_widget(this->xml, "name"));
this->gateway = GTK_ENTRY(glade_xml_get_widget(this->xml, "gateway"));
this->user = GTK_ENTRY(glade_xml_get_widget(this->xml, "user"));
if (this->widget && this->name) if (this->widget && this->name && this->gateway && this->user)
{ {
return &this->public; return &this->public;
} }
+62 -7
View File
@@ -1,20 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.0 on Mon Apr 30 15:31:54 2007 by martin@martin--> <!--Generated with glade3 3.4.0 on Sat Mar 15 17:12:28 2008 -->
<glade-interface> <glade-interface>
<widget class="GtkWindow" id="window1"> <widget class="GtkWindow" id="window1">
<child> <child>
<widget class="GtkTable" id="main"> <widget class="GtkTable" id="main">
<property name="visible">True</property> <property name="visible">True</property>
<property name="n_rows">1</property> <property name="n_rows">3</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<property name="column_spacing">5</property>
<property name="row_spacing">5</property>
<child> <child>
<widget class="GtkLabel" id="label1"> <widget class="GtkEntry" id="user">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Connection _name</property>
<property name="use_underline">True</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label" translatable="yes">_Username</property>
<property name="use_underline">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="gateway">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">_Gateway</property>
<property name="use_underline">True</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property>
</packing> </packing>
@@ -28,8 +73,18 @@
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property>
<property name="x_padding">5</property> </packing>
<property name="y_padding">5</property> </child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Connection _name</property>
<property name="use_underline">True</property>
<property name="justify">GTK_JUSTIFY_FILL</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
</widget> </widget>