~ubuntu-branches/ubuntu/precise/network-manager/precise

« back to all changes in this revision

Viewing changes to libnm-util/nm-utils.c

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2012-02-09 16:45:41 UTC
  • mfrom: (1.1.53)
  • Revision ID: package-import@ubuntu.com-20120209164541-4h90zknlsfdb7x35
Tags: 0.9.2.0+git201202091925.c721477-0ubuntu1
* upstream snapshot 2012-02-09 19:25:59 (GMT)
  + c721477d11d4fe144111d6d2eec8f93f2e9186c9
* debian/patches/avoid-periodic-disk-wakeups.patch: refreshed.
* debian/patches/nl3-default-ip6-route.patch: refreshed.
* debian/libnm-glib4.symbols: add symbols:
  + nm_active_connection_get_master@Base
  + nm_client_new_async@Base
  + nm_client_new_finish@Base
  + nm_remote_settings_new_async@Base
  + nm_remote_settings_new_finish@Base
  + nm_device_get_state_reason@Base
* debian/libnm-util2.symbols: add symbols:
  + nm_setting_802_1x_get_pac_file@Base
  + nm_setting_infiniband_get_transport_mode@Base

Show diffs side-by-side

added added

removed removed

Lines of Context:
537
537
}
538
538
 
539
539
static void
 
540
_nm_utils_convert_op_to_string (const GValue *src_value, GValue *dest_value)
 
541
{
 
542
        g_return_if_fail (g_type_is_a (G_VALUE_TYPE (src_value), DBUS_TYPE_G_OBJECT_PATH));
 
543
 
 
544
        g_value_set_string (dest_value, (const char *) g_value_get_boxed (src_value));
 
545
}
 
546
 
 
547
static void
540
548
_nm_utils_convert_strv_to_slist (const GValue *src_value, GValue *dest_value)
541
549
{
542
550
        char **str;
598
606
}
599
607
 
600
608
static void
 
609
_string_array_to_string (const GPtrArray *strings, GValue *dest_value)
 
610
{
 
611
        GString *printable;
 
612
        int i;
 
613
 
 
614
        printable = g_string_new ("[");
 
615
        for (i = 0; strings && i < strings->len; i++) {
 
616
                if (i > 0)
 
617
                        g_string_append (printable, ", '");
 
618
                else
 
619
                        g_string_append_c (printable, '\'');
 
620
                g_string_append (printable, g_ptr_array_index (strings, i));
 
621
                g_string_append_c (printable, '\'');
 
622
        }
 
623
        g_string_append_c (printable, ']');
 
624
 
 
625
        g_value_take_string (dest_value, printable->str);
 
626
        g_string_free (printable, FALSE);
 
627
}
 
628
 
 
629
static void
601
630
_nm_utils_convert_string_array_to_string (const GValue *src_value, GValue *dest_value)
602
631
{
603
 
        GPtrArray *strings;
604
 
        GString *printable;
605
 
        int i;
 
632
        const GPtrArray *strings;
606
633
 
607
634
        g_return_if_fail (g_type_is_a (G_VALUE_TYPE (src_value), DBUS_TYPE_G_ARRAY_OF_STRING));
608
635
 
609
 
        strings = (GPtrArray *) g_value_get_boxed (src_value);
610
 
 
611
 
        printable = g_string_new ("[");
612
 
        for (i = 0; strings && i < strings->len; i++) {
613
 
                if (i > 0)
614
 
                        g_string_append (printable, ", '");
615
 
                else
616
 
                        g_string_append_c (printable, '\'');
617
 
                g_string_append (printable, g_ptr_array_index (strings, i));
618
 
                g_string_append_c (printable, '\'');
619
 
        }
620
 
        g_string_append_c (printable, ']');
621
 
 
622
 
        g_value_take_string (dest_value, printable->str);
623
 
        g_string_free (printable, FALSE);
 
636
        strings = (const GPtrArray *) g_value_get_boxed (src_value);
 
637
        _string_array_to_string (strings, dest_value);
 
638
}
 
639
 
 
640
static void
 
641
_nm_utils_convert_op_array_to_string (const GValue *src_value, GValue *dest_value)
 
642
{
 
643
        const GPtrArray *strings;
 
644
 
 
645
        g_return_if_fail (g_type_is_a (G_VALUE_TYPE (src_value), DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH));
 
646
 
 
647
        strings = (const GPtrArray *) g_value_get_boxed (src_value);
 
648
        _string_array_to_string (strings, dest_value);
624
649
}
625
650
 
626
651
static void
1082
1107
        static gboolean registered = FALSE;
1083
1108
 
1084
1109
        if (G_UNLIKELY (!registered)) {
 
1110
                g_value_register_transform_func (DBUS_TYPE_G_OBJECT_PATH,
 
1111
                                                 G_TYPE_STRING,
 
1112
                                                 _nm_utils_convert_op_to_string);
1085
1113
                g_value_register_transform_func (G_TYPE_STRV, 
1086
1114
                                                 DBUS_TYPE_G_LIST_OF_STRING,
1087
1115
                                                 _nm_utils_convert_strv_to_slist);
1094
1122
                g_value_register_transform_func (DBUS_TYPE_G_ARRAY_OF_STRING,
1095
1123
                                                 G_TYPE_STRING,
1096
1124
                                                 _nm_utils_convert_string_array_to_string);
 
1125
                g_value_register_transform_func (DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH,
 
1126
                                                 G_TYPE_STRING,
 
1127
                                                 _nm_utils_convert_op_array_to_string);
1097
1128
                g_value_register_transform_func (DBUS_TYPE_G_UINT_ARRAY,
1098
1129
                                                 G_TYPE_STRING, 
1099
1130
                                                 _nm_utils_convert_uint_array_to_string);