Back to index

indicator-session  12.10.0
dbus-accounts.c
Go to the documentation of this file.
00001 /*
00002  * Generated by gdbus-codegen 2.33.3. DO NOT EDIT.
00003  *
00004  * The license of this code is the same as for the source it was derived from.
00005  */
00006 
00007 #ifdef HAVE_CONFIG_H
00008 #  include "config.h"
00009 #endif
00010 
00011 #include "dbus-accounts.h"
00012 
00013 #include <string.h>
00014 #ifdef G_OS_UNIX
00015 #  include <gio/gunixfdlist.h>
00016 #endif
00017 
00018 typedef struct
00019 {
00020   GDBusArgInfo parent_struct;
00021   gboolean use_gvariant;
00022 } _ExtendedGDBusArgInfo;
00023 
00024 typedef struct
00025 {
00026   GDBusMethodInfo parent_struct;
00027   const gchar *signal_name;
00028   gboolean pass_fdlist;
00029 } _ExtendedGDBusMethodInfo;
00030 
00031 typedef struct
00032 {
00033   GDBusSignalInfo parent_struct;
00034   const gchar *signal_name;
00035 } _ExtendedGDBusSignalInfo;
00036 
00037 typedef struct
00038 {
00039   GDBusPropertyInfo parent_struct;
00040   const gchar *hyphen_name;
00041   gboolean use_gvariant;
00042 } _ExtendedGDBusPropertyInfo;
00043 
00044 typedef struct
00045 {
00046   GDBusInterfaceInfo parent_struct;
00047   const gchar *hyphen_name;
00048 } _ExtendedGDBusInterfaceInfo;
00049 
00050 typedef struct
00051 {
00052   const _ExtendedGDBusPropertyInfo *info;
00053   guint prop_id;
00054   GValue orig_value; /* the value before the change */
00055 } ChangedProperty;
00056 
00057 static void
00058 _changed_property_free (ChangedProperty *data)
00059 {
00060   g_value_unset (&data->orig_value);
00061   g_free (data);
00062 }
00063 
00064 static gboolean
00065 _g_strv_equal0 (gchar **a, gchar **b)
00066 {
00067   gboolean ret = FALSE;
00068   guint n;
00069   if (a == NULL && b == NULL)
00070     {
00071       ret = TRUE;
00072       goto out;
00073     }
00074   if (a == NULL || b == NULL)
00075     goto out;
00076   if (g_strv_length (a) != g_strv_length (b))
00077     goto out;
00078   for (n = 0; a[n] != NULL; n++)
00079     if (g_strcmp0 (a[n], b[n]) != 0)
00080       goto out;
00081   ret = TRUE;
00082 out:
00083   return ret;
00084 }
00085 
00086 static gboolean
00087 _g_variant_equal0 (GVariant *a, GVariant *b)
00088 {
00089   gboolean ret = FALSE;
00090   if (a == NULL && b == NULL)
00091     {
00092       ret = TRUE;
00093       goto out;
00094     }
00095   if (a == NULL || b == NULL)
00096     goto out;
00097   ret = g_variant_equal (a, b);
00098 out:
00099   return ret;
00100 }
00101 
00102 G_GNUC_UNUSED static gboolean
00103 _g_value_equal (const GValue *a, const GValue *b)
00104 {
00105   gboolean ret = FALSE;
00106   g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
00107   switch (G_VALUE_TYPE (a))
00108     {
00109       case G_TYPE_BOOLEAN:
00110         ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
00111         break;
00112       case G_TYPE_UCHAR:
00113         ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
00114         break;
00115       case G_TYPE_INT:
00116         ret = (g_value_get_int (a) == g_value_get_int (b));
00117         break;
00118       case G_TYPE_UINT:
00119         ret = (g_value_get_uint (a) == g_value_get_uint (b));
00120         break;
00121       case G_TYPE_INT64:
00122         ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
00123         break;
00124       case G_TYPE_UINT64:
00125         ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
00126         break;
00127       case G_TYPE_DOUBLE:
00128         {
00129           /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
00130           gdouble da = g_value_get_double (a);
00131           gdouble db = g_value_get_double (b);
00132           ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
00133         }
00134         break;
00135       case G_TYPE_STRING:
00136         ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
00137         break;
00138       case G_TYPE_VARIANT:
00139         ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
00140         break;
00141       default:
00142         if (G_VALUE_TYPE (a) == G_TYPE_STRV)
00143           ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
00144         else
00145           g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
00146         break;
00147     }
00148   return ret;
00149 }
00150 
00151 /* ------------------------------------------------------------------------
00152  * Code for interface org.freedesktop.Accounts
00153  * ------------------------------------------------------------------------
00154  */
00155 
00164 /* ---- Introspection data for org.freedesktop.Accounts ---- */
00165 
00166 static const _ExtendedGDBusArgInfo _accounts_method_info_list_cached_users_OUT_ARG_users =
00167 {
00168   {
00169     -1,
00170     (gchar *) "users",
00171     (gchar *) "ao",
00172     NULL
00173   },
00174   FALSE
00175 };
00176 
00177 static const _ExtendedGDBusArgInfo * const _accounts_method_info_list_cached_users_OUT_ARG_pointers[] =
00178 {
00179   &_accounts_method_info_list_cached_users_OUT_ARG_users,
00180   NULL
00181 };
00182 
00183 static const GDBusAnnotationInfo _accounts_method_list_cached_users_annotation_info_0 =
00184 {
00185   -1,
00186   (gchar *) "org.freedesktop.DBus.GLib.Async",
00187   (gchar *) "",
00188   NULL
00189 };
00190 
00191 static const GDBusAnnotationInfo * const _accounts_method_list_cached_users_annotation_info_pointers[] =
00192 {
00193   &_accounts_method_list_cached_users_annotation_info_0,
00194   NULL
00195 };
00196 
00197 static const _ExtendedGDBusMethodInfo _accounts_method_info_list_cached_users =
00198 {
00199   {
00200     -1,
00201     (gchar *) "ListCachedUsers",
00202     NULL,
00203     (GDBusArgInfo **) &_accounts_method_info_list_cached_users_OUT_ARG_pointers,
00204     (GDBusAnnotationInfo **) &_accounts_method_list_cached_users_annotation_info_pointers
00205   },
00206   "handle-list-cached-users",
00207   FALSE
00208 };
00209 
00210 static const _ExtendedGDBusArgInfo _accounts_method_info_find_user_by_id_IN_ARG_id =
00211 {
00212   {
00213     -1,
00214     (gchar *) "id",
00215     (gchar *) "x",
00216     NULL
00217   },
00218   FALSE
00219 };
00220 
00221 static const _ExtendedGDBusArgInfo * const _accounts_method_info_find_user_by_id_IN_ARG_pointers[] =
00222 {
00223   &_accounts_method_info_find_user_by_id_IN_ARG_id,
00224   NULL
00225 };
00226 
00227 static const _ExtendedGDBusArgInfo _accounts_method_info_find_user_by_id_OUT_ARG_user =
00228 {
00229   {
00230     -1,
00231     (gchar *) "user",
00232     (gchar *) "o",
00233     NULL
00234   },
00235   FALSE
00236 };
00237 
00238 static const _ExtendedGDBusArgInfo * const _accounts_method_info_find_user_by_id_OUT_ARG_pointers[] =
00239 {
00240   &_accounts_method_info_find_user_by_id_OUT_ARG_user,
00241   NULL
00242 };
00243 
00244 static const GDBusAnnotationInfo _accounts_method_find_user_by_id_annotation_info_0 =
00245 {
00246   -1,
00247   (gchar *) "org.freedesktop.DBus.GLib.Async",
00248   (gchar *) "",
00249   NULL
00250 };
00251 
00252 static const GDBusAnnotationInfo * const _accounts_method_find_user_by_id_annotation_info_pointers[] =
00253 {
00254   &_accounts_method_find_user_by_id_annotation_info_0,
00255   NULL
00256 };
00257 
00258 static const _ExtendedGDBusMethodInfo _accounts_method_info_find_user_by_id =
00259 {
00260   {
00261     -1,
00262     (gchar *) "FindUserById",
00263     (GDBusArgInfo **) &_accounts_method_info_find_user_by_id_IN_ARG_pointers,
00264     (GDBusArgInfo **) &_accounts_method_info_find_user_by_id_OUT_ARG_pointers,
00265     (GDBusAnnotationInfo **) &_accounts_method_find_user_by_id_annotation_info_pointers
00266   },
00267   "handle-find-user-by-id",
00268   FALSE
00269 };
00270 
00271 static const _ExtendedGDBusArgInfo _accounts_method_info_find_user_by_name_IN_ARG_name =
00272 {
00273   {
00274     -1,
00275     (gchar *) "name",
00276     (gchar *) "s",
00277     NULL
00278   },
00279   FALSE
00280 };
00281 
00282 static const _ExtendedGDBusArgInfo * const _accounts_method_info_find_user_by_name_IN_ARG_pointers[] =
00283 {
00284   &_accounts_method_info_find_user_by_name_IN_ARG_name,
00285   NULL
00286 };
00287 
00288 static const _ExtendedGDBusArgInfo _accounts_method_info_find_user_by_name_OUT_ARG_user =
00289 {
00290   {
00291     -1,
00292     (gchar *) "user",
00293     (gchar *) "o",
00294     NULL
00295   },
00296   FALSE
00297 };
00298 
00299 static const _ExtendedGDBusArgInfo * const _accounts_method_info_find_user_by_name_OUT_ARG_pointers[] =
00300 {
00301   &_accounts_method_info_find_user_by_name_OUT_ARG_user,
00302   NULL
00303 };
00304 
00305 static const GDBusAnnotationInfo _accounts_method_find_user_by_name_annotation_info_0 =
00306 {
00307   -1,
00308   (gchar *) "org.freedesktop.DBus.GLib.Async",
00309   (gchar *) "",
00310   NULL
00311 };
00312 
00313 static const GDBusAnnotationInfo * const _accounts_method_find_user_by_name_annotation_info_pointers[] =
00314 {
00315   &_accounts_method_find_user_by_name_annotation_info_0,
00316   NULL
00317 };
00318 
00319 static const _ExtendedGDBusMethodInfo _accounts_method_info_find_user_by_name =
00320 {
00321   {
00322     -1,
00323     (gchar *) "FindUserByName",
00324     (GDBusArgInfo **) &_accounts_method_info_find_user_by_name_IN_ARG_pointers,
00325     (GDBusArgInfo **) &_accounts_method_info_find_user_by_name_OUT_ARG_pointers,
00326     (GDBusAnnotationInfo **) &_accounts_method_find_user_by_name_annotation_info_pointers
00327   },
00328   "handle-find-user-by-name",
00329   FALSE
00330 };
00331 
00332 static const _ExtendedGDBusArgInfo _accounts_method_info_create_user_IN_ARG_name =
00333 {
00334   {
00335     -1,
00336     (gchar *) "name",
00337     (gchar *) "s",
00338     NULL
00339   },
00340   FALSE
00341 };
00342 
00343 static const _ExtendedGDBusArgInfo _accounts_method_info_create_user_IN_ARG_fullname =
00344 {
00345   {
00346     -1,
00347     (gchar *) "fullname",
00348     (gchar *) "s",
00349     NULL
00350   },
00351   FALSE
00352 };
00353 
00354 static const _ExtendedGDBusArgInfo _accounts_method_info_create_user_IN_ARG_accountType =
00355 {
00356   {
00357     -1,
00358     (gchar *) "accountType",
00359     (gchar *) "i",
00360     NULL
00361   },
00362   FALSE
00363 };
00364 
00365 static const _ExtendedGDBusArgInfo * const _accounts_method_info_create_user_IN_ARG_pointers[] =
00366 {
00367   &_accounts_method_info_create_user_IN_ARG_name,
00368   &_accounts_method_info_create_user_IN_ARG_fullname,
00369   &_accounts_method_info_create_user_IN_ARG_accountType,
00370   NULL
00371 };
00372 
00373 static const _ExtendedGDBusArgInfo _accounts_method_info_create_user_OUT_ARG_user =
00374 {
00375   {
00376     -1,
00377     (gchar *) "user",
00378     (gchar *) "o",
00379     NULL
00380   },
00381   FALSE
00382 };
00383 
00384 static const _ExtendedGDBusArgInfo * const _accounts_method_info_create_user_OUT_ARG_pointers[] =
00385 {
00386   &_accounts_method_info_create_user_OUT_ARG_user,
00387   NULL
00388 };
00389 
00390 static const GDBusAnnotationInfo _accounts_method_create_user_annotation_info_0 =
00391 {
00392   -1,
00393   (gchar *) "org.freedesktop.DBus.GLib.Async",
00394   (gchar *) "",
00395   NULL
00396 };
00397 
00398 static const GDBusAnnotationInfo _accounts_method_create_user_annotation_info_1 =
00399 {
00400   -1,
00401   (gchar *) "org.freedesktop.DBus.GLib.Async",
00402   (gchar *) "",
00403   NULL
00404 };
00405 
00406 static const GDBusAnnotationInfo * const _accounts_method_create_user_annotation_info_pointers[] =
00407 {
00408   &_accounts_method_create_user_annotation_info_0,
00409   &_accounts_method_create_user_annotation_info_1,
00410   NULL
00411 };
00412 
00413 static const _ExtendedGDBusMethodInfo _accounts_method_info_create_user =
00414 {
00415   {
00416     -1,
00417     (gchar *) "CreateUser",
00418     (GDBusArgInfo **) &_accounts_method_info_create_user_IN_ARG_pointers,
00419     (GDBusArgInfo **) &_accounts_method_info_create_user_OUT_ARG_pointers,
00420     (GDBusAnnotationInfo **) &_accounts_method_create_user_annotation_info_pointers
00421   },
00422   "handle-create-user",
00423   FALSE
00424 };
00425 
00426 static const _ExtendedGDBusArgInfo _accounts_method_info_delete_user_IN_ARG_id =
00427 {
00428   {
00429     -1,
00430     (gchar *) "id",
00431     (gchar *) "x",
00432     NULL
00433   },
00434   FALSE
00435 };
00436 
00437 static const _ExtendedGDBusArgInfo _accounts_method_info_delete_user_IN_ARG_removeFiles =
00438 {
00439   {
00440     -1,
00441     (gchar *) "removeFiles",
00442     (gchar *) "b",
00443     NULL
00444   },
00445   FALSE
00446 };
00447 
00448 static const _ExtendedGDBusArgInfo * const _accounts_method_info_delete_user_IN_ARG_pointers[] =
00449 {
00450   &_accounts_method_info_delete_user_IN_ARG_id,
00451   &_accounts_method_info_delete_user_IN_ARG_removeFiles,
00452   NULL
00453 };
00454 
00455 static const GDBusAnnotationInfo _accounts_method_delete_user_annotation_info_0 =
00456 {
00457   -1,
00458   (gchar *) "org.freedesktop.DBus.GLib.Async",
00459   (gchar *) "",
00460   NULL
00461 };
00462 
00463 static const GDBusAnnotationInfo * const _accounts_method_delete_user_annotation_info_pointers[] =
00464 {
00465   &_accounts_method_delete_user_annotation_info_0,
00466   NULL
00467 };
00468 
00469 static const _ExtendedGDBusMethodInfo _accounts_method_info_delete_user =
00470 {
00471   {
00472     -1,
00473     (gchar *) "DeleteUser",
00474     (GDBusArgInfo **) &_accounts_method_info_delete_user_IN_ARG_pointers,
00475     NULL,
00476     (GDBusAnnotationInfo **) &_accounts_method_delete_user_annotation_info_pointers
00477   },
00478   "handle-delete-user",
00479   FALSE
00480 };
00481 
00482 static const _ExtendedGDBusMethodInfo * const _accounts_method_info_pointers[] =
00483 {
00484   &_accounts_method_info_list_cached_users,
00485   &_accounts_method_info_find_user_by_id,
00486   &_accounts_method_info_find_user_by_name,
00487   &_accounts_method_info_create_user,
00488   &_accounts_method_info_delete_user,
00489   NULL
00490 };
00491 
00492 static const _ExtendedGDBusArgInfo _accounts_signal_info_user_added_ARG_user =
00493 {
00494   {
00495     -1,
00496     (gchar *) "user",
00497     (gchar *) "o",
00498     NULL
00499   },
00500   FALSE
00501 };
00502 
00503 static const _ExtendedGDBusArgInfo * const _accounts_signal_info_user_added_ARG_pointers[] =
00504 {
00505   &_accounts_signal_info_user_added_ARG_user,
00506   NULL
00507 };
00508 
00509 static const _ExtendedGDBusSignalInfo _accounts_signal_info_user_added =
00510 {
00511   {
00512     -1,
00513     (gchar *) "UserAdded",
00514     (GDBusArgInfo **) &_accounts_signal_info_user_added_ARG_pointers,
00515     NULL
00516   },
00517   "user-added"
00518 };
00519 
00520 static const _ExtendedGDBusArgInfo _accounts_signal_info_user_deleted_ARG_user =
00521 {
00522   {
00523     -1,
00524     (gchar *) "user",
00525     (gchar *) "o",
00526     NULL
00527   },
00528   FALSE
00529 };
00530 
00531 static const _ExtendedGDBusArgInfo * const _accounts_signal_info_user_deleted_ARG_pointers[] =
00532 {
00533   &_accounts_signal_info_user_deleted_ARG_user,
00534   NULL
00535 };
00536 
00537 static const _ExtendedGDBusSignalInfo _accounts_signal_info_user_deleted =
00538 {
00539   {
00540     -1,
00541     (gchar *) "UserDeleted",
00542     (GDBusArgInfo **) &_accounts_signal_info_user_deleted_ARG_pointers,
00543     NULL
00544   },
00545   "user-deleted"
00546 };
00547 
00548 static const _ExtendedGDBusArgInfo _accounts_signal_info_user_changed_ARG_user =
00549 {
00550   {
00551     -1,
00552     (gchar *) "user",
00553     (gchar *) "o",
00554     NULL
00555   },
00556   FALSE
00557 };
00558 
00559 static const _ExtendedGDBusArgInfo * const _accounts_signal_info_user_changed_ARG_pointers[] =
00560 {
00561   &_accounts_signal_info_user_changed_ARG_user,
00562   NULL
00563 };
00564 
00565 static const _ExtendedGDBusSignalInfo _accounts_signal_info_user_changed =
00566 {
00567   {
00568     -1,
00569     (gchar *) "UserChanged",
00570     (GDBusArgInfo **) &_accounts_signal_info_user_changed_ARG_pointers,
00571     NULL
00572   },
00573   "user-changed"
00574 };
00575 
00576 static const _ExtendedGDBusSignalInfo * const _accounts_signal_info_pointers[] =
00577 {
00578   &_accounts_signal_info_user_added,
00579   &_accounts_signal_info_user_deleted,
00580   &_accounts_signal_info_user_changed,
00581   NULL
00582 };
00583 
00584 static const _ExtendedGDBusPropertyInfo _accounts_property_info_daemon_version =
00585 {
00586   {
00587     -1,
00588     (gchar *) "DaemonVersion",
00589     (gchar *) "s",
00590     G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
00591     NULL
00592   },
00593   "daemon-version",
00594   FALSE
00595 };
00596 
00597 static const _ExtendedGDBusPropertyInfo * const _accounts_property_info_pointers[] =
00598 {
00599   &_accounts_property_info_daemon_version,
00600   NULL
00601 };
00602 
00603 static const _ExtendedGDBusInterfaceInfo _accounts_interface_info =
00604 {
00605   {
00606     -1,
00607     (gchar *) "org.freedesktop.Accounts",
00608     (GDBusMethodInfo **) &_accounts_method_info_pointers,
00609     (GDBusSignalInfo **) &_accounts_signal_info_pointers,
00610     (GDBusPropertyInfo **) &_accounts_property_info_pointers,
00611     NULL
00612   },
00613   "accounts",
00614 };
00615 
00616 
00624 GDBusInterfaceInfo *
00625 accounts_interface_info (void)
00626 {
00627   return (GDBusInterfaceInfo *) &_accounts_interface_info;
00628 }
00629 
00640 guint
00641 accounts_override_properties (GObjectClass *klass, guint property_id_begin)
00642 {
00643   g_object_class_override_property (klass, property_id_begin++, "daemon-version");
00644   return property_id_begin - 1;
00645 }
00646 
00647 
00648 
00671 static void
00672 accounts_default_init (AccountsIface *iface)
00673 {
00674   /* GObject signals for incoming D-Bus method calls: */
00686   g_signal_new ("handle-list-cached-users",
00687     G_TYPE_FROM_INTERFACE (iface),
00688     G_SIGNAL_RUN_LAST,
00689     G_STRUCT_OFFSET (AccountsIface, handle_list_cached_users),
00690     g_signal_accumulator_true_handled,
00691     NULL,
00692     g_cclosure_marshal_generic,
00693     G_TYPE_BOOLEAN,
00694     1,
00695     G_TYPE_DBUS_METHOD_INVOCATION);
00696 
00709   g_signal_new ("handle-find-user-by-id",
00710     G_TYPE_FROM_INTERFACE (iface),
00711     G_SIGNAL_RUN_LAST,
00712     G_STRUCT_OFFSET (AccountsIface, handle_find_user_by_id),
00713     g_signal_accumulator_true_handled,
00714     NULL,
00715     g_cclosure_marshal_generic,
00716     G_TYPE_BOOLEAN,
00717     2,
00718     G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT64);
00719 
00732   g_signal_new ("handle-find-user-by-name",
00733     G_TYPE_FROM_INTERFACE (iface),
00734     G_SIGNAL_RUN_LAST,
00735     G_STRUCT_OFFSET (AccountsIface, handle_find_user_by_name),
00736     g_signal_accumulator_true_handled,
00737     NULL,
00738     g_cclosure_marshal_generic,
00739     G_TYPE_BOOLEAN,
00740     2,
00741     G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
00742 
00757   g_signal_new ("handle-create-user",
00758     G_TYPE_FROM_INTERFACE (iface),
00759     G_SIGNAL_RUN_LAST,
00760     G_STRUCT_OFFSET (AccountsIface, handle_create_user),
00761     g_signal_accumulator_true_handled,
00762     NULL,
00763     g_cclosure_marshal_generic,
00764     G_TYPE_BOOLEAN,
00765     4,
00766     G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
00767 
00781   g_signal_new ("handle-delete-user",
00782     G_TYPE_FROM_INTERFACE (iface),
00783     G_SIGNAL_RUN_LAST,
00784     G_STRUCT_OFFSET (AccountsIface, handle_delete_user),
00785     g_signal_accumulator_true_handled,
00786     NULL,
00787     g_cclosure_marshal_generic,
00788     G_TYPE_BOOLEAN,
00789     3,
00790     G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT64, G_TYPE_BOOLEAN);
00791 
00792   /* GObject signals for received D-Bus signals: */
00802   g_signal_new ("user-added",
00803     G_TYPE_FROM_INTERFACE (iface),
00804     G_SIGNAL_RUN_LAST,
00805     G_STRUCT_OFFSET (AccountsIface, user_added),
00806     NULL,
00807     NULL,
00808     g_cclosure_marshal_generic,
00809     G_TYPE_NONE,
00810     1, G_TYPE_STRING);
00811 
00821   g_signal_new ("user-deleted",
00822     G_TYPE_FROM_INTERFACE (iface),
00823     G_SIGNAL_RUN_LAST,
00824     G_STRUCT_OFFSET (AccountsIface, user_deleted),
00825     NULL,
00826     NULL,
00827     g_cclosure_marshal_generic,
00828     G_TYPE_NONE,
00829     1, G_TYPE_STRING);
00830 
00840   g_signal_new ("user-changed",
00841     G_TYPE_FROM_INTERFACE (iface),
00842     G_SIGNAL_RUN_LAST,
00843     G_STRUCT_OFFSET (AccountsIface, user_changed),
00844     NULL,
00845     NULL,
00846     g_cclosure_marshal_generic,
00847     G_TYPE_NONE,
00848     1, G_TYPE_STRING);
00849 
00850   /* GObject properties for D-Bus properties: */
00858   g_object_interface_install_property (iface,
00859     g_param_spec_string ("daemon-version", "DaemonVersion", "DaemonVersion", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
00860 }
00861 
00862 typedef AccountsIface AccountsInterface;
00863 G_DEFINE_INTERFACE (Accounts, accounts, G_TYPE_OBJECT);
00864 
00877 const gchar *
00878 accounts_get_daemon_version (Accounts *object)
00879 {
00880   return ACCOUNTS_GET_IFACE (object)->get_daemon_version (object);
00881 }
00882 
00893 gchar *
00894 accounts_dup_daemon_version (Accounts *object)
00895 {
00896   gchar *value;
00897   g_object_get (G_OBJECT (object), "daemon-version", &value, NULL);
00898   return value;
00899 }
00900 
00910 void
00911 accounts_set_daemon_version (Accounts *object, const gchar *value)
00912 {
00913   g_object_set (G_OBJECT (object), "daemon-version", value, NULL);
00914 }
00915 
00923 void
00924 accounts_emit_user_added (
00925     Accounts *object,
00926     const gchar *arg_user)
00927 {
00928   g_signal_emit_by_name (object, "user-added", arg_user);
00929 }
00930 
00938 void
00939 accounts_emit_user_deleted (
00940     Accounts *object,
00941     const gchar *arg_user)
00942 {
00943   g_signal_emit_by_name (object, "user-deleted", arg_user);
00944 }
00945 
00953 void
00954 accounts_emit_user_changed (
00955     Accounts *object,
00956     const gchar *arg_user)
00957 {
00958   g_signal_emit_by_name (object, "user-changed", arg_user);
00959 }
00960 
00974 void
00975 accounts_call_list_cached_users (
00976     Accounts *proxy,
00977     GCancellable *cancellable,
00978     GAsyncReadyCallback callback,
00979     gpointer user_data)
00980 {
00981   g_dbus_proxy_call (G_DBUS_PROXY (proxy),
00982     "ListCachedUsers",
00983     g_variant_new ("()"),
00984     G_DBUS_CALL_FLAGS_NONE,
00985     -1,
00986     cancellable,
00987     callback,
00988     user_data);
00989 }
00990 
01002 gboolean
01003 accounts_call_list_cached_users_finish (
01004     Accounts *proxy,
01005     gchar ***out_users,
01006     GAsyncResult *res,
01007     GError **error)
01008 {
01009   GVariant *_ret;
01010   _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
01011   if (_ret == NULL)
01012     goto _out;
01013   g_variant_get (_ret,
01014                  "(^ao)",
01015                  out_users);
01016   g_variant_unref (_ret);
01017 _out:
01018   return _ret != NULL;
01019 }
01020 
01034 gboolean
01035 accounts_call_list_cached_users_sync (
01036     Accounts *proxy,
01037     gchar ***out_users,
01038     GCancellable *cancellable,
01039     GError **error)
01040 {
01041   GVariant *_ret;
01042   _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
01043     "ListCachedUsers",
01044     g_variant_new ("()"),
01045     G_DBUS_CALL_FLAGS_NONE,
01046     -1,
01047     cancellable,
01048     error);
01049   if (_ret == NULL)
01050     goto _out;
01051   g_variant_get (_ret,
01052                  "(^ao)",
01053                  out_users);
01054   g_variant_unref (_ret);
01055 _out:
01056   return _ret != NULL;
01057 }
01058 
01073 void
01074 accounts_call_find_user_by_id (
01075     Accounts *proxy,
01076     gint64 arg_id,
01077     GCancellable *cancellable,
01078     GAsyncReadyCallback callback,
01079     gpointer user_data)
01080 {
01081   g_dbus_proxy_call (G_DBUS_PROXY (proxy),
01082     "FindUserById",
01083     g_variant_new ("(x)",
01084                    arg_id),
01085     G_DBUS_CALL_FLAGS_NONE,
01086     -1,
01087     cancellable,
01088     callback,
01089     user_data);
01090 }
01091 
01103 gboolean
01104 accounts_call_find_user_by_id_finish (
01105     Accounts *proxy,
01106     gchar **out_user,
01107     GAsyncResult *res,
01108     GError **error)
01109 {
01110   GVariant *_ret;
01111   _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
01112   if (_ret == NULL)
01113     goto _out;
01114   g_variant_get (_ret,
01115                  "(o)",
01116                  out_user);
01117   g_variant_unref (_ret);
01118 _out:
01119   return _ret != NULL;
01120 }
01121 
01136 gboolean
01137 accounts_call_find_user_by_id_sync (
01138     Accounts *proxy,
01139     gint64 arg_id,
01140     gchar **out_user,
01141     GCancellable *cancellable,
01142     GError **error)
01143 {
01144   GVariant *_ret;
01145   _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
01146     "FindUserById",
01147     g_variant_new ("(x)",
01148                    arg_id),
01149     G_DBUS_CALL_FLAGS_NONE,
01150     -1,
01151     cancellable,
01152     error);
01153   if (_ret == NULL)
01154     goto _out;
01155   g_variant_get (_ret,
01156                  "(o)",
01157                  out_user);
01158   g_variant_unref (_ret);
01159 _out:
01160   return _ret != NULL;
01161 }
01162 
01177 void
01178 accounts_call_find_user_by_name (
01179     Accounts *proxy,
01180     const gchar *arg_name,
01181     GCancellable *cancellable,
01182     GAsyncReadyCallback callback,
01183     gpointer user_data)
01184 {
01185   g_dbus_proxy_call (G_DBUS_PROXY (proxy),
01186     "FindUserByName",
01187     g_variant_new ("(s)",
01188                    arg_name),
01189     G_DBUS_CALL_FLAGS_NONE,
01190     -1,
01191     cancellable,
01192     callback,
01193     user_data);
01194 }
01195 
01207 gboolean
01208 accounts_call_find_user_by_name_finish (
01209     Accounts *proxy,
01210     gchar **out_user,
01211     GAsyncResult *res,
01212     GError **error)
01213 {
01214   GVariant *_ret;
01215   _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
01216   if (_ret == NULL)
01217     goto _out;
01218   g_variant_get (_ret,
01219                  "(o)",
01220                  out_user);
01221   g_variant_unref (_ret);
01222 _out:
01223   return _ret != NULL;
01224 }
01225 
01240 gboolean
01241 accounts_call_find_user_by_name_sync (
01242     Accounts *proxy,
01243     const gchar *arg_name,
01244     gchar **out_user,
01245     GCancellable *cancellable,
01246     GError **error)
01247 {
01248   GVariant *_ret;
01249   _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
01250     "FindUserByName",
01251     g_variant_new ("(s)",
01252                    arg_name),
01253     G_DBUS_CALL_FLAGS_NONE,
01254     -1,
01255     cancellable,
01256     error);
01257   if (_ret == NULL)
01258     goto _out;
01259   g_variant_get (_ret,
01260                  "(o)",
01261                  out_user);
01262   g_variant_unref (_ret);
01263 _out:
01264   return _ret != NULL;
01265 }
01266 
01283 void
01284 accounts_call_create_user (
01285     Accounts *proxy,
01286     const gchar *arg_name,
01287     const gchar *arg_fullname,
01288     gint arg_accountType,
01289     GCancellable *cancellable,
01290     GAsyncReadyCallback callback,
01291     gpointer user_data)
01292 {
01293   g_dbus_proxy_call (G_DBUS_PROXY (proxy),
01294     "CreateUser",
01295     g_variant_new ("(ssi)",
01296                    arg_name,
01297                    arg_fullname,
01298                    arg_accountType),
01299     G_DBUS_CALL_FLAGS_NONE,
01300     -1,
01301     cancellable,
01302     callback,
01303     user_data);
01304 }
01305 
01317 gboolean
01318 accounts_call_create_user_finish (
01319     Accounts *proxy,
01320     gchar **out_user,
01321     GAsyncResult *res,
01322     GError **error)
01323 {
01324   GVariant *_ret;
01325   _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
01326   if (_ret == NULL)
01327     goto _out;
01328   g_variant_get (_ret,
01329                  "(o)",
01330                  out_user);
01331   g_variant_unref (_ret);
01332 _out:
01333   return _ret != NULL;
01334 }
01335 
01352 gboolean
01353 accounts_call_create_user_sync (
01354     Accounts *proxy,
01355     const gchar *arg_name,
01356     const gchar *arg_fullname,
01357     gint arg_accountType,
01358     gchar **out_user,
01359     GCancellable *cancellable,
01360     GError **error)
01361 {
01362   GVariant *_ret;
01363   _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
01364     "CreateUser",
01365     g_variant_new ("(ssi)",
01366                    arg_name,
01367                    arg_fullname,
01368                    arg_accountType),
01369     G_DBUS_CALL_FLAGS_NONE,
01370     -1,
01371     cancellable,
01372     error);
01373   if (_ret == NULL)
01374     goto _out;
01375   g_variant_get (_ret,
01376                  "(o)",
01377                  out_user);
01378   g_variant_unref (_ret);
01379 _out:
01380   return _ret != NULL;
01381 }
01382 
01398 void
01399 accounts_call_delete_user (
01400     Accounts *proxy,
01401     gint64 arg_id,
01402     gboolean arg_removeFiles,
01403     GCancellable *cancellable,
01404     GAsyncReadyCallback callback,
01405     gpointer user_data)
01406 {
01407   g_dbus_proxy_call (G_DBUS_PROXY (proxy),
01408     "DeleteUser",
01409     g_variant_new ("(xb)",
01410                    arg_id,
01411                    arg_removeFiles),
01412     G_DBUS_CALL_FLAGS_NONE,
01413     -1,
01414     cancellable,
01415     callback,
01416     user_data);
01417 }
01418 
01429 gboolean
01430 accounts_call_delete_user_finish (
01431     Accounts *proxy,
01432     GAsyncResult *res,
01433     GError **error)
01434 {
01435   GVariant *_ret;
01436   _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
01437   if (_ret == NULL)
01438     goto _out;
01439   g_variant_get (_ret,
01440                  "()");
01441   g_variant_unref (_ret);
01442 _out:
01443   return _ret != NULL;
01444 }
01445 
01460 gboolean
01461 accounts_call_delete_user_sync (
01462     Accounts *proxy,
01463     gint64 arg_id,
01464     gboolean arg_removeFiles,
01465     GCancellable *cancellable,
01466     GError **error)
01467 {
01468   GVariant *_ret;
01469   _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
01470     "DeleteUser",
01471     g_variant_new ("(xb)",
01472                    arg_id,
01473                    arg_removeFiles),
01474     G_DBUS_CALL_FLAGS_NONE,
01475     -1,
01476     cancellable,
01477     error);
01478   if (_ret == NULL)
01479     goto _out;
01480   g_variant_get (_ret,
01481                  "()");
01482   g_variant_unref (_ret);
01483 _out:
01484   return _ret != NULL;
01485 }
01486 
01497 void
01498 accounts_complete_list_cached_users (
01499     Accounts *object,
01500     GDBusMethodInvocation *invocation,
01501     const gchar *const *users)
01502 {
01503   g_dbus_method_invocation_return_value (invocation,
01504     g_variant_new ("(^ao)",
01505                    users));
01506 }
01507 
01518 void
01519 accounts_complete_find_user_by_id (
01520     Accounts *object,
01521     GDBusMethodInvocation *invocation,
01522     const gchar *user)
01523 {
01524   g_dbus_method_invocation_return_value (invocation,
01525     g_variant_new ("(o)",
01526                    user));
01527 }
01528 
01539 void
01540 accounts_complete_find_user_by_name (
01541     Accounts *object,
01542     GDBusMethodInvocation *invocation,
01543     const gchar *user)
01544 {
01545   g_dbus_method_invocation_return_value (invocation,
01546     g_variant_new ("(o)",
01547                    user));
01548 }
01549 
01560 void
01561 accounts_complete_create_user (
01562     Accounts *object,
01563     GDBusMethodInvocation *invocation,
01564     const gchar *user)
01565 {
01566   g_dbus_method_invocation_return_value (invocation,
01567     g_variant_new ("(o)",
01568                    user));
01569 }
01570 
01580 void
01581 accounts_complete_delete_user (
01582     Accounts *object,
01583     GDBusMethodInvocation *invocation)
01584 {
01585   g_dbus_method_invocation_return_value (invocation,
01586     g_variant_new ("()"));
01587 }
01588 
01589 /* ------------------------------------------------------------------------ */
01590 
01604 struct _AccountsProxyPrivate
01605 {
01606   GData *qdata;
01607 };
01608 
01609 static void accounts_proxy_iface_init (AccountsIface *iface);
01610 
01611 G_DEFINE_TYPE_WITH_CODE (AccountsProxy, accounts_proxy, G_TYPE_DBUS_PROXY,
01612                          G_IMPLEMENT_INTERFACE (TYPE_ACCOUNTS, accounts_proxy_iface_init));
01613 
01614 static void
01615 accounts_proxy_finalize (GObject *object)
01616 {
01617   AccountsProxy *proxy = ACCOUNTS_PROXY (object);
01618   g_datalist_clear (&proxy->priv->qdata);
01619   G_OBJECT_CLASS (accounts_proxy_parent_class)->finalize (object);
01620 }
01621 
01622 static void
01623 accounts_proxy_get_property (GObject      *object,
01624   guint         prop_id,
01625   GValue       *value,
01626   GParamSpec   *pspec)
01627 {
01628   const _ExtendedGDBusPropertyInfo *info;
01629   GVariant *variant;
01630   g_assert (prop_id != 0 && prop_id - 1 < 1);
01631   info = _accounts_property_info_pointers[prop_id - 1];
01632   variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
01633   if (info->use_gvariant)
01634     {
01635       g_value_set_variant (value, variant);
01636     }
01637   else
01638     {
01639       if (variant != NULL)
01640         g_dbus_gvariant_to_gvalue (variant, value);
01641     }
01642   if (variant != NULL)
01643     g_variant_unref (variant);
01644 }
01645 
01646 static void
01647 accounts_proxy_set_property_cb (GDBusProxy *proxy,
01648   GAsyncResult *res,
01649   gpointer      user_data)
01650 {
01651   const _ExtendedGDBusPropertyInfo *info = user_data;
01652   GError *error;
01653   error = NULL;
01654   if (!g_dbus_proxy_call_finish (proxy, res, &error))
01655     {
01656       g_warning ("Error setting property `%s' on interface org.freedesktop.Accounts: %s (%s, %d)",
01657                  info->parent_struct.name, 
01658                  error->message, g_quark_to_string (error->domain), error->code);
01659       g_error_free (error);
01660     }
01661 }
01662 
01663 static void
01664 accounts_proxy_set_property (GObject      *object,
01665   guint         prop_id,
01666   const GValue *value,
01667   GParamSpec   *pspec)
01668 {
01669   const _ExtendedGDBusPropertyInfo *info;
01670   GVariant *variant;
01671   g_assert (prop_id != 0 && prop_id - 1 < 1);
01672   info = _accounts_property_info_pointers[prop_id - 1];
01673   variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
01674   g_dbus_proxy_call (G_DBUS_PROXY (object),
01675     "org.freedesktop.DBus.Properties.Set",
01676     g_variant_new ("(ssv)", "org.freedesktop.Accounts", info->parent_struct.name, variant),
01677     G_DBUS_CALL_FLAGS_NONE,
01678     -1,
01679     NULL, (GAsyncReadyCallback) accounts_proxy_set_property_cb, (gpointer) info);
01680   g_variant_unref (variant);
01681 }
01682 
01683 static void
01684 accounts_proxy_g_signal (GDBusProxy *proxy,
01685   const gchar *sender_name,
01686   const gchar *signal_name,
01687   GVariant *parameters)
01688 {
01689   _ExtendedGDBusSignalInfo *info;
01690   GVariantIter iter;
01691   GVariant *child;
01692   GValue *paramv;
01693   guint num_params;
01694   guint n;
01695   guint signal_id;
01696   info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_accounts_interface_info, signal_name);
01697   if (info == NULL)
01698     return;
01699   num_params = g_variant_n_children (parameters);
01700   paramv = g_new0 (GValue, num_params + 1);
01701   g_value_init (&paramv[0], TYPE_ACCOUNTS);
01702   g_value_set_object (&paramv[0], proxy);
01703   g_variant_iter_init (&iter, parameters);
01704   n = 1;
01705   while ((child = g_variant_iter_next_value (&iter)) != NULL)
01706     {
01707       _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
01708       if (arg_info->use_gvariant)
01709         {
01710           g_value_init (&paramv[n], G_TYPE_VARIANT);
01711           g_value_set_variant (&paramv[n], child);
01712           n++;
01713         }
01714       else
01715         g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
01716       g_variant_unref (child);
01717     }
01718   signal_id = g_signal_lookup (info->signal_name, TYPE_ACCOUNTS);
01719   g_signal_emitv (paramv, signal_id, 0, NULL);
01720   for (n = 0; n < num_params + 1; n++)
01721     g_value_unset (&paramv[n]);
01722   g_free (paramv);
01723 }
01724 
01725 static void
01726 accounts_proxy_g_properties_changed (GDBusProxy *_proxy,
01727   GVariant *changed_properties,
01728   const gchar *const *invalidated_properties)
01729 {
01730   AccountsProxy *proxy = ACCOUNTS_PROXY (_proxy);
01731   guint n;
01732   const gchar *key;
01733   GVariantIter *iter;
01734   _ExtendedGDBusPropertyInfo *info;
01735   g_variant_get (changed_properties, "a{sv}", &iter);
01736   while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
01737     {
01738       info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_accounts_interface_info, key);
01739       g_datalist_remove_data (&proxy->priv->qdata, key);
01740       if (info != NULL)
01741         g_object_notify (G_OBJECT (proxy), info->hyphen_name);
01742     }
01743   g_variant_iter_free (iter);
01744   for (n = 0; invalidated_properties[n] != NULL; n++)
01745     {
01746       info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_accounts_interface_info, invalidated_properties[n]);
01747       g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
01748       if (info != NULL)
01749         g_object_notify (G_OBJECT (proxy), info->hyphen_name);
01750     }
01751 }
01752 
01753 static const gchar *
01754 accounts_proxy_get_daemon_version (Accounts *object)
01755 {
01756   AccountsProxy *proxy = ACCOUNTS_PROXY (object);
01757   GVariant *variant;
01758   const gchar *value = NULL;
01759   variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "DaemonVersion");
01760   if (variant != NULL)
01761     {
01762       value = g_variant_get_string (variant, NULL);
01763       g_variant_unref (variant);
01764     }
01765   return value;
01766 }
01767 
01768 static void
01769 accounts_proxy_init (AccountsProxy *proxy)
01770 {
01771   proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_ACCOUNTS_PROXY, AccountsProxyPrivate);
01772   g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), accounts_interface_info ());
01773 }
01774 
01775 static void
01776 accounts_proxy_class_init (AccountsProxyClass *klass)
01777 {
01778   GObjectClass *gobject_class;
01779   GDBusProxyClass *proxy_class;
01780 
01781   g_type_class_add_private (klass, sizeof (AccountsProxyPrivate));
01782 
01783   gobject_class = G_OBJECT_CLASS (klass);
01784   gobject_class->finalize     = accounts_proxy_finalize;
01785   gobject_class->get_property = accounts_proxy_get_property;
01786   gobject_class->set_property = accounts_proxy_set_property;
01787 
01788   proxy_class = G_DBUS_PROXY_CLASS (klass);
01789   proxy_class->g_signal = accounts_proxy_g_signal;
01790   proxy_class->g_properties_changed = accounts_proxy_g_properties_changed;
01791 
01792 
01793   accounts_override_properties (gobject_class, 1);
01794 }
01795 
01796 static void
01797 accounts_proxy_iface_init (AccountsIface *iface)
01798 {
01799   iface->get_daemon_version = accounts_proxy_get_daemon_version;
01800 }
01801 
01819 void
01820 accounts_proxy_new (
01821     GDBusConnection     *connection,
01822     GDBusProxyFlags      flags,
01823     const gchar         *name,
01824     const gchar         *object_path,
01825     GCancellable        *cancellable,
01826     GAsyncReadyCallback  callback,
01827     gpointer             user_data)
01828 {
01829   g_async_initable_new_async (TYPE_ACCOUNTS_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.Accounts", NULL);
01830 }
01831 
01841 Accounts *
01842 accounts_proxy_new_finish (
01843     GAsyncResult        *res,
01844     GError             **error)
01845 {
01846   GObject *ret;
01847   GObject *source_object;
01848   source_object = g_async_result_get_source_object (res);
01849   ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
01850   g_object_unref (source_object);
01851   if (ret != NULL)
01852     return ACCOUNTS (ret);
01853   else
01854     return NULL;
01855 }
01856 
01874 Accounts *
01875 accounts_proxy_new_sync (
01876     GDBusConnection     *connection,
01877     GDBusProxyFlags      flags,
01878     const gchar         *name,
01879     const gchar         *object_path,
01880     GCancellable        *cancellable,
01881     GError             **error)
01882 {
01883   GInitable *ret;
01884   ret = g_initable_new (TYPE_ACCOUNTS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.Accounts", NULL);
01885   if (ret != NULL)
01886     return ACCOUNTS (ret);
01887   else
01888     return NULL;
01889 }
01890 
01891 
01909 void
01910 accounts_proxy_new_for_bus (
01911     GBusType             bus_type,
01912     GDBusProxyFlags      flags,
01913     const gchar         *name,
01914     const gchar         *object_path,
01915     GCancellable        *cancellable,
01916     GAsyncReadyCallback  callback,
01917     gpointer             user_data)
01918 {
01919   g_async_initable_new_async (TYPE_ACCOUNTS_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.Accounts", NULL);
01920 }
01921 
01931 Accounts *
01932 accounts_proxy_new_for_bus_finish (
01933     GAsyncResult        *res,
01934     GError             **error)
01935 {
01936   GObject *ret;
01937   GObject *source_object;
01938   source_object = g_async_result_get_source_object (res);
01939   ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
01940   g_object_unref (source_object);
01941   if (ret != NULL)
01942     return ACCOUNTS (ret);
01943   else
01944     return NULL;
01945 }
01946 
01964 Accounts *
01965 accounts_proxy_new_for_bus_sync (
01966     GBusType             bus_type,
01967     GDBusProxyFlags      flags,
01968     const gchar         *name,
01969     const gchar         *object_path,
01970     GCancellable        *cancellable,
01971     GError             **error)
01972 {
01973   GInitable *ret;
01974   ret = g_initable_new (TYPE_ACCOUNTS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.Accounts", NULL);
01975   if (ret != NULL)
01976     return ACCOUNTS (ret);
01977   else
01978     return NULL;
01979 }
01980 
01981 
01982 /* ------------------------------------------------------------------------ */
01983 
01997 struct _AccountsSkeletonPrivate
01998 {
01999   GValue *properties;
02000   GList *changed_properties;
02001   GSource *changed_properties_idle_source;
02002   GMainContext *context;
02003   GMutex lock;
02004 };
02005 
02006 static void
02007 _accounts_skeleton_handle_method_call (
02008   GDBusConnection *connection,
02009   const gchar *sender,
02010   const gchar *object_path,
02011   const gchar *interface_name,
02012   const gchar *method_name,
02013   GVariant *parameters,
02014   GDBusMethodInvocation *invocation,
02015   gpointer user_data)
02016 {
02017   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (user_data);
02018   _ExtendedGDBusMethodInfo *info;
02019   GVariantIter iter;
02020   GVariant *child;
02021   GValue *paramv;
02022   guint num_params;
02023   guint num_extra;
02024   guint n;
02025   guint signal_id;
02026   GValue return_value = G_VALUE_INIT;
02027   info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
02028   g_assert (info != NULL);
02029   num_params = g_variant_n_children (parameters);
02030   num_extra = info->pass_fdlist ? 3 : 2;  paramv = g_new0 (GValue, num_params + num_extra);
02031   n = 0;
02032   g_value_init (&paramv[n], TYPE_ACCOUNTS);
02033   g_value_set_object (&paramv[n++], skeleton);
02034   g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
02035   g_value_set_object (&paramv[n++], invocation);
02036   if (info->pass_fdlist)
02037     {
02038 #ifdef G_OS_UNIX
02039       g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
02040       g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
02041 #else
02042       g_assert_not_reached ();
02043 #endif
02044     }
02045   g_variant_iter_init (&iter, parameters);
02046   while ((child = g_variant_iter_next_value (&iter)) != NULL)
02047     {
02048       _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
02049       if (arg_info->use_gvariant)
02050         {
02051           g_value_init (&paramv[n], G_TYPE_VARIANT);
02052           g_value_set_variant (&paramv[n], child);
02053           n++;
02054         }
02055       else
02056         g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
02057       g_variant_unref (child);
02058     }
02059   signal_id = g_signal_lookup (info->signal_name, TYPE_ACCOUNTS);
02060   g_value_init (&return_value, G_TYPE_BOOLEAN);
02061   g_signal_emitv (paramv, signal_id, 0, &return_value);
02062   if (!g_value_get_boolean (&return_value))
02063     g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
02064   g_value_unset (&return_value);
02065   for (n = 0; n < num_params + num_extra; n++)
02066     g_value_unset (&paramv[n]);
02067   g_free (paramv);
02068 }
02069 
02070 static GVariant *
02071 _accounts_skeleton_handle_get_property (
02072   GDBusConnection *connection,
02073   const gchar *sender,
02074   const gchar *object_path,
02075   const gchar *interface_name,
02076   const gchar *property_name,
02077   GError **error,
02078   gpointer user_data)
02079 {
02080   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (user_data);
02081   GValue value = G_VALUE_INIT;
02082   GParamSpec *pspec;
02083   _ExtendedGDBusPropertyInfo *info;
02084   GVariant *ret;
02085   ret = NULL;
02086   info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_accounts_interface_info, property_name);
02087   g_assert (info != NULL);
02088   pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
02089   if (pspec == NULL)
02090     {
02091       g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
02092     }
02093   else
02094     {
02095       g_value_init (&value, pspec->value_type);
02096       g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
02097       ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
02098       g_value_unset (&value);
02099     }
02100   return ret;
02101 }
02102 
02103 static gboolean
02104 _accounts_skeleton_handle_set_property (
02105   GDBusConnection *connection,
02106   const gchar *sender,
02107   const gchar *object_path,
02108   const gchar *interface_name,
02109   const gchar *property_name,
02110   GVariant *variant,
02111   GError **error,
02112   gpointer user_data)
02113 {
02114   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (user_data);
02115   GValue value = G_VALUE_INIT;
02116   GParamSpec *pspec;
02117   _ExtendedGDBusPropertyInfo *info;
02118   gboolean ret;
02119   ret = FALSE;
02120   info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_accounts_interface_info, property_name);
02121   g_assert (info != NULL);
02122   pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
02123   if (pspec == NULL)
02124     {
02125       g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
02126     }
02127   else
02128     {
02129       if (info->use_gvariant)
02130         g_value_set_variant (&value, variant);
02131       else
02132         g_dbus_gvariant_to_gvalue (variant, &value);
02133       g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
02134       g_value_unset (&value);
02135       ret = TRUE;
02136     }
02137   return ret;
02138 }
02139 
02140 static const GDBusInterfaceVTable _accounts_skeleton_vtable =
02141 {
02142   _accounts_skeleton_handle_method_call,
02143   _accounts_skeleton_handle_get_property,
02144   _accounts_skeleton_handle_set_property
02145 };
02146 
02147 static GDBusInterfaceInfo *
02148 accounts_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton)
02149 {
02150   return accounts_interface_info ();
02151 }
02152 
02153 static GDBusInterfaceVTable *
02154 accounts_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton)
02155 {
02156   return (GDBusInterfaceVTable *) &_accounts_skeleton_vtable;
02157 }
02158 
02159 static GVariant *
02160 accounts_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
02161 {
02162   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (_skeleton);
02163 
02164   GVariantBuilder builder;
02165   guint n;
02166   g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
02167   if (_accounts_interface_info.parent_struct.properties == NULL)
02168     goto out;
02169   for (n = 0; _accounts_interface_info.parent_struct.properties[n] != NULL; n++)
02170     {
02171       GDBusPropertyInfo *info = _accounts_interface_info.parent_struct.properties[n];
02172       if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
02173         {
02174           GVariant *value;
02175           value = _accounts_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Accounts", info->name, NULL, skeleton);
02176           if (value != NULL)
02177             {
02178               g_variant_take_ref (value);
02179               g_variant_builder_add (&builder, "{sv}", info->name, value);
02180               g_variant_unref (value);
02181             }
02182         }
02183     }
02184 out:
02185   return g_variant_builder_end (&builder);
02186 }
02187 
02188 static gboolean _accounts_emit_changed (gpointer user_data);
02189 
02190 static void
02191 accounts_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
02192 {
02193   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (_skeleton);
02194   gboolean emit_changed = FALSE;
02195 
02196   g_mutex_lock (&skeleton->priv->lock);
02197   if (skeleton->priv->changed_properties_idle_source != NULL)
02198     {
02199       g_source_destroy (skeleton->priv->changed_properties_idle_source);
02200       skeleton->priv->changed_properties_idle_source = NULL;
02201       emit_changed = TRUE;
02202     }
02203   g_mutex_unlock (&skeleton->priv->lock);
02204 
02205   if (emit_changed)
02206     _accounts_emit_changed (skeleton);
02207 }
02208 
02209 static void
02210 _accounts_on_signal_user_added (
02211     Accounts *object,
02212     const gchar *arg_user)
02213 {
02214   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object);
02215 
02216   GList      *connections, *l;
02217   GVariant   *signal_variant;
02218   connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
02219 
02220   signal_variant = g_variant_ref_sink (g_variant_new ("(o)",
02221                    arg_user));
02222   for (l = connections; l != NULL; l = l->next)
02223     {
02224       GDBusConnection *connection = l->data;
02225       g_dbus_connection_emit_signal (connection,
02226         NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Accounts", "UserAdded",
02227         signal_variant, NULL);
02228     }
02229   g_variant_unref (signal_variant);
02230   g_list_free_full (connections, g_object_unref);
02231 }
02232 
02233 static void
02234 _accounts_on_signal_user_deleted (
02235     Accounts *object,
02236     const gchar *arg_user)
02237 {
02238   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object);
02239 
02240   GList      *connections, *l;
02241   GVariant   *signal_variant;
02242   connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
02243 
02244   signal_variant = g_variant_ref_sink (g_variant_new ("(o)",
02245                    arg_user));
02246   for (l = connections; l != NULL; l = l->next)
02247     {
02248       GDBusConnection *connection = l->data;
02249       g_dbus_connection_emit_signal (connection,
02250         NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Accounts", "UserDeleted",
02251         signal_variant, NULL);
02252     }
02253   g_variant_unref (signal_variant);
02254   g_list_free_full (connections, g_object_unref);
02255 }
02256 
02257 static void
02258 _accounts_on_signal_user_changed (
02259     Accounts *object,
02260     const gchar *arg_user)
02261 {
02262   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object);
02263 
02264   GList      *connections, *l;
02265   GVariant   *signal_variant;
02266   connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
02267 
02268   signal_variant = g_variant_ref_sink (g_variant_new ("(o)",
02269                    arg_user));
02270   for (l = connections; l != NULL; l = l->next)
02271     {
02272       GDBusConnection *connection = l->data;
02273       g_dbus_connection_emit_signal (connection,
02274         NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Accounts", "UserChanged",
02275         signal_variant, NULL);
02276     }
02277   g_variant_unref (signal_variant);
02278   g_list_free_full (connections, g_object_unref);
02279 }
02280 
02281 static void accounts_skeleton_iface_init (AccountsIface *iface);
02282 G_DEFINE_TYPE_WITH_CODE (AccountsSkeleton, accounts_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
02283                          G_IMPLEMENT_INTERFACE (TYPE_ACCOUNTS, accounts_skeleton_iface_init));
02284 
02285 static void
02286 accounts_skeleton_finalize (GObject *object)
02287 {
02288   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object);
02289   guint n;
02290   for (n = 0; n < 1; n++)
02291     g_value_unset (&skeleton->priv->properties[n]);
02292   g_free (skeleton->priv->properties);
02293   g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
02294   if (skeleton->priv->changed_properties_idle_source != NULL)
02295     g_source_destroy (skeleton->priv->changed_properties_idle_source);
02296   g_main_context_unref (skeleton->priv->context);
02297   g_mutex_clear (&skeleton->priv->lock);
02298   G_OBJECT_CLASS (accounts_skeleton_parent_class)->finalize (object);
02299 }
02300 
02301 static void
02302 accounts_skeleton_get_property (GObject      *object,
02303   guint         prop_id,
02304   GValue       *value,
02305   GParamSpec   *pspec)
02306 {
02307   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object);
02308   g_assert (prop_id != 0 && prop_id - 1 < 1);
02309   g_mutex_lock (&skeleton->priv->lock);
02310   g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
02311   g_mutex_unlock (&skeleton->priv->lock);
02312 }
02313 
02314 static gboolean
02315 _accounts_emit_changed (gpointer user_data)
02316 {
02317   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (user_data);
02318   GList *l;
02319   GVariantBuilder builder;
02320   GVariantBuilder invalidated_builder;
02321   guint num_changes;
02322 
02323   g_mutex_lock (&skeleton->priv->lock);
02324   g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
02325   g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
02326   for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
02327     {
02328       ChangedProperty *cp = l->data;
02329       GVariant *variant;
02330       const GValue *cur_value;
02331 
02332       cur_value = &skeleton->priv->properties[cp->prop_id - 1];
02333       if (!_g_value_equal (cur_value, &cp->orig_value))
02334         {
02335           variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
02336           g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
02337           g_variant_unref (variant);
02338           num_changes++;
02339         }
02340     }
02341   if (num_changes > 0)
02342     {
02343       GList *connections, *l;
02344       GVariant *signal_variant;
02345       signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.Accounts",
02346                                            &builder, &invalidated_builder));
02347       connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
02348       for (l = connections; l != NULL; l = l->next)
02349         {
02350           GDBusConnection *connection = l->data;
02351 
02352           g_dbus_connection_emit_signal (connection,
02353                                          NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
02354                                          "org.freedesktop.DBus.Properties",
02355                                          "PropertiesChanged",
02356                                          signal_variant,
02357                                          NULL);
02358         }
02359       g_variant_unref (signal_variant);
02360       g_list_free_full (connections, g_object_unref);
02361     }
02362   else
02363     {
02364       g_variant_builder_clear (&builder);
02365       g_variant_builder_clear (&invalidated_builder);
02366     }
02367   g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
02368   skeleton->priv->changed_properties = NULL;
02369   skeleton->priv->changed_properties_idle_source = NULL;
02370   g_mutex_unlock (&skeleton->priv->lock);
02371   return FALSE;
02372 }
02373 
02374 static void
02375 _accounts_schedule_emit_changed (AccountsSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
02376 {
02377   ChangedProperty *cp;
02378   GList *l;
02379   cp = NULL;
02380   for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
02381     {
02382       ChangedProperty *i_cp = l->data;
02383       if (i_cp->info == info)
02384         {
02385           cp = i_cp;
02386           break;
02387         }
02388     }
02389   if (cp == NULL)
02390     {
02391       cp = g_new0 (ChangedProperty, 1);
02392       cp->prop_id = prop_id;
02393       cp->info = info;
02394       skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
02395       g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
02396       g_value_copy (orig_value, &cp->orig_value);
02397     }
02398 }
02399 
02400 static void
02401 accounts_skeleton_notify (GObject      *object,
02402   GParamSpec *pspec)
02403 {
02404   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object);
02405   g_mutex_lock (&skeleton->priv->lock);
02406   if (skeleton->priv->changed_properties != NULL &&
02407       skeleton->priv->changed_properties_idle_source == NULL)
02408     {
02409       skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
02410       g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
02411       g_source_set_callback (skeleton->priv->changed_properties_idle_source, _accounts_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
02412       g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
02413       g_source_unref (skeleton->priv->changed_properties_idle_source);
02414     }
02415   g_mutex_unlock (&skeleton->priv->lock);
02416 }
02417 
02418 static void
02419 accounts_skeleton_set_property (GObject      *object,
02420   guint         prop_id,
02421   const GValue *value,
02422   GParamSpec   *pspec)
02423 {
02424   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object);
02425   g_assert (prop_id != 0 && prop_id - 1 < 1);
02426   g_mutex_lock (&skeleton->priv->lock);
02427   g_object_freeze_notify (object);
02428   if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
02429     {
02430       if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
02431         _accounts_schedule_emit_changed (skeleton, _accounts_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
02432       g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
02433       g_object_notify_by_pspec (object, pspec);
02434     }
02435   g_mutex_unlock (&skeleton->priv->lock);
02436   g_object_thaw_notify (object);
02437 }
02438 
02439 static void
02440 accounts_skeleton_init (AccountsSkeleton *skeleton)
02441 {
02442   skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_ACCOUNTS_SKELETON, AccountsSkeletonPrivate);
02443   g_mutex_init (&skeleton->priv->lock);
02444   skeleton->priv->context = g_main_context_ref_thread_default ();
02445   skeleton->priv->properties = g_new0 (GValue, 1);
02446   g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
02447 }
02448 
02449 static const gchar *
02450 accounts_skeleton_get_daemon_version (Accounts *object)
02451 {
02452   AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object);
02453   const gchar *value;
02454   g_mutex_lock (&skeleton->priv->lock);
02455   value = g_value_get_string (&(skeleton->priv->properties[0]));
02456   g_mutex_unlock (&skeleton->priv->lock);
02457   return value;
02458 }
02459 
02460 static void
02461 accounts_skeleton_class_init (AccountsSkeletonClass *klass)
02462 {
02463   GObjectClass *gobject_class;
02464   GDBusInterfaceSkeletonClass *skeleton_class;
02465 
02466   g_type_class_add_private (klass, sizeof (AccountsSkeletonPrivate));
02467 
02468   gobject_class = G_OBJECT_CLASS (klass);
02469   gobject_class->finalize = accounts_skeleton_finalize;
02470   gobject_class->get_property = accounts_skeleton_get_property;
02471   gobject_class->set_property = accounts_skeleton_set_property;
02472   gobject_class->notify       = accounts_skeleton_notify;
02473 
02474 
02475   accounts_override_properties (gobject_class, 1);
02476 
02477   skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
02478   skeleton_class->get_info = accounts_skeleton_dbus_interface_get_info;
02479   skeleton_class->get_properties = accounts_skeleton_dbus_interface_get_properties;
02480   skeleton_class->flush = accounts_skeleton_dbus_interface_flush;
02481   skeleton_class->get_vtable = accounts_skeleton_dbus_interface_get_vtable;
02482 }
02483 
02484 static void
02485 accounts_skeleton_iface_init (AccountsIface *iface)
02486 {
02487   iface->user_added = _accounts_on_signal_user_added;
02488   iface->user_deleted = _accounts_on_signal_user_deleted;
02489   iface->user_changed = _accounts_on_signal_user_changed;
02490   iface->get_daemon_version = accounts_skeleton_get_daemon_version;
02491 }
02492 
02500 Accounts *
02501 accounts_skeleton_new (void)
02502 {
02503   return ACCOUNTS (g_object_new (TYPE_ACCOUNTS_SKELETON, NULL));
02504 }
02505