~ubuntu-branches/debian/sid/glib2.0/sid

« back to all changes in this revision

Viewing changes to gio/gdbus-2.0/codegen/codegen.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-05-08 06:25:57 UTC
  • mfrom: (1.27.14) (3.1.181 experimental)
  • Revision ID: package-import@ubuntu.com-20130508062557-i7gbku66mls70gi2
Tags: 2.36.1-2
Merge experimental branch, upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
737
737
            self.c.write('static const GDBusAnnotationInfo %s_%d =\n'
738
738
                         '{\n'
739
739
                         '  -1,\n'
740
 
                         '  "%s",\n'
741
 
                         '  "%s",\n'%(prefix, n, a.key, a.value))
 
740
                         '  (gchar *) "%s",\n'
 
741
                         '  (gchar *) "%s",\n'%(prefix, n, a.key, a.value))
742
742
            if len(a.annotations) == 0:
743
743
                self.c.write('  NULL\n')
744
744
            else:
769
769
                         '{\n'
770
770
                         '  {\n'
771
771
                         '    -1,\n'
772
 
                         '    "%s",\n'
773
 
                         '    "%s",\n'%(prefix, a.name, a.name, a.signature))
 
772
                         '    (gchar *) "%s",\n'
 
773
                         '    (gchar *) "%s",\n'%(prefix, a.name, a.name, a.signature))
774
774
            if num_anno == 0:
775
775
                self.c.write('    NULL\n')
776
776
            else:
810
810
                                 '{\n'
811
811
                                 '  {\n'
812
812
                                 '    -1,\n'
813
 
                                 '    "%s",\n'%(i.name_lower, m.name_lower, m.name))
 
813
                                 '    (gchar *) "%s",\n'%(i.name_lower, m.name_lower, m.name))
814
814
                    if len(m.in_args) == 0:
815
815
                        self.c.write('    NULL,\n')
816
816
                    else:
849
849
                                 '{\n'
850
850
                                 '  {\n'
851
851
                                 '    -1,\n'
852
 
                                 '    "%s",\n'%(i.name_lower, s.name_lower, s.name))
 
852
                                 '    (gchar *) "%s",\n'%(i.name_lower, s.name_lower, s.name))
853
853
                    if len(s.args) == 0:
854
854
                        self.c.write('    NULL,\n')
855
855
                    else:
889
889
                                 '{\n'
890
890
                                 '  {\n'
891
891
                                 '    -1,\n'
892
 
                                 '    "%s",\n'
893
 
                                 '    "%s",\n'
 
892
                                 '    (gchar *) "%s",\n'
 
893
                                 '    (gchar *) "%s",\n'
894
894
                                 '    %s,\n'%(i.name_lower, p.name_lower, p.name, p.arg.signature, access))
895
895
                    if num_anno == 0:
896
896
                        self.c.write('    NULL\n')
919
919
                         '{\n'
920
920
                         '  {\n'
921
921
                         '    -1,\n'
922
 
                         '    "%s",\n'%(i.name_lower, i.name))
 
922
                         '    (gchar *) "%s",\n'%(i.name_lower, i.name))
923
923
            if len(i.methods) == 0:
924
924
                self.c.write('    NULL,\n')
925
925
            else:
954
954
            self.c.write('GDBusInterfaceInfo *\n'
955
955
                         '%s_interface_info (void)\n'
956
956
                         '{\n'
957
 
                         '  return (GDBusInterfaceInfo *) &_%s_interface_info;\n'
 
957
                         '  return (GDBusInterfaceInfo *) &_%s_interface_info.parent_struct;\n'
958
958
                         '}\n'
959
959
                         '\n'%(i.name_lower, i.name_lower))
960
960
 
1651
1651
                         '    g_variant_new ("(ssv)", "%s", info->parent_struct.name, variant),\n'
1652
1652
                         '    G_DBUS_CALL_FLAGS_NONE,\n'
1653
1653
                         '    -1,\n'
1654
 
                         '    NULL, (GAsyncReadyCallback) %s_proxy_set_property_cb, (gpointer) info);\n'
 
1654
                         '    NULL, (GAsyncReadyCallback) %s_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);\n'
1655
1655
                         '  g_variant_unref (variant);\n'
1656
1656
                         %(len(i.properties), i.name_lower, i.name, i.name_lower))
1657
1657
        self.c.write('}\n'
1672
1672
                     '  guint n;\n'
1673
1673
                     '  guint signal_id;\n');
1674
1674
        # Note: info could be NULL if we are talking to a newer version of the interface
1675
 
        self.c.write('  info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_%s_interface_info, signal_name);\n'
 
1675
        self.c.write('  info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_%s_interface_info.parent_struct, signal_name);\n'
1676
1676
                     '  if (info == NULL)\n'
1677
1677
                     '    return;\n'
1678
1678
                     %(i.name_lower))
1721
1721
                     '  g_variant_get (changed_properties, "a{sv}", &iter);\n'
1722
1722
                     '  while (g_variant_iter_next (iter, "{&sv}", &key, NULL))\n'
1723
1723
                     '    {\n'
1724
 
                     '      info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info, key);\n'
 
1724
                     '      info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info.parent_struct, key);\n'
1725
1725
                     '      g_datalist_remove_data (&proxy->priv->qdata, key);\n'
1726
1726
                     '      if (info != NULL)\n'
1727
1727
                     '        g_object_notify (G_OBJECT (proxy), info->hyphen_name);\n'
1729
1729
                     '  g_variant_iter_free (iter);\n'
1730
1730
                     '  for (n = 0; invalidated_properties[n] != NULL; n++)\n'
1731
1731
                     '    {\n'
1732
 
                     '      info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info, invalidated_properties[n]);\n'
 
1732
                     '      info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info.parent_struct, invalidated_properties[n]);\n'
1733
1733
                     '      g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);\n'
1734
1734
                     '      if (info != NULL)\n'
1735
1735
                     '        g_object_notify (G_OBJECT (proxy), info->hyphen_name);\n'
2157
2157
                     '  GVariant *ret;\n'
2158
2158
                     %(i.name_lower, i.camel_name, i.ns_upper, i.name_upper))
2159
2159
        self.c.write('  ret = NULL;\n'
2160
 
                     '  info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info, property_name);\n'
 
2160
                     '  info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info.parent_struct, property_name);\n'
2161
2161
                     '  g_assert (info != NULL);\n'
2162
2162
                     '  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);\n'
2163
2163
                     '  if (pspec == NULL)\n'
2194
2194
                     '  gboolean ret;\n'
2195
2195
                     %(i.name_lower, i.camel_name, i.ns_upper, i.name_upper))
2196
2196
        self.c.write('  ret = FALSE;\n'
2197
 
                     '  info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info, property_name);\n'
 
2197
                     '  info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info.parent_struct, property_name);\n'
2198
2198
                     '  g_assert (info != NULL);\n'
2199
2199
                     '  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);\n'
2200
2200
                     '  if (pspec == NULL)\n'
2221
2221
                     '{\n'
2222
2222
                     '  _%s_skeleton_handle_method_call,\n'
2223
2223
                     '  _%s_skeleton_handle_get_property,\n'
2224
 
                     '  _%s_skeleton_handle_set_property\n'
 
2224
                     '  _%s_skeleton_handle_set_property,\n'
 
2225
                     '  {NULL}\n'
2225
2226
                     '};\n'
2226
2227
                     '\n'%(i.name_lower, i.name_lower, i.name_lower, i.name_lower))
2227
2228
 
2420
2421
                         '    }\n'
2421
2422
                         '  if (num_changes > 0)\n'
2422
2423
                         '    {\n'
2423
 
                         '      GList *connections, *l;\n'
 
2424
                         '      GList *connections, *ll;\n'
2424
2425
                         '      GVariant *signal_variant;'
2425
2426
                         '\n'
2426
2427
                         '      signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "%s",\n'
2427
2428
                         '                                           &builder, &invalidated_builder));\n'
2428
2429
                         '      connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));\n'
2429
 
                         '      for (l = connections; l != NULL; l = l->next)\n'
 
2430
                         '      for (ll = connections; ll != NULL; ll = ll->next)\n'
2430
2431
                         '        {\n'
2431
 
                         '          GDBusConnection *connection = l->data;\n'
 
2432
                         '          GDBusConnection *connection = ll->data;\n'
2432
2433
                         '\n'
2433
2434
                         '          g_dbus_connection_emit_signal (connection,\n'
2434
2435
                         '                                         NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),\n'
3103
3104
                     '      lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);\n'
3104
3105
                     %(self.ns_upper))
3105
3106
        for i in self.ifaces:
3106
 
            self.c.write('      g_hash_table_insert (lookup_hash, "%s", GSIZE_TO_POINTER (%sTYPE_%s_PROXY));\n'
 
3107
            self.c.write('      g_hash_table_insert (lookup_hash, (gpointer) "%s", GSIZE_TO_POINTER (%sTYPE_%s_PROXY));\n'
3107
3108
                         %(i.name, i.ns_upper, i.name_upper))
3108
3109
        self.c.write('      g_once_init_leave (&once_init_value, 1);\n'
3109
3110
                     '    }\n')