~ubuntu-branches/ubuntu/saucy/network-manager-applet/saucy-updates

« back to all changes in this revision

Viewing changes to src/utils/utils.c

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2012-08-10 15:44:44 UTC
  • mfrom: (1.2.30)
  • Revision ID: package-import@ubuntu.com-20120810154444-nmjepmyshkpbxt60
Tags: 0.9.6.2-0ubuntu1
* New upstream release.
  - Fix GNOME Bluetooth plugin DUN modem detection and setup
  - Various crash and stability fixes
  - Allow appending DNS servers and domains in automatic addressing mode
  - Fix defaults for PPP echo values
  - Show IPv6 addressing page for VPN plugins that support it
  - Port to GSettings and split out 0.8 -> 0.9 migration code
  - Recognize PKCS#12 certificates imported from Firefox
  - Pre-fill CDMA username/password in the mobile broadband wizard
  - Only handle VPN secrets for GNOME Shell 3.3 and lower
* debian/control: Bump Depends and Build-Depends to (>= 0.9.6) for
  network-manager and the libnm-{glib,util,glib-vpn}-dev packages.
* debian/patches/git_fix_some_leaks_80ef61b.patch: cherry-picked patch to
  fix a few leaks: g_object_get() and gtk_tree_model_get() copy/ref the
  values they return, so make sure to deal with that everywhere.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <string.h>
25
25
#include <netinet/ether.h>
26
26
#include <glib.h>
 
27
#include <glib/gi18n.h>
27
28
#include <gtk/gtk.h>
28
29
 
29
30
#include <nm-setting-connection.h>
312
313
        return g_string_free (escaped, FALSE);
313
314
}
314
315
 
315
 
GnomeKeyringAttributeList *
316
 
utils_create_keyring_add_attr_list (NMConnection *connection,
317
 
                                    const char *connection_uuid,
318
 
                                    const char *connection_id,
319
 
                                    const char *setting_name,
320
 
                                    const char *setting_key,
321
 
                                    char **out_display_name)
 
316
char *
 
317
utils_create_mobile_connection_id (const char *provider, const char *plan_name)
322
318
{
323
 
        GnomeKeyringAttributeList *attrs = NULL;
324
 
        NMSettingConnection *s_con;
325
 
 
326
 
        if (connection) {
327
 
                s_con = nm_connection_get_setting_connection (connection);
328
 
                g_return_val_if_fail (s_con != NULL, NULL);
329
 
                connection_uuid = nm_setting_connection_get_uuid (s_con);
330
 
                connection_id = nm_setting_connection_get_id (s_con);
331
 
        }
332
 
 
333
 
        g_return_val_if_fail (connection_uuid != NULL, NULL);
334
 
        g_return_val_if_fail (connection_id != NULL, NULL);
335
 
        g_return_val_if_fail (setting_name != NULL, NULL);
336
 
        g_return_val_if_fail (setting_key != NULL, NULL);
337
 
 
338
 
        if (out_display_name) {
339
 
                *out_display_name = g_strdup_printf ("Network secret for %s/%s/%s",
340
 
                                                     connection_id,
341
 
                                                     setting_name,
342
 
                                                     setting_key);
343
 
        }
344
 
 
345
 
        attrs = gnome_keyring_attribute_list_new ();
346
 
        gnome_keyring_attribute_list_append_string (attrs,
347
 
                                                    KEYRING_UUID_TAG,
348
 
                                                    connection_uuid);
349
 
        gnome_keyring_attribute_list_append_string (attrs,
350
 
                                                    KEYRING_SN_TAG,
351
 
                                                    setting_name);
352
 
        gnome_keyring_attribute_list_append_string (attrs,
353
 
                                                    KEYRING_SK_TAG,
354
 
                                                    setting_key);
355
 
        return attrs;
 
319
        g_return_val_if_fail (provider != NULL, NULL);
 
320
 
 
321
        if (plan_name)
 
322
                return g_strdup_printf ("%s %s", provider, plan_name);
 
323
 
 
324
        /* The %s is a mobile provider name, eg "T-Mobile" */
 
325
        return g_strdup_printf (_("%s connection"), provider);
356
326
}
357
327
 
358
328
void