summaryrefslogtreecommitdiff
path: root/clients/tui/nmt-route-editor.c
diff options
context:
space:
mode:
Diffstat (limited to 'clients/tui/nmt-route-editor.c')
-rw-r--r--clients/tui/nmt-route-editor.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/clients/tui/nmt-route-editor.c b/clients/tui/nmt-route-editor.c
index 98fd9ccbb6..77bbec76de 100644
--- a/clients/tui/nmt-route-editor.c
+++ b/clients/tui/nmt-route-editor.c
@@ -77,21 +77,15 @@ save_routes_and_exit (NmtNewtButton *button,
{
NmtRouteEditor *editor = user_data;
NmtRouteEditorPrivate *priv = NMT_ROUTE_EDITOR_GET_PRIVATE (editor);
- const char *property;
- GBinding *binding;
+ GPtrArray *routes;
- if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting))
- property = NM_SETTING_IP4_CONFIG_ROUTES;
- else
- property = NM_SETTING_IP6_CONFIG_ROUTES;
-
- /* Because of the complicated dbus-glib GTypes, it's easier to cheat
- * and use GBinding to do this than it is to copy the value by hand.
- */
- binding = g_object_bind_property (priv->edit_setting, property,
- priv->orig_setting, property,
- G_BINDING_SYNC_CREATE);
- g_object_unref (binding);
+ g_object_get (priv->edit_setting,
+ NM_SETTING_IP_CONFIG_ROUTES, &routes,
+ NULL);
+ g_object_set (priv->orig_setting,
+ NM_SETTING_IP_CONFIG_ROUTES, routes,
+ NULL);
+ g_ptr_array_unref (routes);
nmt_newt_form_quit (NMT_NEWT_FORM (editor));
}
@@ -106,17 +100,13 @@ nmt_route_editor_constructed (GObject *object)
if (G_OBJECT_CLASS (nmt_route_editor_parent_class)->constructed)
G_OBJECT_CLASS (nmt_route_editor_parent_class)->constructed (object);
- if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting)) {
+ if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting))
routes = nmt_route_table_new (AF_INET);
- g_object_bind_property (priv->edit_setting, NM_SETTING_IP4_CONFIG_ROUTES,
- routes, "ip4-routes",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
- } else {
+ else
routes = nmt_route_table_new (AF_INET6);
- g_object_bind_property (priv->edit_setting, NM_SETTING_IP6_CONFIG_ROUTES,
- routes, "ip6-routes",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
- }
+ g_object_bind_property (priv->edit_setting, NM_SETTING_IP_CONFIG_ROUTES,
+ routes, "routes",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
vbox = nmt_newt_grid_new ();
nmt_newt_grid_add (NMT_NEWT_GRID (vbox), routes, 0, 0);