Back to index

indicator-session  12.10.0
dbus-display-manager.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-display-manager.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.DisplayManager.Seat
00153  * ------------------------------------------------------------------------
00154  */
00155 
00164 /* ---- Introspection data for org.freedesktop.DisplayManager.Seat ---- */
00165 
00166 static const _ExtendedGDBusMethodInfo _display_manager_seat_method_info_switch_to_greeter =
00167 {
00168   {
00169     -1,
00170     (gchar *) "SwitchToGreeter",
00171     NULL,
00172     NULL,
00173     NULL
00174   },
00175   "handle-switch-to-greeter",
00176   FALSE
00177 };
00178 
00179 static const _ExtendedGDBusArgInfo _display_manager_seat_method_info_switch_to_user_IN_ARG_username =
00180 {
00181   {
00182     -1,
00183     (gchar *) "username",
00184     (gchar *) "s",
00185     NULL
00186   },
00187   FALSE
00188 };
00189 
00190 static const _ExtendedGDBusArgInfo _display_manager_seat_method_info_switch_to_user_IN_ARG_session_name =
00191 {
00192   {
00193     -1,
00194     (gchar *) "session_name",
00195     (gchar *) "s",
00196     NULL
00197   },
00198   FALSE
00199 };
00200 
00201 static const _ExtendedGDBusArgInfo * const _display_manager_seat_method_info_switch_to_user_IN_ARG_pointers[] =
00202 {
00203   &_display_manager_seat_method_info_switch_to_user_IN_ARG_username,
00204   &_display_manager_seat_method_info_switch_to_user_IN_ARG_session_name,
00205   NULL
00206 };
00207 
00208 static const _ExtendedGDBusMethodInfo _display_manager_seat_method_info_switch_to_user =
00209 {
00210   {
00211     -1,
00212     (gchar *) "SwitchToUser",
00213     (GDBusArgInfo **) &_display_manager_seat_method_info_switch_to_user_IN_ARG_pointers,
00214     NULL,
00215     NULL
00216   },
00217   "handle-switch-to-user",
00218   FALSE
00219 };
00220 
00221 static const _ExtendedGDBusArgInfo _display_manager_seat_method_info_switch_to_guest_IN_ARG_session_name =
00222 {
00223   {
00224     -1,
00225     (gchar *) "session_name",
00226     (gchar *) "s",
00227     NULL
00228   },
00229   FALSE
00230 };
00231 
00232 static const _ExtendedGDBusArgInfo * const _display_manager_seat_method_info_switch_to_guest_IN_ARG_pointers[] =
00233 {
00234   &_display_manager_seat_method_info_switch_to_guest_IN_ARG_session_name,
00235   NULL
00236 };
00237 
00238 static const _ExtendedGDBusMethodInfo _display_manager_seat_method_info_switch_to_guest =
00239 {
00240   {
00241     -1,
00242     (gchar *) "SwitchToGuest",
00243     (GDBusArgInfo **) &_display_manager_seat_method_info_switch_to_guest_IN_ARG_pointers,
00244     NULL,
00245     NULL
00246   },
00247   "handle-switch-to-guest",
00248   FALSE
00249 };
00250 
00251 static const _ExtendedGDBusMethodInfo _display_manager_seat_method_info_lock =
00252 {
00253   {
00254     -1,
00255     (gchar *) "Lock",
00256     NULL,
00257     NULL,
00258     NULL
00259   },
00260   "handle-lock",
00261   FALSE
00262 };
00263 
00264 static const _ExtendedGDBusMethodInfo * const _display_manager_seat_method_info_pointers[] =
00265 {
00266   &_display_manager_seat_method_info_switch_to_greeter,
00267   &_display_manager_seat_method_info_switch_to_user,
00268   &_display_manager_seat_method_info_switch_to_guest,
00269   &_display_manager_seat_method_info_lock,
00270   NULL
00271 };
00272 
00273 static const _ExtendedGDBusPropertyInfo _display_manager_seat_property_info_can_switch =
00274 {
00275   {
00276     -1,
00277     (gchar *) "CanSwitch",
00278     (gchar *) "b",
00279     G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
00280     NULL
00281   },
00282   "can-switch",
00283   FALSE
00284 };
00285 
00286 static const _ExtendedGDBusPropertyInfo _display_manager_seat_property_info_has_guest_account =
00287 {
00288   {
00289     -1,
00290     (gchar *) "HasGuestAccount",
00291     (gchar *) "b",
00292     G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
00293     NULL
00294   },
00295   "has-guest-account",
00296   FALSE
00297 };
00298 
00299 static const _ExtendedGDBusPropertyInfo _display_manager_seat_property_info_sessions =
00300 {
00301   {
00302     -1,
00303     (gchar *) "Sessions",
00304     (gchar *) "ao",
00305     G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
00306     NULL
00307   },
00308   "sessions",
00309   FALSE
00310 };
00311 
00312 static const _ExtendedGDBusPropertyInfo * const _display_manager_seat_property_info_pointers[] =
00313 {
00314   &_display_manager_seat_property_info_can_switch,
00315   &_display_manager_seat_property_info_has_guest_account,
00316   &_display_manager_seat_property_info_sessions,
00317   NULL
00318 };
00319 
00320 static const _ExtendedGDBusInterfaceInfo _display_manager_seat_interface_info =
00321 {
00322   {
00323     -1,
00324     (gchar *) "org.freedesktop.DisplayManager.Seat",
00325     (GDBusMethodInfo **) &_display_manager_seat_method_info_pointers,
00326     NULL,
00327     (GDBusPropertyInfo **) &_display_manager_seat_property_info_pointers,
00328     NULL
00329   },
00330   "display-manager-seat",
00331 };
00332 
00333 
00341 GDBusInterfaceInfo *
00342 display_manager_seat_interface_info (void)
00343 {
00344   return (GDBusInterfaceInfo *) &_display_manager_seat_interface_info;
00345 }
00346 
00357 guint
00358 display_manager_seat_override_properties (GObjectClass *klass, guint property_id_begin)
00359 {
00360   g_object_class_override_property (klass, property_id_begin++, "can-switch");
00361   g_object_class_override_property (klass, property_id_begin++, "has-guest-account");
00362   g_object_class_override_property (klass, property_id_begin++, "sessions");
00363   return property_id_begin - 1;
00364 }
00365 
00366 
00367 
00388 static void
00389 display_manager_seat_default_init (DisplayManagerSeatIface *iface)
00390 {
00391   /* GObject signals for incoming D-Bus method calls: */
00403   g_signal_new ("handle-switch-to-greeter",
00404     G_TYPE_FROM_INTERFACE (iface),
00405     G_SIGNAL_RUN_LAST,
00406     G_STRUCT_OFFSET (DisplayManagerSeatIface, handle_switch_to_greeter),
00407     g_signal_accumulator_true_handled,
00408     NULL,
00409     g_cclosure_marshal_generic,
00410     G_TYPE_BOOLEAN,
00411     1,
00412     G_TYPE_DBUS_METHOD_INVOCATION);
00413 
00427   g_signal_new ("handle-switch-to-user",
00428     G_TYPE_FROM_INTERFACE (iface),
00429     G_SIGNAL_RUN_LAST,
00430     G_STRUCT_OFFSET (DisplayManagerSeatIface, handle_switch_to_user),
00431     g_signal_accumulator_true_handled,
00432     NULL,
00433     g_cclosure_marshal_generic,
00434     G_TYPE_BOOLEAN,
00435     3,
00436     G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
00437 
00450   g_signal_new ("handle-switch-to-guest",
00451     G_TYPE_FROM_INTERFACE (iface),
00452     G_SIGNAL_RUN_LAST,
00453     G_STRUCT_OFFSET (DisplayManagerSeatIface, handle_switch_to_guest),
00454     g_signal_accumulator_true_handled,
00455     NULL,
00456     g_cclosure_marshal_generic,
00457     G_TYPE_BOOLEAN,
00458     2,
00459     G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
00460 
00472   g_signal_new ("handle-lock",
00473     G_TYPE_FROM_INTERFACE (iface),
00474     G_SIGNAL_RUN_LAST,
00475     G_STRUCT_OFFSET (DisplayManagerSeatIface, handle_lock),
00476     g_signal_accumulator_true_handled,
00477     NULL,
00478     g_cclosure_marshal_generic,
00479     G_TYPE_BOOLEAN,
00480     1,
00481     G_TYPE_DBUS_METHOD_INVOCATION);
00482 
00483   /* GObject properties for D-Bus properties: */
00491   g_object_interface_install_property (iface,
00492     g_param_spec_boolean ("can-switch", "CanSwitch", "CanSwitch", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
00500   g_object_interface_install_property (iface,
00501     g_param_spec_boolean ("has-guest-account", "HasGuestAccount", "HasGuestAccount", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
00509   g_object_interface_install_property (iface,
00510     g_param_spec_boxed ("sessions", "Sessions", "Sessions", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
00511 }
00512 
00513 typedef DisplayManagerSeatIface DisplayManagerSeatInterface;
00514 G_DEFINE_INTERFACE (DisplayManagerSeat, display_manager_seat, G_TYPE_OBJECT);
00515 
00526 gboolean 
00527 display_manager_seat_get_can_switch (DisplayManagerSeat *object)
00528 {
00529   return DISPLAY_MANAGER_SEAT_GET_IFACE (object)->get_can_switch (object);
00530 }
00531 
00541 void
00542 display_manager_seat_set_can_switch (DisplayManagerSeat *object, gboolean value)
00543 {
00544   g_object_set (G_OBJECT (object), "can-switch", value, NULL);
00545 }
00546 
00557 gboolean 
00558 display_manager_seat_get_has_guest_account (DisplayManagerSeat *object)
00559 {
00560   return DISPLAY_MANAGER_SEAT_GET_IFACE (object)->get_has_guest_account (object);
00561 }
00562 
00572 void
00573 display_manager_seat_set_has_guest_account (DisplayManagerSeat *object, gboolean value)
00574 {
00575   g_object_set (G_OBJECT (object), "has-guest-account", value, NULL);
00576 }
00577 
00590 const gchar *const *
00591 display_manager_seat_get_sessions (DisplayManagerSeat *object)
00592 {
00593   return DISPLAY_MANAGER_SEAT_GET_IFACE (object)->get_sessions (object);
00594 }
00595 
00606 gchar **
00607 display_manager_seat_dup_sessions (DisplayManagerSeat *object)
00608 {
00609   gchar **value;
00610   g_object_get (G_OBJECT (object), "sessions", &value, NULL);
00611   return value;
00612 }
00613 
00623 void
00624 display_manager_seat_set_sessions (DisplayManagerSeat *object, const gchar *const *value)
00625 {
00626   g_object_set (G_OBJECT (object), "sessions", value, NULL);
00627 }
00628 
00642 void
00643 display_manager_seat_call_switch_to_greeter (
00644     DisplayManagerSeat *proxy,
00645     GCancellable *cancellable,
00646     GAsyncReadyCallback callback,
00647     gpointer user_data)
00648 {
00649   g_dbus_proxy_call (G_DBUS_PROXY (proxy),
00650     "SwitchToGreeter",
00651     g_variant_new ("()"),
00652     G_DBUS_CALL_FLAGS_NONE,
00653     -1,
00654     cancellable,
00655     callback,
00656     user_data);
00657 }
00658 
00669 gboolean
00670 display_manager_seat_call_switch_to_greeter_finish (
00671     DisplayManagerSeat *proxy,
00672     GAsyncResult *res,
00673     GError **error)
00674 {
00675   GVariant *_ret;
00676   _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
00677   if (_ret == NULL)
00678     goto _out;
00679   g_variant_get (_ret,
00680                  "()");
00681   g_variant_unref (_ret);
00682 _out:
00683   return _ret != NULL;
00684 }
00685 
00698 gboolean
00699 display_manager_seat_call_switch_to_greeter_sync (
00700     DisplayManagerSeat *proxy,
00701     GCancellable *cancellable,
00702     GError **error)
00703 {
00704   GVariant *_ret;
00705   _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
00706     "SwitchToGreeter",
00707     g_variant_new ("()"),
00708     G_DBUS_CALL_FLAGS_NONE,
00709     -1,
00710     cancellable,
00711     error);
00712   if (_ret == NULL)
00713     goto _out;
00714   g_variant_get (_ret,
00715                  "()");
00716   g_variant_unref (_ret);
00717 _out:
00718   return _ret != NULL;
00719 }
00720 
00736 void
00737 display_manager_seat_call_switch_to_user (
00738     DisplayManagerSeat *proxy,
00739     const gchar *arg_username,
00740     const gchar *arg_session_name,
00741     GCancellable *cancellable,
00742     GAsyncReadyCallback callback,
00743     gpointer user_data)
00744 {
00745   g_dbus_proxy_call (G_DBUS_PROXY (proxy),
00746     "SwitchToUser",
00747     g_variant_new ("(ss)",
00748                    arg_username,
00749                    arg_session_name),
00750     G_DBUS_CALL_FLAGS_NONE,
00751     -1,
00752     cancellable,
00753     callback,
00754     user_data);
00755 }
00756 
00767 gboolean
00768 display_manager_seat_call_switch_to_user_finish (
00769     DisplayManagerSeat *proxy,
00770     GAsyncResult *res,
00771     GError **error)
00772 {
00773   GVariant *_ret;
00774   _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
00775   if (_ret == NULL)
00776     goto _out;
00777   g_variant_get (_ret,
00778                  "()");
00779   g_variant_unref (_ret);
00780 _out:
00781   return _ret != NULL;
00782 }
00783 
00798 gboolean
00799 display_manager_seat_call_switch_to_user_sync (
00800     DisplayManagerSeat *proxy,
00801     const gchar *arg_username,
00802     const gchar *arg_session_name,
00803     GCancellable *cancellable,
00804     GError **error)
00805 {
00806   GVariant *_ret;
00807   _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
00808     "SwitchToUser",
00809     g_variant_new ("(ss)",
00810                    arg_username,
00811                    arg_session_name),
00812     G_DBUS_CALL_FLAGS_NONE,
00813     -1,
00814     cancellable,
00815     error);
00816   if (_ret == NULL)
00817     goto _out;
00818   g_variant_get (_ret,
00819                  "()");
00820   g_variant_unref (_ret);
00821 _out:
00822   return _ret != NULL;
00823 }
00824 
00839 void
00840 display_manager_seat_call_switch_to_guest (
00841     DisplayManagerSeat *proxy,
00842     const gchar *arg_session_name,
00843     GCancellable *cancellable,
00844     GAsyncReadyCallback callback,
00845     gpointer user_data)
00846 {
00847   g_dbus_proxy_call (G_DBUS_PROXY (proxy),
00848     "SwitchToGuest",
00849     g_variant_new ("(s)",
00850                    arg_session_name),
00851     G_DBUS_CALL_FLAGS_NONE,
00852     -1,
00853     cancellable,
00854     callback,
00855     user_data);
00856 }
00857 
00868 gboolean
00869 display_manager_seat_call_switch_to_guest_finish (
00870     DisplayManagerSeat *proxy,
00871     GAsyncResult *res,
00872     GError **error)
00873 {
00874   GVariant *_ret;
00875   _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
00876   if (_ret == NULL)
00877     goto _out;
00878   g_variant_get (_ret,
00879                  "()");
00880   g_variant_unref (_ret);
00881 _out:
00882   return _ret != NULL;
00883 }
00884 
00898 gboolean
00899 display_manager_seat_call_switch_to_guest_sync (
00900     DisplayManagerSeat *proxy,
00901     const gchar *arg_session_name,
00902     GCancellable *cancellable,
00903     GError **error)
00904 {
00905   GVariant *_ret;
00906   _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
00907     "SwitchToGuest",
00908     g_variant_new ("(s)",
00909                    arg_session_name),
00910     G_DBUS_CALL_FLAGS_NONE,
00911     -1,
00912     cancellable,
00913     error);
00914   if (_ret == NULL)
00915     goto _out;
00916   g_variant_get (_ret,
00917                  "()");
00918   g_variant_unref (_ret);
00919 _out:
00920   return _ret != NULL;
00921 }
00922 
00936 void
00937 display_manager_seat_call_lock (
00938     DisplayManagerSeat *proxy,
00939     GCancellable *cancellable,
00940     GAsyncReadyCallback callback,
00941     gpointer user_data)
00942 {
00943   g_dbus_proxy_call (G_DBUS_PROXY (proxy),
00944     "Lock",
00945     g_variant_new ("()"),
00946     G_DBUS_CALL_FLAGS_NONE,
00947     -1,
00948     cancellable,
00949     callback,
00950     user_data);
00951 }
00952 
00963 gboolean
00964 display_manager_seat_call_lock_finish (
00965     DisplayManagerSeat *proxy,
00966     GAsyncResult *res,
00967     GError **error)
00968 {
00969   GVariant *_ret;
00970   _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
00971   if (_ret == NULL)
00972     goto _out;
00973   g_variant_get (_ret,
00974                  "()");
00975   g_variant_unref (_ret);
00976 _out:
00977   return _ret != NULL;
00978 }
00979 
00992 gboolean
00993 display_manager_seat_call_lock_sync (
00994     DisplayManagerSeat *proxy,
00995     GCancellable *cancellable,
00996     GError **error)
00997 {
00998   GVariant *_ret;
00999   _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
01000     "Lock",
01001     g_variant_new ("()"),
01002     G_DBUS_CALL_FLAGS_NONE,
01003     -1,
01004     cancellable,
01005     error);
01006   if (_ret == NULL)
01007     goto _out;
01008   g_variant_get (_ret,
01009                  "()");
01010   g_variant_unref (_ret);
01011 _out:
01012   return _ret != NULL;
01013 }
01014 
01024 void
01025 display_manager_seat_complete_switch_to_greeter (
01026     DisplayManagerSeat *object,
01027     GDBusMethodInvocation *invocation)
01028 {
01029   g_dbus_method_invocation_return_value (invocation,
01030     g_variant_new ("()"));
01031 }
01032 
01042 void
01043 display_manager_seat_complete_switch_to_user (
01044     DisplayManagerSeat *object,
01045     GDBusMethodInvocation *invocation)
01046 {
01047   g_dbus_method_invocation_return_value (invocation,
01048     g_variant_new ("()"));
01049 }
01050 
01060 void
01061 display_manager_seat_complete_switch_to_guest (
01062     DisplayManagerSeat *object,
01063     GDBusMethodInvocation *invocation)
01064 {
01065   g_dbus_method_invocation_return_value (invocation,
01066     g_variant_new ("()"));
01067 }
01068 
01078 void
01079 display_manager_seat_complete_lock (
01080     DisplayManagerSeat *object,
01081     GDBusMethodInvocation *invocation)
01082 {
01083   g_dbus_method_invocation_return_value (invocation,
01084     g_variant_new ("()"));
01085 }
01086 
01087 /* ------------------------------------------------------------------------ */
01088 
01102 struct _DisplayManagerSeatProxyPrivate
01103 {
01104   GData *qdata;
01105 };
01106 
01107 static void display_manager_seat_proxy_iface_init (DisplayManagerSeatIface *iface);
01108 
01109 G_DEFINE_TYPE_WITH_CODE (DisplayManagerSeatProxy, display_manager_seat_proxy, G_TYPE_DBUS_PROXY,
01110                          G_IMPLEMENT_INTERFACE (TYPE_DISPLAY_MANAGER_SEAT, display_manager_seat_proxy_iface_init));
01111 
01112 static void
01113 display_manager_seat_proxy_finalize (GObject *object)
01114 {
01115   DisplayManagerSeatProxy *proxy = DISPLAY_MANAGER_SEAT_PROXY (object);
01116   g_datalist_clear (&proxy->priv->qdata);
01117   G_OBJECT_CLASS (display_manager_seat_proxy_parent_class)->finalize (object);
01118 }
01119 
01120 static void
01121 display_manager_seat_proxy_get_property (GObject      *object,
01122   guint         prop_id,
01123   GValue       *value,
01124   GParamSpec   *pspec)
01125 {
01126   const _ExtendedGDBusPropertyInfo *info;
01127   GVariant *variant;
01128   g_assert (prop_id != 0 && prop_id - 1 < 3);
01129   info = _display_manager_seat_property_info_pointers[prop_id - 1];
01130   variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
01131   if (info->use_gvariant)
01132     {
01133       g_value_set_variant (value, variant);
01134     }
01135   else
01136     {
01137       if (variant != NULL)
01138         g_dbus_gvariant_to_gvalue (variant, value);
01139     }
01140   if (variant != NULL)
01141     g_variant_unref (variant);
01142 }
01143 
01144 static void
01145 display_manager_seat_proxy_set_property_cb (GDBusProxy *proxy,
01146   GAsyncResult *res,
01147   gpointer      user_data)
01148 {
01149   const _ExtendedGDBusPropertyInfo *info = user_data;
01150   GError *error;
01151   error = NULL;
01152   if (!g_dbus_proxy_call_finish (proxy, res, &error))
01153     {
01154       g_warning ("Error setting property `%s' on interface org.freedesktop.DisplayManager.Seat: %s (%s, %d)",
01155                  info->parent_struct.name, 
01156                  error->message, g_quark_to_string (error->domain), error->code);
01157       g_error_free (error);
01158     }
01159 }
01160 
01161 static void
01162 display_manager_seat_proxy_set_property (GObject      *object,
01163   guint         prop_id,
01164   const GValue *value,
01165   GParamSpec   *pspec)
01166 {
01167   const _ExtendedGDBusPropertyInfo *info;
01168   GVariant *variant;
01169   g_assert (prop_id != 0 && prop_id - 1 < 3);
01170   info = _display_manager_seat_property_info_pointers[prop_id - 1];
01171   variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
01172   g_dbus_proxy_call (G_DBUS_PROXY (object),
01173     "org.freedesktop.DBus.Properties.Set",
01174     g_variant_new ("(ssv)", "org.freedesktop.DisplayManager.Seat", info->parent_struct.name, variant),
01175     G_DBUS_CALL_FLAGS_NONE,
01176     -1,
01177     NULL, (GAsyncReadyCallback) display_manager_seat_proxy_set_property_cb, (gpointer) info);
01178   g_variant_unref (variant);
01179 }
01180 
01181 static void
01182 display_manager_seat_proxy_g_signal (GDBusProxy *proxy,
01183   const gchar *sender_name,
01184   const gchar *signal_name,
01185   GVariant *parameters)
01186 {
01187   _ExtendedGDBusSignalInfo *info;
01188   GVariantIter iter;
01189   GVariant *child;
01190   GValue *paramv;
01191   guint num_params;
01192   guint n;
01193   guint signal_id;
01194   info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_display_manager_seat_interface_info, signal_name);
01195   if (info == NULL)
01196     return;
01197   num_params = g_variant_n_children (parameters);
01198   paramv = g_new0 (GValue, num_params + 1);
01199   g_value_init (&paramv[0], TYPE_DISPLAY_MANAGER_SEAT);
01200   g_value_set_object (&paramv[0], proxy);
01201   g_variant_iter_init (&iter, parameters);
01202   n = 1;
01203   while ((child = g_variant_iter_next_value (&iter)) != NULL)
01204     {
01205       _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
01206       if (arg_info->use_gvariant)
01207         {
01208           g_value_init (&paramv[n], G_TYPE_VARIANT);
01209           g_value_set_variant (&paramv[n], child);
01210           n++;
01211         }
01212       else
01213         g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
01214       g_variant_unref (child);
01215     }
01216   signal_id = g_signal_lookup (info->signal_name, TYPE_DISPLAY_MANAGER_SEAT);
01217   g_signal_emitv (paramv, signal_id, 0, NULL);
01218   for (n = 0; n < num_params + 1; n++)
01219     g_value_unset (&paramv[n]);
01220   g_free (paramv);
01221 }
01222 
01223 static void
01224 display_manager_seat_proxy_g_properties_changed (GDBusProxy *_proxy,
01225   GVariant *changed_properties,
01226   const gchar *const *invalidated_properties)
01227 {
01228   DisplayManagerSeatProxy *proxy = DISPLAY_MANAGER_SEAT_PROXY (_proxy);
01229   guint n;
01230   const gchar *key;
01231   GVariantIter *iter;
01232   _ExtendedGDBusPropertyInfo *info;
01233   g_variant_get (changed_properties, "a{sv}", &iter);
01234   while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
01235     {
01236       info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_display_manager_seat_interface_info, key);
01237       g_datalist_remove_data (&proxy->priv->qdata, key);
01238       if (info != NULL)
01239         g_object_notify (G_OBJECT (proxy), info->hyphen_name);
01240     }
01241   g_variant_iter_free (iter);
01242   for (n = 0; invalidated_properties[n] != NULL; n++)
01243     {
01244       info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_display_manager_seat_interface_info, invalidated_properties[n]);
01245       g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
01246       if (info != NULL)
01247         g_object_notify (G_OBJECT (proxy), info->hyphen_name);
01248     }
01249 }
01250 
01251 static gboolean 
01252 display_manager_seat_proxy_get_can_switch (DisplayManagerSeat *object)
01253 {
01254   DisplayManagerSeatProxy *proxy = DISPLAY_MANAGER_SEAT_PROXY (object);
01255   GVariant *variant;
01256   gboolean value = 0;
01257   variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "CanSwitch");
01258   if (variant != NULL)
01259     {
01260       value = g_variant_get_boolean (variant);
01261       g_variant_unref (variant);
01262     }
01263   return value;
01264 }
01265 
01266 static gboolean 
01267 display_manager_seat_proxy_get_has_guest_account (DisplayManagerSeat *object)
01268 {
01269   DisplayManagerSeatProxy *proxy = DISPLAY_MANAGER_SEAT_PROXY (object);
01270   GVariant *variant;
01271   gboolean value = 0;
01272   variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "HasGuestAccount");
01273   if (variant != NULL)
01274     {
01275       value = g_variant_get_boolean (variant);
01276       g_variant_unref (variant);
01277     }
01278   return value;
01279 }
01280 
01281 static const gchar *const *
01282 display_manager_seat_proxy_get_sessions (DisplayManagerSeat *object)
01283 {
01284   DisplayManagerSeatProxy *proxy = DISPLAY_MANAGER_SEAT_PROXY (object);
01285   GVariant *variant;
01286   const gchar *const *value = NULL;
01287   variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Sessions");
01288   if (variant != NULL)
01289     {
01290       value = g_variant_get_objv (variant, NULL);
01291       g_variant_unref (variant);
01292     }
01293   return value;
01294 }
01295 
01296 static void
01297 display_manager_seat_proxy_init (DisplayManagerSeatProxy *proxy)
01298 {
01299   proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_DISPLAY_MANAGER_SEAT_PROXY, DisplayManagerSeatProxyPrivate);
01300   g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), display_manager_seat_interface_info ());
01301 }
01302 
01303 static void
01304 display_manager_seat_proxy_class_init (DisplayManagerSeatProxyClass *klass)
01305 {
01306   GObjectClass *gobject_class;
01307   GDBusProxyClass *proxy_class;
01308 
01309   g_type_class_add_private (klass, sizeof (DisplayManagerSeatProxyPrivate));
01310 
01311   gobject_class = G_OBJECT_CLASS (klass);
01312   gobject_class->finalize     = display_manager_seat_proxy_finalize;
01313   gobject_class->get_property = display_manager_seat_proxy_get_property;
01314   gobject_class->set_property = display_manager_seat_proxy_set_property;
01315 
01316   proxy_class = G_DBUS_PROXY_CLASS (klass);
01317   proxy_class->g_signal = display_manager_seat_proxy_g_signal;
01318   proxy_class->g_properties_changed = display_manager_seat_proxy_g_properties_changed;
01319 
01320 
01321   display_manager_seat_override_properties (gobject_class, 1);
01322 }
01323 
01324 static void
01325 display_manager_seat_proxy_iface_init (DisplayManagerSeatIface *iface)
01326 {
01327   iface->get_can_switch = display_manager_seat_proxy_get_can_switch;
01328   iface->get_has_guest_account = display_manager_seat_proxy_get_has_guest_account;
01329   iface->get_sessions = display_manager_seat_proxy_get_sessions;
01330 }
01331 
01349 void
01350 display_manager_seat_proxy_new (
01351     GDBusConnection     *connection,
01352     GDBusProxyFlags      flags,
01353     const gchar         *name,
01354     const gchar         *object_path,
01355     GCancellable        *cancellable,
01356     GAsyncReadyCallback  callback,
01357     gpointer             user_data)
01358 {
01359   g_async_initable_new_async (TYPE_DISPLAY_MANAGER_SEAT_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.DisplayManager.Seat", NULL);
01360 }
01361 
01371 DisplayManagerSeat *
01372 display_manager_seat_proxy_new_finish (
01373     GAsyncResult        *res,
01374     GError             **error)
01375 {
01376   GObject *ret;
01377   GObject *source_object;
01378   source_object = g_async_result_get_source_object (res);
01379   ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
01380   g_object_unref (source_object);
01381   if (ret != NULL)
01382     return DISPLAY_MANAGER_SEAT (ret);
01383   else
01384     return NULL;
01385 }
01386 
01404 DisplayManagerSeat *
01405 display_manager_seat_proxy_new_sync (
01406     GDBusConnection     *connection,
01407     GDBusProxyFlags      flags,
01408     const gchar         *name,
01409     const gchar         *object_path,
01410     GCancellable        *cancellable,
01411     GError             **error)
01412 {
01413   GInitable *ret;
01414   ret = g_initable_new (TYPE_DISPLAY_MANAGER_SEAT_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DisplayManager.Seat", NULL);
01415   if (ret != NULL)
01416     return DISPLAY_MANAGER_SEAT (ret);
01417   else
01418     return NULL;
01419 }
01420 
01421 
01439 void
01440 display_manager_seat_proxy_new_for_bus (
01441     GBusType             bus_type,
01442     GDBusProxyFlags      flags,
01443     const gchar         *name,
01444     const gchar         *object_path,
01445     GCancellable        *cancellable,
01446     GAsyncReadyCallback  callback,
01447     gpointer             user_data)
01448 {
01449   g_async_initable_new_async (TYPE_DISPLAY_MANAGER_SEAT_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.DisplayManager.Seat", NULL);
01450 }
01451 
01461 DisplayManagerSeat *
01462 display_manager_seat_proxy_new_for_bus_finish (
01463     GAsyncResult        *res,
01464     GError             **error)
01465 {
01466   GObject *ret;
01467   GObject *source_object;
01468   source_object = g_async_result_get_source_object (res);
01469   ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
01470   g_object_unref (source_object);
01471   if (ret != NULL)
01472     return DISPLAY_MANAGER_SEAT (ret);
01473   else
01474     return NULL;
01475 }
01476 
01494 DisplayManagerSeat *
01495 display_manager_seat_proxy_new_for_bus_sync (
01496     GBusType             bus_type,
01497     GDBusProxyFlags      flags,
01498     const gchar         *name,
01499     const gchar         *object_path,
01500     GCancellable        *cancellable,
01501     GError             **error)
01502 {
01503   GInitable *ret;
01504   ret = g_initable_new (TYPE_DISPLAY_MANAGER_SEAT_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DisplayManager.Seat", NULL);
01505   if (ret != NULL)
01506     return DISPLAY_MANAGER_SEAT (ret);
01507   else
01508     return NULL;
01509 }
01510 
01511 
01512 /* ------------------------------------------------------------------------ */
01513 
01527 struct _DisplayManagerSeatSkeletonPrivate
01528 {
01529   GValue *properties;
01530   GList *changed_properties;
01531   GSource *changed_properties_idle_source;
01532   GMainContext *context;
01533   GMutex lock;
01534 };
01535 
01536 static void
01537 _display_manager_seat_skeleton_handle_method_call (
01538   GDBusConnection *connection,
01539   const gchar *sender,
01540   const gchar *object_path,
01541   const gchar *interface_name,
01542   const gchar *method_name,
01543   GVariant *parameters,
01544   GDBusMethodInvocation *invocation,
01545   gpointer user_data)
01546 {
01547   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (user_data);
01548   _ExtendedGDBusMethodInfo *info;
01549   GVariantIter iter;
01550   GVariant *child;
01551   GValue *paramv;
01552   guint num_params;
01553   guint num_extra;
01554   guint n;
01555   guint signal_id;
01556   GValue return_value = G_VALUE_INIT;
01557   info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
01558   g_assert (info != NULL);
01559   num_params = g_variant_n_children (parameters);
01560   num_extra = info->pass_fdlist ? 3 : 2;  paramv = g_new0 (GValue, num_params + num_extra);
01561   n = 0;
01562   g_value_init (&paramv[n], TYPE_DISPLAY_MANAGER_SEAT);
01563   g_value_set_object (&paramv[n++], skeleton);
01564   g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
01565   g_value_set_object (&paramv[n++], invocation);
01566   if (info->pass_fdlist)
01567     {
01568 #ifdef G_OS_UNIX
01569       g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
01570       g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
01571 #else
01572       g_assert_not_reached ();
01573 #endif
01574     }
01575   g_variant_iter_init (&iter, parameters);
01576   while ((child = g_variant_iter_next_value (&iter)) != NULL)
01577     {
01578       _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
01579       if (arg_info->use_gvariant)
01580         {
01581           g_value_init (&paramv[n], G_TYPE_VARIANT);
01582           g_value_set_variant (&paramv[n], child);
01583           n++;
01584         }
01585       else
01586         g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
01587       g_variant_unref (child);
01588     }
01589   signal_id = g_signal_lookup (info->signal_name, TYPE_DISPLAY_MANAGER_SEAT);
01590   g_value_init (&return_value, G_TYPE_BOOLEAN);
01591   g_signal_emitv (paramv, signal_id, 0, &return_value);
01592   if (!g_value_get_boolean (&return_value))
01593     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);
01594   g_value_unset (&return_value);
01595   for (n = 0; n < num_params + num_extra; n++)
01596     g_value_unset (&paramv[n]);
01597   g_free (paramv);
01598 }
01599 
01600 static GVariant *
01601 _display_manager_seat_skeleton_handle_get_property (
01602   GDBusConnection *connection,
01603   const gchar *sender,
01604   const gchar *object_path,
01605   const gchar *interface_name,
01606   const gchar *property_name,
01607   GError **error,
01608   gpointer user_data)
01609 {
01610   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (user_data);
01611   GValue value = G_VALUE_INIT;
01612   GParamSpec *pspec;
01613   _ExtendedGDBusPropertyInfo *info;
01614   GVariant *ret;
01615   ret = NULL;
01616   info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_display_manager_seat_interface_info, property_name);
01617   g_assert (info != NULL);
01618   pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
01619   if (pspec == NULL)
01620     {
01621       g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
01622     }
01623   else
01624     {
01625       g_value_init (&value, pspec->value_type);
01626       g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
01627       ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
01628       g_value_unset (&value);
01629     }
01630   return ret;
01631 }
01632 
01633 static gboolean
01634 _display_manager_seat_skeleton_handle_set_property (
01635   GDBusConnection *connection,
01636   const gchar *sender,
01637   const gchar *object_path,
01638   const gchar *interface_name,
01639   const gchar *property_name,
01640   GVariant *variant,
01641   GError **error,
01642   gpointer user_data)
01643 {
01644   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (user_data);
01645   GValue value = G_VALUE_INIT;
01646   GParamSpec *pspec;
01647   _ExtendedGDBusPropertyInfo *info;
01648   gboolean ret;
01649   ret = FALSE;
01650   info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_display_manager_seat_interface_info, property_name);
01651   g_assert (info != NULL);
01652   pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
01653   if (pspec == NULL)
01654     {
01655       g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
01656     }
01657   else
01658     {
01659       if (info->use_gvariant)
01660         g_value_set_variant (&value, variant);
01661       else
01662         g_dbus_gvariant_to_gvalue (variant, &value);
01663       g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
01664       g_value_unset (&value);
01665       ret = TRUE;
01666     }
01667   return ret;
01668 }
01669 
01670 static const GDBusInterfaceVTable _display_manager_seat_skeleton_vtable =
01671 {
01672   _display_manager_seat_skeleton_handle_method_call,
01673   _display_manager_seat_skeleton_handle_get_property,
01674   _display_manager_seat_skeleton_handle_set_property
01675 };
01676 
01677 static GDBusInterfaceInfo *
01678 display_manager_seat_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton)
01679 {
01680   return display_manager_seat_interface_info ();
01681 }
01682 
01683 static GDBusInterfaceVTable *
01684 display_manager_seat_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton)
01685 {
01686   return (GDBusInterfaceVTable *) &_display_manager_seat_skeleton_vtable;
01687 }
01688 
01689 static GVariant *
01690 display_manager_seat_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
01691 {
01692   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (_skeleton);
01693 
01694   GVariantBuilder builder;
01695   guint n;
01696   g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
01697   if (_display_manager_seat_interface_info.parent_struct.properties == NULL)
01698     goto out;
01699   for (n = 0; _display_manager_seat_interface_info.parent_struct.properties[n] != NULL; n++)
01700     {
01701       GDBusPropertyInfo *info = _display_manager_seat_interface_info.parent_struct.properties[n];
01702       if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
01703         {
01704           GVariant *value;
01705           value = _display_manager_seat_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.DisplayManager.Seat", info->name, NULL, skeleton);
01706           if (value != NULL)
01707             {
01708               g_variant_take_ref (value);
01709               g_variant_builder_add (&builder, "{sv}", info->name, value);
01710               g_variant_unref (value);
01711             }
01712         }
01713     }
01714 out:
01715   return g_variant_builder_end (&builder);
01716 }
01717 
01718 static gboolean _display_manager_seat_emit_changed (gpointer user_data);
01719 
01720 static void
01721 display_manager_seat_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
01722 {
01723   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (_skeleton);
01724   gboolean emit_changed = FALSE;
01725 
01726   g_mutex_lock (&skeleton->priv->lock);
01727   if (skeleton->priv->changed_properties_idle_source != NULL)
01728     {
01729       g_source_destroy (skeleton->priv->changed_properties_idle_source);
01730       skeleton->priv->changed_properties_idle_source = NULL;
01731       emit_changed = TRUE;
01732     }
01733   g_mutex_unlock (&skeleton->priv->lock);
01734 
01735   if (emit_changed)
01736     _display_manager_seat_emit_changed (skeleton);
01737 }
01738 
01739 static void display_manager_seat_skeleton_iface_init (DisplayManagerSeatIface *iface);
01740 G_DEFINE_TYPE_WITH_CODE (DisplayManagerSeatSkeleton, display_manager_seat_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
01741                          G_IMPLEMENT_INTERFACE (TYPE_DISPLAY_MANAGER_SEAT, display_manager_seat_skeleton_iface_init));
01742 
01743 static void
01744 display_manager_seat_skeleton_finalize (GObject *object)
01745 {
01746   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object);
01747   guint n;
01748   for (n = 0; n < 3; n++)
01749     g_value_unset (&skeleton->priv->properties[n]);
01750   g_free (skeleton->priv->properties);
01751   g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
01752   if (skeleton->priv->changed_properties_idle_source != NULL)
01753     g_source_destroy (skeleton->priv->changed_properties_idle_source);
01754   g_main_context_unref (skeleton->priv->context);
01755   g_mutex_clear (&skeleton->priv->lock);
01756   G_OBJECT_CLASS (display_manager_seat_skeleton_parent_class)->finalize (object);
01757 }
01758 
01759 static void
01760 display_manager_seat_skeleton_get_property (GObject      *object,
01761   guint         prop_id,
01762   GValue       *value,
01763   GParamSpec   *pspec)
01764 {
01765   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object);
01766   g_assert (prop_id != 0 && prop_id - 1 < 3);
01767   g_mutex_lock (&skeleton->priv->lock);
01768   g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
01769   g_mutex_unlock (&skeleton->priv->lock);
01770 }
01771 
01772 static gboolean
01773 _display_manager_seat_emit_changed (gpointer user_data)
01774 {
01775   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (user_data);
01776   GList *l;
01777   GVariantBuilder builder;
01778   GVariantBuilder invalidated_builder;
01779   guint num_changes;
01780 
01781   g_mutex_lock (&skeleton->priv->lock);
01782   g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
01783   g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
01784   for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
01785     {
01786       ChangedProperty *cp = l->data;
01787       GVariant *variant;
01788       const GValue *cur_value;
01789 
01790       cur_value = &skeleton->priv->properties[cp->prop_id - 1];
01791       if (!_g_value_equal (cur_value, &cp->orig_value))
01792         {
01793           variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
01794           g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
01795           g_variant_unref (variant);
01796           num_changes++;
01797         }
01798     }
01799   if (num_changes > 0)
01800     {
01801       GList *connections, *l;
01802       GVariant *signal_variant;
01803       signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.DisplayManager.Seat",
01804                                            &builder, &invalidated_builder));
01805       connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
01806       for (l = connections; l != NULL; l = l->next)
01807         {
01808           GDBusConnection *connection = l->data;
01809 
01810           g_dbus_connection_emit_signal (connection,
01811                                          NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
01812                                          "org.freedesktop.DBus.Properties",
01813                                          "PropertiesChanged",
01814                                          signal_variant,
01815                                          NULL);
01816         }
01817       g_variant_unref (signal_variant);
01818       g_list_free_full (connections, g_object_unref);
01819     }
01820   else
01821     {
01822       g_variant_builder_clear (&builder);
01823       g_variant_builder_clear (&invalidated_builder);
01824     }
01825   g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
01826   skeleton->priv->changed_properties = NULL;
01827   skeleton->priv->changed_properties_idle_source = NULL;
01828   g_mutex_unlock (&skeleton->priv->lock);
01829   return FALSE;
01830 }
01831 
01832 static void
01833 _display_manager_seat_schedule_emit_changed (DisplayManagerSeatSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
01834 {
01835   ChangedProperty *cp;
01836   GList *l;
01837   cp = NULL;
01838   for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
01839     {
01840       ChangedProperty *i_cp = l->data;
01841       if (i_cp->info == info)
01842         {
01843           cp = i_cp;
01844           break;
01845         }
01846     }
01847   if (cp == NULL)
01848     {
01849       cp = g_new0 (ChangedProperty, 1);
01850       cp->prop_id = prop_id;
01851       cp->info = info;
01852       skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
01853       g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
01854       g_value_copy (orig_value, &cp->orig_value);
01855     }
01856 }
01857 
01858 static void
01859 display_manager_seat_skeleton_notify (GObject      *object,
01860   GParamSpec *pspec)
01861 {
01862   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object);
01863   g_mutex_lock (&skeleton->priv->lock);
01864   if (skeleton->priv->changed_properties != NULL &&
01865       skeleton->priv->changed_properties_idle_source == NULL)
01866     {
01867       skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
01868       g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
01869       g_source_set_callback (skeleton->priv->changed_properties_idle_source, _display_manager_seat_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
01870       g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
01871       g_source_unref (skeleton->priv->changed_properties_idle_source);
01872     }
01873   g_mutex_unlock (&skeleton->priv->lock);
01874 }
01875 
01876 static void
01877 display_manager_seat_skeleton_set_property (GObject      *object,
01878   guint         prop_id,
01879   const GValue *value,
01880   GParamSpec   *pspec)
01881 {
01882   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object);
01883   g_assert (prop_id != 0 && prop_id - 1 < 3);
01884   g_mutex_lock (&skeleton->priv->lock);
01885   g_object_freeze_notify (object);
01886   if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
01887     {
01888       if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
01889         _display_manager_seat_schedule_emit_changed (skeleton, _display_manager_seat_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
01890       g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
01891       g_object_notify_by_pspec (object, pspec);
01892     }
01893   g_mutex_unlock (&skeleton->priv->lock);
01894   g_object_thaw_notify (object);
01895 }
01896 
01897 static void
01898 display_manager_seat_skeleton_init (DisplayManagerSeatSkeleton *skeleton)
01899 {
01900   skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_DISPLAY_MANAGER_SEAT_SKELETON, DisplayManagerSeatSkeletonPrivate);
01901   g_mutex_init (&skeleton->priv->lock);
01902   skeleton->priv->context = g_main_context_ref_thread_default ();
01903   skeleton->priv->properties = g_new0 (GValue, 3);
01904   g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
01905   g_value_init (&skeleton->priv->properties[1], G_TYPE_BOOLEAN);
01906   g_value_init (&skeleton->priv->properties[2], G_TYPE_STRV);
01907 }
01908 
01909 static gboolean 
01910 display_manager_seat_skeleton_get_can_switch (DisplayManagerSeat *object)
01911 {
01912   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object);
01913   gboolean value;
01914   g_mutex_lock (&skeleton->priv->lock);
01915   value = g_value_get_boolean (&(skeleton->priv->properties[0]));
01916   g_mutex_unlock (&skeleton->priv->lock);
01917   return value;
01918 }
01919 
01920 static gboolean 
01921 display_manager_seat_skeleton_get_has_guest_account (DisplayManagerSeat *object)
01922 {
01923   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object);
01924   gboolean value;
01925   g_mutex_lock (&skeleton->priv->lock);
01926   value = g_value_get_boolean (&(skeleton->priv->properties[1]));
01927   g_mutex_unlock (&skeleton->priv->lock);
01928   return value;
01929 }
01930 
01931 static const gchar *const *
01932 display_manager_seat_skeleton_get_sessions (DisplayManagerSeat *object)
01933 {
01934   DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object);
01935   const gchar *const *value;
01936   g_mutex_lock (&skeleton->priv->lock);
01937   value = g_value_get_boxed (&(skeleton->priv->properties[2]));
01938   g_mutex_unlock (&skeleton->priv->lock);
01939   return value;
01940 }
01941 
01942 static void
01943 display_manager_seat_skeleton_class_init (DisplayManagerSeatSkeletonClass *klass)
01944 {
01945   GObjectClass *gobject_class;
01946   GDBusInterfaceSkeletonClass *skeleton_class;
01947 
01948   g_type_class_add_private (klass, sizeof (DisplayManagerSeatSkeletonPrivate));
01949 
01950   gobject_class = G_OBJECT_CLASS (klass);
01951   gobject_class->finalize = display_manager_seat_skeleton_finalize;
01952   gobject_class->get_property = display_manager_seat_skeleton_get_property;
01953   gobject_class->set_property = display_manager_seat_skeleton_set_property;
01954   gobject_class->notify       = display_manager_seat_skeleton_notify;
01955 
01956 
01957   display_manager_seat_override_properties (gobject_class, 1);
01958 
01959   skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
01960   skeleton_class->get_info = display_manager_seat_skeleton_dbus_interface_get_info;
01961   skeleton_class->get_properties = display_manager_seat_skeleton_dbus_interface_get_properties;
01962   skeleton_class->flush = display_manager_seat_skeleton_dbus_interface_flush;
01963   skeleton_class->get_vtable = display_manager_seat_skeleton_dbus_interface_get_vtable;
01964 }
01965 
01966 static void
01967 display_manager_seat_skeleton_iface_init (DisplayManagerSeatIface *iface)
01968 {
01969   iface->get_can_switch = display_manager_seat_skeleton_get_can_switch;
01970   iface->get_has_guest_account = display_manager_seat_skeleton_get_has_guest_account;
01971   iface->get_sessions = display_manager_seat_skeleton_get_sessions;
01972 }
01973 
01981 DisplayManagerSeat *
01982 display_manager_seat_skeleton_new (void)
01983 {
01984   return DISPLAY_MANAGER_SEAT (g_object_new (TYPE_DISPLAY_MANAGER_SEAT_SKELETON, NULL));
01985 }
01986