Commit 6785ea56 authored by Zeeshan Ali (Khattak)'s avatar Zeeshan Ali (Khattak)
Browse files

Use g_object_new to create GUPnPContext objects

Use g_object_new() to create GUPnPContext objects so we can pass in
constructor props not part of gupnp_context_new().
parent aa8dad5a
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -141,7 +141,12 @@ create_loopback_context (gpointer data)
                      "port", &port,
                      NULL);

        context = gupnp_context_new (main_context, LOOPBACK_IP, port, &error);
        context = g_object_new (GUPNP_TYPE_CONTEXT,
                                "main-context", main_context,
                                "host-ip", LOOPBACK_IP,
                                "port", port,
                                "error", &error,
                                NULL);
        if (error) {
                g_warning ("Error creating GUPnP context: %s\n",
			   error->message);
@@ -177,10 +182,12 @@ create_context_for_device (NMDevice *nm_device,
                      "port", &port,
                      NULL);

        nm_device->context = gupnp_context_new (main_context,
                                                ip4_str,
                                                port,
                                                &error);
        nm_device->context = g_object_new (GUPNP_TYPE_CONTEXT,
                                           "main-context", main_context,
                                           "host-ip", ip4_str,
                                           "port", port,
                                           "error", &error,
                                           NULL);
        if (error) {
                g_warning ("Error creating GUPnP context: %s\n",
			   error->message);
+6 −4
Original line number Diff line number Diff line
@@ -107,10 +107,12 @@ create_and_signal_context (GUPnPUnixContextManager *manager,
                      NULL);

        error = NULL;
        context = gupnp_context_new (main_context,
                                     host_ip,
                                     port,
                                     &error);
        context = g_object_new (GUPNP_TYPE_CONTEXT,
                                "main-context", main_context,
                                "host-ip", host_ip,
                                "port", port,
                                "error", &error,
                                NULL);
        if (error != NULL) {
                g_warning ("Failed to create context for host/IP '%s': %s\n",
                           host_ip,