[Merge] lp:~tiagosh/telepathy-ofono/use-accounts-service into lp:telepathy-ofono

Gustavo Pichorim Boiko gustavo.boiko at canonical.com
Thu Mar 24 00:23:38 UTC 2016


Review: Needs Fixing

There is a couple things to fix in the code.

Diff comments:

> === modified file 'mc-plugin/mcp-account-manager-ofono.c'
> --- mc-plugin/mcp-account-manager-ofono.c	2015-07-08 20:01:30 +0000
> +++ mc-plugin/mcp-account-manager-ofono.c	2016-03-18 19:21:31 +0000
> @@ -106,11 +106,35 @@
>          }
>      }
>  
> -    GSettings *settings = NULL;
> -    GSettingsSchemaSource *source = g_settings_schema_source_get_default();
> -    if (source != NULL && g_settings_schema_source_lookup(source, "com.ubuntu.phone", TRUE) != NULL) {
> -        settings = g_settings_new("com.ubuntu.phone");
> -    }
> +    GHashTable *simNames = NULL;
> +    GHashTableIter iter;
> +    gpointer key, value;
> +    char dbus_path[80] = {0};
> +    sprintf(dbus_path, "/org/freedesktop/Accounts/User%d", getuid());
> +    DBusGConnection *bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);

According to the documentation, this method is deprecated, instead you should use GDBusConnection *g_bus_get_sync(...)

> +    DBusGProxy *props_proxy = NULL;
> +    if (bus) {
> +        DBusGProxy *props_proxy = dbus_g_proxy_new_for_name (bus,

According to the documentation this method is deprecated, instead you should use:
GDBusProxy *g_dbus_proxy_new_sync(...)

Also, I think you need to g_object_unref the props_proxy somewhere in the code too.

> +                                                             "org.freedesktop.Accounts",
> +                                                             dbus_path,
> +                                                             "org.freedesktop.DBus.Properties");
> +    }
> +
> +    if (props_proxy) {
> +        GError *error = NULL;
> +
> +        /* Retrieve all SimNames from Accounts Service */
> +        if (!dbus_g_proxy_call (props_proxy, "Get", &error,
> +                    G_TYPE_STRING, "com.ubuntu.touch.AccountsService.Phone",
> +                    G_TYPE_STRING, "SimNames",
> +                    G_TYPE_INVALID,
> +                    DBUS_TYPE_G_STRING_STRING_HASHTABLE, &simNames,
> +                    G_TYPE_INVALID)) {
> +            g_warning ("Failed to get SimNames property: %s", error->message);
> +            g_error_free (error);
> +        }
> +    }
> +
>      for (index = 0; index < num_modems; index++) {
>          OfonoAccount *account = (OfonoAccount*)malloc(sizeof(OfonoAccount));
>          char account_name[30] = {0};


-- 
https://code.launchpad.net/~tiagosh/telepathy-ofono/use-accounts-service/+merge/289539
Your team Ubuntu Phablet Team is subscribed to branch lp:telepathy-ofono.



More information about the Ubuntu-reviews mailing list