Call AddConnection DBus



Dear,
         I want to use c code to implement AddConnection.
reference by add-system-connection.py.

        DBusGConnection *p_source_bus;
        DBusGProxy *p_source_object;
        GError *p_source_error = NULL;
     
        NMConnection *connection;
        NMSettingConnection *s_con;
        NMSettingWired *s_wired;
        NMSettingIP4Config *s_ip4;
        NMSettingIP6Config *s_ip6;

        /*  ------------------------------------------  */
g_type_init ();
        p_source_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &p_source_error);
        if (!p_source_bus)
                printf ("Couldn't connect to session bus");

        p_source_object = dbus_g_proxy_new_for_name (p_source_bus,
                                             "org.freedesktop.NetworkManagerSystemSettings",
                                             "/org/freedesktop/NetworkManagerSettings",
                                             "org.freedesktop.NetworkManagerSettings");
        if (!p_source_object)
                printf ("Failed to get name owner");

        if (!dbus_g_proxy_call (p_source_object, "AddConnection", &p_source_error, , s_con, G_TYPE_INVALID, G_TYPE_INVALID))
                                                                                                                      ^^
                                                                                                           What is it G_type a{sa{sv}} that i need input?
                                                                                                           Or could not use c code to add?
Thanks
blue


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