diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2012-07-11 19:25:42 +0200 |
---|---|---|
committer | Sebastien Bacher <seb128@ubuntu.com> | 2012-07-11 19:25:42 +0200 |
commit | e1ec25c1ccc63162bcfefc0661fc61fac9f376d1 (patch) | |
tree | d4d8adfec594c44bf54ed58c9ddf91dedaaa20e4 /src | |
parent | 6127a94efad13c780625228a1541c387528d75f1 (diff) | |
parent | 5b3945bab742d40e33e8a9bb3077cdc2b3898b22 (diff) | |
download | ayatana-indicator-session-e1ec25c1ccc63162bcfefc0661fc61fac9f376d1.tar.gz ayatana-indicator-session-e1ec25c1ccc63162bcfefc0661fc61fac9f376d1.tar.bz2 ayatana-indicator-session-e1ec25c1ccc63162bcfefc0661fc61fac9f376d1.zip |
Import upstream version 12.10.0
Diffstat (limited to 'src')
50 files changed, 31374 insertions, 6493 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index b29e8d4..7bc6306 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ - +CLEANFILES = EXTRA_DIST = libexec_PROGRAMS = \ @@ -13,75 +13,96 @@ endif # Indicator Stuff ################### +CLEANFILES += .libs/*.gcda .libs/*.gcno *.gcda *.gcno + sessionlibdir = $(INDICATORDIR) sessionlib_LTLIBRARIES = libsession.la libsession_la_SOURCES = \ indicator-session.c \ gen-session-dbus.xml.h \ - dbus-shared-names.h \ - dbusmenu-shared.h \ + shared-names.h \ user-widget.c \ - user-widget.h \ - accounts-service-client.h \ - accounts-service-user-client.h + user-widget.h libsession_la_CFLAGS = \ $(APPLET_CFLAGS) \ $(COVERAGE_CFLAGS) \ - -Wall -Werror \ + -Wall -Wunused \ -DG_LOG_DOMAIN=\"Indicator-Session\" libsession_la_LIBADD = $(APPLET_LIBS) libsession_la_LDFLAGS = \ $(COVERAGE_LDFLAGS) \ -module -avoid-version -consolekit-manager-client.h: $(srcdir)/org.freedesktop.ConsoleKit.Manager.xml - dbus-binding-tool \ - --prefix=_consolekit_manager_client \ - --mode=glib-client \ - --output=consolekit-manager-client.h \ - $(srcdir)/org.freedesktop.ConsoleKit.Manager.xml - -consolekit-seat-client.h: $(srcdir)/org.freedesktop.ConsoleKit.Seat.xml - dbus-binding-tool \ - --prefix=_consolekit_seat_client \ - --mode=glib-client \ - --output=consolekit-seat-client.h \ - $(srcdir)/org.freedesktop.ConsoleKit.Seat.xml - -consolekit-session-client.h: $(srcdir)/org.freedesktop.ConsoleKit.Session.xml - dbus-binding-tool \ - --prefix=_consolekit_session_client \ - --mode=glib-client \ - --output=consolekit-session-client.h \ - $(srcdir)/org.freedesktop.ConsoleKit.Session.xml - -display-manager-client.h: $(srcdir)/display-manager.xml - dbus-binding-tool \ - --prefix=_gdm_local_display_factory_client \ - --mode=glib-client \ - --output=display-manager-client.h \ - $(srcdir)/display-manager.xml - -accounts-service-client.h: $(srcdir)/accounts-service.xml - dbus-binding-tool \ - --prefix=_accounts_service_client \ - --mode=glib-client \ - --output=accounts-service-client.h \ - $(srcdir)/accounts-service.xml - -accounts-service-user-client.h: $(srcdir)/accounts-service-user.xml - dbus-binding-tool \ - --prefix=_accounts_service_user_client \ - --mode=glib-client \ - --output=accounts-service-user-client.h \ - $(srcdir)/accounts-service-user.xml - -upower-client.h: $(srcdir)/upower.xml - dbus-binding-tool \ - --prefix=_upower_client \ - --mode=glib-client \ - --output=upower-client.h \ - $(srcdir)/upower.xml +dbus_display_manager_sources = \ + dbus-display-manager.c \ + dbus-display-manager.h + +$(dbus_display_manager_sources): display-manager.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-display-manager \ + $^ + +dbus_consolekit_manager_sources = \ + dbus-consolekit-manager.c \ + dbus-consolekit-manager.h + +$(dbus_consolekit_manager_sources): org.freedesktop.ConsoleKit.Manager.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-consolekit-manager \ + $^ + +dbus_consolekit_seat_sources = \ + dbus-consolekit-seat.c \ + dbus-consolekit-seat.h + +$(dbus_consolekit_seat_sources): org.freedesktop.ConsoleKit.Seat.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-consolekit-seat \ + $^ + +dbus_consolekit_session_sources = \ + dbus-consolekit-session.c \ + dbus-consolekit-session.h + +$(dbus_consolekit_session_sources): org.freedesktop.ConsoleKit.Session.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-consolekit-session \ + $^ + +dbus_accounts_sources = \ + dbus-accounts.c \ + dbus-accounts.h + +$(dbus_accounts_sources): org.freedesktop.Accounts.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-accounts \ + $^ + +dbus_user_sources = \ + dbus-user.c \ + dbus-user.h + +$(dbus_user_sources): org.freedesktop.Accounts.User.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-user \ + $^ + +dbus_upower_sources = \ + dbus-upower.c \ + dbus-upower.h + +$(dbus_upower_sources): upower.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-upower \ + --c-namespace DBus \ + $^ gen-%.xml.c: %.xml @echo "Building $@ from $<" @@ -98,54 +119,32 @@ gen-%.xml.h: %.xml ################# indicator_session_service_SOURCES = \ - lock-helper.c \ - lock-helper.h \ + $(dbus_accounts_sources) \ + $(dbus_consolekit_manager_sources) \ + $(dbus_consolekit_seat_sources) \ + $(dbus_consolekit_session_sources) \ + $(dbus_display_manager_sources) \ + $(dbus_upower_sources) \ + $(dbus_user_sources) \ session-service.c \ session-dbus.c \ session-dbus.h \ gen-session-dbus.xml.c \ - dbusmenu-shared.h \ - settings-helper.c \ users-service-dbus.h \ users-service-dbus.c \ - user-menu-mgr.h \ - user-menu-mgr.c \ - device-menu-mgr.h \ - device-menu-mgr.c \ - sane-rules.h - -if BUILD_APT -indicator_session_service_SOURCES += \ - apt-watcher.h \ - apt-watcher.c -else -EXTRA_DIST += \ - apt-watcher.h \ - apt-watcher.c -endif - -if HAS_GUDEV -indicator_session_service_SOURCES += \ - udev-mgr.h \ - udev-mgr.c -else -EXTRA_DIST += \ - udev-mgr.h \ - udev-mgr.c -endif + session-menu-mgr.h \ + session-menu-mgr.c indicator_session_service_CFLAGS = \ $(SESSIONSERVICE_CFLAGS) \ $(GCONF_CFLAGS) \ -DLIBEXECDIR=\"$(libexecdir)\" \ - -Wall -Werror \ + -Wall \ -DG_LOG_DOMAIN=\"Indicator-Session\" \ - $(GUDEV_CFLAGS) \ $(COVERAGE_CFLAGS) indicator_session_service_LDADD = \ $(SESSIONSERVICE_LIBS) \ - $(GCONF_LIBS) \ - $(GUDEV_LIBS) + $(GCONF_LIBS) indicator_session_service_LDFLAGS = \ $(COVERAGE_LDFLAGS) @@ -155,9 +154,8 @@ indicator_session_service_LDFLAGS = \ if BUILD_GTKLOGOUTHELPER gtk_logout_helper_SOURCES = \ + $(dbus_consolekit_manager_sources) \ gtk-logout-helper.c \ - settings-helper.c \ - settings-helper.h \ dialog.c \ dialog.h @@ -166,7 +164,7 @@ gtk_logout_helper_CFLAGS = \ $(GTKLOGOUTHELPER_CFLAGS) \ $(GCONF_CFLAGS) \ $(COVERAGE_CFLAGS) \ - -Wall -Werror \ + -Wall \ -DINDICATOR_ICONS_DIR="\"$(INDICATORICONSDIR)\"" gtk_logout_helper_LDADD = \ @@ -184,25 +182,24 @@ endif ############### BUILT_SOURCES = \ - consolekit-manager-client.h \ - consolekit-seat-client.h \ - consolekit-session-client.h \ - display-manager-client.h \ + $(dbus_accounts_sources) \ + $(dbus_consolekit_manager_sources) \ + $(dbus_consolekit_seat_sources) \ + $(dbus_consolekit_session_sources) \ + $(dbus_display_manager_sources) \ + $(dbus_upower_sources) \ + $(dbus_user_sources) \ gen-session-dbus.xml.c \ - gen-session-dbus.xml.h \ - upower-client.h \ - accounts-service-client.h \ - accounts-service-user-client.h + gen-session-dbus.xml.h EXTRA_DIST += \ + display-manager.xml \ + org.freedesktop.Accounts.User.xml \ + org.freedesktop.Accounts.xml \ org.freedesktop.ConsoleKit.Manager.xml \ org.freedesktop.ConsoleKit.Seat.xml \ org.freedesktop.ConsoleKit.Session.xml \ - display-manager.xml \ session-dbus.xml \ - upower.xml \ - accounts-service.xml \ - accounts-service-user.xml + upower.xml -CLEANFILES = \ - $(BUILT_SOURCES) +CLEANFILES += $(BUILT_SOURCES) diff --git a/src/Makefile.in b/src/Makefile.in index 5e7dfdb..73b2cdb 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.11.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -17,6 +17,23 @@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -39,30 +56,14 @@ libexec_PROGRAMS = indicator-session-service$(EXEEXT) $(am__EXEEXT_1) @BUILD_GTKLOGOUTHELPER_TRUE@am__append_1 = \ @BUILD_GTKLOGOUTHELPER_TRUE@ gtk-logout-helper -@BUILD_APT_TRUE@am__append_2 = \ -@BUILD_APT_TRUE@ apt-watcher.h \ -@BUILD_APT_TRUE@ apt-watcher.c - -@BUILD_APT_FALSE@am__append_3 = \ -@BUILD_APT_FALSE@ apt-watcher.h \ -@BUILD_APT_FALSE@ apt-watcher.c - -@HAS_GUDEV_TRUE@am__append_4 = \ -@HAS_GUDEV_TRUE@ udev-mgr.h \ -@HAS_GUDEV_TRUE@ udev-mgr.c - -@HAS_GUDEV_FALSE@am__append_5 = \ -@HAS_GUDEV_FALSE@ udev-mgr.h \ -@HAS_GUDEV_FALSE@ udev-mgr.c - subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/gcov.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/gtest.m4 \ + $(top_srcdir)/m4/gcov.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -112,10 +113,13 @@ libsession_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(CFLAGS) $(libsession_la_LDFLAGS) $(LDFLAGS) -o $@ @BUILD_GTKLOGOUTHELPER_TRUE@am__EXEEXT_1 = gtk-logout-helper$(EXEEXT) PROGRAMS = $(libexec_PROGRAMS) -am__gtk_logout_helper_SOURCES_DIST = gtk-logout-helper.c \ - settings-helper.c settings-helper.h dialog.c dialog.h -@BUILD_GTKLOGOUTHELPER_TRUE@am_gtk_logout_helper_OBJECTS = gtk_logout_helper-gtk-logout-helper.$(OBJEXT) \ -@BUILD_GTKLOGOUTHELPER_TRUE@ gtk_logout_helper-settings-helper.$(OBJEXT) \ +am__gtk_logout_helper_SOURCES_DIST = dbus-consolekit-manager.c \ + dbus-consolekit-manager.h gtk-logout-helper.c dialog.c \ + dialog.h +am__objects_1 = gtk_logout_helper-dbus-consolekit-manager.$(OBJEXT) +@BUILD_GTKLOGOUTHELPER_TRUE@am_gtk_logout_helper_OBJECTS = \ +@BUILD_GTKLOGOUTHELPER_TRUE@ $(am__objects_1) \ +@BUILD_GTKLOGOUTHELPER_TRUE@ gtk_logout_helper-gtk-logout-helper.$(OBJEXT) \ @BUILD_GTKLOGOUTHELPER_TRUE@ gtk_logout_helper-dialog.$(OBJEXT) gtk_logout_helper_OBJECTS = $(am_gtk_logout_helper_OBJECTS) @BUILD_GTKLOGOUTHELPER_TRUE@gtk_logout_helper_DEPENDENCIES = \ @@ -125,29 +129,28 @@ gtk_logout_helper_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(gtk_logout_helper_CFLAGS) $(CFLAGS) \ $(gtk_logout_helper_LDFLAGS) $(LDFLAGS) -o $@ -am__indicator_session_service_SOURCES_DIST = lock-helper.c \ - lock-helper.h session-service.c session-dbus.c session-dbus.h \ - gen-session-dbus.xml.c dbusmenu-shared.h settings-helper.c \ - users-service-dbus.h users-service-dbus.c user-menu-mgr.h \ - user-menu-mgr.c device-menu-mgr.h device-menu-mgr.c \ - sane-rules.h apt-watcher.h apt-watcher.c udev-mgr.h udev-mgr.c -@BUILD_APT_TRUE@am__objects_1 = indicator_session_service-apt-watcher.$(OBJEXT) -@HAS_GUDEV_TRUE@am__objects_2 = \ -@HAS_GUDEV_TRUE@ indicator_session_service-udev-mgr.$(OBJEXT) -am_indicator_session_service_OBJECTS = \ - indicator_session_service-lock-helper.$(OBJEXT) \ +am__objects_2 = indicator_session_service-dbus-accounts.$(OBJEXT) +am__objects_3 = \ + indicator_session_service-dbus-consolekit-manager.$(OBJEXT) +am__objects_4 = \ + indicator_session_service-dbus-consolekit-seat.$(OBJEXT) +am__objects_5 = \ + indicator_session_service-dbus-consolekit-session.$(OBJEXT) +am__objects_6 = \ + indicator_session_service-dbus-display-manager.$(OBJEXT) +am__objects_7 = indicator_session_service-dbus-upower.$(OBJEXT) +am__objects_8 = indicator_session_service-dbus-user.$(OBJEXT) +am_indicator_session_service_OBJECTS = $(am__objects_2) \ + $(am__objects_3) $(am__objects_4) $(am__objects_5) \ + $(am__objects_6) $(am__objects_7) $(am__objects_8) \ indicator_session_service-session-service.$(OBJEXT) \ indicator_session_service-session-dbus.$(OBJEXT) \ indicator_session_service-gen-session-dbus.xml.$(OBJEXT) \ - indicator_session_service-settings-helper.$(OBJEXT) \ indicator_session_service-users-service-dbus.$(OBJEXT) \ - indicator_session_service-user-menu-mgr.$(OBJEXT) \ - indicator_session_service-device-menu-mgr.$(OBJEXT) \ - $(am__objects_1) $(am__objects_2) + indicator_session_service-session-menu-mgr.$(OBJEXT) indicator_session_service_OBJECTS = \ $(am_indicator_session_service_OBJECTS) -indicator_session_service_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) +indicator_session_service_DEPENDENCIES = $(am__DEPENDENCIES_1) indicator_session_service_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(indicator_session_service_CFLAGS) $(CFLAGS) \ @@ -182,7 +185,12 @@ SOURCES = $(libsession_la_SOURCES) $(gtk_logout_helper_SOURCES) \ $(indicator_session_service_SOURCES) DIST_SOURCES = $(libsession_la_SOURCES) \ $(am__gtk_logout_helper_SOURCES_DIST) \ - $(am__indicator_session_service_SOURCES_DIST) + $(indicator_session_service_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -197,6 +205,7 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BASE_CXXFLAGS = @BASE_CXXFLAGS@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ @@ -206,6 +215,11 @@ COVERAGE_CFLAGS = @COVERAGE_CFLAGS@ COVERAGE_LDFLAGS = @COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DBUSSERVICEDIR = @DBUSSERVICEDIR@ @@ -218,6 +232,8 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +EVEMU_CFLAGS = @EVEMU_CFLAGS@ +EVEMU_LIBS = @EVEMU_LIBS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GCOVR = @GCOVR@ @@ -229,6 +245,8 @@ GMSGFMT = @GMSGFMT@ GNOMELOCALEDIR = @GNOMELOCALEDIR@ GREP = @GREP@ GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GTEST_CPPFLAGS = @GTEST_CPPFLAGS@ +GTEST_SOURCE = @GTEST_SOURCE@ GTKLOGOUTHELPER_CFLAGS = @GTKLOGOUTHELPER_CFLAGS@ GTKLOGOUTHELPER_LIBS = @GTKLOGOUTHELPER_LIBS@ GUDEV_CFLAGS = @GUDEV_CFLAGS@ @@ -297,16 +315,25 @@ SESSIONSERVICE_LIBS = @SESSIONSERVICE_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SHTOOL = @SHTOOL@ +STRICT_CXXFLAGS = @STRICT_CXXFLAGS@ STRIP = @STRIP@ +TEST_SERVICE_CFLAGS = @TEST_SERVICE_CFLAGS@ +TEST_SERVICE_LDFLAGS = @TEST_SERVICE_LDFLAGS@ +TEST_SERVICE_LIBS = @TEST_SERVICE_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +X11_CFLAGS = @X11_CFLAGS@ +X11_LIBS = @X11_LIBS@ XGETTEXT = @XGETTEXT@ +XORG_GTEST_CPPFLAGS = @XORG_GTEST_CPPFLAGS@ +XORG_GTEST_SOURCE = @XORG_GTEST_SOURCE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ @@ -356,32 +383,30 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -EXTRA_DIST = $(am__append_3) $(am__append_5) \ - org.freedesktop.ConsoleKit.Manager.xml \ - org.freedesktop.ConsoleKit.Seat.xml \ - org.freedesktop.ConsoleKit.Session.xml display-manager.xml \ - session-dbus.xml upower.xml accounts-service.xml \ - accounts-service-user.xml ################### # Indicator Stuff ################### +CLEANFILES = .libs/*.gcda .libs/*.gcno *.gcda *.gcno $(BUILT_SOURCES) +EXTRA_DIST = display-manager.xml org.freedesktop.Accounts.User.xml \ + org.freedesktop.Accounts.xml \ + org.freedesktop.ConsoleKit.Manager.xml \ + org.freedesktop.ConsoleKit.Seat.xml \ + org.freedesktop.ConsoleKit.Session.xml session-dbus.xml \ + upower.xml sessionlibdir = $(INDICATORDIR) sessionlib_LTLIBRARIES = libsession.la libsession_la_SOURCES = \ indicator-session.c \ gen-session-dbus.xml.h \ - dbus-shared-names.h \ - dbusmenu-shared.h \ + shared-names.h \ user-widget.c \ - user-widget.h \ - accounts-service-client.h \ - accounts-service-user-client.h + user-widget.h libsession_la_CFLAGS = \ $(APPLET_CFLAGS) \ $(COVERAGE_CFLAGS) \ - -Wall -Werror \ + -Wall -Wunused \ -DG_LOG_DOMAIN=\"Indicator-Session\" libsession_la_LIBADD = $(APPLET_LIBS) @@ -389,29 +414,66 @@ libsession_la_LDFLAGS = \ $(COVERAGE_LDFLAGS) \ -module -avoid-version +dbus_display_manager_sources = \ + dbus-display-manager.c \ + dbus-display-manager.h + +dbus_consolekit_manager_sources = \ + dbus-consolekit-manager.c \ + dbus-consolekit-manager.h + +dbus_consolekit_seat_sources = \ + dbus-consolekit-seat.c \ + dbus-consolekit-seat.h + +dbus_consolekit_session_sources = \ + dbus-consolekit-session.c \ + dbus-consolekit-session.h + +dbus_accounts_sources = \ + dbus-accounts.c \ + dbus-accounts.h + +dbus_user_sources = \ + dbus-user.c \ + dbus-user.h + +dbus_upower_sources = \ + dbus-upower.c \ + dbus-upower.h + ################# # Session Stuff ################# -indicator_session_service_SOURCES = lock-helper.c lock-helper.h \ - session-service.c session-dbus.c session-dbus.h \ - gen-session-dbus.xml.c dbusmenu-shared.h settings-helper.c \ - users-service-dbus.h users-service-dbus.c user-menu-mgr.h \ - user-menu-mgr.c device-menu-mgr.h device-menu-mgr.c \ - sane-rules.h $(am__append_2) $(am__append_4) +indicator_session_service_SOURCES = \ + $(dbus_accounts_sources) \ + $(dbus_consolekit_manager_sources) \ + $(dbus_consolekit_seat_sources) \ + $(dbus_consolekit_session_sources) \ + $(dbus_display_manager_sources) \ + $(dbus_upower_sources) \ + $(dbus_user_sources) \ + session-service.c \ + session-dbus.c \ + session-dbus.h \ + gen-session-dbus.xml.c \ + users-service-dbus.h \ + users-service-dbus.c \ + session-menu-mgr.h \ + session-menu-mgr.c + indicator_session_service_CFLAGS = \ $(SESSIONSERVICE_CFLAGS) \ $(GCONF_CFLAGS) \ -DLIBEXECDIR=\"$(libexecdir)\" \ - -Wall -Werror \ + -Wall \ -DG_LOG_DOMAIN=\"Indicator-Session\" \ - $(GUDEV_CFLAGS) \ $(COVERAGE_CFLAGS) indicator_session_service_LDADD = \ $(SESSIONSERVICE_LIBS) \ - $(GCONF_LIBS) \ - $(GUDEV_LIBS) + $(GCONF_LIBS) indicator_session_service_LDFLAGS = \ $(COVERAGE_LDFLAGS) @@ -421,9 +483,8 @@ indicator_session_service_LDFLAGS = \ # GTK Logout Stuff ################# @BUILD_GTKLOGOUTHELPER_TRUE@gtk_logout_helper_SOURCES = \ +@BUILD_GTKLOGOUTHELPER_TRUE@ $(dbus_consolekit_manager_sources) \ @BUILD_GTKLOGOUTHELPER_TRUE@ gtk-logout-helper.c \ -@BUILD_GTKLOGOUTHELPER_TRUE@ settings-helper.c \ -@BUILD_GTKLOGOUTHELPER_TRUE@ settings-helper.h \ @BUILD_GTKLOGOUTHELPER_TRUE@ dialog.c \ @BUILD_GTKLOGOUTHELPER_TRUE@ dialog.h @@ -432,7 +493,7 @@ indicator_session_service_LDFLAGS = \ @BUILD_GTKLOGOUTHELPER_TRUE@ $(GTKLOGOUTHELPER_CFLAGS) \ @BUILD_GTKLOGOUTHELPER_TRUE@ $(GCONF_CFLAGS) \ @BUILD_GTKLOGOUTHELPER_TRUE@ $(COVERAGE_CFLAGS) \ -@BUILD_GTKLOGOUTHELPER_TRUE@ -Wall -Werror \ +@BUILD_GTKLOGOUTHELPER_TRUE@ -Wall \ @BUILD_GTKLOGOUTHELPER_TRUE@ -DINDICATOR_ICONS_DIR="\"$(INDICATORICONSDIR)\"" @BUILD_GTKLOGOUTHELPER_TRUE@gtk_logout_helper_LDADD = \ @@ -448,18 +509,15 @@ indicator_session_service_LDFLAGS = \ # Other Stuff ############### BUILT_SOURCES = \ - consolekit-manager-client.h \ - consolekit-seat-client.h \ - consolekit-session-client.h \ - display-manager-client.h \ + $(dbus_accounts_sources) \ + $(dbus_consolekit_manager_sources) \ + $(dbus_consolekit_seat_sources) \ + $(dbus_consolekit_session_sources) \ + $(dbus_display_manager_sources) \ + $(dbus_upower_sources) \ + $(dbus_user_sources) \ gen-session-dbus.xml.c \ - gen-session-dbus.xml.h \ - upower-client.h \ - accounts-service-client.h \ - accounts-service-user-client.h - -CLEANFILES = \ - $(BUILT_SOURCES) + gen-session-dbus.xml.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -498,7 +556,6 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): install-sessionlibLTLIBRARIES: $(sessionlib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(sessionlibdir)" || $(MKDIR_P) "$(DESTDIR)$(sessionlibdir)" @list='$(sessionlib_LTLIBRARIES)'; test -n "$(sessionlibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ @@ -506,6 +563,8 @@ install-sessionlibLTLIBRARIES: $(sessionlib_LTLIBRARIES) else :; fi; \ done; \ test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(sessionlibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sessionlibdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(sessionlibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(sessionlibdir)"; \ } @@ -531,8 +590,11 @@ libsession.la: $(libsession_la_OBJECTS) $(libsession_la_DEPENDENCIES) $(EXTRA_li $(AM_V_CCLD)$(libsession_la_LINK) -rpath $(sessionlibdir) $(libsession_la_OBJECTS) $(libsession_la_LIBADD) $(LIBS) install-libexecPROGRAMS: $(libexec_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(libexecdir)" || $(MKDIR_P) "$(DESTDIR)$(libexecdir)" @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ @@ -585,18 +647,20 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_logout_helper-dbus-consolekit-manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_logout_helper-dialog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_logout_helper-gtk-logout-helper.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_logout_helper-settings-helper.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-apt-watcher.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-device-menu-mgr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-dbus-accounts.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-dbus-consolekit-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-dbus-consolekit-seat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-dbus-consolekit-session.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-dbus-display-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-dbus-upower.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-dbus-user.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-gen-session-dbus.xml.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-lock-helper.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-session-dbus.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-session-menu-mgr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-session-service.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-settings-helper.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-udev-mgr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-user-menu-mgr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_session_service-users-service-dbus.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsession_la-indicator-session.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsession_la-user-widget.Plo@am__quote@ @@ -636,6 +700,20 @@ libsession_la-user-widget.lo: user-widget.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsession_la_CFLAGS) $(CFLAGS) -c -o libsession_la-user-widget.lo `test -f 'user-widget.c' || echo '$(srcdir)/'`user-widget.c +gtk_logout_helper-dbus-consolekit-manager.o: dbus-consolekit-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtk_logout_helper_CFLAGS) $(CFLAGS) -MT gtk_logout_helper-dbus-consolekit-manager.o -MD -MP -MF $(DEPDIR)/gtk_logout_helper-dbus-consolekit-manager.Tpo -c -o gtk_logout_helper-dbus-consolekit-manager.o `test -f 'dbus-consolekit-manager.c' || echo '$(srcdir)/'`dbus-consolekit-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtk_logout_helper-dbus-consolekit-manager.Tpo $(DEPDIR)/gtk_logout_helper-dbus-consolekit-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-consolekit-manager.c' object='gtk_logout_helper-dbus-consolekit-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtk_logout_helper_CFLAGS) $(CFLAGS) -c -o gtk_logout_helper-dbus-consolekit-manager.o `test -f 'dbus-consolekit-manager.c' || echo '$(srcdir)/'`dbus-consolekit-manager.c + +gtk_logout_helper-dbus-consolekit-manager.obj: dbus-consolekit-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtk_logout_helper_CFLAGS) $(CFLAGS) -MT gtk_logout_helper-dbus-consolekit-manager.obj -MD -MP -MF $(DEPDIR)/gtk_logout_helper-dbus-consolekit-manager.Tpo -c -o gtk_logout_helper-dbus-consolekit-manager.obj `if test -f 'dbus-consolekit-manager.c'; then $(CYGPATH_W) 'dbus-consolekit-manager.c'; else $(CYGPATH_W) '$(srcdir)/dbus-consolekit-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtk_logout_helper-dbus-consolekit-manager.Tpo $(DEPDIR)/gtk_logout_helper-dbus-consolekit-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-consolekit-manager.c' object='gtk_logout_helper-dbus-consolekit-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtk_logout_helper_CFLAGS) $(CFLAGS) -c -o gtk_logout_helper-dbus-consolekit-manager.obj `if test -f 'dbus-consolekit-manager.c'; then $(CYGPATH_W) 'dbus-consolekit-manager.c'; else $(CYGPATH_W) '$(srcdir)/dbus-consolekit-manager.c'; fi` + gtk_logout_helper-gtk-logout-helper.o: gtk-logout-helper.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtk_logout_helper_CFLAGS) $(CFLAGS) -MT gtk_logout_helper-gtk-logout-helper.o -MD -MP -MF $(DEPDIR)/gtk_logout_helper-gtk-logout-helper.Tpo -c -o gtk_logout_helper-gtk-logout-helper.o `test -f 'gtk-logout-helper.c' || echo '$(srcdir)/'`gtk-logout-helper.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtk_logout_helper-gtk-logout-helper.Tpo $(DEPDIR)/gtk_logout_helper-gtk-logout-helper.Po @@ -650,20 +728,6 @@ gtk_logout_helper-gtk-logout-helper.obj: gtk-logout-helper.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtk_logout_helper_CFLAGS) $(CFLAGS) -c -o gtk_logout_helper-gtk-logout-helper.obj `if test -f 'gtk-logout-helper.c'; then $(CYGPATH_W) 'gtk-logout-helper.c'; else $(CYGPATH_W) '$(srcdir)/gtk-logout-helper.c'; fi` -gtk_logout_helper-settings-helper.o: settings-helper.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtk_logout_helper_CFLAGS) $(CFLAGS) -MT gtk_logout_helper-settings-helper.o -MD -MP -MF $(DEPDIR)/gtk_logout_helper-settings-helper.Tpo -c -o gtk_logout_helper-settings-helper.o `test -f 'settings-helper.c' || echo '$(srcdir)/'`settings-helper.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtk_logout_helper-settings-helper.Tpo $(DEPDIR)/gtk_logout_helper-settings-helper.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='settings-helper.c' object='gtk_logout_helper-settings-helper.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtk_logout_helper_CFLAGS) $(CFLAGS) -c -o gtk_logout_helper-settings-helper.o `test -f 'settings-helper.c' || echo '$(srcdir)/'`settings-helper.c - -gtk_logout_helper-settings-helper.obj: settings-helper.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtk_logout_helper_CFLAGS) $(CFLAGS) -MT gtk_logout_helper-settings-helper.obj -MD -MP -MF $(DEPDIR)/gtk_logout_helper-settings-helper.Tpo -c -o gtk_logout_helper-settings-helper.obj `if test -f 'settings-helper.c'; then $(CYGPATH_W) 'settings-helper.c'; else $(CYGPATH_W) '$(srcdir)/settings-helper.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtk_logout_helper-settings-helper.Tpo $(DEPDIR)/gtk_logout_helper-settings-helper.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='settings-helper.c' object='gtk_logout_helper-settings-helper.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtk_logout_helper_CFLAGS) $(CFLAGS) -c -o gtk_logout_helper-settings-helper.obj `if test -f 'settings-helper.c'; then $(CYGPATH_W) 'settings-helper.c'; else $(CYGPATH_W) '$(srcdir)/settings-helper.c'; fi` - gtk_logout_helper-dialog.o: dialog.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtk_logout_helper_CFLAGS) $(CFLAGS) -MT gtk_logout_helper-dialog.o -MD -MP -MF $(DEPDIR)/gtk_logout_helper-dialog.Tpo -c -o gtk_logout_helper-dialog.o `test -f 'dialog.c' || echo '$(srcdir)/'`dialog.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtk_logout_helper-dialog.Tpo $(DEPDIR)/gtk_logout_helper-dialog.Po @@ -678,19 +742,103 @@ gtk_logout_helper-dialog.obj: dialog.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtk_logout_helper_CFLAGS) $(CFLAGS) -c -o gtk_logout_helper-dialog.obj `if test -f 'dialog.c'; then $(CYGPATH_W) 'dialog.c'; else $(CYGPATH_W) '$(srcdir)/dialog.c'; fi` -indicator_session_service-lock-helper.o: lock-helper.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-lock-helper.o -MD -MP -MF $(DEPDIR)/indicator_session_service-lock-helper.Tpo -c -o indicator_session_service-lock-helper.o `test -f 'lock-helper.c' || echo '$(srcdir)/'`lock-helper.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-lock-helper.Tpo $(DEPDIR)/indicator_session_service-lock-helper.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lock-helper.c' object='indicator_session_service-lock-helper.o' libtool=no @AMDEPBACKSLASH@ +indicator_session_service-dbus-accounts.o: dbus-accounts.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-accounts.o -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-accounts.Tpo -c -o indicator_session_service-dbus-accounts.o `test -f 'dbus-accounts.c' || echo '$(srcdir)/'`dbus-accounts.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-accounts.Tpo $(DEPDIR)/indicator_session_service-dbus-accounts.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-accounts.c' object='indicator_session_service-dbus-accounts.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-accounts.o `test -f 'dbus-accounts.c' || echo '$(srcdir)/'`dbus-accounts.c + +indicator_session_service-dbus-accounts.obj: dbus-accounts.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-accounts.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-accounts.Tpo -c -o indicator_session_service-dbus-accounts.obj `if test -f 'dbus-accounts.c'; then $(CYGPATH_W) 'dbus-accounts.c'; else $(CYGPATH_W) '$(srcdir)/dbus-accounts.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-accounts.Tpo $(DEPDIR)/indicator_session_service-dbus-accounts.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-accounts.c' object='indicator_session_service-dbus-accounts.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-accounts.obj `if test -f 'dbus-accounts.c'; then $(CYGPATH_W) 'dbus-accounts.c'; else $(CYGPATH_W) '$(srcdir)/dbus-accounts.c'; fi` + +indicator_session_service-dbus-consolekit-manager.o: dbus-consolekit-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-consolekit-manager.o -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-consolekit-manager.Tpo -c -o indicator_session_service-dbus-consolekit-manager.o `test -f 'dbus-consolekit-manager.c' || echo '$(srcdir)/'`dbus-consolekit-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-consolekit-manager.Tpo $(DEPDIR)/indicator_session_service-dbus-consolekit-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-consolekit-manager.c' object='indicator_session_service-dbus-consolekit-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-consolekit-manager.o `test -f 'dbus-consolekit-manager.c' || echo '$(srcdir)/'`dbus-consolekit-manager.c + +indicator_session_service-dbus-consolekit-manager.obj: dbus-consolekit-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-consolekit-manager.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-consolekit-manager.Tpo -c -o indicator_session_service-dbus-consolekit-manager.obj `if test -f 'dbus-consolekit-manager.c'; then $(CYGPATH_W) 'dbus-consolekit-manager.c'; else $(CYGPATH_W) '$(srcdir)/dbus-consolekit-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-consolekit-manager.Tpo $(DEPDIR)/indicator_session_service-dbus-consolekit-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-consolekit-manager.c' object='indicator_session_service-dbus-consolekit-manager.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-lock-helper.o `test -f 'lock-helper.c' || echo '$(srcdir)/'`lock-helper.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-consolekit-manager.obj `if test -f 'dbus-consolekit-manager.c'; then $(CYGPATH_W) 'dbus-consolekit-manager.c'; else $(CYGPATH_W) '$(srcdir)/dbus-consolekit-manager.c'; fi` -indicator_session_service-lock-helper.obj: lock-helper.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-lock-helper.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-lock-helper.Tpo -c -o indicator_session_service-lock-helper.obj `if test -f 'lock-helper.c'; then $(CYGPATH_W) 'lock-helper.c'; else $(CYGPATH_W) '$(srcdir)/lock-helper.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-lock-helper.Tpo $(DEPDIR)/indicator_session_service-lock-helper.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lock-helper.c' object='indicator_session_service-lock-helper.obj' libtool=no @AMDEPBACKSLASH@ +indicator_session_service-dbus-consolekit-seat.o: dbus-consolekit-seat.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-consolekit-seat.o -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-consolekit-seat.Tpo -c -o indicator_session_service-dbus-consolekit-seat.o `test -f 'dbus-consolekit-seat.c' || echo '$(srcdir)/'`dbus-consolekit-seat.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-consolekit-seat.Tpo $(DEPDIR)/indicator_session_service-dbus-consolekit-seat.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-consolekit-seat.c' object='indicator_session_service-dbus-consolekit-seat.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-lock-helper.obj `if test -f 'lock-helper.c'; then $(CYGPATH_W) 'lock-helper.c'; else $(CYGPATH_W) '$(srcdir)/lock-helper.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-consolekit-seat.o `test -f 'dbus-consolekit-seat.c' || echo '$(srcdir)/'`dbus-consolekit-seat.c + +indicator_session_service-dbus-consolekit-seat.obj: dbus-consolekit-seat.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-consolekit-seat.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-consolekit-seat.Tpo -c -o indicator_session_service-dbus-consolekit-seat.obj `if test -f 'dbus-consolekit-seat.c'; then $(CYGPATH_W) 'dbus-consolekit-seat.c'; else $(CYGPATH_W) '$(srcdir)/dbus-consolekit-seat.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-consolekit-seat.Tpo $(DEPDIR)/indicator_session_service-dbus-consolekit-seat.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-consolekit-seat.c' object='indicator_session_service-dbus-consolekit-seat.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-consolekit-seat.obj `if test -f 'dbus-consolekit-seat.c'; then $(CYGPATH_W) 'dbus-consolekit-seat.c'; else $(CYGPATH_W) '$(srcdir)/dbus-consolekit-seat.c'; fi` + +indicator_session_service-dbus-consolekit-session.o: dbus-consolekit-session.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-consolekit-session.o -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-consolekit-session.Tpo -c -o indicator_session_service-dbus-consolekit-session.o `test -f 'dbus-consolekit-session.c' || echo '$(srcdir)/'`dbus-consolekit-session.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-consolekit-session.Tpo $(DEPDIR)/indicator_session_service-dbus-consolekit-session.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-consolekit-session.c' object='indicator_session_service-dbus-consolekit-session.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-consolekit-session.o `test -f 'dbus-consolekit-session.c' || echo '$(srcdir)/'`dbus-consolekit-session.c + +indicator_session_service-dbus-consolekit-session.obj: dbus-consolekit-session.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-consolekit-session.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-consolekit-session.Tpo -c -o indicator_session_service-dbus-consolekit-session.obj `if test -f 'dbus-consolekit-session.c'; then $(CYGPATH_W) 'dbus-consolekit-session.c'; else $(CYGPATH_W) '$(srcdir)/dbus-consolekit-session.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-consolekit-session.Tpo $(DEPDIR)/indicator_session_service-dbus-consolekit-session.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-consolekit-session.c' object='indicator_session_service-dbus-consolekit-session.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-consolekit-session.obj `if test -f 'dbus-consolekit-session.c'; then $(CYGPATH_W) 'dbus-consolekit-session.c'; else $(CYGPATH_W) '$(srcdir)/dbus-consolekit-session.c'; fi` + +indicator_session_service-dbus-display-manager.o: dbus-display-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-display-manager.o -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-display-manager.Tpo -c -o indicator_session_service-dbus-display-manager.o `test -f 'dbus-display-manager.c' || echo '$(srcdir)/'`dbus-display-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-display-manager.Tpo $(DEPDIR)/indicator_session_service-dbus-display-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-display-manager.c' object='indicator_session_service-dbus-display-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-display-manager.o `test -f 'dbus-display-manager.c' || echo '$(srcdir)/'`dbus-display-manager.c + +indicator_session_service-dbus-display-manager.obj: dbus-display-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-display-manager.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-display-manager.Tpo -c -o indicator_session_service-dbus-display-manager.obj `if test -f 'dbus-display-manager.c'; then $(CYGPATH_W) 'dbus-display-manager.c'; else $(CYGPATH_W) '$(srcdir)/dbus-display-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-display-manager.Tpo $(DEPDIR)/indicator_session_service-dbus-display-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-display-manager.c' object='indicator_session_service-dbus-display-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-display-manager.obj `if test -f 'dbus-display-manager.c'; then $(CYGPATH_W) 'dbus-display-manager.c'; else $(CYGPATH_W) '$(srcdir)/dbus-display-manager.c'; fi` + +indicator_session_service-dbus-upower.o: dbus-upower.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-upower.o -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-upower.Tpo -c -o indicator_session_service-dbus-upower.o `test -f 'dbus-upower.c' || echo '$(srcdir)/'`dbus-upower.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-upower.Tpo $(DEPDIR)/indicator_session_service-dbus-upower.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-upower.c' object='indicator_session_service-dbus-upower.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-upower.o `test -f 'dbus-upower.c' || echo '$(srcdir)/'`dbus-upower.c + +indicator_session_service-dbus-upower.obj: dbus-upower.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-upower.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-upower.Tpo -c -o indicator_session_service-dbus-upower.obj `if test -f 'dbus-upower.c'; then $(CYGPATH_W) 'dbus-upower.c'; else $(CYGPATH_W) '$(srcdir)/dbus-upower.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-upower.Tpo $(DEPDIR)/indicator_session_service-dbus-upower.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-upower.c' object='indicator_session_service-dbus-upower.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-upower.obj `if test -f 'dbus-upower.c'; then $(CYGPATH_W) 'dbus-upower.c'; else $(CYGPATH_W) '$(srcdir)/dbus-upower.c'; fi` + +indicator_session_service-dbus-user.o: dbus-user.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-user.o -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-user.Tpo -c -o indicator_session_service-dbus-user.o `test -f 'dbus-user.c' || echo '$(srcdir)/'`dbus-user.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-user.Tpo $(DEPDIR)/indicator_session_service-dbus-user.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-user.c' object='indicator_session_service-dbus-user.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-user.o `test -f 'dbus-user.c' || echo '$(srcdir)/'`dbus-user.c + +indicator_session_service-dbus-user.obj: dbus-user.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-dbus-user.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-dbus-user.Tpo -c -o indicator_session_service-dbus-user.obj `if test -f 'dbus-user.c'; then $(CYGPATH_W) 'dbus-user.c'; else $(CYGPATH_W) '$(srcdir)/dbus-user.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-dbus-user.Tpo $(DEPDIR)/indicator_session_service-dbus-user.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dbus-user.c' object='indicator_session_service-dbus-user.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-dbus-user.obj `if test -f 'dbus-user.c'; then $(CYGPATH_W) 'dbus-user.c'; else $(CYGPATH_W) '$(srcdir)/dbus-user.c'; fi` indicator_session_service-session-service.o: session-service.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-session-service.o -MD -MP -MF $(DEPDIR)/indicator_session_service-session-service.Tpo -c -o indicator_session_service-session-service.o `test -f 'session-service.c' || echo '$(srcdir)/'`session-service.c @@ -734,20 +882,6 @@ indicator_session_service-gen-session-dbus.xml.obj: gen-session-dbus.xml.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-gen-session-dbus.xml.obj `if test -f 'gen-session-dbus.xml.c'; then $(CYGPATH_W) 'gen-session-dbus.xml.c'; else $(CYGPATH_W) '$(srcdir)/gen-session-dbus.xml.c'; fi` -indicator_session_service-settings-helper.o: settings-helper.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-settings-helper.o -MD -MP -MF $(DEPDIR)/indicator_session_service-settings-helper.Tpo -c -o indicator_session_service-settings-helper.o `test -f 'settings-helper.c' || echo '$(srcdir)/'`settings-helper.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-settings-helper.Tpo $(DEPDIR)/indicator_session_service-settings-helper.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='settings-helper.c' object='indicator_session_service-settings-helper.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-settings-helper.o `test -f 'settings-helper.c' || echo '$(srcdir)/'`settings-helper.c - -indicator_session_service-settings-helper.obj: settings-helper.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-settings-helper.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-settings-helper.Tpo -c -o indicator_session_service-settings-helper.obj `if test -f 'settings-helper.c'; then $(CYGPATH_W) 'settings-helper.c'; else $(CYGPATH_W) '$(srcdir)/settings-helper.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-settings-helper.Tpo $(DEPDIR)/indicator_session_service-settings-helper.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='settings-helper.c' object='indicator_session_service-settings-helper.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-settings-helper.obj `if test -f 'settings-helper.c'; then $(CYGPATH_W) 'settings-helper.c'; else $(CYGPATH_W) '$(srcdir)/settings-helper.c'; fi` - indicator_session_service-users-service-dbus.o: users-service-dbus.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-users-service-dbus.o -MD -MP -MF $(DEPDIR)/indicator_session_service-users-service-dbus.Tpo -c -o indicator_session_service-users-service-dbus.o `test -f 'users-service-dbus.c' || echo '$(srcdir)/'`users-service-dbus.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-users-service-dbus.Tpo $(DEPDIR)/indicator_session_service-users-service-dbus.Po @@ -762,61 +896,19 @@ indicator_session_service-users-service-dbus.obj: users-service-dbus.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-users-service-dbus.obj `if test -f 'users-service-dbus.c'; then $(CYGPATH_W) 'users-service-dbus.c'; else $(CYGPATH_W) '$(srcdir)/users-service-dbus.c'; fi` -indicator_session_service-user-menu-mgr.o: user-menu-mgr.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-user-menu-mgr.o -MD -MP -MF $(DEPDIR)/indicator_session_service-user-menu-mgr.Tpo -c -o indicator_session_service-user-menu-mgr.o `test -f 'user-menu-mgr.c' || echo '$(srcdir)/'`user-menu-mgr.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-user-menu-mgr.Tpo $(DEPDIR)/indicator_session_service-user-menu-mgr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='user-menu-mgr.c' object='indicator_session_service-user-menu-mgr.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-user-menu-mgr.o `test -f 'user-menu-mgr.c' || echo '$(srcdir)/'`user-menu-mgr.c - -indicator_session_service-user-menu-mgr.obj: user-menu-mgr.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-user-menu-mgr.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-user-menu-mgr.Tpo -c -o indicator_session_service-user-menu-mgr.obj `if test -f 'user-menu-mgr.c'; then $(CYGPATH_W) 'user-menu-mgr.c'; else $(CYGPATH_W) '$(srcdir)/user-menu-mgr.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-user-menu-mgr.Tpo $(DEPDIR)/indicator_session_service-user-menu-mgr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='user-menu-mgr.c' object='indicator_session_service-user-menu-mgr.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-user-menu-mgr.obj `if test -f 'user-menu-mgr.c'; then $(CYGPATH_W) 'user-menu-mgr.c'; else $(CYGPATH_W) '$(srcdir)/user-menu-mgr.c'; fi` - -indicator_session_service-device-menu-mgr.o: device-menu-mgr.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-device-menu-mgr.o -MD -MP -MF $(DEPDIR)/indicator_session_service-device-menu-mgr.Tpo -c -o indicator_session_service-device-menu-mgr.o `test -f 'device-menu-mgr.c' || echo '$(srcdir)/'`device-menu-mgr.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-device-menu-mgr.Tpo $(DEPDIR)/indicator_session_service-device-menu-mgr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='device-menu-mgr.c' object='indicator_session_service-device-menu-mgr.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-device-menu-mgr.o `test -f 'device-menu-mgr.c' || echo '$(srcdir)/'`device-menu-mgr.c - -indicator_session_service-device-menu-mgr.obj: device-menu-mgr.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-device-menu-mgr.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-device-menu-mgr.Tpo -c -o indicator_session_service-device-menu-mgr.obj `if test -f 'device-menu-mgr.c'; then $(CYGPATH_W) 'device-menu-mgr.c'; else $(CYGPATH_W) '$(srcdir)/device-menu-mgr.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-device-menu-mgr.Tpo $(DEPDIR)/indicator_session_service-device-menu-mgr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='device-menu-mgr.c' object='indicator_session_service-device-menu-mgr.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-device-menu-mgr.obj `if test -f 'device-menu-mgr.c'; then $(CYGPATH_W) 'device-menu-mgr.c'; else $(CYGPATH_W) '$(srcdir)/device-menu-mgr.c'; fi` - -indicator_session_service-apt-watcher.o: apt-watcher.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-apt-watcher.o -MD -MP -MF $(DEPDIR)/indicator_session_service-apt-watcher.Tpo -c -o indicator_session_service-apt-watcher.o `test -f 'apt-watcher.c' || echo '$(srcdir)/'`apt-watcher.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-apt-watcher.Tpo $(DEPDIR)/indicator_session_service-apt-watcher.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apt-watcher.c' object='indicator_session_service-apt-watcher.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-apt-watcher.o `test -f 'apt-watcher.c' || echo '$(srcdir)/'`apt-watcher.c - -indicator_session_service-apt-watcher.obj: apt-watcher.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-apt-watcher.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-apt-watcher.Tpo -c -o indicator_session_service-apt-watcher.obj `if test -f 'apt-watcher.c'; then $(CYGPATH_W) 'apt-watcher.c'; else $(CYGPATH_W) '$(srcdir)/apt-watcher.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-apt-watcher.Tpo $(DEPDIR)/indicator_session_service-apt-watcher.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apt-watcher.c' object='indicator_session_service-apt-watcher.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-apt-watcher.obj `if test -f 'apt-watcher.c'; then $(CYGPATH_W) 'apt-watcher.c'; else $(CYGPATH_W) '$(srcdir)/apt-watcher.c'; fi` - -indicator_session_service-udev-mgr.o: udev-mgr.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-udev-mgr.o -MD -MP -MF $(DEPDIR)/indicator_session_service-udev-mgr.Tpo -c -o indicator_session_service-udev-mgr.o `test -f 'udev-mgr.c' || echo '$(srcdir)/'`udev-mgr.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-udev-mgr.Tpo $(DEPDIR)/indicator_session_service-udev-mgr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='udev-mgr.c' object='indicator_session_service-udev-mgr.o' libtool=no @AMDEPBACKSLASH@ +indicator_session_service-session-menu-mgr.o: session-menu-mgr.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-session-menu-mgr.o -MD -MP -MF $(DEPDIR)/indicator_session_service-session-menu-mgr.Tpo -c -o indicator_session_service-session-menu-mgr.o `test -f 'session-menu-mgr.c' || echo '$(srcdir)/'`session-menu-mgr.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-session-menu-mgr.Tpo $(DEPDIR)/indicator_session_service-session-menu-mgr.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='session-menu-mgr.c' object='indicator_session_service-session-menu-mgr.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-udev-mgr.o `test -f 'udev-mgr.c' || echo '$(srcdir)/'`udev-mgr.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-session-menu-mgr.o `test -f 'session-menu-mgr.c' || echo '$(srcdir)/'`session-menu-mgr.c -indicator_session_service-udev-mgr.obj: udev-mgr.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-udev-mgr.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-udev-mgr.Tpo -c -o indicator_session_service-udev-mgr.obj `if test -f 'udev-mgr.c'; then $(CYGPATH_W) 'udev-mgr.c'; else $(CYGPATH_W) '$(srcdir)/udev-mgr.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-udev-mgr.Tpo $(DEPDIR)/indicator_session_service-udev-mgr.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='udev-mgr.c' object='indicator_session_service-udev-mgr.obj' libtool=no @AMDEPBACKSLASH@ +indicator_session_service-session-menu-mgr.obj: session-menu-mgr.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -MT indicator_session_service-session-menu-mgr.obj -MD -MP -MF $(DEPDIR)/indicator_session_service-session-menu-mgr.Tpo -c -o indicator_session_service-session-menu-mgr.obj `if test -f 'session-menu-mgr.c'; then $(CYGPATH_W) 'session-menu-mgr.c'; else $(CYGPATH_W) '$(srcdir)/session-menu-mgr.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_session_service-session-menu-mgr.Tpo $(DEPDIR)/indicator_session_service-session-menu-mgr.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='session-menu-mgr.c' object='indicator_session_service-session-menu-mgr.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-udev-mgr.obj `if test -f 'udev-mgr.c'; then $(CYGPATH_W) 'udev-mgr.c'; else $(CYGPATH_W) '$(srcdir)/udev-mgr.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_session_service_CFLAGS) $(CFLAGS) -c -o indicator_session_service-session-menu-mgr.obj `if test -f 'session-menu-mgr.c'; then $(CYGPATH_W) 'session-menu-mgr.c'; else $(CYGPATH_W) '$(srcdir)/session-menu-mgr.c'; fi` mostlyclean-libtool: -rm -f *.lo @@ -1038,54 +1130,48 @@ uninstall-am: uninstall-libexecPROGRAMS \ uninstall-sessionlibLTLIBRARIES -consolekit-manager-client.h: $(srcdir)/org.freedesktop.ConsoleKit.Manager.xml - dbus-binding-tool \ - --prefix=_consolekit_manager_client \ - --mode=glib-client \ - --output=consolekit-manager-client.h \ - $(srcdir)/org.freedesktop.ConsoleKit.Manager.xml - -consolekit-seat-client.h: $(srcdir)/org.freedesktop.ConsoleKit.Seat.xml - dbus-binding-tool \ - --prefix=_consolekit_seat_client \ - --mode=glib-client \ - --output=consolekit-seat-client.h \ - $(srcdir)/org.freedesktop.ConsoleKit.Seat.xml - -consolekit-session-client.h: $(srcdir)/org.freedesktop.ConsoleKit.Session.xml - dbus-binding-tool \ - --prefix=_consolekit_session_client \ - --mode=glib-client \ - --output=consolekit-session-client.h \ - $(srcdir)/org.freedesktop.ConsoleKit.Session.xml - -display-manager-client.h: $(srcdir)/display-manager.xml - dbus-binding-tool \ - --prefix=_gdm_local_display_factory_client \ - --mode=glib-client \ - --output=display-manager-client.h \ - $(srcdir)/display-manager.xml - -accounts-service-client.h: $(srcdir)/accounts-service.xml - dbus-binding-tool \ - --prefix=_accounts_service_client \ - --mode=glib-client \ - --output=accounts-service-client.h \ - $(srcdir)/accounts-service.xml - -accounts-service-user-client.h: $(srcdir)/accounts-service-user.xml - dbus-binding-tool \ - --prefix=_accounts_service_user_client \ - --mode=glib-client \ - --output=accounts-service-user-client.h \ - $(srcdir)/accounts-service-user.xml - -upower-client.h: $(srcdir)/upower.xml - dbus-binding-tool \ - --prefix=_upower_client \ - --mode=glib-client \ - --output=upower-client.h \ - $(srcdir)/upower.xml +$(dbus_display_manager_sources): display-manager.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-display-manager \ + $^ + +$(dbus_consolekit_manager_sources): org.freedesktop.ConsoleKit.Manager.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-consolekit-manager \ + $^ + +$(dbus_consolekit_seat_sources): org.freedesktop.ConsoleKit.Seat.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-consolekit-seat \ + $^ + +$(dbus_consolekit_session_sources): org.freedesktop.ConsoleKit.Session.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-consolekit-session \ + $^ + +$(dbus_accounts_sources): org.freedesktop.Accounts.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-accounts \ + $^ + +$(dbus_user_sources): org.freedesktop.Accounts.User.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-user \ + $^ + +$(dbus_upower_sources): upower.xml + gdbus-codegen \ + --interface-prefix org.freedesktop \ + --generate-c-code dbus-upower \ + --c-namespace DBus \ + $^ gen-%.xml.c: %.xml @echo "Building $@ from $<" diff --git a/src/accounts-service-client.h b/src/accounts-service-client.h deleted file mode 100644 index c4686b3..0000000 --- a/src/accounts-service-client.h +++ /dev/null @@ -1,215 +0,0 @@ -/* Generated by dbus-binding-tool; do not edit! */ - -#include <glib.h> -#include <dbus/dbus-glib.h> - -G_BEGIN_DECLS - -#ifndef _DBUS_GLIB_ASYNC_DATA_FREE -#define _DBUS_GLIB_ASYNC_DATA_FREE -static -#ifdef G_HAVE_INLINE -inline -#endif -void -_dbus_glib_async_data_free (gpointer stuff) -{ - g_slice_free (DBusGAsyncData, stuff); -} -#endif - -#ifndef DBUS_GLIB_CLIENT_WRAPPERS_org_freedesktop_Accounts -#define DBUS_GLIB_CLIENT_WRAPPERS_org_freedesktop_Accounts - -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_list_cached_users (DBusGProxy *proxy, GPtrArray** OUT_users, GError **error) - -{ - return dbus_g_proxy_call (proxy, "ListCachedUsers", error, G_TYPE_INVALID, dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), OUT_users, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_list_cached_users_reply) (DBusGProxy *proxy, GPtrArray *OUT_users, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_list_cached_users_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - GPtrArray* OUT_users; - dbus_g_proxy_end_call (proxy, call, &error, dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), &OUT_users, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_list_cached_users_reply)data->cb) (proxy, OUT_users, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_list_cached_users_async (DBusGProxy *proxy, org_freedesktop_Accounts_list_cached_users_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "ListCachedUsers", org_freedesktop_Accounts_list_cached_users_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_find_user_by_id (DBusGProxy *proxy, const gint64 IN_id, char** OUT_user, GError **error) - -{ - return dbus_g_proxy_call (proxy, "FindUserById", error, G_TYPE_INT64, IN_id, G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH, OUT_user, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_find_user_by_id_reply) (DBusGProxy *proxy, char *OUT_user, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_find_user_by_id_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - char* OUT_user; - dbus_g_proxy_end_call (proxy, call, &error, DBUS_TYPE_G_OBJECT_PATH, &OUT_user, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_find_user_by_id_reply)data->cb) (proxy, OUT_user, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_find_user_by_id_async (DBusGProxy *proxy, const gint64 IN_id, org_freedesktop_Accounts_find_user_by_id_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "FindUserById", org_freedesktop_Accounts_find_user_by_id_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_INT64, IN_id, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_find_user_by_name (DBusGProxy *proxy, const char * IN_name, char** OUT_user, GError **error) - -{ - return dbus_g_proxy_call (proxy, "FindUserByName", error, G_TYPE_STRING, IN_name, G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH, OUT_user, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_find_user_by_name_reply) (DBusGProxy *proxy, char *OUT_user, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_find_user_by_name_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - char* OUT_user; - dbus_g_proxy_end_call (proxy, call, &error, DBUS_TYPE_G_OBJECT_PATH, &OUT_user, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_find_user_by_name_reply)data->cb) (proxy, OUT_user, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_find_user_by_name_async (DBusGProxy *proxy, const char * IN_name, org_freedesktop_Accounts_find_user_by_name_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "FindUserByName", org_freedesktop_Accounts_find_user_by_name_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_name, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_create_user (DBusGProxy *proxy, const char * IN_name, const char * IN_fullname, const gint IN_accountType, char** OUT_user, GError **error) - -{ - return dbus_g_proxy_call (proxy, "CreateUser", error, G_TYPE_STRING, IN_name, G_TYPE_STRING, IN_fullname, G_TYPE_INT, IN_accountType, G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH, OUT_user, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_create_user_reply) (DBusGProxy *proxy, char *OUT_user, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_create_user_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - char* OUT_user; - dbus_g_proxy_end_call (proxy, call, &error, DBUS_TYPE_G_OBJECT_PATH, &OUT_user, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_create_user_reply)data->cb) (proxy, OUT_user, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_create_user_async (DBusGProxy *proxy, const char * IN_name, const char * IN_fullname, const gint IN_accountType, org_freedesktop_Accounts_create_user_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "CreateUser", org_freedesktop_Accounts_create_user_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_name, G_TYPE_STRING, IN_fullname, G_TYPE_INT, IN_accountType, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_delete_user (DBusGProxy *proxy, const gint64 IN_id, const gboolean IN_removeFiles, GError **error) - -{ - return dbus_g_proxy_call (proxy, "DeleteUser", error, G_TYPE_INT64, IN_id, G_TYPE_BOOLEAN, IN_removeFiles, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_delete_user_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_delete_user_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_delete_user_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_delete_user_async (DBusGProxy *proxy, const gint64 IN_id, const gboolean IN_removeFiles, org_freedesktop_Accounts_delete_user_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "DeleteUser", org_freedesktop_Accounts_delete_user_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_INT64, IN_id, G_TYPE_BOOLEAN, IN_removeFiles, G_TYPE_INVALID); -} -#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_freedesktop_Accounts */ - -G_END_DECLS diff --git a/src/accounts-service-user-client.h b/src/accounts-service-user-client.h deleted file mode 100644 index 499e9bc..0000000 --- a/src/accounts-service-user-client.h +++ /dev/null @@ -1,507 +0,0 @@ -/* Generated by dbus-binding-tool; do not edit! */ - -#include <glib.h> -#include <dbus/dbus-glib.h> - -G_BEGIN_DECLS - -#ifndef _DBUS_GLIB_ASYNC_DATA_FREE -#define _DBUS_GLIB_ASYNC_DATA_FREE -static -#ifdef G_HAVE_INLINE -inline -#endif -void -_dbus_glib_async_data_free (gpointer stuff) -{ - g_slice_free (DBusGAsyncData, stuff); -} -#endif - -#ifndef DBUS_GLIB_CLIENT_WRAPPERS_org_freedesktop_Accounts_User -#define DBUS_GLIB_CLIENT_WRAPPERS_org_freedesktop_Accounts_User - -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_user_name (DBusGProxy *proxy, const char * IN_name, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetUserName", error, G_TYPE_STRING, IN_name, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_user_name_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_user_name_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_user_name_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_user_name_async (DBusGProxy *proxy, const char * IN_name, org_freedesktop_Accounts_User_set_user_name_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetUserName", org_freedesktop_Accounts_User_set_user_name_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_name, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_real_name (DBusGProxy *proxy, const char * IN_name, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetRealName", error, G_TYPE_STRING, IN_name, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_real_name_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_real_name_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_real_name_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_real_name_async (DBusGProxy *proxy, const char * IN_name, org_freedesktop_Accounts_User_set_real_name_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetRealName", org_freedesktop_Accounts_User_set_real_name_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_name, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_email (DBusGProxy *proxy, const char * IN_email, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetEmail", error, G_TYPE_STRING, IN_email, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_email_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_email_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_email_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_email_async (DBusGProxy *proxy, const char * IN_email, org_freedesktop_Accounts_User_set_email_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetEmail", org_freedesktop_Accounts_User_set_email_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_email, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_language (DBusGProxy *proxy, const char * IN_language, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetLanguage", error, G_TYPE_STRING, IN_language, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_language_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_language_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_language_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_language_async (DBusGProxy *proxy, const char * IN_language, org_freedesktop_Accounts_User_set_language_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetLanguage", org_freedesktop_Accounts_User_set_language_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_language, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_location (DBusGProxy *proxy, const char * IN_location, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetLocation", error, G_TYPE_STRING, IN_location, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_location_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_location_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_location_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_location_async (DBusGProxy *proxy, const char * IN_location, org_freedesktop_Accounts_User_set_location_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetLocation", org_freedesktop_Accounts_User_set_location_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_location, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_home_directory (DBusGProxy *proxy, const char * IN_homedir, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetHomeDirectory", error, G_TYPE_STRING, IN_homedir, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_home_directory_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_home_directory_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_home_directory_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_home_directory_async (DBusGProxy *proxy, const char * IN_homedir, org_freedesktop_Accounts_User_set_home_directory_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetHomeDirectory", org_freedesktop_Accounts_User_set_home_directory_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_homedir, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_shell (DBusGProxy *proxy, const char * IN_shell, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetShell", error, G_TYPE_STRING, IN_shell, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_shell_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_shell_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_shell_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_shell_async (DBusGProxy *proxy, const char * IN_shell, org_freedesktop_Accounts_User_set_shell_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetShell", org_freedesktop_Accounts_User_set_shell_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_shell, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_icon_file (DBusGProxy *proxy, const char * IN_filename, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetIconFile", error, G_TYPE_STRING, IN_filename, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_icon_file_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_icon_file_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_icon_file_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_icon_file_async (DBusGProxy *proxy, const char * IN_filename, org_freedesktop_Accounts_User_set_icon_file_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetIconFile", org_freedesktop_Accounts_User_set_icon_file_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_filename, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_locked (DBusGProxy *proxy, const gboolean IN_locked, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetLocked", error, G_TYPE_BOOLEAN, IN_locked, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_locked_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_locked_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_locked_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_locked_async (DBusGProxy *proxy, const gboolean IN_locked, org_freedesktop_Accounts_User_set_locked_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetLocked", org_freedesktop_Accounts_User_set_locked_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_BOOLEAN, IN_locked, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_account_type (DBusGProxy *proxy, const gint IN_accountType, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetAccountType", error, G_TYPE_INT, IN_accountType, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_account_type_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_account_type_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_account_type_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_account_type_async (DBusGProxy *proxy, const gint IN_accountType, org_freedesktop_Accounts_User_set_account_type_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetAccountType", org_freedesktop_Accounts_User_set_account_type_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_INT, IN_accountType, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_password_mode (DBusGProxy *proxy, const gint IN_mode, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetPasswordMode", error, G_TYPE_INT, IN_mode, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_password_mode_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_password_mode_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_password_mode_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_password_mode_async (DBusGProxy *proxy, const gint IN_mode, org_freedesktop_Accounts_User_set_password_mode_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetPasswordMode", org_freedesktop_Accounts_User_set_password_mode_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_INT, IN_mode, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_password (DBusGProxy *proxy, const char * IN_password, const char * IN_hint, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetPassword", error, G_TYPE_STRING, IN_password, G_TYPE_STRING, IN_hint, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_password_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_password_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_password_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_password_async (DBusGProxy *proxy, const char * IN_password, const char * IN_hint, org_freedesktop_Accounts_User_set_password_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetPassword", org_freedesktop_Accounts_User_set_password_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_password, G_TYPE_STRING, IN_hint, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_freedesktop_Accounts_User_set_automatic_login (DBusGProxy *proxy, const gboolean IN_enabled, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetAutomaticLogin", error, G_TYPE_BOOLEAN, IN_enabled, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_freedesktop_Accounts_User_set_automatic_login_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_freedesktop_Accounts_User_set_automatic_login_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_freedesktop_Accounts_User_set_automatic_login_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_freedesktop_Accounts_User_set_automatic_login_async (DBusGProxy *proxy, const gboolean IN_enabled, org_freedesktop_Accounts_User_set_automatic_login_reply callback, gpointer userdata) - -{ - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (callback); - stuff->userdata = userdata; - return dbus_g_proxy_begin_call (proxy, "SetAutomaticLogin", org_freedesktop_Accounts_User_set_automatic_login_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_BOOLEAN, IN_enabled, G_TYPE_INVALID); -} -#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_freedesktop_Accounts_User */ - -G_END_DECLS diff --git a/src/apt-watcher.c b/src/apt-watcher.c deleted file mode 100644 index 092942f..0000000 --- a/src/apt-watcher.c +++ /dev/null @@ -1,287 +0,0 @@ -/* -Copyright 2011 Canonical Ltd. - -Authors: - Conor Curran <conor.curran@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -// Conor - 6/2/2012 -// Please pull in packagekit's client lib -// using apt-get install --no-install-recommends libpackagekit-glib2-dev -// make sure you don't install package-kit -#define I_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE - -#include <glib/gi18n.h> -#include <packagekit-glib2/packagekit.h> -#include "apt-watcher.h" -#include "dbus-shared-names.h" - -static guint watcher_id; - -struct _AptWatcher -{ - GObject parent_instance; - SessionDbus* session_dbus_interface; - DbusmenuMenuitem* apt_item; - AptState current_state; - GCancellable * proxy_cancel; - GDBusProxy * proxy; -}; - -G_DEFINE_TYPE (AptWatcher, apt_watcher, G_TYPE_OBJECT); - - -static void -get_updates_complete (GObject *source_object, - GAsyncResult *res, - gpointer user_data) -{ - g_return_if_fail (APT_IS_WATCHER (user_data)); - AptWatcher* self = APT_WATCHER (user_data); - - PkResults *results; - PkRestartEnum restart_required; - GError *error = NULL; - results = pk_client_generic_finish (PK_CLIENT(source_object), res, &error); - - if (error != NULL){ - g_warning ("Unable to query for updates - error - %s", error->message); - return; - } - - GPtrArray *packages; - packages = pk_results_get_package_array (results); - - const gchar* disposition; - disposition = dbusmenu_menuitem_property_get (self->apt_item, - DBUSMENU_MENUITEM_PROP_DISPOSITION); - gboolean do_update; - do_update = g_strcmp0 (disposition, DBUSMENU_MENUITEM_DISPOSITION_ALERT) != 0; - - if (packages->len > 0){ - g_print ("Apparently we have updates available - change dbmitem %i", do_update); - if (do_update) - dbusmenu_menuitem_property_set (self->apt_item, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Updates Available…")); - } - else{ - g_print ("No updates available - change dbmitem - %i", do_update); - if (do_update) - dbusmenu_menuitem_property_set (self->apt_item, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Software Up to Date")); - } - - /* check if there was a restart required info in the signal */ - restart_required = pk_results_get_require_restart_worst (results); - if (restart_required == PK_RESTART_ENUM_SYSTEM || - restart_required == PK_RESTART_ENUM_SECURITY_SYSTEM) { - dbusmenu_menuitem_property_set (self->apt_item, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Restart to Complete Updates…")); - dbusmenu_menuitem_property_set (self->apt_item, - DBUSMENU_MENUITEM_PROP_DISPOSITION, - DBUSMENU_MENUITEM_DISPOSITION_ALERT); - session_dbus_restart_required (self->session_dbus_interface); - } - - g_ptr_array_unref (packages); - g_object_unref (results); - g_object_unref (source_object); -} - -static void -apt_watcher_check_for_updates (AptWatcher* self) -{ - PkClient* client; - client = pk_client_new (); - - pk_client_get_updates_async (client, - PK_FILTER_ENUM_NONE, - NULL, NULL, NULL, - (GAsyncReadyCallback)get_updates_complete, - self); -} - -static void apt_watcher_signal_cb ( GDBusProxy* proxy, - gchar* sender_name, - gchar* signal_name, - GVariant* parameters, - gpointer user_data) -{ - g_return_if_fail (APT_IS_WATCHER (user_data)); - AptWatcher* self = APT_WATCHER (user_data); - - g_debug ("apt-watcher-signal cb signal name - %s", signal_name); - if (g_strcmp0(signal_name, "UpdatesChanged") == 0){ - g_debug ("updates changed signal received"); - apt_watcher_check_for_updates (self); - } -} - -static void -apt_watcher_on_name_appeared (GDBusConnection *connection, - const gchar *name, - const gchar *name_owner, - gpointer user_data) -{ - g_return_if_fail (APT_IS_WATCHER (user_data)); - // AptWatcher* watcher = APT_WATCHER (user_data); - - g_print ("Name %s on %s is owned by %s\n", - name, - "the system bus", - name_owner); -} - - -static void -apt_watcher_on_name_vanished (GDBusConnection *connection, - const gchar *name, - gpointer user_data) -{ - g_debug ("Name %s does not exist or has just vanished", - name); - g_return_if_fail (APT_IS_WATCHER (user_data)); -} - -static void -fetch_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) -{ - GError * error = NULL; - - AptWatcher* self = APT_WATCHER(user_data); - g_return_if_fail(self != NULL); - - GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish (res, &error); - - if (self->proxy_cancel != NULL) { - g_object_unref (self->proxy_cancel); - self->proxy_cancel = NULL; - } - - if (error != NULL) { - g_warning("Could not grab DBus proxy for %s: %s", - "org.debian.apt", error->message); - g_error_free(error); - return; - } - - self->proxy = proxy; - // Set up the watch. - watcher_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM, - "org.freedesktop.PackageKit", - G_BUS_NAME_WATCHER_FLAGS_NONE, - apt_watcher_on_name_appeared, - apt_watcher_on_name_vanished, - self, - NULL); - g_signal_connect (self->proxy, - "g-signal", - G_CALLBACK(apt_watcher_signal_cb), - self); -} - -static gboolean -apt_watcher_start_apt_interaction (gpointer data) -{ - g_return_val_if_fail (APT_IS_WATCHER (data), FALSE); - AptWatcher* self = APT_WATCHER (data); - g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, - G_DBUS_PROXY_FLAGS_NONE, - NULL, - "org.freedesktop.PackageKit", - "/org/freedesktop/PackageKit", - "org.freedesktop.PackageKit", - self->proxy_cancel, - fetch_proxy_cb, - self); - apt_watcher_check_for_updates (self); - return FALSE; -} - - -static void -apt_watcher_show_apt_dialog (DbusmenuMenuitem * mi, - guint timestamp, - gpointer userdata) -{ - GError * error = NULL; - g_return_if_fail (APT_IS_WATCHER (userdata)); - AptWatcher* self = APT_WATCHER (userdata); - const gchar* disposition = NULL; - disposition = dbusmenu_menuitem_property_get (self->apt_item, - DBUSMENU_MENUITEM_PROP_DISPOSITION); - - if (g_strcmp0 (disposition, DBUSMENU_MENUITEM_DISPOSITION_ALERT) == 0){ - gchar * helper = g_build_filename (LIBEXECDIR, "gtk-logout-helper", NULL); - gchar * dialog_line = g_strdup_printf ("%s --%s", helper, "restart"); - g_free(helper); - if (!g_spawn_command_line_async(dialog_line, &error)) { - g_warning("Unable to show dialog: %s", error->message); - g_error_free(error); - } - g_free(dialog_line); - } - else{ - if (!g_spawn_command_line_async("update-manager", &error)) - { - g_warning("Unable to show update-manager: %s", error->message); - g_error_free(error); - } - } -} - -static void -apt_watcher_init (AptWatcher *self) -{ - self->current_state = UP_TO_DATE; - g_timeout_add_seconds (60, - apt_watcher_start_apt_interaction, - self); -} - -static void -apt_watcher_finalize (GObject *object) -{ - g_bus_unwatch_name (watcher_id); - AptWatcher* self = APT_WATCHER (object); - - if (self->proxy != NULL) - g_object_unref (self->proxy); - - G_OBJECT_CLASS (apt_watcher_parent_class)->finalize (object); -} - -static void -apt_watcher_class_init (AptWatcherClass *klass) -{ - GObjectClass* object_class = G_OBJECT_CLASS (klass); - object_class->finalize = apt_watcher_finalize; -} - -AptWatcher* apt_watcher_new (SessionDbus* session_dbus, - DbusmenuMenuitem* item) -{ - AptWatcher* watcher = g_object_new (APT_TYPE_WATCHER, NULL); - watcher->session_dbus_interface = session_dbus; - watcher->apt_item = item; - g_signal_connect (G_OBJECT(watcher->apt_item), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(apt_watcher_show_apt_dialog), watcher); - return watcher; -} - diff --git a/src/apt-watcher.h b/src/apt-watcher.h deleted file mode 100644 index c571502..0000000 --- a/src/apt-watcher.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright 2011 Canonical Ltd. - -Authors: - Conor Curran <conor.curran@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef _APT_WATCHER_H_ -#define _APT_WATCHER_H_ - -#include <glib-object.h> - -#include <libdbusmenu-glib/client.h> - -#include <gtk/gtk.h> -#include <libdbusmenu-gtk/menuitem.h> - -#include "session-dbus.h" - -G_BEGIN_DECLS - -#define APT_TYPE_WATCHER (apt_watcher_get_type ()) -#define APT_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APT_TYPE_WATCHER, AptWatcher)) -#define APT_WATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APT_TYPE_WATCHER, AptWatcherClass)) -#define APT_IS_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APT_TYPE_WATCHER)) -#define APT_IS_WATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APT_TYPE_WATCHER)) -#define APT_WATCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APT_TYPE_WATCHER, AptWatcherClass)) - -typedef struct _AptWatcherClass AptWatcherClass; -typedef struct _AptWatcher AptWatcher; - -struct _AptWatcherClass -{ - GObjectClass parent_class; -}; - -GType apt_watcher_get_type (void) G_GNUC_CONST; - -AptWatcher* apt_watcher_new (SessionDbus* session_dbus, - DbusmenuMenuitem* apt_item); -G_END_DECLS - -#endif /* _APT_WATCHER_H_ */ diff --git a/src/dbus-accounts.c b/src/dbus-accounts.c new file mode 100644 index 0000000..4443657 --- /dev/null +++ b/src/dbus-accounts.c @@ -0,0 +1,2505 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "dbus-accounts.h" + +#include <string.h> +#ifdef G_OS_UNIX +# include <gio/gunixfdlist.h> +#endif + +typedef struct +{ + GDBusArgInfo parent_struct; + gboolean use_gvariant; +} _ExtendedGDBusArgInfo; + +typedef struct +{ + GDBusMethodInfo parent_struct; + const gchar *signal_name; + gboolean pass_fdlist; +} _ExtendedGDBusMethodInfo; + +typedef struct +{ + GDBusSignalInfo parent_struct; + const gchar *signal_name; +} _ExtendedGDBusSignalInfo; + +typedef struct +{ + GDBusPropertyInfo parent_struct; + const gchar *hyphen_name; + gboolean use_gvariant; +} _ExtendedGDBusPropertyInfo; + +typedef struct +{ + GDBusInterfaceInfo parent_struct; + const gchar *hyphen_name; +} _ExtendedGDBusInterfaceInfo; + +typedef struct +{ + const _ExtendedGDBusPropertyInfo *info; + guint prop_id; + GValue orig_value; /* the value before the change */ +} ChangedProperty; + +static void +_changed_property_free (ChangedProperty *data) +{ + g_value_unset (&data->orig_value); + g_free (data); +} + +static gboolean +_g_strv_equal0 (gchar **a, gchar **b) +{ + gboolean ret = FALSE; + guint n; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + if (g_strv_length (a) != g_strv_length (b)) + goto out; + for (n = 0; a[n] != NULL; n++) + if (g_strcmp0 (a[n], b[n]) != 0) + goto out; + ret = TRUE; +out: + return ret; +} + +static gboolean +_g_variant_equal0 (GVariant *a, GVariant *b) +{ + gboolean ret = FALSE; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + ret = g_variant_equal (a, b); +out: + return ret; +} + +G_GNUC_UNUSED static gboolean +_g_value_equal (const GValue *a, const GValue *b) +{ + gboolean ret = FALSE; + g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); + switch (G_VALUE_TYPE (a)) + { + case G_TYPE_BOOLEAN: + ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); + break; + case G_TYPE_UCHAR: + ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); + break; + case G_TYPE_INT: + ret = (g_value_get_int (a) == g_value_get_int (b)); + break; + case G_TYPE_UINT: + ret = (g_value_get_uint (a) == g_value_get_uint (b)); + break; + case G_TYPE_INT64: + ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); + break; + case G_TYPE_UINT64: + ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); + break; + case G_TYPE_DOUBLE: + { + /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ + gdouble da = g_value_get_double (a); + gdouble db = g_value_get_double (b); + ret = memcmp (&da, &db, sizeof (gdouble)) == 0; + } + break; + case G_TYPE_STRING: + ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); + break; + case G_TYPE_VARIANT: + ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); + break; + default: + if (G_VALUE_TYPE (a) == G_TYPE_STRV) + ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); + else + g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); + break; + } + return ret; +} + +/* ------------------------------------------------------------------------ + * Code for interface org.freedesktop.Accounts + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:Accounts + * @title: Accounts + * @short_description: Generated C code for the org.freedesktop.Accounts D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-Accounts.top_of_page">org.freedesktop.Accounts</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.freedesktop.Accounts ---- */ + +static const _ExtendedGDBusArgInfo _accounts_method_info_list_cached_users_OUT_ARG_users = +{ + { + -1, + (gchar *) "users", + (gchar *) "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_method_info_list_cached_users_OUT_ARG_pointers[] = +{ + &_accounts_method_info_list_cached_users_OUT_ARG_users, + NULL +}; + +static const GDBusAnnotationInfo _accounts_method_list_cached_users_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_method_list_cached_users_annotation_info_pointers[] = +{ + &_accounts_method_list_cached_users_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_method_info_list_cached_users = +{ + { + -1, + (gchar *) "ListCachedUsers", + NULL, + (GDBusArgInfo **) &_accounts_method_info_list_cached_users_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_accounts_method_list_cached_users_annotation_info_pointers + }, + "handle-list-cached-users", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_method_info_find_user_by_id_IN_ARG_id = +{ + { + -1, + (gchar *) "id", + (gchar *) "x", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_method_info_find_user_by_id_IN_ARG_pointers[] = +{ + &_accounts_method_info_find_user_by_id_IN_ARG_id, + NULL +}; + +static const _ExtendedGDBusArgInfo _accounts_method_info_find_user_by_id_OUT_ARG_user = +{ + { + -1, + (gchar *) "user", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_method_info_find_user_by_id_OUT_ARG_pointers[] = +{ + &_accounts_method_info_find_user_by_id_OUT_ARG_user, + NULL +}; + +static const GDBusAnnotationInfo _accounts_method_find_user_by_id_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_method_find_user_by_id_annotation_info_pointers[] = +{ + &_accounts_method_find_user_by_id_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_method_info_find_user_by_id = +{ + { + -1, + (gchar *) "FindUserById", + (GDBusArgInfo **) &_accounts_method_info_find_user_by_id_IN_ARG_pointers, + (GDBusArgInfo **) &_accounts_method_info_find_user_by_id_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_accounts_method_find_user_by_id_annotation_info_pointers + }, + "handle-find-user-by-id", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_method_info_find_user_by_name_IN_ARG_name = +{ + { + -1, + (gchar *) "name", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_method_info_find_user_by_name_IN_ARG_pointers[] = +{ + &_accounts_method_info_find_user_by_name_IN_ARG_name, + NULL +}; + +static const _ExtendedGDBusArgInfo _accounts_method_info_find_user_by_name_OUT_ARG_user = +{ + { + -1, + (gchar *) "user", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_method_info_find_user_by_name_OUT_ARG_pointers[] = +{ + &_accounts_method_info_find_user_by_name_OUT_ARG_user, + NULL +}; + +static const GDBusAnnotationInfo _accounts_method_find_user_by_name_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_method_find_user_by_name_annotation_info_pointers[] = +{ + &_accounts_method_find_user_by_name_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_method_info_find_user_by_name = +{ + { + -1, + (gchar *) "FindUserByName", + (GDBusArgInfo **) &_accounts_method_info_find_user_by_name_IN_ARG_pointers, + (GDBusArgInfo **) &_accounts_method_info_find_user_by_name_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_accounts_method_find_user_by_name_annotation_info_pointers + }, + "handle-find-user-by-name", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_method_info_create_user_IN_ARG_name = +{ + { + -1, + (gchar *) "name", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_method_info_create_user_IN_ARG_fullname = +{ + { + -1, + (gchar *) "fullname", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_method_info_create_user_IN_ARG_accountType = +{ + { + -1, + (gchar *) "accountType", + (gchar *) "i", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_method_info_create_user_IN_ARG_pointers[] = +{ + &_accounts_method_info_create_user_IN_ARG_name, + &_accounts_method_info_create_user_IN_ARG_fullname, + &_accounts_method_info_create_user_IN_ARG_accountType, + NULL +}; + +static const _ExtendedGDBusArgInfo _accounts_method_info_create_user_OUT_ARG_user = +{ + { + -1, + (gchar *) "user", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_method_info_create_user_OUT_ARG_pointers[] = +{ + &_accounts_method_info_create_user_OUT_ARG_user, + NULL +}; + +static const GDBusAnnotationInfo _accounts_method_create_user_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo _accounts_method_create_user_annotation_info_1 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_method_create_user_annotation_info_pointers[] = +{ + &_accounts_method_create_user_annotation_info_0, + &_accounts_method_create_user_annotation_info_1, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_method_info_create_user = +{ + { + -1, + (gchar *) "CreateUser", + (GDBusArgInfo **) &_accounts_method_info_create_user_IN_ARG_pointers, + (GDBusArgInfo **) &_accounts_method_info_create_user_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_accounts_method_create_user_annotation_info_pointers + }, + "handle-create-user", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_method_info_delete_user_IN_ARG_id = +{ + { + -1, + (gchar *) "id", + (gchar *) "x", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_method_info_delete_user_IN_ARG_removeFiles = +{ + { + -1, + (gchar *) "removeFiles", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_method_info_delete_user_IN_ARG_pointers[] = +{ + &_accounts_method_info_delete_user_IN_ARG_id, + &_accounts_method_info_delete_user_IN_ARG_removeFiles, + NULL +}; + +static const GDBusAnnotationInfo _accounts_method_delete_user_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_method_delete_user_annotation_info_pointers[] = +{ + &_accounts_method_delete_user_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_method_info_delete_user = +{ + { + -1, + (gchar *) "DeleteUser", + (GDBusArgInfo **) &_accounts_method_info_delete_user_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_method_delete_user_annotation_info_pointers + }, + "handle-delete-user", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _accounts_method_info_pointers[] = +{ + &_accounts_method_info_list_cached_users, + &_accounts_method_info_find_user_by_id, + &_accounts_method_info_find_user_by_name, + &_accounts_method_info_create_user, + &_accounts_method_info_delete_user, + NULL +}; + +static const _ExtendedGDBusArgInfo _accounts_signal_info_user_added_ARG_user = +{ + { + -1, + (gchar *) "user", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_signal_info_user_added_ARG_pointers[] = +{ + &_accounts_signal_info_user_added_ARG_user, + NULL +}; + +static const _ExtendedGDBusSignalInfo _accounts_signal_info_user_added = +{ + { + -1, + (gchar *) "UserAdded", + (GDBusArgInfo **) &_accounts_signal_info_user_added_ARG_pointers, + NULL + }, + "user-added" +}; + +static const _ExtendedGDBusArgInfo _accounts_signal_info_user_deleted_ARG_user = +{ + { + -1, + (gchar *) "user", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_signal_info_user_deleted_ARG_pointers[] = +{ + &_accounts_signal_info_user_deleted_ARG_user, + NULL +}; + +static const _ExtendedGDBusSignalInfo _accounts_signal_info_user_deleted = +{ + { + -1, + (gchar *) "UserDeleted", + (GDBusArgInfo **) &_accounts_signal_info_user_deleted_ARG_pointers, + NULL + }, + "user-deleted" +}; + +static const _ExtendedGDBusArgInfo _accounts_signal_info_user_changed_ARG_user = +{ + { + -1, + (gchar *) "user", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_signal_info_user_changed_ARG_pointers[] = +{ + &_accounts_signal_info_user_changed_ARG_user, + NULL +}; + +static const _ExtendedGDBusSignalInfo _accounts_signal_info_user_changed = +{ + { + -1, + (gchar *) "UserChanged", + (GDBusArgInfo **) &_accounts_signal_info_user_changed_ARG_pointers, + NULL + }, + "user-changed" +}; + +static const _ExtendedGDBusSignalInfo * const _accounts_signal_info_pointers[] = +{ + &_accounts_signal_info_user_added, + &_accounts_signal_info_user_deleted, + &_accounts_signal_info_user_changed, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _accounts_property_info_daemon_version = +{ + { + -1, + (gchar *) "DaemonVersion", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "daemon-version", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const _accounts_property_info_pointers[] = +{ + &_accounts_property_info_daemon_version, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _accounts_interface_info = +{ + { + -1, + (gchar *) "org.freedesktop.Accounts", + (GDBusMethodInfo **) &_accounts_method_info_pointers, + (GDBusSignalInfo **) &_accounts_signal_info_pointers, + (GDBusPropertyInfo **) &_accounts_property_info_pointers, + NULL + }, + "accounts", +}; + + +/** + * accounts_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-Accounts.top_of_page">org.freedesktop.Accounts</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +accounts_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_accounts_interface_info; +} + +/** + * accounts_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #Accounts interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +accounts_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "daemon-version"); + return property_id_begin - 1; +} + + + +/** + * Accounts: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Accounts.top_of_page">org.freedesktop.Accounts</link>. + */ + +/** + * AccountsIface: + * @parent_iface: The parent interface. + * @handle_create_user: Handler for the #Accounts::handle-create-user signal. + * @handle_delete_user: Handler for the #Accounts::handle-delete-user signal. + * @handle_find_user_by_id: Handler for the #Accounts::handle-find-user-by-id signal. + * @handle_find_user_by_name: Handler for the #Accounts::handle-find-user-by-name signal. + * @handle_list_cached_users: Handler for the #Accounts::handle-list-cached-users signal. + * @get_daemon_version: Getter for the #Accounts:daemon-version property. + * @user_added: Handler for the #Accounts::user-added signal. + * @user_changed: Handler for the #Accounts::user-changed signal. + * @user_deleted: Handler for the #Accounts::user-deleted signal. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Accounts.top_of_page">org.freedesktop.Accounts</link>. + */ + +static void +accounts_default_init (AccountsIface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * Accounts::handle-list-cached-users: + * @object: A #Accounts. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts.ListCachedUsers">ListCachedUsers()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_complete_list_cached_users() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-list-cached-users", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsIface, handle_list_cached_users), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * Accounts::handle-find-user-by-id: + * @object: A #Accounts. + * @invocation: A #GDBusMethodInvocation. + * @arg_id: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts.FindUserById">FindUserById()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_complete_find_user_by_id() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-find-user-by-id", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsIface, handle_find_user_by_id), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT64); + + /** + * Accounts::handle-find-user-by-name: + * @object: A #Accounts. + * @invocation: A #GDBusMethodInvocation. + * @arg_name: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts.FindUserByName">FindUserByName()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_complete_find_user_by_name() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-find-user-by-name", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsIface, handle_find_user_by_name), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * Accounts::handle-create-user: + * @object: A #Accounts. + * @invocation: A #GDBusMethodInvocation. + * @arg_name: Argument passed by remote caller. + * @arg_fullname: Argument passed by remote caller. + * @arg_accountType: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts.CreateUser">CreateUser()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_complete_create_user() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-create-user", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsIface, handle_create_user), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 4, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT); + + /** + * Accounts::handle-delete-user: + * @object: A #Accounts. + * @invocation: A #GDBusMethodInvocation. + * @arg_id: Argument passed by remote caller. + * @arg_removeFiles: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts.DeleteUser">DeleteUser()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_complete_delete_user() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-delete-user", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsIface, handle_delete_user), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 3, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT64, G_TYPE_BOOLEAN); + + /* GObject signals for received D-Bus signals: */ + /** + * Accounts::user-added: + * @object: A #Accounts. + * @arg_user: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-Accounts.UserAdded">"UserAdded"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("user-added", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsIface, user_added), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * Accounts::user-deleted: + * @object: A #Accounts. + * @arg_user: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-Accounts.UserDeleted">"UserDeleted"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("user-deleted", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsIface, user_deleted), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * Accounts::user-changed: + * @object: A #Accounts. + * @arg_user: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-Accounts.UserChanged">"UserChanged"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("user-changed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsIface, user_changed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /* GObject properties for D-Bus properties: */ + /** + * Accounts:daemon-version: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts.DaemonVersion">"DaemonVersion"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("daemon-version", "DaemonVersion", "DaemonVersion", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +typedef AccountsIface AccountsInterface; +G_DEFINE_INTERFACE (Accounts, accounts, G_TYPE_OBJECT); + +/** + * accounts_get_daemon_version: (skip) + * @object: A #Accounts. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts.DaemonVersion">"DaemonVersion"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use accounts_dup_daemon_version() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +accounts_get_daemon_version (Accounts *object) +{ + return ACCOUNTS_GET_IFACE (object)->get_daemon_version (object); +} + +/** + * accounts_dup_daemon_version: (skip) + * @object: A #Accounts. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-Accounts.DaemonVersion">"DaemonVersion"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +accounts_dup_daemon_version (Accounts *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "daemon-version", &value, NULL); + return value; +} + +/** + * accounts_set_daemon_version: (skip) + * @object: A #Accounts. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts.DaemonVersion">"DaemonVersion"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_set_daemon_version (Accounts *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "daemon-version", value, NULL); +} + +/** + * accounts_emit_user_added: + * @object: A #Accounts. + * @arg_user: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-Accounts.UserAdded">"UserAdded"</link> D-Bus signal. + */ +void +accounts_emit_user_added ( + Accounts *object, + const gchar *arg_user) +{ + g_signal_emit_by_name (object, "user-added", arg_user); +} + +/** + * accounts_emit_user_deleted: + * @object: A #Accounts. + * @arg_user: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-Accounts.UserDeleted">"UserDeleted"</link> D-Bus signal. + */ +void +accounts_emit_user_deleted ( + Accounts *object, + const gchar *arg_user) +{ + g_signal_emit_by_name (object, "user-deleted", arg_user); +} + +/** + * accounts_emit_user_changed: + * @object: A #Accounts. + * @arg_user: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-Accounts.UserChanged">"UserChanged"</link> D-Bus signal. + */ +void +accounts_emit_user_changed ( + Accounts *object, + const gchar *arg_user) +{ + g_signal_emit_by_name (object, "user-changed", arg_user); +} + +/** + * accounts_call_list_cached_users: + * @proxy: A #AccountsProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts.ListCachedUsers">ListCachedUsers()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_call_list_cached_users_finish() to get the result of the operation. + * + * See accounts_call_list_cached_users_sync() for the synchronous, blocking version of this method. + */ +void +accounts_call_list_cached_users ( + Accounts *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "ListCachedUsers", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_call_list_cached_users_finish: + * @proxy: A #AccountsProxy. + * @out_users: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_call_list_cached_users(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_call_list_cached_users(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_call_list_cached_users_finish ( + Accounts *proxy, + gchar ***out_users, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_users); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_call_list_cached_users_sync: + * @proxy: A #AccountsProxy. + * @out_users: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts.ListCachedUsers">ListCachedUsers()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_call_list_cached_users() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_call_list_cached_users_sync ( + Accounts *proxy, + gchar ***out_users, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "ListCachedUsers", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_users); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_call_find_user_by_id: + * @proxy: A #AccountsProxy. + * @arg_id: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts.FindUserById">FindUserById()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_call_find_user_by_id_finish() to get the result of the operation. + * + * See accounts_call_find_user_by_id_sync() for the synchronous, blocking version of this method. + */ +void +accounts_call_find_user_by_id ( + Accounts *proxy, + gint64 arg_id, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "FindUserById", + g_variant_new ("(x)", + arg_id), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_call_find_user_by_id_finish: + * @proxy: A #AccountsProxy. + * @out_user: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_call_find_user_by_id(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_call_find_user_by_id(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_call_find_user_by_id_finish ( + Accounts *proxy, + gchar **out_user, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_user); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_call_find_user_by_id_sync: + * @proxy: A #AccountsProxy. + * @arg_id: Argument to pass with the method invocation. + * @out_user: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts.FindUserById">FindUserById()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_call_find_user_by_id() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_call_find_user_by_id_sync ( + Accounts *proxy, + gint64 arg_id, + gchar **out_user, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "FindUserById", + g_variant_new ("(x)", + arg_id), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_user); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_call_find_user_by_name: + * @proxy: A #AccountsProxy. + * @arg_name: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts.FindUserByName">FindUserByName()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_call_find_user_by_name_finish() to get the result of the operation. + * + * See accounts_call_find_user_by_name_sync() for the synchronous, blocking version of this method. + */ +void +accounts_call_find_user_by_name ( + Accounts *proxy, + const gchar *arg_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "FindUserByName", + g_variant_new ("(s)", + arg_name), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_call_find_user_by_name_finish: + * @proxy: A #AccountsProxy. + * @out_user: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_call_find_user_by_name(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_call_find_user_by_name(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_call_find_user_by_name_finish ( + Accounts *proxy, + gchar **out_user, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_user); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_call_find_user_by_name_sync: + * @proxy: A #AccountsProxy. + * @arg_name: Argument to pass with the method invocation. + * @out_user: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts.FindUserByName">FindUserByName()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_call_find_user_by_name() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_call_find_user_by_name_sync ( + Accounts *proxy, + const gchar *arg_name, + gchar **out_user, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "FindUserByName", + g_variant_new ("(s)", + arg_name), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_user); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_call_create_user: + * @proxy: A #AccountsProxy. + * @arg_name: Argument to pass with the method invocation. + * @arg_fullname: Argument to pass with the method invocation. + * @arg_accountType: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts.CreateUser">CreateUser()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_call_create_user_finish() to get the result of the operation. + * + * See accounts_call_create_user_sync() for the synchronous, blocking version of this method. + */ +void +accounts_call_create_user ( + Accounts *proxy, + const gchar *arg_name, + const gchar *arg_fullname, + gint arg_accountType, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "CreateUser", + g_variant_new ("(ssi)", + arg_name, + arg_fullname, + arg_accountType), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_call_create_user_finish: + * @proxy: A #AccountsProxy. + * @out_user: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_call_create_user(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_call_create_user(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_call_create_user_finish ( + Accounts *proxy, + gchar **out_user, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_user); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_call_create_user_sync: + * @proxy: A #AccountsProxy. + * @arg_name: Argument to pass with the method invocation. + * @arg_fullname: Argument to pass with the method invocation. + * @arg_accountType: Argument to pass with the method invocation. + * @out_user: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts.CreateUser">CreateUser()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_call_create_user() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_call_create_user_sync ( + Accounts *proxy, + const gchar *arg_name, + const gchar *arg_fullname, + gint arg_accountType, + gchar **out_user, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "CreateUser", + g_variant_new ("(ssi)", + arg_name, + arg_fullname, + arg_accountType), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_user); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_call_delete_user: + * @proxy: A #AccountsProxy. + * @arg_id: Argument to pass with the method invocation. + * @arg_removeFiles: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts.DeleteUser">DeleteUser()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_call_delete_user_finish() to get the result of the operation. + * + * See accounts_call_delete_user_sync() for the synchronous, blocking version of this method. + */ +void +accounts_call_delete_user ( + Accounts *proxy, + gint64 arg_id, + gboolean arg_removeFiles, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "DeleteUser", + g_variant_new ("(xb)", + arg_id, + arg_removeFiles), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_call_delete_user_finish: + * @proxy: A #AccountsProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_call_delete_user(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_call_delete_user(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_call_delete_user_finish ( + Accounts *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_call_delete_user_sync: + * @proxy: A #AccountsProxy. + * @arg_id: Argument to pass with the method invocation. + * @arg_removeFiles: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts.DeleteUser">DeleteUser()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_call_delete_user() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_call_delete_user_sync ( + Accounts *proxy, + gint64 arg_id, + gboolean arg_removeFiles, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "DeleteUser", + g_variant_new ("(xb)", + arg_id, + arg_removeFiles), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_complete_list_cached_users: + * @object: A #Accounts. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @users: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts.ListCachedUsers">ListCachedUsers()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_complete_list_cached_users ( + Accounts *object, + GDBusMethodInvocation *invocation, + const gchar *const *users) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^ao)", + users)); +} + +/** + * accounts_complete_find_user_by_id: + * @object: A #Accounts. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @user: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts.FindUserById">FindUserById()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_complete_find_user_by_id ( + Accounts *object, + GDBusMethodInvocation *invocation, + const gchar *user) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(o)", + user)); +} + +/** + * accounts_complete_find_user_by_name: + * @object: A #Accounts. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @user: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts.FindUserByName">FindUserByName()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_complete_find_user_by_name ( + Accounts *object, + GDBusMethodInvocation *invocation, + const gchar *user) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(o)", + user)); +} + +/** + * accounts_complete_create_user: + * @object: A #Accounts. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @user: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts.CreateUser">CreateUser()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_complete_create_user ( + Accounts *object, + GDBusMethodInvocation *invocation, + const gchar *user) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(o)", + user)); +} + +/** + * accounts_complete_delete_user: + * @object: A #Accounts. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts.DeleteUser">DeleteUser()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_complete_delete_user ( + Accounts *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * AccountsProxy: + * + * The #AccountsProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * AccountsProxyClass: + * @parent_class: The parent class. + * + * Class structure for #AccountsProxy. + */ + +struct _AccountsProxyPrivate +{ + GData *qdata; +}; + +static void accounts_proxy_iface_init (AccountsIface *iface); + +G_DEFINE_TYPE_WITH_CODE (AccountsProxy, accounts_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_ACCOUNTS, accounts_proxy_iface_init)); + +static void +accounts_proxy_finalize (GObject *object) +{ + AccountsProxy *proxy = ACCOUNTS_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (accounts_proxy_parent_class)->finalize (object); +} + +static void +accounts_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 1); + info = _accounts_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +accounts_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + error = NULL; + if (!g_dbus_proxy_call_finish (proxy, res, &error)) + { + g_warning ("Error setting property `%s' on interface org.freedesktop.Accounts: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } +} + +static void +accounts_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 1); + info = _accounts_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.freedesktop.Accounts", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) accounts_proxy_set_property_cb, (gpointer) info); + g_variant_unref (variant); +} + +static void +accounts_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_accounts_interface_info, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_ACCOUNTS); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_ACCOUNTS); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +accounts_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + AccountsProxy *proxy = ACCOUNTS_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_accounts_interface_info, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_accounts_interface_info, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static const gchar * +accounts_proxy_get_daemon_version (Accounts *object) +{ + AccountsProxy *proxy = ACCOUNTS_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "DaemonVersion"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static void +accounts_proxy_init (AccountsProxy *proxy) +{ + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_ACCOUNTS_PROXY, AccountsProxyPrivate); + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), accounts_interface_info ()); +} + +static void +accounts_proxy_class_init (AccountsProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + g_type_class_add_private (klass, sizeof (AccountsProxyPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = accounts_proxy_finalize; + gobject_class->get_property = accounts_proxy_get_property; + gobject_class->set_property = accounts_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = accounts_proxy_g_signal; + proxy_class->g_properties_changed = accounts_proxy_g_properties_changed; + + + accounts_override_properties (gobject_class, 1); +} + +static void +accounts_proxy_iface_init (AccountsIface *iface) +{ + iface->get_daemon_version = accounts_proxy_get_daemon_version; +} + +/** + * accounts_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Accounts.top_of_page">org.freedesktop.Accounts</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_proxy_new_finish() to get the result of the operation. + * + * See accounts_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +accounts_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + 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); +} + +/** + * accounts_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with accounts_proxy_new(). + * + * Returns: (transfer full) (type AccountsProxy): The constructed proxy object or %NULL if @error is set. + */ +Accounts * +accounts_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return ACCOUNTS (ret); + else + return NULL; +} + +/** + * accounts_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Accounts.top_of_page">org.freedesktop.Accounts</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See accounts_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type AccountsProxy): The constructed proxy object or %NULL if @error is set. + */ +Accounts * +accounts_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + 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); + if (ret != NULL) + return ACCOUNTS (ret); + else + return NULL; +} + + +/** + * accounts_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like accounts_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_proxy_new_for_bus_finish() to get the result of the operation. + * + * See accounts_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +accounts_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + 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); +} + +/** + * accounts_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with accounts_proxy_new_for_bus(). + * + * Returns: (transfer full) (type AccountsProxy): The constructed proxy object or %NULL if @error is set. + */ +Accounts * +accounts_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return ACCOUNTS (ret); + else + return NULL; +} + +/** + * accounts_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like accounts_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See accounts_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type AccountsProxy): The constructed proxy object or %NULL if @error is set. + */ +Accounts * +accounts_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + 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); + if (ret != NULL) + return ACCOUNTS (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * AccountsSkeleton: + * + * The #AccountsSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * AccountsSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #AccountsSkeleton. + */ + +struct _AccountsSkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_accounts_skeleton_handle_method_call ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_ACCOUNTS); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_ACCOUNTS); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + 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); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_accounts_skeleton_handle_get_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_accounts_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_accounts_skeleton_handle_set_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_accounts_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _accounts_skeleton_vtable = +{ + _accounts_skeleton_handle_method_call, + _accounts_skeleton_handle_get_property, + _accounts_skeleton_handle_set_property +}; + +static GDBusInterfaceInfo * +accounts_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton) +{ + return accounts_interface_info (); +} + +static GDBusInterfaceVTable * +accounts_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton) +{ + return (GDBusInterfaceVTable *) &_accounts_skeleton_vtable; +} + +static GVariant * +accounts_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_accounts_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _accounts_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _accounts_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + 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); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean _accounts_emit_changed (gpointer user_data); + +static void +accounts_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (&skeleton->priv->lock); + + if (emit_changed) + _accounts_emit_changed (skeleton); +} + +static void +_accounts_on_signal_user_added ( + Accounts *object, + const gchar *arg_user) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o)", + arg_user)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Accounts", "UserAdded", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_accounts_on_signal_user_deleted ( + Accounts *object, + const gchar *arg_user) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o)", + arg_user)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Accounts", "UserDeleted", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_accounts_on_signal_user_changed ( + Accounts *object, + const gchar *arg_user) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o)", + arg_user)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Accounts", "UserChanged", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void accounts_skeleton_iface_init (AccountsIface *iface); +G_DEFINE_TYPE_WITH_CODE (AccountsSkeleton, accounts_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_ACCOUNTS, accounts_skeleton_iface_init)); + +static void +accounts_skeleton_finalize (GObject *object) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object); + guint n; + for (n = 0; n < 1; n++) + g_value_unset (&skeleton->priv->properties[n]); + g_free (skeleton->priv->properties); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (accounts_skeleton_parent_class)->finalize (object); +} + +static void +accounts_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 1); + g_mutex_lock (&skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock (&skeleton->priv->lock); +} + +static gboolean +_accounts_emit_changed (gpointer user_data) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (&skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *l; + GVariant *signal_variant; + signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.Accounts", + &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + signal_variant, + NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (&skeleton->priv->lock); + return FALSE; +} + +static void +_accounts_schedule_emit_changed (AccountsSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +accounts_skeleton_notify (GObject *object, + GParamSpec *pspec) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object); + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, _accounts_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (&skeleton->priv->lock); +} + +static void +accounts_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 1); + g_mutex_lock (&skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + _accounts_schedule_emit_changed (skeleton, _accounts_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (&skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +accounts_skeleton_init (AccountsSkeleton *skeleton) +{ + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_ACCOUNTS_SKELETON, AccountsSkeletonPrivate); + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); + skeleton->priv->properties = g_new0 (GValue, 1); + g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); +} + +static const gchar * +accounts_skeleton_get_daemon_version (Accounts *object) +{ + AccountsSkeleton *skeleton = ACCOUNTS_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[0])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static void +accounts_skeleton_class_init (AccountsSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + g_type_class_add_private (klass, sizeof (AccountsSkeletonPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = accounts_skeleton_finalize; + gobject_class->get_property = accounts_skeleton_get_property; + gobject_class->set_property = accounts_skeleton_set_property; + gobject_class->notify = accounts_skeleton_notify; + + + accounts_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = accounts_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = accounts_skeleton_dbus_interface_get_properties; + skeleton_class->flush = accounts_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = accounts_skeleton_dbus_interface_get_vtable; +} + +static void +accounts_skeleton_iface_init (AccountsIface *iface) +{ + iface->user_added = _accounts_on_signal_user_added; + iface->user_deleted = _accounts_on_signal_user_deleted; + iface->user_changed = _accounts_on_signal_user_changed; + iface->get_daemon_version = accounts_skeleton_get_daemon_version; +} + +/** + * accounts_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Accounts.top_of_page">org.freedesktop.Accounts</link>. + * + * Returns: (transfer full) (type AccountsSkeleton): The skeleton object. + */ +Accounts * +accounts_skeleton_new (void) +{ + return ACCOUNTS (g_object_new (TYPE_ACCOUNTS_SKELETON, NULL)); +} + diff --git a/src/dbus-accounts.h b/src/dbus-accounts.h new file mode 100644 index 0000000..d9da913 --- /dev/null +++ b/src/dbus-accounts.h @@ -0,0 +1,333 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __DBUS_ACCOUNTS_H__ +#define __DBUS_ACCOUNTS_H__ + +#include <gio/gio.h> + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.freedesktop.Accounts */ + +#define TYPE_ACCOUNTS (accounts_get_type ()) +#define ACCOUNTS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ACCOUNTS, Accounts)) +#define IS_ACCOUNTS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ACCOUNTS)) +#define ACCOUNTS_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_ACCOUNTS, AccountsIface)) + +struct _Accounts; +typedef struct _Accounts Accounts; +typedef struct _AccountsIface AccountsIface; + +struct _AccountsIface +{ + GTypeInterface parent_iface; + + + + gboolean (*handle_create_user) ( + Accounts *object, + GDBusMethodInvocation *invocation, + const gchar *arg_name, + const gchar *arg_fullname, + gint arg_accountType); + + gboolean (*handle_delete_user) ( + Accounts *object, + GDBusMethodInvocation *invocation, + gint64 arg_id, + gboolean arg_removeFiles); + + gboolean (*handle_find_user_by_id) ( + Accounts *object, + GDBusMethodInvocation *invocation, + gint64 arg_id); + + gboolean (*handle_find_user_by_name) ( + Accounts *object, + GDBusMethodInvocation *invocation, + const gchar *arg_name); + + gboolean (*handle_list_cached_users) ( + Accounts *object, + GDBusMethodInvocation *invocation); + + const gchar * (*get_daemon_version) (Accounts *object); + + void (*user_added) ( + Accounts *object, + const gchar *arg_user); + + void (*user_changed) ( + Accounts *object, + const gchar *arg_user); + + void (*user_deleted) ( + Accounts *object, + const gchar *arg_user); + +}; + +GType accounts_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *accounts_interface_info (void); +guint accounts_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void accounts_complete_list_cached_users ( + Accounts *object, + GDBusMethodInvocation *invocation, + const gchar *const *users); + +void accounts_complete_find_user_by_id ( + Accounts *object, + GDBusMethodInvocation *invocation, + const gchar *user); + +void accounts_complete_find_user_by_name ( + Accounts *object, + GDBusMethodInvocation *invocation, + const gchar *user); + +void accounts_complete_create_user ( + Accounts *object, + GDBusMethodInvocation *invocation, + const gchar *user); + +void accounts_complete_delete_user ( + Accounts *object, + GDBusMethodInvocation *invocation); + + + +/* D-Bus signal emissions functions: */ +void accounts_emit_user_added ( + Accounts *object, + const gchar *arg_user); + +void accounts_emit_user_deleted ( + Accounts *object, + const gchar *arg_user); + +void accounts_emit_user_changed ( + Accounts *object, + const gchar *arg_user); + + + +/* D-Bus method calls: */ +void accounts_call_list_cached_users ( + Accounts *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_call_list_cached_users_finish ( + Accounts *proxy, + gchar ***out_users, + GAsyncResult *res, + GError **error); + +gboolean accounts_call_list_cached_users_sync ( + Accounts *proxy, + gchar ***out_users, + GCancellable *cancellable, + GError **error); + +void accounts_call_find_user_by_id ( + Accounts *proxy, + gint64 arg_id, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_call_find_user_by_id_finish ( + Accounts *proxy, + gchar **out_user, + GAsyncResult *res, + GError **error); + +gboolean accounts_call_find_user_by_id_sync ( + Accounts *proxy, + gint64 arg_id, + gchar **out_user, + GCancellable *cancellable, + GError **error); + +void accounts_call_find_user_by_name ( + Accounts *proxy, + const gchar *arg_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_call_find_user_by_name_finish ( + Accounts *proxy, + gchar **out_user, + GAsyncResult *res, + GError **error); + +gboolean accounts_call_find_user_by_name_sync ( + Accounts *proxy, + const gchar *arg_name, + gchar **out_user, + GCancellable *cancellable, + GError **error); + +void accounts_call_create_user ( + Accounts *proxy, + const gchar *arg_name, + const gchar *arg_fullname, + gint arg_accountType, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_call_create_user_finish ( + Accounts *proxy, + gchar **out_user, + GAsyncResult *res, + GError **error); + +gboolean accounts_call_create_user_sync ( + Accounts *proxy, + const gchar *arg_name, + const gchar *arg_fullname, + gint arg_accountType, + gchar **out_user, + GCancellable *cancellable, + GError **error); + +void accounts_call_delete_user ( + Accounts *proxy, + gint64 arg_id, + gboolean arg_removeFiles, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_call_delete_user_finish ( + Accounts *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_call_delete_user_sync ( + Accounts *proxy, + gint64 arg_id, + gboolean arg_removeFiles, + GCancellable *cancellable, + GError **error); + + + +/* D-Bus property accessors: */ +const gchar *accounts_get_daemon_version (Accounts *object); +gchar *accounts_dup_daemon_version (Accounts *object); +void accounts_set_daemon_version (Accounts *object, const gchar *value); + + +/* ---- */ + +#define TYPE_ACCOUNTS_PROXY (accounts_proxy_get_type ()) +#define ACCOUNTS_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ACCOUNTS_PROXY, AccountsProxy)) +#define ACCOUNTS_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_ACCOUNTS_PROXY, AccountsProxyClass)) +#define ACCOUNTS_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ACCOUNTS_PROXY, AccountsProxyClass)) +#define IS_ACCOUNTS_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ACCOUNTS_PROXY)) +#define IS_ACCOUNTS_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ACCOUNTS_PROXY)) + +typedef struct _AccountsProxy AccountsProxy; +typedef struct _AccountsProxyClass AccountsProxyClass; +typedef struct _AccountsProxyPrivate AccountsProxyPrivate; + +struct _AccountsProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + AccountsProxyPrivate *priv; +}; + +struct _AccountsProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType accounts_proxy_get_type (void) G_GNUC_CONST; + +void accounts_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +Accounts *accounts_proxy_new_finish ( + GAsyncResult *res, + GError **error); +Accounts *accounts_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void accounts_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +Accounts *accounts_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +Accounts *accounts_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_ACCOUNTS_SKELETON (accounts_skeleton_get_type ()) +#define ACCOUNTS_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ACCOUNTS_SKELETON, AccountsSkeleton)) +#define ACCOUNTS_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_ACCOUNTS_SKELETON, AccountsSkeletonClass)) +#define ACCOUNTS_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ACCOUNTS_SKELETON, AccountsSkeletonClass)) +#define IS_ACCOUNTS_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ACCOUNTS_SKELETON)) +#define IS_ACCOUNTS_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ACCOUNTS_SKELETON)) + +typedef struct _AccountsSkeleton AccountsSkeleton; +typedef struct _AccountsSkeletonClass AccountsSkeletonClass; +typedef struct _AccountsSkeletonPrivate AccountsSkeletonPrivate; + +struct _AccountsSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + AccountsSkeletonPrivate *priv; +}; + +struct _AccountsSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType accounts_skeleton_get_type (void) G_GNUC_CONST; + +Accounts *accounts_skeleton_new (void); + + +G_END_DECLS + +#endif /* __DBUS_ACCOUNTS_H__ */ diff --git a/src/dbus-consolekit-manager.c b/src/dbus-consolekit-manager.c new file mode 100644 index 0000000..e0decbe --- /dev/null +++ b/src/dbus-consolekit-manager.c @@ -0,0 +1,4139 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "dbus-consolekit-manager.h" + +#include <string.h> +#ifdef G_OS_UNIX +# include <gio/gunixfdlist.h> +#endif + +typedef struct +{ + GDBusArgInfo parent_struct; + gboolean use_gvariant; +} _ExtendedGDBusArgInfo; + +typedef struct +{ + GDBusMethodInfo parent_struct; + const gchar *signal_name; + gboolean pass_fdlist; +} _ExtendedGDBusMethodInfo; + +typedef struct +{ + GDBusSignalInfo parent_struct; + const gchar *signal_name; +} _ExtendedGDBusSignalInfo; + +typedef struct +{ + GDBusPropertyInfo parent_struct; + const gchar *hyphen_name; + gboolean use_gvariant; +} _ExtendedGDBusPropertyInfo; + +typedef struct +{ + GDBusInterfaceInfo parent_struct; + const gchar *hyphen_name; +} _ExtendedGDBusInterfaceInfo; + +typedef struct +{ + const _ExtendedGDBusPropertyInfo *info; + guint prop_id; + GValue orig_value; /* the value before the change */ +} ChangedProperty; + +static void +_changed_property_free (ChangedProperty *data) +{ + g_value_unset (&data->orig_value); + g_free (data); +} + +static gboolean +_g_strv_equal0 (gchar **a, gchar **b) +{ + gboolean ret = FALSE; + guint n; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + if (g_strv_length (a) != g_strv_length (b)) + goto out; + for (n = 0; a[n] != NULL; n++) + if (g_strcmp0 (a[n], b[n]) != 0) + goto out; + ret = TRUE; +out: + return ret; +} + +static gboolean +_g_variant_equal0 (GVariant *a, GVariant *b) +{ + gboolean ret = FALSE; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + ret = g_variant_equal (a, b); +out: + return ret; +} + +G_GNUC_UNUSED static gboolean +_g_value_equal (const GValue *a, const GValue *b) +{ + gboolean ret = FALSE; + g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); + switch (G_VALUE_TYPE (a)) + { + case G_TYPE_BOOLEAN: + ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); + break; + case G_TYPE_UCHAR: + ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); + break; + case G_TYPE_INT: + ret = (g_value_get_int (a) == g_value_get_int (b)); + break; + case G_TYPE_UINT: + ret = (g_value_get_uint (a) == g_value_get_uint (b)); + break; + case G_TYPE_INT64: + ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); + break; + case G_TYPE_UINT64: + ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); + break; + case G_TYPE_DOUBLE: + { + /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ + gdouble da = g_value_get_double (a); + gdouble db = g_value_get_double (b); + ret = memcmp (&da, &db, sizeof (gdouble)) == 0; + } + break; + case G_TYPE_STRING: + ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); + break; + case G_TYPE_VARIANT: + ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); + break; + default: + if (G_VALUE_TYPE (a) == G_TYPE_STRV) + ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); + else + g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); + break; + } + return ret; +} + +/* ------------------------------------------------------------------------ + * Code for interface org.freedesktop.ConsoleKit.Manager + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:ConsoleKitManager + * @title: ConsoleKitManager + * @short_description: Generated C code for the org.freedesktop.ConsoleKit.Manager D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Manager.top_of_page">org.freedesktop.ConsoleKit.Manager</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.freedesktop.ConsoleKit.Manager ---- */ + +static const GDBusAnnotationInfo _console_kit_manager_method_restart_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_manager_method_restart_annotation_info_pointers[] = +{ + &_console_kit_manager_method_restart_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_restart = +{ + { + -1, + (gchar *) "Restart", + NULL, + NULL, + (GDBusAnnotationInfo **) &_console_kit_manager_method_restart_annotation_info_pointers + }, + "handle-restart", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_can_restart_OUT_ARG_can_restart = +{ + { + -1, + (gchar *) "can_restart", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_can_restart_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_can_restart_OUT_ARG_can_restart, + NULL +}; + +static const GDBusAnnotationInfo _console_kit_manager_method_can_restart_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_manager_method_can_restart_annotation_info_pointers[] = +{ + &_console_kit_manager_method_can_restart_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_can_restart = +{ + { + -1, + (gchar *) "CanRestart", + NULL, + (GDBusArgInfo **) &_console_kit_manager_method_info_can_restart_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_console_kit_manager_method_can_restart_annotation_info_pointers + }, + "handle-can-restart", + FALSE +}; + +static const GDBusAnnotationInfo _console_kit_manager_method_stop_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_manager_method_stop_annotation_info_pointers[] = +{ + &_console_kit_manager_method_stop_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_stop = +{ + { + -1, + (gchar *) "Stop", + NULL, + NULL, + (GDBusAnnotationInfo **) &_console_kit_manager_method_stop_annotation_info_pointers + }, + "handle-stop", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_can_stop_OUT_ARG_can_stop = +{ + { + -1, + (gchar *) "can_stop", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_can_stop_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_can_stop_OUT_ARG_can_stop, + NULL +}; + +static const GDBusAnnotationInfo _console_kit_manager_method_can_stop_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_manager_method_can_stop_annotation_info_pointers[] = +{ + &_console_kit_manager_method_can_stop_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_can_stop = +{ + { + -1, + (gchar *) "CanStop", + NULL, + (GDBusArgInfo **) &_console_kit_manager_method_info_can_stop_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_console_kit_manager_method_can_stop_annotation_info_pointers + }, + "handle-can-stop", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_open_session_OUT_ARG_cookie = +{ + { + -1, + (gchar *) "cookie", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_open_session_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_open_session_OUT_ARG_cookie, + NULL +}; + +static const GDBusAnnotationInfo _console_kit_manager_method_open_session_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_manager_method_open_session_annotation_info_pointers[] = +{ + &_console_kit_manager_method_open_session_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_open_session = +{ + { + -1, + (gchar *) "OpenSession", + NULL, + (GDBusArgInfo **) &_console_kit_manager_method_info_open_session_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_console_kit_manager_method_open_session_annotation_info_pointers + }, + "handle-open-session", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_open_session_with_parameters_IN_ARG_parameters = +{ + { + -1, + (gchar *) "parameters", + (gchar *) "a(sv)", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_open_session_with_parameters_IN_ARG_pointers[] = +{ + &_console_kit_manager_method_info_open_session_with_parameters_IN_ARG_parameters, + NULL +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_open_session_with_parameters_OUT_ARG_cookie = +{ + { + -1, + (gchar *) "cookie", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_open_session_with_parameters_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_open_session_with_parameters_OUT_ARG_cookie, + NULL +}; + +static const GDBusAnnotationInfo _console_kit_manager_method_open_session_with_parameters_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_manager_method_open_session_with_parameters_annotation_info_pointers[] = +{ + &_console_kit_manager_method_open_session_with_parameters_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_open_session_with_parameters = +{ + { + -1, + (gchar *) "OpenSessionWithParameters", + (GDBusArgInfo **) &_console_kit_manager_method_info_open_session_with_parameters_IN_ARG_pointers, + (GDBusArgInfo **) &_console_kit_manager_method_info_open_session_with_parameters_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_console_kit_manager_method_open_session_with_parameters_annotation_info_pointers + }, + "handle-open-session-with-parameters", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_close_session_IN_ARG_cookie = +{ + { + -1, + (gchar *) "cookie", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_close_session_IN_ARG_pointers[] = +{ + &_console_kit_manager_method_info_close_session_IN_ARG_cookie, + NULL +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_close_session_OUT_ARG_result = +{ + { + -1, + (gchar *) "result", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_close_session_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_close_session_OUT_ARG_result, + NULL +}; + +static const GDBusAnnotationInfo _console_kit_manager_method_close_session_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_manager_method_close_session_annotation_info_pointers[] = +{ + &_console_kit_manager_method_close_session_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_close_session = +{ + { + -1, + (gchar *) "CloseSession", + (GDBusArgInfo **) &_console_kit_manager_method_info_close_session_IN_ARG_pointers, + (GDBusArgInfo **) &_console_kit_manager_method_info_close_session_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_console_kit_manager_method_close_session_annotation_info_pointers + }, + "handle-close-session", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_seats_OUT_ARG_seats = +{ + { + -1, + (gchar *) "seats", + (gchar *) "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_seats_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_seats_OUT_ARG_seats, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_get_seats = +{ + { + -1, + (gchar *) "GetSeats", + NULL, + (GDBusArgInfo **) &_console_kit_manager_method_info_get_seats_OUT_ARG_pointers, + NULL + }, + "handle-get-seats", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_sessions_OUT_ARG_sessions = +{ + { + -1, + (gchar *) "sessions", + (gchar *) "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_sessions_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_sessions_OUT_ARG_sessions, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_get_sessions = +{ + { + -1, + (gchar *) "GetSessions", + NULL, + (GDBusArgInfo **) &_console_kit_manager_method_info_get_sessions_OUT_ARG_pointers, + NULL + }, + "handle-get-sessions", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_session_for_cookie_IN_ARG_cookie = +{ + { + -1, + (gchar *) "cookie", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_session_for_cookie_IN_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_session_for_cookie_IN_ARG_cookie, + NULL +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_session_for_cookie_OUT_ARG_ssid = +{ + { + -1, + (gchar *) "ssid", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_session_for_cookie_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_session_for_cookie_OUT_ARG_ssid, + NULL +}; + +static const GDBusAnnotationInfo _console_kit_manager_method_get_session_for_cookie_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_manager_method_get_session_for_cookie_annotation_info_pointers[] = +{ + &_console_kit_manager_method_get_session_for_cookie_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_get_session_for_cookie = +{ + { + -1, + (gchar *) "GetSessionForCookie", + (GDBusArgInfo **) &_console_kit_manager_method_info_get_session_for_cookie_IN_ARG_pointers, + (GDBusArgInfo **) &_console_kit_manager_method_info_get_session_for_cookie_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_console_kit_manager_method_get_session_for_cookie_annotation_info_pointers + }, + "handle-get-session-for-cookie", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_session_for_unix_process_IN_ARG_pid = +{ + { + -1, + (gchar *) "pid", + (gchar *) "u", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_session_for_unix_process_IN_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_session_for_unix_process_IN_ARG_pid, + NULL +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_session_for_unix_process_OUT_ARG_ssid = +{ + { + -1, + (gchar *) "ssid", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_session_for_unix_process_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_session_for_unix_process_OUT_ARG_ssid, + NULL +}; + +static const GDBusAnnotationInfo _console_kit_manager_method_get_session_for_unix_process_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_manager_method_get_session_for_unix_process_annotation_info_pointers[] = +{ + &_console_kit_manager_method_get_session_for_unix_process_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_get_session_for_unix_process = +{ + { + -1, + (gchar *) "GetSessionForUnixProcess", + (GDBusArgInfo **) &_console_kit_manager_method_info_get_session_for_unix_process_IN_ARG_pointers, + (GDBusArgInfo **) &_console_kit_manager_method_info_get_session_for_unix_process_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_console_kit_manager_method_get_session_for_unix_process_annotation_info_pointers + }, + "handle-get-session-for-unix-process", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_current_session_OUT_ARG_ssid = +{ + { + -1, + (gchar *) "ssid", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_current_session_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_current_session_OUT_ARG_ssid, + NULL +}; + +static const GDBusAnnotationInfo _console_kit_manager_method_get_current_session_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_manager_method_get_current_session_annotation_info_pointers[] = +{ + &_console_kit_manager_method_get_current_session_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_get_current_session = +{ + { + -1, + (gchar *) "GetCurrentSession", + NULL, + (GDBusArgInfo **) &_console_kit_manager_method_info_get_current_session_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_console_kit_manager_method_get_current_session_annotation_info_pointers + }, + "handle-get-current-session", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_sessions_for_unix_user_IN_ARG_uid = +{ + { + -1, + (gchar *) "uid", + (gchar *) "u", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_sessions_for_unix_user_IN_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_sessions_for_unix_user_IN_ARG_uid, + NULL +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_sessions_for_unix_user_OUT_ARG_sessions = +{ + { + -1, + (gchar *) "sessions", + (gchar *) "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_sessions_for_unix_user_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_sessions_for_unix_user_OUT_ARG_sessions, + NULL +}; + +static const GDBusAnnotationInfo _console_kit_manager_method_get_sessions_for_unix_user_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_manager_method_get_sessions_for_unix_user_annotation_info_pointers[] = +{ + &_console_kit_manager_method_get_sessions_for_unix_user_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_get_sessions_for_unix_user = +{ + { + -1, + (gchar *) "GetSessionsForUnixUser", + (GDBusArgInfo **) &_console_kit_manager_method_info_get_sessions_for_unix_user_IN_ARG_pointers, + (GDBusArgInfo **) &_console_kit_manager_method_info_get_sessions_for_unix_user_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_console_kit_manager_method_get_sessions_for_unix_user_annotation_info_pointers + }, + "handle-get-sessions-for-unix-user", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_sessions_for_user_IN_ARG_uid = +{ + { + -1, + (gchar *) "uid", + (gchar *) "u", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_sessions_for_user_IN_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_sessions_for_user_IN_ARG_uid, + NULL +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_sessions_for_user_OUT_ARG_sessions = +{ + { + -1, + (gchar *) "sessions", + (gchar *) "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_sessions_for_user_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_sessions_for_user_OUT_ARG_sessions, + NULL +}; + +static const GDBusAnnotationInfo _console_kit_manager_method_get_sessions_for_user_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_manager_method_get_sessions_for_user_annotation_info_pointers[] = +{ + &_console_kit_manager_method_get_sessions_for_user_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_get_sessions_for_user = +{ + { + -1, + (gchar *) "GetSessionsForUser", + (GDBusArgInfo **) &_console_kit_manager_method_info_get_sessions_for_user_IN_ARG_pointers, + (GDBusArgInfo **) &_console_kit_manager_method_info_get_sessions_for_user_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_console_kit_manager_method_get_sessions_for_user_annotation_info_pointers + }, + "handle-get-sessions-for-user", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_system_idle_hint_OUT_ARG_idle_hint = +{ + { + -1, + (gchar *) "idle_hint", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_system_idle_hint_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_system_idle_hint_OUT_ARG_idle_hint, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_get_system_idle_hint = +{ + { + -1, + (gchar *) "GetSystemIdleHint", + NULL, + (GDBusArgInfo **) &_console_kit_manager_method_info_get_system_idle_hint_OUT_ARG_pointers, + NULL + }, + "handle-get-system-idle-hint", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_method_info_get_system_idle_since_hint_OUT_ARG_iso8601_datetime = +{ + { + -1, + (gchar *) "iso8601_datetime", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_method_info_get_system_idle_since_hint_OUT_ARG_pointers[] = +{ + &_console_kit_manager_method_info_get_system_idle_since_hint_OUT_ARG_iso8601_datetime, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_manager_method_info_get_system_idle_since_hint = +{ + { + -1, + (gchar *) "GetSystemIdleSinceHint", + NULL, + (GDBusArgInfo **) &_console_kit_manager_method_info_get_system_idle_since_hint_OUT_ARG_pointers, + NULL + }, + "handle-get-system-idle-since-hint", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _console_kit_manager_method_info_pointers[] = +{ + &_console_kit_manager_method_info_restart, + &_console_kit_manager_method_info_can_restart, + &_console_kit_manager_method_info_stop, + &_console_kit_manager_method_info_can_stop, + &_console_kit_manager_method_info_open_session, + &_console_kit_manager_method_info_open_session_with_parameters, + &_console_kit_manager_method_info_close_session, + &_console_kit_manager_method_info_get_seats, + &_console_kit_manager_method_info_get_sessions, + &_console_kit_manager_method_info_get_session_for_cookie, + &_console_kit_manager_method_info_get_session_for_unix_process, + &_console_kit_manager_method_info_get_current_session, + &_console_kit_manager_method_info_get_sessions_for_unix_user, + &_console_kit_manager_method_info_get_sessions_for_user, + &_console_kit_manager_method_info_get_system_idle_hint, + &_console_kit_manager_method_info_get_system_idle_since_hint, + NULL +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_signal_info_seat_added_ARG_sid = +{ + { + -1, + (gchar *) "sid", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_signal_info_seat_added_ARG_pointers[] = +{ + &_console_kit_manager_signal_info_seat_added_ARG_sid, + NULL +}; + +static const _ExtendedGDBusSignalInfo _console_kit_manager_signal_info_seat_added = +{ + { + -1, + (gchar *) "SeatAdded", + (GDBusArgInfo **) &_console_kit_manager_signal_info_seat_added_ARG_pointers, + NULL + }, + "seat-added" +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_signal_info_seat_removed_ARG_sid = +{ + { + -1, + (gchar *) "sid", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_signal_info_seat_removed_ARG_pointers[] = +{ + &_console_kit_manager_signal_info_seat_removed_ARG_sid, + NULL +}; + +static const _ExtendedGDBusSignalInfo _console_kit_manager_signal_info_seat_removed = +{ + { + -1, + (gchar *) "SeatRemoved", + (GDBusArgInfo **) &_console_kit_manager_signal_info_seat_removed_ARG_pointers, + NULL + }, + "seat-removed" +}; + +static const _ExtendedGDBusArgInfo _console_kit_manager_signal_info_system_idle_hint_changed_ARG_hint = +{ + { + -1, + (gchar *) "hint", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_manager_signal_info_system_idle_hint_changed_ARG_pointers[] = +{ + &_console_kit_manager_signal_info_system_idle_hint_changed_ARG_hint, + NULL +}; + +static const _ExtendedGDBusSignalInfo _console_kit_manager_signal_info_system_idle_hint_changed = +{ + { + -1, + (gchar *) "SystemIdleHintChanged", + (GDBusArgInfo **) &_console_kit_manager_signal_info_system_idle_hint_changed_ARG_pointers, + NULL + }, + "system-idle-hint-changed" +}; + +static const _ExtendedGDBusSignalInfo * const _console_kit_manager_signal_info_pointers[] = +{ + &_console_kit_manager_signal_info_seat_added, + &_console_kit_manager_signal_info_seat_removed, + &_console_kit_manager_signal_info_system_idle_hint_changed, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _console_kit_manager_interface_info = +{ + { + -1, + (gchar *) "org.freedesktop.ConsoleKit.Manager", + (GDBusMethodInfo **) &_console_kit_manager_method_info_pointers, + (GDBusSignalInfo **) &_console_kit_manager_signal_info_pointers, + NULL, + NULL + }, + "console-kit-manager", +}; + + +/** + * console_kit_manager_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Manager.top_of_page">org.freedesktop.ConsoleKit.Manager</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +console_kit_manager_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_console_kit_manager_interface_info; +} + +/** + * console_kit_manager_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #ConsoleKitManager interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +console_kit_manager_override_properties (GObjectClass *klass, guint property_id_begin) +{ + return property_id_begin - 1; +} + + + +/** + * ConsoleKitManager: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Manager.top_of_page">org.freedesktop.ConsoleKit.Manager</link>. + */ + +/** + * ConsoleKitManagerIface: + * @parent_iface: The parent interface. + * @handle_can_restart: Handler for the #ConsoleKitManager::handle-can-restart signal. + * @handle_can_stop: Handler for the #ConsoleKitManager::handle-can-stop signal. + * @handle_close_session: Handler for the #ConsoleKitManager::handle-close-session signal. + * @handle_get_current_session: Handler for the #ConsoleKitManager::handle-get-current-session signal. + * @handle_get_seats: Handler for the #ConsoleKitManager::handle-get-seats signal. + * @handle_get_session_for_cookie: Handler for the #ConsoleKitManager::handle-get-session-for-cookie signal. + * @handle_get_session_for_unix_process: Handler for the #ConsoleKitManager::handle-get-session-for-unix-process signal. + * @handle_get_sessions: Handler for the #ConsoleKitManager::handle-get-sessions signal. + * @handle_get_sessions_for_unix_user: Handler for the #ConsoleKitManager::handle-get-sessions-for-unix-user signal. + * @handle_get_sessions_for_user: Handler for the #ConsoleKitManager::handle-get-sessions-for-user signal. + * @handle_get_system_idle_hint: Handler for the #ConsoleKitManager::handle-get-system-idle-hint signal. + * @handle_get_system_idle_since_hint: Handler for the #ConsoleKitManager::handle-get-system-idle-since-hint signal. + * @handle_open_session: Handler for the #ConsoleKitManager::handle-open-session signal. + * @handle_open_session_with_parameters: Handler for the #ConsoleKitManager::handle-open-session-with-parameters signal. + * @handle_restart: Handler for the #ConsoleKitManager::handle-restart signal. + * @handle_stop: Handler for the #ConsoleKitManager::handle-stop signal. + * @seat_added: Handler for the #ConsoleKitManager::seat-added signal. + * @seat_removed: Handler for the #ConsoleKitManager::seat-removed signal. + * @system_idle_hint_changed: Handler for the #ConsoleKitManager::system-idle-hint-changed signal. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Manager.top_of_page">org.freedesktop.ConsoleKit.Manager</link>. + */ + +static void +console_kit_manager_default_init (ConsoleKitManagerIface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * ConsoleKitManager::handle-restart: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.Restart">Restart()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_restart() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-restart", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_restart), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitManager::handle-can-restart: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.CanRestart">CanRestart()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_can_restart() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-can-restart", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_can_restart), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitManager::handle-stop: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.Stop">Stop()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_stop() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-stop", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_stop), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitManager::handle-can-stop: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.CanStop">CanStop()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_can_stop() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-can-stop", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_can_stop), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitManager::handle-open-session: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.OpenSession">OpenSession()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_open_session() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-open-session", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_open_session), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitManager::handle-open-session-with-parameters: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * @arg_parameters: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.OpenSessionWithParameters">OpenSessionWithParameters()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_open_session_with_parameters() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-open-session-with-parameters", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_open_session_with_parameters), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); + + /** + * ConsoleKitManager::handle-close-session: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * @arg_cookie: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.CloseSession">CloseSession()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_close_session() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-close-session", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_close_session), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * ConsoleKitManager::handle-get-seats: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSeats">GetSeats()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_get_seats() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-seats", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_get_seats), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitManager::handle-get-sessions: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessions">GetSessions()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_get_sessions() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-sessions", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_get_sessions), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitManager::handle-get-session-for-cookie: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * @arg_cookie: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionForCookie">GetSessionForCookie()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_get_session_for_cookie() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-session-for-cookie", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_get_session_for_cookie), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * ConsoleKitManager::handle-get-session-for-unix-process: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * @arg_pid: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionForUnixProcess">GetSessionForUnixProcess()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_get_session_for_unix_process() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-session-for-unix-process", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_get_session_for_unix_process), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UINT); + + /** + * ConsoleKitManager::handle-get-current-session: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetCurrentSession">GetCurrentSession()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_get_current_session() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-current-session", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_get_current_session), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitManager::handle-get-sessions-for-unix-user: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * @arg_uid: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionsForUnixUser">GetSessionsForUnixUser()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_get_sessions_for_unix_user() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-sessions-for-unix-user", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_get_sessions_for_unix_user), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UINT); + + /** + * ConsoleKitManager::handle-get-sessions-for-user: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * @arg_uid: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionsForUser">GetSessionsForUser()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_get_sessions_for_user() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-sessions-for-user", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_get_sessions_for_user), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UINT); + + /** + * ConsoleKitManager::handle-get-system-idle-hint: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSystemIdleHint">GetSystemIdleHint()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_get_system_idle_hint() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-system-idle-hint", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_get_system_idle_hint), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitManager::handle-get-system-idle-since-hint: + * @object: A #ConsoleKitManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSystemIdleSinceHint">GetSystemIdleSinceHint()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_manager_complete_get_system_idle_since_hint() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-system-idle-since-hint", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, handle_get_system_idle_since_hint), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /* GObject signals for received D-Bus signals: */ + /** + * ConsoleKitManager::seat-added: + * @object: A #ConsoleKitManager. + * @arg_sid: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Manager.SeatAdded">"SeatAdded"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("seat-added", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, seat_added), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * ConsoleKitManager::seat-removed: + * @object: A #ConsoleKitManager. + * @arg_sid: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Manager.SeatRemoved">"SeatRemoved"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("seat-removed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, seat_removed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * ConsoleKitManager::system-idle-hint-changed: + * @object: A #ConsoleKitManager. + * @arg_hint: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Manager.SystemIdleHintChanged">"SystemIdleHintChanged"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("system-idle-hint-changed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitManagerIface, system_idle_hint_changed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_BOOLEAN); + +} + +typedef ConsoleKitManagerIface ConsoleKitManagerInterface; +G_DEFINE_INTERFACE (ConsoleKitManager, console_kit_manager, G_TYPE_OBJECT); + +/** + * console_kit_manager_emit_seat_added: + * @object: A #ConsoleKitManager. + * @arg_sid: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Manager.SeatAdded">"SeatAdded"</link> D-Bus signal. + */ +void +console_kit_manager_emit_seat_added ( + ConsoleKitManager *object, + const gchar *arg_sid) +{ + g_signal_emit_by_name (object, "seat-added", arg_sid); +} + +/** + * console_kit_manager_emit_seat_removed: + * @object: A #ConsoleKitManager. + * @arg_sid: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Manager.SeatRemoved">"SeatRemoved"</link> D-Bus signal. + */ +void +console_kit_manager_emit_seat_removed ( + ConsoleKitManager *object, + const gchar *arg_sid) +{ + g_signal_emit_by_name (object, "seat-removed", arg_sid); +} + +/** + * console_kit_manager_emit_system_idle_hint_changed: + * @object: A #ConsoleKitManager. + * @arg_hint: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Manager.SystemIdleHintChanged">"SystemIdleHintChanged"</link> D-Bus signal. + */ +void +console_kit_manager_emit_system_idle_hint_changed ( + ConsoleKitManager *object, + gboolean arg_hint) +{ + g_signal_emit_by_name (object, "system-idle-hint-changed", arg_hint); +} + +/** + * console_kit_manager_call_restart: + * @proxy: A #ConsoleKitManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.Restart">Restart()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_restart_finish() to get the result of the operation. + * + * See console_kit_manager_call_restart_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_restart ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Restart", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_restart_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_restart(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_restart(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_restart_finish ( + ConsoleKitManager *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_restart_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.Restart">Restart()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_restart() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_restart_sync ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Restart", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_can_restart: + * @proxy: A #ConsoleKitManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.CanRestart">CanRestart()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_can_restart_finish() to get the result of the operation. + * + * See console_kit_manager_call_can_restart_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_can_restart ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "CanRestart", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_can_restart_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_can_restart: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_can_restart(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_can_restart(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_can_restart_finish ( + ConsoleKitManager *proxy, + gboolean *out_can_restart, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_can_restart); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_can_restart_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @out_can_restart: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.CanRestart">CanRestart()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_can_restart() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_can_restart_sync ( + ConsoleKitManager *proxy, + gboolean *out_can_restart, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "CanRestart", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_can_restart); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_stop: + * @proxy: A #ConsoleKitManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.Stop">Stop()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_stop_finish() to get the result of the operation. + * + * See console_kit_manager_call_stop_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_stop ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Stop", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_stop_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_stop(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_stop(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_stop_finish ( + ConsoleKitManager *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_stop_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.Stop">Stop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_stop() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_stop_sync ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Stop", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_can_stop: + * @proxy: A #ConsoleKitManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.CanStop">CanStop()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_can_stop_finish() to get the result of the operation. + * + * See console_kit_manager_call_can_stop_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_can_stop ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "CanStop", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_can_stop_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_can_stop: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_can_stop(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_can_stop(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_can_stop_finish ( + ConsoleKitManager *proxy, + gboolean *out_can_stop, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_can_stop); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_can_stop_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @out_can_stop: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.CanStop">CanStop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_can_stop() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_can_stop_sync ( + ConsoleKitManager *proxy, + gboolean *out_can_stop, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "CanStop", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_can_stop); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_open_session: + * @proxy: A #ConsoleKitManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.OpenSession">OpenSession()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_open_session_finish() to get the result of the operation. + * + * See console_kit_manager_call_open_session_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_open_session ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "OpenSession", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_open_session_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_cookie: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_open_session(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_open_session(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_open_session_finish ( + ConsoleKitManager *proxy, + gchar **out_cookie, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_cookie); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_open_session_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @out_cookie: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.OpenSession">OpenSession()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_open_session() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_open_session_sync ( + ConsoleKitManager *proxy, + gchar **out_cookie, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "OpenSession", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_cookie); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_open_session_with_parameters: + * @proxy: A #ConsoleKitManagerProxy. + * @arg_parameters: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.OpenSessionWithParameters">OpenSessionWithParameters()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_open_session_with_parameters_finish() to get the result of the operation. + * + * See console_kit_manager_call_open_session_with_parameters_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_open_session_with_parameters ( + ConsoleKitManager *proxy, + GVariant *arg_parameters, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "OpenSessionWithParameters", + g_variant_new ("(@a(sv))", + arg_parameters), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_open_session_with_parameters_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_cookie: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_open_session_with_parameters(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_open_session_with_parameters(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_open_session_with_parameters_finish ( + ConsoleKitManager *proxy, + gchar **out_cookie, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_cookie); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_open_session_with_parameters_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @arg_parameters: Argument to pass with the method invocation. + * @out_cookie: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.OpenSessionWithParameters">OpenSessionWithParameters()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_open_session_with_parameters() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_open_session_with_parameters_sync ( + ConsoleKitManager *proxy, + GVariant *arg_parameters, + gchar **out_cookie, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "OpenSessionWithParameters", + g_variant_new ("(@a(sv))", + arg_parameters), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_cookie); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_close_session: + * @proxy: A #ConsoleKitManagerProxy. + * @arg_cookie: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.CloseSession">CloseSession()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_close_session_finish() to get the result of the operation. + * + * See console_kit_manager_call_close_session_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_close_session ( + ConsoleKitManager *proxy, + const gchar *arg_cookie, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "CloseSession", + g_variant_new ("(s)", + arg_cookie), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_close_session_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_result: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_close_session(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_close_session(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_close_session_finish ( + ConsoleKitManager *proxy, + gboolean *out_result, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_result); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_close_session_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @arg_cookie: Argument to pass with the method invocation. + * @out_result: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.CloseSession">CloseSession()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_close_session() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_close_session_sync ( + ConsoleKitManager *proxy, + const gchar *arg_cookie, + gboolean *out_result, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "CloseSession", + g_variant_new ("(s)", + arg_cookie), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_result); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_seats: + * @proxy: A #ConsoleKitManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSeats">GetSeats()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_get_seats_finish() to get the result of the operation. + * + * See console_kit_manager_call_get_seats_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_get_seats ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetSeats", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_get_seats_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_seats: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_get_seats(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_get_seats(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_seats_finish ( + ConsoleKitManager *proxy, + gchar ***out_seats, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_seats); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_seats_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @out_seats: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSeats">GetSeats()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_get_seats() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_seats_sync ( + ConsoleKitManager *proxy, + gchar ***out_seats, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetSeats", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_seats); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_sessions: + * @proxy: A #ConsoleKitManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessions">GetSessions()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_get_sessions_finish() to get the result of the operation. + * + * See console_kit_manager_call_get_sessions_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_get_sessions ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetSessions", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_get_sessions_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_sessions: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_get_sessions(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_get_sessions(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_sessions_finish ( + ConsoleKitManager *proxy, + gchar ***out_sessions, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_sessions); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_sessions_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @out_sessions: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessions">GetSessions()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_get_sessions() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_sessions_sync ( + ConsoleKitManager *proxy, + gchar ***out_sessions, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetSessions", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_sessions); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_session_for_cookie: + * @proxy: A #ConsoleKitManagerProxy. + * @arg_cookie: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionForCookie">GetSessionForCookie()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_get_session_for_cookie_finish() to get the result of the operation. + * + * See console_kit_manager_call_get_session_for_cookie_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_get_session_for_cookie ( + ConsoleKitManager *proxy, + const gchar *arg_cookie, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetSessionForCookie", + g_variant_new ("(s)", + arg_cookie), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_get_session_for_cookie_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_ssid: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_get_session_for_cookie(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_get_session_for_cookie(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_session_for_cookie_finish ( + ConsoleKitManager *proxy, + gchar **out_ssid, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_ssid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_session_for_cookie_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @arg_cookie: Argument to pass with the method invocation. + * @out_ssid: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionForCookie">GetSessionForCookie()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_get_session_for_cookie() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_session_for_cookie_sync ( + ConsoleKitManager *proxy, + const gchar *arg_cookie, + gchar **out_ssid, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetSessionForCookie", + g_variant_new ("(s)", + arg_cookie), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_ssid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_session_for_unix_process: + * @proxy: A #ConsoleKitManagerProxy. + * @arg_pid: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionForUnixProcess">GetSessionForUnixProcess()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_get_session_for_unix_process_finish() to get the result of the operation. + * + * See console_kit_manager_call_get_session_for_unix_process_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_get_session_for_unix_process ( + ConsoleKitManager *proxy, + guint arg_pid, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetSessionForUnixProcess", + g_variant_new ("(u)", + arg_pid), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_get_session_for_unix_process_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_ssid: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_get_session_for_unix_process(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_get_session_for_unix_process(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_session_for_unix_process_finish ( + ConsoleKitManager *proxy, + gchar **out_ssid, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_ssid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_session_for_unix_process_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @arg_pid: Argument to pass with the method invocation. + * @out_ssid: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionForUnixProcess">GetSessionForUnixProcess()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_get_session_for_unix_process() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_session_for_unix_process_sync ( + ConsoleKitManager *proxy, + guint arg_pid, + gchar **out_ssid, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetSessionForUnixProcess", + g_variant_new ("(u)", + arg_pid), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_ssid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_current_session: + * @proxy: A #ConsoleKitManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetCurrentSession">GetCurrentSession()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_get_current_session_finish() to get the result of the operation. + * + * See console_kit_manager_call_get_current_session_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_get_current_session ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetCurrentSession", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_get_current_session_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_ssid: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_get_current_session(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_get_current_session(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_current_session_finish ( + ConsoleKitManager *proxy, + gchar **out_ssid, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_ssid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_current_session_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @out_ssid: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetCurrentSession">GetCurrentSession()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_get_current_session() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_current_session_sync ( + ConsoleKitManager *proxy, + gchar **out_ssid, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetCurrentSession", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_ssid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_sessions_for_unix_user: + * @proxy: A #ConsoleKitManagerProxy. + * @arg_uid: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionsForUnixUser">GetSessionsForUnixUser()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_get_sessions_for_unix_user_finish() to get the result of the operation. + * + * See console_kit_manager_call_get_sessions_for_unix_user_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_get_sessions_for_unix_user ( + ConsoleKitManager *proxy, + guint arg_uid, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetSessionsForUnixUser", + g_variant_new ("(u)", + arg_uid), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_get_sessions_for_unix_user_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_sessions: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_get_sessions_for_unix_user(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_get_sessions_for_unix_user(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_sessions_for_unix_user_finish ( + ConsoleKitManager *proxy, + gchar ***out_sessions, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_sessions); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_sessions_for_unix_user_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @arg_uid: Argument to pass with the method invocation. + * @out_sessions: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionsForUnixUser">GetSessionsForUnixUser()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_get_sessions_for_unix_user() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_sessions_for_unix_user_sync ( + ConsoleKitManager *proxy, + guint arg_uid, + gchar ***out_sessions, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetSessionsForUnixUser", + g_variant_new ("(u)", + arg_uid), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_sessions); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_sessions_for_user: + * @proxy: A #ConsoleKitManagerProxy. + * @arg_uid: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionsForUser">GetSessionsForUser()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_get_sessions_for_user_finish() to get the result of the operation. + * + * See console_kit_manager_call_get_sessions_for_user_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_get_sessions_for_user ( + ConsoleKitManager *proxy, + guint arg_uid, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetSessionsForUser", + g_variant_new ("(u)", + arg_uid), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_get_sessions_for_user_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_sessions: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_get_sessions_for_user(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_get_sessions_for_user(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_sessions_for_user_finish ( + ConsoleKitManager *proxy, + gchar ***out_sessions, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_sessions); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_sessions_for_user_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @arg_uid: Argument to pass with the method invocation. + * @out_sessions: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionsForUser">GetSessionsForUser()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_get_sessions_for_user() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_sessions_for_user_sync ( + ConsoleKitManager *proxy, + guint arg_uid, + gchar ***out_sessions, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetSessionsForUser", + g_variant_new ("(u)", + arg_uid), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_sessions); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_system_idle_hint: + * @proxy: A #ConsoleKitManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSystemIdleHint">GetSystemIdleHint()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_get_system_idle_hint_finish() to get the result of the operation. + * + * See console_kit_manager_call_get_system_idle_hint_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_get_system_idle_hint ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetSystemIdleHint", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_get_system_idle_hint_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_idle_hint: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_get_system_idle_hint(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_get_system_idle_hint(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_system_idle_hint_finish ( + ConsoleKitManager *proxy, + gboolean *out_idle_hint, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_idle_hint); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_system_idle_hint_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @out_idle_hint: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSystemIdleHint">GetSystemIdleHint()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_get_system_idle_hint() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_system_idle_hint_sync ( + ConsoleKitManager *proxy, + gboolean *out_idle_hint, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetSystemIdleHint", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_idle_hint); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_system_idle_since_hint: + * @proxy: A #ConsoleKitManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSystemIdleSinceHint">GetSystemIdleSinceHint()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_call_get_system_idle_since_hint_finish() to get the result of the operation. + * + * See console_kit_manager_call_get_system_idle_since_hint_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_manager_call_get_system_idle_since_hint ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetSystemIdleSinceHint", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_manager_call_get_system_idle_since_hint_finish: + * @proxy: A #ConsoleKitManagerProxy. + * @out_iso8601_datetime: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_call_get_system_idle_since_hint(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_manager_call_get_system_idle_since_hint(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_system_idle_since_hint_finish ( + ConsoleKitManager *proxy, + gchar **out_iso8601_datetime, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_iso8601_datetime); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_call_get_system_idle_since_hint_sync: + * @proxy: A #ConsoleKitManagerProxy. + * @out_iso8601_datetime: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSystemIdleSinceHint">GetSystemIdleSinceHint()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_manager_call_get_system_idle_since_hint() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_manager_call_get_system_idle_since_hint_sync ( + ConsoleKitManager *proxy, + gchar **out_iso8601_datetime, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetSystemIdleSinceHint", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_iso8601_datetime); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_manager_complete_restart: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.Restart">Restart()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_restart ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * console_kit_manager_complete_can_restart: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @can_restart: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.CanRestart">CanRestart()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_can_restart ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + gboolean can_restart) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(b)", + can_restart)); +} + +/** + * console_kit_manager_complete_stop: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.Stop">Stop()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_stop ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * console_kit_manager_complete_can_stop: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @can_stop: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.CanStop">CanStop()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_can_stop ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + gboolean can_stop) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(b)", + can_stop)); +} + +/** + * console_kit_manager_complete_open_session: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @cookie: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.OpenSession">OpenSession()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_open_session ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *cookie) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(s)", + cookie)); +} + +/** + * console_kit_manager_complete_open_session_with_parameters: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @cookie: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.OpenSessionWithParameters">OpenSessionWithParameters()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_open_session_with_parameters ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *cookie) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(s)", + cookie)); +} + +/** + * console_kit_manager_complete_close_session: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @result: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.CloseSession">CloseSession()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_close_session ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + gboolean result) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(b)", + result)); +} + +/** + * console_kit_manager_complete_get_seats: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @seats: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSeats">GetSeats()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_get_seats ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *const *seats) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^ao)", + seats)); +} + +/** + * console_kit_manager_complete_get_sessions: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @sessions: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessions">GetSessions()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_get_sessions ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *const *sessions) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^ao)", + sessions)); +} + +/** + * console_kit_manager_complete_get_session_for_cookie: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @ssid: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionForCookie">GetSessionForCookie()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_get_session_for_cookie ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *ssid) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(o)", + ssid)); +} + +/** + * console_kit_manager_complete_get_session_for_unix_process: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @ssid: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionForUnixProcess">GetSessionForUnixProcess()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_get_session_for_unix_process ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *ssid) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(o)", + ssid)); +} + +/** + * console_kit_manager_complete_get_current_session: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @ssid: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetCurrentSession">GetCurrentSession()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_get_current_session ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *ssid) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(o)", + ssid)); +} + +/** + * console_kit_manager_complete_get_sessions_for_unix_user: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @sessions: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionsForUnixUser">GetSessionsForUnixUser()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_get_sessions_for_unix_user ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *const *sessions) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^ao)", + sessions)); +} + +/** + * console_kit_manager_complete_get_sessions_for_user: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @sessions: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSessionsForUser">GetSessionsForUser()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_get_sessions_for_user ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *const *sessions) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^ao)", + sessions)); +} + +/** + * console_kit_manager_complete_get_system_idle_hint: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @idle_hint: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSystemIdleHint">GetSystemIdleHint()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_get_system_idle_hint ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + gboolean idle_hint) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(b)", + idle_hint)); +} + +/** + * console_kit_manager_complete_get_system_idle_since_hint: + * @object: A #ConsoleKitManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @iso8601_datetime: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Manager.GetSystemIdleSinceHint">GetSystemIdleSinceHint()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_manager_complete_get_system_idle_since_hint ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *iso8601_datetime) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(s)", + iso8601_datetime)); +} + +/* ------------------------------------------------------------------------ */ + +/** + * ConsoleKitManagerProxy: + * + * The #ConsoleKitManagerProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * ConsoleKitManagerProxyClass: + * @parent_class: The parent class. + * + * Class structure for #ConsoleKitManagerProxy. + */ + +struct _ConsoleKitManagerProxyPrivate +{ + GData *qdata; +}; + +static void console_kit_manager_proxy_iface_init (ConsoleKitManagerIface *iface); + +G_DEFINE_TYPE_WITH_CODE (ConsoleKitManagerProxy, console_kit_manager_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_CONSOLE_KIT_MANAGER, console_kit_manager_proxy_iface_init)); + +static void +console_kit_manager_proxy_finalize (GObject *object) +{ + ConsoleKitManagerProxy *proxy = CONSOLE_KIT_MANAGER_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (console_kit_manager_proxy_parent_class)->finalize (object); +} + +static void +console_kit_manager_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ +} + +static void +console_kit_manager_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ +} + +static void +console_kit_manager_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_console_kit_manager_interface_info, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_CONSOLE_KIT_MANAGER); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_CONSOLE_KIT_MANAGER); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +console_kit_manager_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + ConsoleKitManagerProxy *proxy = CONSOLE_KIT_MANAGER_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_console_kit_manager_interface_info, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_console_kit_manager_interface_info, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static void +console_kit_manager_proxy_init (ConsoleKitManagerProxy *proxy) +{ + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONSOLE_KIT_MANAGER_PROXY, ConsoleKitManagerProxyPrivate); + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), console_kit_manager_interface_info ()); +} + +static void +console_kit_manager_proxy_class_init (ConsoleKitManagerProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + g_type_class_add_private (klass, sizeof (ConsoleKitManagerProxyPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = console_kit_manager_proxy_finalize; + gobject_class->get_property = console_kit_manager_proxy_get_property; + gobject_class->set_property = console_kit_manager_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = console_kit_manager_proxy_g_signal; + proxy_class->g_properties_changed = console_kit_manager_proxy_g_properties_changed; + +} + +static void +console_kit_manager_proxy_iface_init (ConsoleKitManagerIface *iface) +{ +} + +/** + * console_kit_manager_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Manager.top_of_page">org.freedesktop.ConsoleKit.Manager</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_proxy_new_finish() to get the result of the operation. + * + * See console_kit_manager_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +console_kit_manager_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_CONSOLE_KIT_MANAGER_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.ConsoleKit.Manager", NULL); +} + +/** + * console_kit_manager_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with console_kit_manager_proxy_new(). + * + * Returns: (transfer full) (type ConsoleKitManagerProxy): The constructed proxy object or %NULL if @error is set. + */ +ConsoleKitManager * +console_kit_manager_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return CONSOLE_KIT_MANAGER (ret); + else + return NULL; +} + +/** + * console_kit_manager_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Manager.top_of_page">org.freedesktop.ConsoleKit.Manager</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See console_kit_manager_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type ConsoleKitManagerProxy): The constructed proxy object or %NULL if @error is set. + */ +ConsoleKitManager * +console_kit_manager_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_CONSOLE_KIT_MANAGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.ConsoleKit.Manager", NULL); + if (ret != NULL) + return CONSOLE_KIT_MANAGER (ret); + else + return NULL; +} + + +/** + * console_kit_manager_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like console_kit_manager_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_manager_proxy_new_for_bus_finish() to get the result of the operation. + * + * See console_kit_manager_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +console_kit_manager_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_CONSOLE_KIT_MANAGER_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.ConsoleKit.Manager", NULL); +} + +/** + * console_kit_manager_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_manager_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with console_kit_manager_proxy_new_for_bus(). + * + * Returns: (transfer full) (type ConsoleKitManagerProxy): The constructed proxy object or %NULL if @error is set. + */ +ConsoleKitManager * +console_kit_manager_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return CONSOLE_KIT_MANAGER (ret); + else + return NULL; +} + +/** + * console_kit_manager_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like console_kit_manager_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See console_kit_manager_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type ConsoleKitManagerProxy): The constructed proxy object or %NULL if @error is set. + */ +ConsoleKitManager * +console_kit_manager_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_CONSOLE_KIT_MANAGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.ConsoleKit.Manager", NULL); + if (ret != NULL) + return CONSOLE_KIT_MANAGER (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * ConsoleKitManagerSkeleton: + * + * The #ConsoleKitManagerSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * ConsoleKitManagerSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #ConsoleKitManagerSkeleton. + */ + +struct _ConsoleKitManagerSkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_console_kit_manager_skeleton_handle_method_call ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + ConsoleKitManagerSkeleton *skeleton = CONSOLE_KIT_MANAGER_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_CONSOLE_KIT_MANAGER); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_CONSOLE_KIT_MANAGER); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + 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); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_console_kit_manager_skeleton_handle_get_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + ConsoleKitManagerSkeleton *skeleton = CONSOLE_KIT_MANAGER_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_console_kit_manager_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_console_kit_manager_skeleton_handle_set_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + ConsoleKitManagerSkeleton *skeleton = CONSOLE_KIT_MANAGER_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_console_kit_manager_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _console_kit_manager_skeleton_vtable = +{ + _console_kit_manager_skeleton_handle_method_call, + _console_kit_manager_skeleton_handle_get_property, + _console_kit_manager_skeleton_handle_set_property +}; + +static GDBusInterfaceInfo * +console_kit_manager_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton) +{ + return console_kit_manager_interface_info (); +} + +static GDBusInterfaceVTable * +console_kit_manager_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton) +{ + return (GDBusInterfaceVTable *) &_console_kit_manager_skeleton_vtable; +} + +static GVariant * +console_kit_manager_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + ConsoleKitManagerSkeleton *skeleton = CONSOLE_KIT_MANAGER_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_console_kit_manager_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _console_kit_manager_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _console_kit_manager_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _console_kit_manager_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.ConsoleKit.Manager", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static void +console_kit_manager_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ +} + +static void +_console_kit_manager_on_signal_seat_added ( + ConsoleKitManager *object, + const gchar *arg_sid) +{ + ConsoleKitManagerSkeleton *skeleton = CONSOLE_KIT_MANAGER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o)", + arg_sid)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.ConsoleKit.Manager", "SeatAdded", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_console_kit_manager_on_signal_seat_removed ( + ConsoleKitManager *object, + const gchar *arg_sid) +{ + ConsoleKitManagerSkeleton *skeleton = CONSOLE_KIT_MANAGER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o)", + arg_sid)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.ConsoleKit.Manager", "SeatRemoved", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_console_kit_manager_on_signal_system_idle_hint_changed ( + ConsoleKitManager *object, + gboolean arg_hint) +{ + ConsoleKitManagerSkeleton *skeleton = CONSOLE_KIT_MANAGER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(b)", + arg_hint)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.ConsoleKit.Manager", "SystemIdleHintChanged", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void console_kit_manager_skeleton_iface_init (ConsoleKitManagerIface *iface); +G_DEFINE_TYPE_WITH_CODE (ConsoleKitManagerSkeleton, console_kit_manager_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_CONSOLE_KIT_MANAGER, console_kit_manager_skeleton_iface_init)); + +static void +console_kit_manager_skeleton_finalize (GObject *object) +{ + ConsoleKitManagerSkeleton *skeleton = CONSOLE_KIT_MANAGER_SKELETON (object); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (console_kit_manager_skeleton_parent_class)->finalize (object); +} + +static void +console_kit_manager_skeleton_init (ConsoleKitManagerSkeleton *skeleton) +{ + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONSOLE_KIT_MANAGER_SKELETON, ConsoleKitManagerSkeletonPrivate); + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); +} + +static void +console_kit_manager_skeleton_class_init (ConsoleKitManagerSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + g_type_class_add_private (klass, sizeof (ConsoleKitManagerSkeletonPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = console_kit_manager_skeleton_finalize; + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = console_kit_manager_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = console_kit_manager_skeleton_dbus_interface_get_properties; + skeleton_class->flush = console_kit_manager_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = console_kit_manager_skeleton_dbus_interface_get_vtable; +} + +static void +console_kit_manager_skeleton_iface_init (ConsoleKitManagerIface *iface) +{ + iface->seat_added = _console_kit_manager_on_signal_seat_added; + iface->seat_removed = _console_kit_manager_on_signal_seat_removed; + iface->system_idle_hint_changed = _console_kit_manager_on_signal_system_idle_hint_changed; +} + +/** + * console_kit_manager_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Manager.top_of_page">org.freedesktop.ConsoleKit.Manager</link>. + * + * Returns: (transfer full) (type ConsoleKitManagerSkeleton): The skeleton object. + */ +ConsoleKitManager * +console_kit_manager_skeleton_new (void) +{ + return CONSOLE_KIT_MANAGER (g_object_new (TYPE_CONSOLE_KIT_MANAGER_SKELETON, NULL)); +} + diff --git a/src/dbus-consolekit-manager.h b/src/dbus-consolekit-manager.h new file mode 100644 index 0000000..60c7413 --- /dev/null +++ b/src/dbus-consolekit-manager.h @@ -0,0 +1,615 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __DBUS_CONSOLEKIT_MANAGER_H__ +#define __DBUS_CONSOLEKIT_MANAGER_H__ + +#include <gio/gio.h> + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.freedesktop.ConsoleKit.Manager */ + +#define TYPE_CONSOLE_KIT_MANAGER (console_kit_manager_get_type ()) +#define CONSOLE_KIT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_CONSOLE_KIT_MANAGER, ConsoleKitManager)) +#define IS_CONSOLE_KIT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_CONSOLE_KIT_MANAGER)) +#define CONSOLE_KIT_MANAGER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_CONSOLE_KIT_MANAGER, ConsoleKitManagerIface)) + +struct _ConsoleKitManager; +typedef struct _ConsoleKitManager ConsoleKitManager; +typedef struct _ConsoleKitManagerIface ConsoleKitManagerIface; + +struct _ConsoleKitManagerIface +{ + GTypeInterface parent_iface; + + + gboolean (*handle_can_restart) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_can_stop) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_close_session) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *arg_cookie); + + gboolean (*handle_get_current_session) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_seats) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_session_for_cookie) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *arg_cookie); + + gboolean (*handle_get_session_for_unix_process) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + guint arg_pid); + + gboolean (*handle_get_sessions) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_sessions_for_unix_user) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + guint arg_uid); + + gboolean (*handle_get_sessions_for_user) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + guint arg_uid); + + gboolean (*handle_get_system_idle_hint) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_system_idle_since_hint) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_open_session) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_open_session_with_parameters) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + GVariant *arg_parameters); + + gboolean (*handle_restart) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_stop) ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation); + + void (*seat_added) ( + ConsoleKitManager *object, + const gchar *arg_sid); + + void (*seat_removed) ( + ConsoleKitManager *object, + const gchar *arg_sid); + + void (*system_idle_hint_changed) ( + ConsoleKitManager *object, + gboolean arg_hint); + +}; + +GType console_kit_manager_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *console_kit_manager_interface_info (void); +guint console_kit_manager_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void console_kit_manager_complete_restart ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation); + +void console_kit_manager_complete_can_restart ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + gboolean can_restart); + +void console_kit_manager_complete_stop ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation); + +void console_kit_manager_complete_can_stop ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + gboolean can_stop); + +void console_kit_manager_complete_open_session ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *cookie); + +void console_kit_manager_complete_open_session_with_parameters ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *cookie); + +void console_kit_manager_complete_close_session ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + gboolean result); + +void console_kit_manager_complete_get_seats ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *const *seats); + +void console_kit_manager_complete_get_sessions ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *const *sessions); + +void console_kit_manager_complete_get_session_for_cookie ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *ssid); + +void console_kit_manager_complete_get_session_for_unix_process ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *ssid); + +void console_kit_manager_complete_get_current_session ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *ssid); + +void console_kit_manager_complete_get_sessions_for_unix_user ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *const *sessions); + +void console_kit_manager_complete_get_sessions_for_user ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *const *sessions); + +void console_kit_manager_complete_get_system_idle_hint ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + gboolean idle_hint); + +void console_kit_manager_complete_get_system_idle_since_hint ( + ConsoleKitManager *object, + GDBusMethodInvocation *invocation, + const gchar *iso8601_datetime); + + + +/* D-Bus signal emissions functions: */ +void console_kit_manager_emit_seat_added ( + ConsoleKitManager *object, + const gchar *arg_sid); + +void console_kit_manager_emit_seat_removed ( + ConsoleKitManager *object, + const gchar *arg_sid); + +void console_kit_manager_emit_system_idle_hint_changed ( + ConsoleKitManager *object, + gboolean arg_hint); + + + +/* D-Bus method calls: */ +void console_kit_manager_call_restart ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_restart_finish ( + ConsoleKitManager *proxy, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_restart_sync ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_can_restart ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_can_restart_finish ( + ConsoleKitManager *proxy, + gboolean *out_can_restart, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_can_restart_sync ( + ConsoleKitManager *proxy, + gboolean *out_can_restart, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_stop ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_stop_finish ( + ConsoleKitManager *proxy, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_stop_sync ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_can_stop ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_can_stop_finish ( + ConsoleKitManager *proxy, + gboolean *out_can_stop, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_can_stop_sync ( + ConsoleKitManager *proxy, + gboolean *out_can_stop, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_open_session ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_open_session_finish ( + ConsoleKitManager *proxy, + gchar **out_cookie, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_open_session_sync ( + ConsoleKitManager *proxy, + gchar **out_cookie, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_open_session_with_parameters ( + ConsoleKitManager *proxy, + GVariant *arg_parameters, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_open_session_with_parameters_finish ( + ConsoleKitManager *proxy, + gchar **out_cookie, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_open_session_with_parameters_sync ( + ConsoleKitManager *proxy, + GVariant *arg_parameters, + gchar **out_cookie, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_close_session ( + ConsoleKitManager *proxy, + const gchar *arg_cookie, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_close_session_finish ( + ConsoleKitManager *proxy, + gboolean *out_result, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_close_session_sync ( + ConsoleKitManager *proxy, + const gchar *arg_cookie, + gboolean *out_result, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_get_seats ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_get_seats_finish ( + ConsoleKitManager *proxy, + gchar ***out_seats, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_get_seats_sync ( + ConsoleKitManager *proxy, + gchar ***out_seats, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_get_sessions ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_get_sessions_finish ( + ConsoleKitManager *proxy, + gchar ***out_sessions, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_get_sessions_sync ( + ConsoleKitManager *proxy, + gchar ***out_sessions, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_get_session_for_cookie ( + ConsoleKitManager *proxy, + const gchar *arg_cookie, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_get_session_for_cookie_finish ( + ConsoleKitManager *proxy, + gchar **out_ssid, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_get_session_for_cookie_sync ( + ConsoleKitManager *proxy, + const gchar *arg_cookie, + gchar **out_ssid, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_get_session_for_unix_process ( + ConsoleKitManager *proxy, + guint arg_pid, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_get_session_for_unix_process_finish ( + ConsoleKitManager *proxy, + gchar **out_ssid, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_get_session_for_unix_process_sync ( + ConsoleKitManager *proxy, + guint arg_pid, + gchar **out_ssid, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_get_current_session ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_get_current_session_finish ( + ConsoleKitManager *proxy, + gchar **out_ssid, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_get_current_session_sync ( + ConsoleKitManager *proxy, + gchar **out_ssid, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_get_sessions_for_unix_user ( + ConsoleKitManager *proxy, + guint arg_uid, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_get_sessions_for_unix_user_finish ( + ConsoleKitManager *proxy, + gchar ***out_sessions, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_get_sessions_for_unix_user_sync ( + ConsoleKitManager *proxy, + guint arg_uid, + gchar ***out_sessions, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_get_sessions_for_user ( + ConsoleKitManager *proxy, + guint arg_uid, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_get_sessions_for_user_finish ( + ConsoleKitManager *proxy, + gchar ***out_sessions, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_get_sessions_for_user_sync ( + ConsoleKitManager *proxy, + guint arg_uid, + gchar ***out_sessions, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_get_system_idle_hint ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_get_system_idle_hint_finish ( + ConsoleKitManager *proxy, + gboolean *out_idle_hint, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_get_system_idle_hint_sync ( + ConsoleKitManager *proxy, + gboolean *out_idle_hint, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_call_get_system_idle_since_hint ( + ConsoleKitManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_manager_call_get_system_idle_since_hint_finish ( + ConsoleKitManager *proxy, + gchar **out_iso8601_datetime, + GAsyncResult *res, + GError **error); + +gboolean console_kit_manager_call_get_system_idle_since_hint_sync ( + ConsoleKitManager *proxy, + gchar **out_iso8601_datetime, + GCancellable *cancellable, + GError **error); + + + +/* ---- */ + +#define TYPE_CONSOLE_KIT_MANAGER_PROXY (console_kit_manager_proxy_get_type ()) +#define CONSOLE_KIT_MANAGER_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_CONSOLE_KIT_MANAGER_PROXY, ConsoleKitManagerProxy)) +#define CONSOLE_KIT_MANAGER_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_CONSOLE_KIT_MANAGER_PROXY, ConsoleKitManagerProxyClass)) +#define CONSOLE_KIT_MANAGER_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_CONSOLE_KIT_MANAGER_PROXY, ConsoleKitManagerProxyClass)) +#define IS_CONSOLE_KIT_MANAGER_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_CONSOLE_KIT_MANAGER_PROXY)) +#define IS_CONSOLE_KIT_MANAGER_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_CONSOLE_KIT_MANAGER_PROXY)) + +typedef struct _ConsoleKitManagerProxy ConsoleKitManagerProxy; +typedef struct _ConsoleKitManagerProxyClass ConsoleKitManagerProxyClass; +typedef struct _ConsoleKitManagerProxyPrivate ConsoleKitManagerProxyPrivate; + +struct _ConsoleKitManagerProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + ConsoleKitManagerProxyPrivate *priv; +}; + +struct _ConsoleKitManagerProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType console_kit_manager_proxy_get_type (void) G_GNUC_CONST; + +void console_kit_manager_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +ConsoleKitManager *console_kit_manager_proxy_new_finish ( + GAsyncResult *res, + GError **error); +ConsoleKitManager *console_kit_manager_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void console_kit_manager_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +ConsoleKitManager *console_kit_manager_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +ConsoleKitManager *console_kit_manager_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_CONSOLE_KIT_MANAGER_SKELETON (console_kit_manager_skeleton_get_type ()) +#define CONSOLE_KIT_MANAGER_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_CONSOLE_KIT_MANAGER_SKELETON, ConsoleKitManagerSkeleton)) +#define CONSOLE_KIT_MANAGER_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_CONSOLE_KIT_MANAGER_SKELETON, ConsoleKitManagerSkeletonClass)) +#define CONSOLE_KIT_MANAGER_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_CONSOLE_KIT_MANAGER_SKELETON, ConsoleKitManagerSkeletonClass)) +#define IS_CONSOLE_KIT_MANAGER_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_CONSOLE_KIT_MANAGER_SKELETON)) +#define IS_CONSOLE_KIT_MANAGER_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_CONSOLE_KIT_MANAGER_SKELETON)) + +typedef struct _ConsoleKitManagerSkeleton ConsoleKitManagerSkeleton; +typedef struct _ConsoleKitManagerSkeletonClass ConsoleKitManagerSkeletonClass; +typedef struct _ConsoleKitManagerSkeletonPrivate ConsoleKitManagerSkeletonPrivate; + +struct _ConsoleKitManagerSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + ConsoleKitManagerSkeletonPrivate *priv; +}; + +struct _ConsoleKitManagerSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType console_kit_manager_skeleton_get_type (void) G_GNUC_CONST; + +ConsoleKitManager *console_kit_manager_skeleton_new (void); + + +G_END_DECLS + +#endif /* __DBUS_CONSOLEKIT_MANAGER_H__ */ diff --git a/src/dbus-consolekit-seat.c b/src/dbus-consolekit-seat.c new file mode 100644 index 0000000..aa3c9ad --- /dev/null +++ b/src/dbus-consolekit-seat.c @@ -0,0 +1,2339 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "dbus-consolekit-seat.h" + +#include <string.h> +#ifdef G_OS_UNIX +# include <gio/gunixfdlist.h> +#endif + +typedef struct +{ + GDBusArgInfo parent_struct; + gboolean use_gvariant; +} _ExtendedGDBusArgInfo; + +typedef struct +{ + GDBusMethodInfo parent_struct; + const gchar *signal_name; + gboolean pass_fdlist; +} _ExtendedGDBusMethodInfo; + +typedef struct +{ + GDBusSignalInfo parent_struct; + const gchar *signal_name; +} _ExtendedGDBusSignalInfo; + +typedef struct +{ + GDBusPropertyInfo parent_struct; + const gchar *hyphen_name; + gboolean use_gvariant; +} _ExtendedGDBusPropertyInfo; + +typedef struct +{ + GDBusInterfaceInfo parent_struct; + const gchar *hyphen_name; +} _ExtendedGDBusInterfaceInfo; + +typedef struct +{ + const _ExtendedGDBusPropertyInfo *info; + guint prop_id; + GValue orig_value; /* the value before the change */ +} ChangedProperty; + +static void +_changed_property_free (ChangedProperty *data) +{ + g_value_unset (&data->orig_value); + g_free (data); +} + +static gboolean +_g_strv_equal0 (gchar **a, gchar **b) +{ + gboolean ret = FALSE; + guint n; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + if (g_strv_length (a) != g_strv_length (b)) + goto out; + for (n = 0; a[n] != NULL; n++) + if (g_strcmp0 (a[n], b[n]) != 0) + goto out; + ret = TRUE; +out: + return ret; +} + +static gboolean +_g_variant_equal0 (GVariant *a, GVariant *b) +{ + gboolean ret = FALSE; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + ret = g_variant_equal (a, b); +out: + return ret; +} + +G_GNUC_UNUSED static gboolean +_g_value_equal (const GValue *a, const GValue *b) +{ + gboolean ret = FALSE; + g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); + switch (G_VALUE_TYPE (a)) + { + case G_TYPE_BOOLEAN: + ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); + break; + case G_TYPE_UCHAR: + ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); + break; + case G_TYPE_INT: + ret = (g_value_get_int (a) == g_value_get_int (b)); + break; + case G_TYPE_UINT: + ret = (g_value_get_uint (a) == g_value_get_uint (b)); + break; + case G_TYPE_INT64: + ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); + break; + case G_TYPE_UINT64: + ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); + break; + case G_TYPE_DOUBLE: + { + /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ + gdouble da = g_value_get_double (a); + gdouble db = g_value_get_double (b); + ret = memcmp (&da, &db, sizeof (gdouble)) == 0; + } + break; + case G_TYPE_STRING: + ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); + break; + case G_TYPE_VARIANT: + ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); + break; + default: + if (G_VALUE_TYPE (a) == G_TYPE_STRV) + ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); + else + g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); + break; + } + return ret; +} + +/* ------------------------------------------------------------------------ + * Code for interface org.freedesktop.ConsoleKit.Seat + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:ConsoleKitSeat + * @title: ConsoleKitSeat + * @short_description: Generated C code for the org.freedesktop.ConsoleKit.Seat D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Seat.top_of_page">org.freedesktop.ConsoleKit.Seat</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.freedesktop.ConsoleKit.Seat ---- */ + +static const _ExtendedGDBusArgInfo _console_kit_seat_method_info_get_id_OUT_ARG_sid = +{ + { + -1, + (gchar *) "sid", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_seat_method_info_get_id_OUT_ARG_pointers[] = +{ + &_console_kit_seat_method_info_get_id_OUT_ARG_sid, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_seat_method_info_get_id = +{ + { + -1, + (gchar *) "GetId", + NULL, + (GDBusArgInfo **) &_console_kit_seat_method_info_get_id_OUT_ARG_pointers, + NULL + }, + "handle-get-id", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_seat_method_info_get_sessions_OUT_ARG_sessions = +{ + { + -1, + (gchar *) "sessions", + (gchar *) "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_seat_method_info_get_sessions_OUT_ARG_pointers[] = +{ + &_console_kit_seat_method_info_get_sessions_OUT_ARG_sessions, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_seat_method_info_get_sessions = +{ + { + -1, + (gchar *) "GetSessions", + NULL, + (GDBusArgInfo **) &_console_kit_seat_method_info_get_sessions_OUT_ARG_pointers, + NULL + }, + "handle-get-sessions", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_seat_method_info_get_devices_OUT_ARG_devices = +{ + { + -1, + (gchar *) "devices", + (gchar *) "a(ss)", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_seat_method_info_get_devices_OUT_ARG_pointers[] = +{ + &_console_kit_seat_method_info_get_devices_OUT_ARG_devices, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_seat_method_info_get_devices = +{ + { + -1, + (gchar *) "GetDevices", + NULL, + (GDBusArgInfo **) &_console_kit_seat_method_info_get_devices_OUT_ARG_pointers, + NULL + }, + "handle-get-devices", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_seat_method_info_get_active_session_OUT_ARG_ssid = +{ + { + -1, + (gchar *) "ssid", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_seat_method_info_get_active_session_OUT_ARG_pointers[] = +{ + &_console_kit_seat_method_info_get_active_session_OUT_ARG_ssid, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_seat_method_info_get_active_session = +{ + { + -1, + (gchar *) "GetActiveSession", + NULL, + (GDBusArgInfo **) &_console_kit_seat_method_info_get_active_session_OUT_ARG_pointers, + NULL + }, + "handle-get-active-session", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_seat_method_info_can_activate_sessions_OUT_ARG_can_activate = +{ + { + -1, + (gchar *) "can_activate", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_seat_method_info_can_activate_sessions_OUT_ARG_pointers[] = +{ + &_console_kit_seat_method_info_can_activate_sessions_OUT_ARG_can_activate, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_seat_method_info_can_activate_sessions = +{ + { + -1, + (gchar *) "CanActivateSessions", + NULL, + (GDBusArgInfo **) &_console_kit_seat_method_info_can_activate_sessions_OUT_ARG_pointers, + NULL + }, + "handle-can-activate-sessions", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_seat_method_info_activate_session_IN_ARG_ssid = +{ + { + -1, + (gchar *) "ssid", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_seat_method_info_activate_session_IN_ARG_pointers[] = +{ + &_console_kit_seat_method_info_activate_session_IN_ARG_ssid, + NULL +}; + +static const GDBusAnnotationInfo _console_kit_seat_method_activate_session_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_seat_method_activate_session_annotation_info_pointers[] = +{ + &_console_kit_seat_method_activate_session_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_seat_method_info_activate_session = +{ + { + -1, + (gchar *) "ActivateSession", + (GDBusArgInfo **) &_console_kit_seat_method_info_activate_session_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_console_kit_seat_method_activate_session_annotation_info_pointers + }, + "handle-activate-session", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _console_kit_seat_method_info_pointers[] = +{ + &_console_kit_seat_method_info_get_id, + &_console_kit_seat_method_info_get_sessions, + &_console_kit_seat_method_info_get_devices, + &_console_kit_seat_method_info_get_active_session, + &_console_kit_seat_method_info_can_activate_sessions, + &_console_kit_seat_method_info_activate_session, + NULL +}; + +static const _ExtendedGDBusArgInfo _console_kit_seat_signal_info_active_session_changed_ARG_ssid = +{ + { + -1, + (gchar *) "ssid", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_seat_signal_info_active_session_changed_ARG_pointers[] = +{ + &_console_kit_seat_signal_info_active_session_changed_ARG_ssid, + NULL +}; + +static const _ExtendedGDBusSignalInfo _console_kit_seat_signal_info_active_session_changed = +{ + { + -1, + (gchar *) "ActiveSessionChanged", + (GDBusArgInfo **) &_console_kit_seat_signal_info_active_session_changed_ARG_pointers, + NULL + }, + "active-session-changed" +}; + +static const _ExtendedGDBusArgInfo _console_kit_seat_signal_info_session_added_ARG_ssid = +{ + { + -1, + (gchar *) "ssid", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_seat_signal_info_session_added_ARG_pointers[] = +{ + &_console_kit_seat_signal_info_session_added_ARG_ssid, + NULL +}; + +static const _ExtendedGDBusSignalInfo _console_kit_seat_signal_info_session_added = +{ + { + -1, + (gchar *) "SessionAdded", + (GDBusArgInfo **) &_console_kit_seat_signal_info_session_added_ARG_pointers, + NULL + }, + "session-added" +}; + +static const _ExtendedGDBusArgInfo _console_kit_seat_signal_info_session_removed_ARG_ssid = +{ + { + -1, + (gchar *) "ssid", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_seat_signal_info_session_removed_ARG_pointers[] = +{ + &_console_kit_seat_signal_info_session_removed_ARG_ssid, + NULL +}; + +static const _ExtendedGDBusSignalInfo _console_kit_seat_signal_info_session_removed = +{ + { + -1, + (gchar *) "SessionRemoved", + (GDBusArgInfo **) &_console_kit_seat_signal_info_session_removed_ARG_pointers, + NULL + }, + "session-removed" +}; + +static const _ExtendedGDBusArgInfo _console_kit_seat_signal_info_device_added_ARG_device = +{ + { + -1, + (gchar *) "device", + (gchar *) "(ss)", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_seat_signal_info_device_added_ARG_pointers[] = +{ + &_console_kit_seat_signal_info_device_added_ARG_device, + NULL +}; + +static const _ExtendedGDBusSignalInfo _console_kit_seat_signal_info_device_added = +{ + { + -1, + (gchar *) "DeviceAdded", + (GDBusArgInfo **) &_console_kit_seat_signal_info_device_added_ARG_pointers, + NULL + }, + "device-added" +}; + +static const _ExtendedGDBusArgInfo _console_kit_seat_signal_info_device_removed_ARG_device = +{ + { + -1, + (gchar *) "device", + (gchar *) "(ss)", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_seat_signal_info_device_removed_ARG_pointers[] = +{ + &_console_kit_seat_signal_info_device_removed_ARG_device, + NULL +}; + +static const _ExtendedGDBusSignalInfo _console_kit_seat_signal_info_device_removed = +{ + { + -1, + (gchar *) "DeviceRemoved", + (GDBusArgInfo **) &_console_kit_seat_signal_info_device_removed_ARG_pointers, + NULL + }, + "device-removed" +}; + +static const _ExtendedGDBusSignalInfo * const _console_kit_seat_signal_info_pointers[] = +{ + &_console_kit_seat_signal_info_active_session_changed, + &_console_kit_seat_signal_info_session_added, + &_console_kit_seat_signal_info_session_removed, + &_console_kit_seat_signal_info_device_added, + &_console_kit_seat_signal_info_device_removed, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _console_kit_seat_interface_info = +{ + { + -1, + (gchar *) "org.freedesktop.ConsoleKit.Seat", + (GDBusMethodInfo **) &_console_kit_seat_method_info_pointers, + (GDBusSignalInfo **) &_console_kit_seat_signal_info_pointers, + NULL, + NULL + }, + "console-kit-seat", +}; + + +/** + * console_kit_seat_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Seat.top_of_page">org.freedesktop.ConsoleKit.Seat</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +console_kit_seat_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_console_kit_seat_interface_info; +} + +/** + * console_kit_seat_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #ConsoleKitSeat interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +console_kit_seat_override_properties (GObjectClass *klass, guint property_id_begin) +{ + return property_id_begin - 1; +} + + + +/** + * ConsoleKitSeat: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Seat.top_of_page">org.freedesktop.ConsoleKit.Seat</link>. + */ + +/** + * ConsoleKitSeatIface: + * @parent_iface: The parent interface. + * @handle_activate_session: Handler for the #ConsoleKitSeat::handle-activate-session signal. + * @handle_can_activate_sessions: Handler for the #ConsoleKitSeat::handle-can-activate-sessions signal. + * @handle_get_active_session: Handler for the #ConsoleKitSeat::handle-get-active-session signal. + * @handle_get_devices: Handler for the #ConsoleKitSeat::handle-get-devices signal. + * @handle_get_id: Handler for the #ConsoleKitSeat::handle-get-id signal. + * @handle_get_sessions: Handler for the #ConsoleKitSeat::handle-get-sessions signal. + * @active_session_changed: Handler for the #ConsoleKitSeat::active-session-changed signal. + * @device_added: Handler for the #ConsoleKitSeat::device-added signal. + * @device_removed: Handler for the #ConsoleKitSeat::device-removed signal. + * @session_added: Handler for the #ConsoleKitSeat::session-added signal. + * @session_removed: Handler for the #ConsoleKitSeat::session-removed signal. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Seat.top_of_page">org.freedesktop.ConsoleKit.Seat</link>. + */ + +static void +console_kit_seat_default_init (ConsoleKitSeatIface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * ConsoleKitSeat::handle-get-id: + * @object: A #ConsoleKitSeat. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetId">GetId()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_seat_complete_get_id() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-id", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSeatIface, handle_get_id), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSeat::handle-get-sessions: + * @object: A #ConsoleKitSeat. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetSessions">GetSessions()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_seat_complete_get_sessions() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-sessions", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSeatIface, handle_get_sessions), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSeat::handle-get-devices: + * @object: A #ConsoleKitSeat. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetDevices">GetDevices()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_seat_complete_get_devices() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-devices", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSeatIface, handle_get_devices), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSeat::handle-get-active-session: + * @object: A #ConsoleKitSeat. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetActiveSession">GetActiveSession()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_seat_complete_get_active_session() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-active-session", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSeatIface, handle_get_active_session), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSeat::handle-can-activate-sessions: + * @object: A #ConsoleKitSeat. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.CanActivateSessions">CanActivateSessions()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_seat_complete_can_activate_sessions() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-can-activate-sessions", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSeatIface, handle_can_activate_sessions), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSeat::handle-activate-session: + * @object: A #ConsoleKitSeat. + * @invocation: A #GDBusMethodInvocation. + * @arg_ssid: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.ActivateSession">ActivateSession()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_seat_complete_activate_session() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-activate-session", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSeatIface, handle_activate_session), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /* GObject signals for received D-Bus signals: */ + /** + * ConsoleKitSeat::active-session-changed: + * @object: A #ConsoleKitSeat. + * @arg_ssid: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Seat.ActiveSessionChanged">"ActiveSessionChanged"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("active-session-changed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSeatIface, active_session_changed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * ConsoleKitSeat::session-added: + * @object: A #ConsoleKitSeat. + * @arg_ssid: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Seat.SessionAdded">"SessionAdded"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("session-added", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSeatIface, session_added), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * ConsoleKitSeat::session-removed: + * @object: A #ConsoleKitSeat. + * @arg_ssid: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Seat.SessionRemoved">"SessionRemoved"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("session-removed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSeatIface, session_removed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * ConsoleKitSeat::device-added: + * @object: A #ConsoleKitSeat. + * @arg_device: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Seat.DeviceAdded">"DeviceAdded"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("device-added", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSeatIface, device_added), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_VARIANT); + + /** + * ConsoleKitSeat::device-removed: + * @object: A #ConsoleKitSeat. + * @arg_device: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Seat.DeviceRemoved">"DeviceRemoved"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("device-removed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSeatIface, device_removed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_VARIANT); + +} + +typedef ConsoleKitSeatIface ConsoleKitSeatInterface; +G_DEFINE_INTERFACE (ConsoleKitSeat, console_kit_seat, G_TYPE_OBJECT); + +/** + * console_kit_seat_emit_active_session_changed: + * @object: A #ConsoleKitSeat. + * @arg_ssid: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Seat.ActiveSessionChanged">"ActiveSessionChanged"</link> D-Bus signal. + */ +void +console_kit_seat_emit_active_session_changed ( + ConsoleKitSeat *object, + const gchar *arg_ssid) +{ + g_signal_emit_by_name (object, "active-session-changed", arg_ssid); +} + +/** + * console_kit_seat_emit_session_added: + * @object: A #ConsoleKitSeat. + * @arg_ssid: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Seat.SessionAdded">"SessionAdded"</link> D-Bus signal. + */ +void +console_kit_seat_emit_session_added ( + ConsoleKitSeat *object, + const gchar *arg_ssid) +{ + g_signal_emit_by_name (object, "session-added", arg_ssid); +} + +/** + * console_kit_seat_emit_session_removed: + * @object: A #ConsoleKitSeat. + * @arg_ssid: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Seat.SessionRemoved">"SessionRemoved"</link> D-Bus signal. + */ +void +console_kit_seat_emit_session_removed ( + ConsoleKitSeat *object, + const gchar *arg_ssid) +{ + g_signal_emit_by_name (object, "session-removed", arg_ssid); +} + +/** + * console_kit_seat_emit_device_added: + * @object: A #ConsoleKitSeat. + * @arg_device: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Seat.DeviceAdded">"DeviceAdded"</link> D-Bus signal. + */ +void +console_kit_seat_emit_device_added ( + ConsoleKitSeat *object, + GVariant *arg_device) +{ + g_signal_emit_by_name (object, "device-added", arg_device); +} + +/** + * console_kit_seat_emit_device_removed: + * @object: A #ConsoleKitSeat. + * @arg_device: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Seat.DeviceRemoved">"DeviceRemoved"</link> D-Bus signal. + */ +void +console_kit_seat_emit_device_removed ( + ConsoleKitSeat *object, + GVariant *arg_device) +{ + g_signal_emit_by_name (object, "device-removed", arg_device); +} + +/** + * console_kit_seat_call_get_id: + * @proxy: A #ConsoleKitSeatProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetId">GetId()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_seat_call_get_id_finish() to get the result of the operation. + * + * See console_kit_seat_call_get_id_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_seat_call_get_id ( + ConsoleKitSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetId", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_seat_call_get_id_finish: + * @proxy: A #ConsoleKitSeatProxy. + * @out_sid: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_seat_call_get_id(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_seat_call_get_id(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_seat_call_get_id_finish ( + ConsoleKitSeat *proxy, + gchar **out_sid, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_sid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_seat_call_get_id_sync: + * @proxy: A #ConsoleKitSeatProxy. + * @out_sid: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetId">GetId()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_seat_call_get_id() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_seat_call_get_id_sync ( + ConsoleKitSeat *proxy, + gchar **out_sid, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetId", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_sid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_seat_call_get_sessions: + * @proxy: A #ConsoleKitSeatProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetSessions">GetSessions()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_seat_call_get_sessions_finish() to get the result of the operation. + * + * See console_kit_seat_call_get_sessions_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_seat_call_get_sessions ( + ConsoleKitSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetSessions", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_seat_call_get_sessions_finish: + * @proxy: A #ConsoleKitSeatProxy. + * @out_sessions: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_seat_call_get_sessions(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_seat_call_get_sessions(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_seat_call_get_sessions_finish ( + ConsoleKitSeat *proxy, + gchar ***out_sessions, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_sessions); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_seat_call_get_sessions_sync: + * @proxy: A #ConsoleKitSeatProxy. + * @out_sessions: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetSessions">GetSessions()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_seat_call_get_sessions() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_seat_call_get_sessions_sync ( + ConsoleKitSeat *proxy, + gchar ***out_sessions, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetSessions", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_sessions); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_seat_call_get_devices: + * @proxy: A #ConsoleKitSeatProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetDevices">GetDevices()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_seat_call_get_devices_finish() to get the result of the operation. + * + * See console_kit_seat_call_get_devices_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_seat_call_get_devices ( + ConsoleKitSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetDevices", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_seat_call_get_devices_finish: + * @proxy: A #ConsoleKitSeatProxy. + * @out_devices: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_seat_call_get_devices(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_seat_call_get_devices(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_seat_call_get_devices_finish ( + ConsoleKitSeat *proxy, + GVariant **out_devices, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(@a(ss))", + out_devices); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_seat_call_get_devices_sync: + * @proxy: A #ConsoleKitSeatProxy. + * @out_devices: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetDevices">GetDevices()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_seat_call_get_devices() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_seat_call_get_devices_sync ( + ConsoleKitSeat *proxy, + GVariant **out_devices, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetDevices", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(@a(ss))", + out_devices); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_seat_call_get_active_session: + * @proxy: A #ConsoleKitSeatProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetActiveSession">GetActiveSession()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_seat_call_get_active_session_finish() to get the result of the operation. + * + * See console_kit_seat_call_get_active_session_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_seat_call_get_active_session ( + ConsoleKitSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetActiveSession", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_seat_call_get_active_session_finish: + * @proxy: A #ConsoleKitSeatProxy. + * @out_ssid: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_seat_call_get_active_session(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_seat_call_get_active_session(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_seat_call_get_active_session_finish ( + ConsoleKitSeat *proxy, + gchar **out_ssid, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_ssid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_seat_call_get_active_session_sync: + * @proxy: A #ConsoleKitSeatProxy. + * @out_ssid: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetActiveSession">GetActiveSession()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_seat_call_get_active_session() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_seat_call_get_active_session_sync ( + ConsoleKitSeat *proxy, + gchar **out_ssid, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetActiveSession", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_ssid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_seat_call_can_activate_sessions: + * @proxy: A #ConsoleKitSeatProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.CanActivateSessions">CanActivateSessions()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_seat_call_can_activate_sessions_finish() to get the result of the operation. + * + * See console_kit_seat_call_can_activate_sessions_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_seat_call_can_activate_sessions ( + ConsoleKitSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "CanActivateSessions", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_seat_call_can_activate_sessions_finish: + * @proxy: A #ConsoleKitSeatProxy. + * @out_can_activate: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_seat_call_can_activate_sessions(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_seat_call_can_activate_sessions(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_seat_call_can_activate_sessions_finish ( + ConsoleKitSeat *proxy, + gboolean *out_can_activate, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_can_activate); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_seat_call_can_activate_sessions_sync: + * @proxy: A #ConsoleKitSeatProxy. + * @out_can_activate: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.CanActivateSessions">CanActivateSessions()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_seat_call_can_activate_sessions() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_seat_call_can_activate_sessions_sync ( + ConsoleKitSeat *proxy, + gboolean *out_can_activate, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "CanActivateSessions", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_can_activate); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_seat_call_activate_session: + * @proxy: A #ConsoleKitSeatProxy. + * @arg_ssid: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.ActivateSession">ActivateSession()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_seat_call_activate_session_finish() to get the result of the operation. + * + * See console_kit_seat_call_activate_session_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_seat_call_activate_session ( + ConsoleKitSeat *proxy, + const gchar *arg_ssid, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "ActivateSession", + g_variant_new ("(o)", + arg_ssid), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_seat_call_activate_session_finish: + * @proxy: A #ConsoleKitSeatProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_seat_call_activate_session(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_seat_call_activate_session(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_seat_call_activate_session_finish ( + ConsoleKitSeat *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_seat_call_activate_session_sync: + * @proxy: A #ConsoleKitSeatProxy. + * @arg_ssid: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.ActivateSession">ActivateSession()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_seat_call_activate_session() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_seat_call_activate_session_sync ( + ConsoleKitSeat *proxy, + const gchar *arg_ssid, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "ActivateSession", + g_variant_new ("(o)", + arg_ssid), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_seat_complete_get_id: + * @object: A #ConsoleKitSeat. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @sid: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetId">GetId()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_seat_complete_get_id ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation, + const gchar *sid) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(o)", + sid)); +} + +/** + * console_kit_seat_complete_get_sessions: + * @object: A #ConsoleKitSeat. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @sessions: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetSessions">GetSessions()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_seat_complete_get_sessions ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation, + const gchar *const *sessions) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^ao)", + sessions)); +} + +/** + * console_kit_seat_complete_get_devices: + * @object: A #ConsoleKitSeat. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @devices: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetDevices">GetDevices()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_seat_complete_get_devices ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation, + GVariant *devices) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(@a(ss))", + devices)); +} + +/** + * console_kit_seat_complete_get_active_session: + * @object: A #ConsoleKitSeat. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @ssid: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.GetActiveSession">GetActiveSession()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_seat_complete_get_active_session ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation, + const gchar *ssid) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(o)", + ssid)); +} + +/** + * console_kit_seat_complete_can_activate_sessions: + * @object: A #ConsoleKitSeat. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @can_activate: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.CanActivateSessions">CanActivateSessions()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_seat_complete_can_activate_sessions ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation, + gboolean can_activate) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(b)", + can_activate)); +} + +/** + * console_kit_seat_complete_activate_session: + * @object: A #ConsoleKitSeat. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Seat.ActivateSession">ActivateSession()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_seat_complete_activate_session ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * ConsoleKitSeatProxy: + * + * The #ConsoleKitSeatProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * ConsoleKitSeatProxyClass: + * @parent_class: The parent class. + * + * Class structure for #ConsoleKitSeatProxy. + */ + +struct _ConsoleKitSeatProxyPrivate +{ + GData *qdata; +}; + +static void console_kit_seat_proxy_iface_init (ConsoleKitSeatIface *iface); + +G_DEFINE_TYPE_WITH_CODE (ConsoleKitSeatProxy, console_kit_seat_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_CONSOLE_KIT_SEAT, console_kit_seat_proxy_iface_init)); + +static void +console_kit_seat_proxy_finalize (GObject *object) +{ + ConsoleKitSeatProxy *proxy = CONSOLE_KIT_SEAT_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (console_kit_seat_proxy_parent_class)->finalize (object); +} + +static void +console_kit_seat_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ +} + +static void +console_kit_seat_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ +} + +static void +console_kit_seat_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_console_kit_seat_interface_info, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_CONSOLE_KIT_SEAT); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_CONSOLE_KIT_SEAT); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +console_kit_seat_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + ConsoleKitSeatProxy *proxy = CONSOLE_KIT_SEAT_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_console_kit_seat_interface_info, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_console_kit_seat_interface_info, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static void +console_kit_seat_proxy_init (ConsoleKitSeatProxy *proxy) +{ + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONSOLE_KIT_SEAT_PROXY, ConsoleKitSeatProxyPrivate); + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), console_kit_seat_interface_info ()); +} + +static void +console_kit_seat_proxy_class_init (ConsoleKitSeatProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + g_type_class_add_private (klass, sizeof (ConsoleKitSeatProxyPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = console_kit_seat_proxy_finalize; + gobject_class->get_property = console_kit_seat_proxy_get_property; + gobject_class->set_property = console_kit_seat_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = console_kit_seat_proxy_g_signal; + proxy_class->g_properties_changed = console_kit_seat_proxy_g_properties_changed; + +} + +static void +console_kit_seat_proxy_iface_init (ConsoleKitSeatIface *iface) +{ +} + +/** + * console_kit_seat_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Seat.top_of_page">org.freedesktop.ConsoleKit.Seat</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_seat_proxy_new_finish() to get the result of the operation. + * + * See console_kit_seat_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +console_kit_seat_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_CONSOLE_KIT_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.ConsoleKit.Seat", NULL); +} + +/** + * console_kit_seat_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_seat_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with console_kit_seat_proxy_new(). + * + * Returns: (transfer full) (type ConsoleKitSeatProxy): The constructed proxy object or %NULL if @error is set. + */ +ConsoleKitSeat * +console_kit_seat_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return CONSOLE_KIT_SEAT (ret); + else + return NULL; +} + +/** + * console_kit_seat_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Seat.top_of_page">org.freedesktop.ConsoleKit.Seat</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See console_kit_seat_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type ConsoleKitSeatProxy): The constructed proxy object or %NULL if @error is set. + */ +ConsoleKitSeat * +console_kit_seat_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_CONSOLE_KIT_SEAT_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.ConsoleKit.Seat", NULL); + if (ret != NULL) + return CONSOLE_KIT_SEAT (ret); + else + return NULL; +} + + +/** + * console_kit_seat_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like console_kit_seat_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_seat_proxy_new_for_bus_finish() to get the result of the operation. + * + * See console_kit_seat_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +console_kit_seat_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_CONSOLE_KIT_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.ConsoleKit.Seat", NULL); +} + +/** + * console_kit_seat_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_seat_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with console_kit_seat_proxy_new_for_bus(). + * + * Returns: (transfer full) (type ConsoleKitSeatProxy): The constructed proxy object or %NULL if @error is set. + */ +ConsoleKitSeat * +console_kit_seat_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return CONSOLE_KIT_SEAT (ret); + else + return NULL; +} + +/** + * console_kit_seat_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like console_kit_seat_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See console_kit_seat_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type ConsoleKitSeatProxy): The constructed proxy object or %NULL if @error is set. + */ +ConsoleKitSeat * +console_kit_seat_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_CONSOLE_KIT_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.ConsoleKit.Seat", NULL); + if (ret != NULL) + return CONSOLE_KIT_SEAT (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * ConsoleKitSeatSkeleton: + * + * The #ConsoleKitSeatSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * ConsoleKitSeatSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #ConsoleKitSeatSkeleton. + */ + +struct _ConsoleKitSeatSkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_console_kit_seat_skeleton_handle_method_call ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + ConsoleKitSeatSkeleton *skeleton = CONSOLE_KIT_SEAT_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_CONSOLE_KIT_SEAT); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_CONSOLE_KIT_SEAT); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + 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); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_console_kit_seat_skeleton_handle_get_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + ConsoleKitSeatSkeleton *skeleton = CONSOLE_KIT_SEAT_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_console_kit_seat_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_console_kit_seat_skeleton_handle_set_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + ConsoleKitSeatSkeleton *skeleton = CONSOLE_KIT_SEAT_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_console_kit_seat_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _console_kit_seat_skeleton_vtable = +{ + _console_kit_seat_skeleton_handle_method_call, + _console_kit_seat_skeleton_handle_get_property, + _console_kit_seat_skeleton_handle_set_property +}; + +static GDBusInterfaceInfo * +console_kit_seat_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton) +{ + return console_kit_seat_interface_info (); +} + +static GDBusInterfaceVTable * +console_kit_seat_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton) +{ + return (GDBusInterfaceVTable *) &_console_kit_seat_skeleton_vtable; +} + +static GVariant * +console_kit_seat_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + ConsoleKitSeatSkeleton *skeleton = CONSOLE_KIT_SEAT_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_console_kit_seat_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _console_kit_seat_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _console_kit_seat_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _console_kit_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.ConsoleKit.Seat", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static void +console_kit_seat_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ +} + +static void +_console_kit_seat_on_signal_active_session_changed ( + ConsoleKitSeat *object, + const gchar *arg_ssid) +{ + ConsoleKitSeatSkeleton *skeleton = CONSOLE_KIT_SEAT_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(s)", + arg_ssid)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.ConsoleKit.Seat", "ActiveSessionChanged", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_console_kit_seat_on_signal_session_added ( + ConsoleKitSeat *object, + const gchar *arg_ssid) +{ + ConsoleKitSeatSkeleton *skeleton = CONSOLE_KIT_SEAT_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o)", + arg_ssid)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.ConsoleKit.Seat", "SessionAdded", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_console_kit_seat_on_signal_session_removed ( + ConsoleKitSeat *object, + const gchar *arg_ssid) +{ + ConsoleKitSeatSkeleton *skeleton = CONSOLE_KIT_SEAT_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o)", + arg_ssid)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.ConsoleKit.Seat", "SessionRemoved", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_console_kit_seat_on_signal_device_added ( + ConsoleKitSeat *object, + GVariant *arg_device) +{ + ConsoleKitSeatSkeleton *skeleton = CONSOLE_KIT_SEAT_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(@(ss))", + arg_device)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.ConsoleKit.Seat", "DeviceAdded", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_console_kit_seat_on_signal_device_removed ( + ConsoleKitSeat *object, + GVariant *arg_device) +{ + ConsoleKitSeatSkeleton *skeleton = CONSOLE_KIT_SEAT_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(@(ss))", + arg_device)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.ConsoleKit.Seat", "DeviceRemoved", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void console_kit_seat_skeleton_iface_init (ConsoleKitSeatIface *iface); +G_DEFINE_TYPE_WITH_CODE (ConsoleKitSeatSkeleton, console_kit_seat_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_CONSOLE_KIT_SEAT, console_kit_seat_skeleton_iface_init)); + +static void +console_kit_seat_skeleton_finalize (GObject *object) +{ + ConsoleKitSeatSkeleton *skeleton = CONSOLE_KIT_SEAT_SKELETON (object); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (console_kit_seat_skeleton_parent_class)->finalize (object); +} + +static void +console_kit_seat_skeleton_init (ConsoleKitSeatSkeleton *skeleton) +{ + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONSOLE_KIT_SEAT_SKELETON, ConsoleKitSeatSkeletonPrivate); + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); +} + +static void +console_kit_seat_skeleton_class_init (ConsoleKitSeatSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + g_type_class_add_private (klass, sizeof (ConsoleKitSeatSkeletonPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = console_kit_seat_skeleton_finalize; + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = console_kit_seat_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = console_kit_seat_skeleton_dbus_interface_get_properties; + skeleton_class->flush = console_kit_seat_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = console_kit_seat_skeleton_dbus_interface_get_vtable; +} + +static void +console_kit_seat_skeleton_iface_init (ConsoleKitSeatIface *iface) +{ + iface->active_session_changed = _console_kit_seat_on_signal_active_session_changed; + iface->session_added = _console_kit_seat_on_signal_session_added; + iface->session_removed = _console_kit_seat_on_signal_session_removed; + iface->device_added = _console_kit_seat_on_signal_device_added; + iface->device_removed = _console_kit_seat_on_signal_device_removed; +} + +/** + * console_kit_seat_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Seat.top_of_page">org.freedesktop.ConsoleKit.Seat</link>. + * + * Returns: (transfer full) (type ConsoleKitSeatSkeleton): The skeleton object. + */ +ConsoleKitSeat * +console_kit_seat_skeleton_new (void) +{ + return CONSOLE_KIT_SEAT (g_object_new (TYPE_CONSOLE_KIT_SEAT_SKELETON, NULL)); +} + diff --git a/src/dbus-consolekit-seat.h b/src/dbus-consolekit-seat.h new file mode 100644 index 0000000..b3d3938 --- /dev/null +++ b/src/dbus-consolekit-seat.h @@ -0,0 +1,349 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __DBUS_CONSOLEKIT_SEAT_H__ +#define __DBUS_CONSOLEKIT_SEAT_H__ + +#include <gio/gio.h> + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.freedesktop.ConsoleKit.Seat */ + +#define TYPE_CONSOLE_KIT_SEAT (console_kit_seat_get_type ()) +#define CONSOLE_KIT_SEAT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_CONSOLE_KIT_SEAT, ConsoleKitSeat)) +#define IS_CONSOLE_KIT_SEAT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_CONSOLE_KIT_SEAT)) +#define CONSOLE_KIT_SEAT_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_CONSOLE_KIT_SEAT, ConsoleKitSeatIface)) + +struct _ConsoleKitSeat; +typedef struct _ConsoleKitSeat ConsoleKitSeat; +typedef struct _ConsoleKitSeatIface ConsoleKitSeatIface; + +struct _ConsoleKitSeatIface +{ + GTypeInterface parent_iface; + + + gboolean (*handle_activate_session) ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation, + const gchar *arg_ssid); + + gboolean (*handle_can_activate_sessions) ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_active_session) ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_devices) ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_id) ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_sessions) ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation); + + void (*active_session_changed) ( + ConsoleKitSeat *object, + const gchar *arg_ssid); + + void (*device_added) ( + ConsoleKitSeat *object, + GVariant *arg_device); + + void (*device_removed) ( + ConsoleKitSeat *object, + GVariant *arg_device); + + void (*session_added) ( + ConsoleKitSeat *object, + const gchar *arg_ssid); + + void (*session_removed) ( + ConsoleKitSeat *object, + const gchar *arg_ssid); + +}; + +GType console_kit_seat_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *console_kit_seat_interface_info (void); +guint console_kit_seat_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void console_kit_seat_complete_get_id ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation, + const gchar *sid); + +void console_kit_seat_complete_get_sessions ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation, + const gchar *const *sessions); + +void console_kit_seat_complete_get_devices ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation, + GVariant *devices); + +void console_kit_seat_complete_get_active_session ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation, + const gchar *ssid); + +void console_kit_seat_complete_can_activate_sessions ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation, + gboolean can_activate); + +void console_kit_seat_complete_activate_session ( + ConsoleKitSeat *object, + GDBusMethodInvocation *invocation); + + + +/* D-Bus signal emissions functions: */ +void console_kit_seat_emit_active_session_changed ( + ConsoleKitSeat *object, + const gchar *arg_ssid); + +void console_kit_seat_emit_session_added ( + ConsoleKitSeat *object, + const gchar *arg_ssid); + +void console_kit_seat_emit_session_removed ( + ConsoleKitSeat *object, + const gchar *arg_ssid); + +void console_kit_seat_emit_device_added ( + ConsoleKitSeat *object, + GVariant *arg_device); + +void console_kit_seat_emit_device_removed ( + ConsoleKitSeat *object, + GVariant *arg_device); + + + +/* D-Bus method calls: */ +void console_kit_seat_call_get_id ( + ConsoleKitSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_seat_call_get_id_finish ( + ConsoleKitSeat *proxy, + gchar **out_sid, + GAsyncResult *res, + GError **error); + +gboolean console_kit_seat_call_get_id_sync ( + ConsoleKitSeat *proxy, + gchar **out_sid, + GCancellable *cancellable, + GError **error); + +void console_kit_seat_call_get_sessions ( + ConsoleKitSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_seat_call_get_sessions_finish ( + ConsoleKitSeat *proxy, + gchar ***out_sessions, + GAsyncResult *res, + GError **error); + +gboolean console_kit_seat_call_get_sessions_sync ( + ConsoleKitSeat *proxy, + gchar ***out_sessions, + GCancellable *cancellable, + GError **error); + +void console_kit_seat_call_get_devices ( + ConsoleKitSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_seat_call_get_devices_finish ( + ConsoleKitSeat *proxy, + GVariant **out_devices, + GAsyncResult *res, + GError **error); + +gboolean console_kit_seat_call_get_devices_sync ( + ConsoleKitSeat *proxy, + GVariant **out_devices, + GCancellable *cancellable, + GError **error); + +void console_kit_seat_call_get_active_session ( + ConsoleKitSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_seat_call_get_active_session_finish ( + ConsoleKitSeat *proxy, + gchar **out_ssid, + GAsyncResult *res, + GError **error); + +gboolean console_kit_seat_call_get_active_session_sync ( + ConsoleKitSeat *proxy, + gchar **out_ssid, + GCancellable *cancellable, + GError **error); + +void console_kit_seat_call_can_activate_sessions ( + ConsoleKitSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_seat_call_can_activate_sessions_finish ( + ConsoleKitSeat *proxy, + gboolean *out_can_activate, + GAsyncResult *res, + GError **error); + +gboolean console_kit_seat_call_can_activate_sessions_sync ( + ConsoleKitSeat *proxy, + gboolean *out_can_activate, + GCancellable *cancellable, + GError **error); + +void console_kit_seat_call_activate_session ( + ConsoleKitSeat *proxy, + const gchar *arg_ssid, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_seat_call_activate_session_finish ( + ConsoleKitSeat *proxy, + GAsyncResult *res, + GError **error); + +gboolean console_kit_seat_call_activate_session_sync ( + ConsoleKitSeat *proxy, + const gchar *arg_ssid, + GCancellable *cancellable, + GError **error); + + + +/* ---- */ + +#define TYPE_CONSOLE_KIT_SEAT_PROXY (console_kit_seat_proxy_get_type ()) +#define CONSOLE_KIT_SEAT_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_CONSOLE_KIT_SEAT_PROXY, ConsoleKitSeatProxy)) +#define CONSOLE_KIT_SEAT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_CONSOLE_KIT_SEAT_PROXY, ConsoleKitSeatProxyClass)) +#define CONSOLE_KIT_SEAT_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_CONSOLE_KIT_SEAT_PROXY, ConsoleKitSeatProxyClass)) +#define IS_CONSOLE_KIT_SEAT_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_CONSOLE_KIT_SEAT_PROXY)) +#define IS_CONSOLE_KIT_SEAT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_CONSOLE_KIT_SEAT_PROXY)) + +typedef struct _ConsoleKitSeatProxy ConsoleKitSeatProxy; +typedef struct _ConsoleKitSeatProxyClass ConsoleKitSeatProxyClass; +typedef struct _ConsoleKitSeatProxyPrivate ConsoleKitSeatProxyPrivate; + +struct _ConsoleKitSeatProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + ConsoleKitSeatProxyPrivate *priv; +}; + +struct _ConsoleKitSeatProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType console_kit_seat_proxy_get_type (void) G_GNUC_CONST; + +void console_kit_seat_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +ConsoleKitSeat *console_kit_seat_proxy_new_finish ( + GAsyncResult *res, + GError **error); +ConsoleKitSeat *console_kit_seat_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void console_kit_seat_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +ConsoleKitSeat *console_kit_seat_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +ConsoleKitSeat *console_kit_seat_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_CONSOLE_KIT_SEAT_SKELETON (console_kit_seat_skeleton_get_type ()) +#define CONSOLE_KIT_SEAT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_CONSOLE_KIT_SEAT_SKELETON, ConsoleKitSeatSkeleton)) +#define CONSOLE_KIT_SEAT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_CONSOLE_KIT_SEAT_SKELETON, ConsoleKitSeatSkeletonClass)) +#define CONSOLE_KIT_SEAT_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_CONSOLE_KIT_SEAT_SKELETON, ConsoleKitSeatSkeletonClass)) +#define IS_CONSOLE_KIT_SEAT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_CONSOLE_KIT_SEAT_SKELETON)) +#define IS_CONSOLE_KIT_SEAT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_CONSOLE_KIT_SEAT_SKELETON)) + +typedef struct _ConsoleKitSeatSkeleton ConsoleKitSeatSkeleton; +typedef struct _ConsoleKitSeatSkeletonClass ConsoleKitSeatSkeletonClass; +typedef struct _ConsoleKitSeatSkeletonPrivate ConsoleKitSeatSkeletonPrivate; + +struct _ConsoleKitSeatSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + ConsoleKitSeatSkeletonPrivate *priv; +}; + +struct _ConsoleKitSeatSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType console_kit_seat_skeleton_get_type (void) G_GNUC_CONST; + +ConsoleKitSeat *console_kit_seat_skeleton_new (void); + + +G_END_DECLS + +#endif /* __DBUS_CONSOLEKIT_SEAT_H__ */ diff --git a/src/dbus-consolekit-session.c b/src/dbus-consolekit-session.c new file mode 100644 index 0000000..02b5fdd --- /dev/null +++ b/src/dbus-consolekit-session.c @@ -0,0 +1,5587 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "dbus-consolekit-session.h" + +#include <string.h> +#ifdef G_OS_UNIX +# include <gio/gunixfdlist.h> +#endif + +typedef struct +{ + GDBusArgInfo parent_struct; + gboolean use_gvariant; +} _ExtendedGDBusArgInfo; + +typedef struct +{ + GDBusMethodInfo parent_struct; + const gchar *signal_name; + gboolean pass_fdlist; +} _ExtendedGDBusMethodInfo; + +typedef struct +{ + GDBusSignalInfo parent_struct; + const gchar *signal_name; +} _ExtendedGDBusSignalInfo; + +typedef struct +{ + GDBusPropertyInfo parent_struct; + const gchar *hyphen_name; + gboolean use_gvariant; +} _ExtendedGDBusPropertyInfo; + +typedef struct +{ + GDBusInterfaceInfo parent_struct; + const gchar *hyphen_name; +} _ExtendedGDBusInterfaceInfo; + +typedef struct +{ + const _ExtendedGDBusPropertyInfo *info; + guint prop_id; + GValue orig_value; /* the value before the change */ +} ChangedProperty; + +static void +_changed_property_free (ChangedProperty *data) +{ + g_value_unset (&data->orig_value); + g_free (data); +} + +static gboolean +_g_strv_equal0 (gchar **a, gchar **b) +{ + gboolean ret = FALSE; + guint n; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + if (g_strv_length (a) != g_strv_length (b)) + goto out; + for (n = 0; a[n] != NULL; n++) + if (g_strcmp0 (a[n], b[n]) != 0) + goto out; + ret = TRUE; +out: + return ret; +} + +static gboolean +_g_variant_equal0 (GVariant *a, GVariant *b) +{ + gboolean ret = FALSE; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + ret = g_variant_equal (a, b); +out: + return ret; +} + +G_GNUC_UNUSED static gboolean +_g_value_equal (const GValue *a, const GValue *b) +{ + gboolean ret = FALSE; + g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); + switch (G_VALUE_TYPE (a)) + { + case G_TYPE_BOOLEAN: + ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); + break; + case G_TYPE_UCHAR: + ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); + break; + case G_TYPE_INT: + ret = (g_value_get_int (a) == g_value_get_int (b)); + break; + case G_TYPE_UINT: + ret = (g_value_get_uint (a) == g_value_get_uint (b)); + break; + case G_TYPE_INT64: + ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); + break; + case G_TYPE_UINT64: + ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); + break; + case G_TYPE_DOUBLE: + { + /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ + gdouble da = g_value_get_double (a); + gdouble db = g_value_get_double (b); + ret = memcmp (&da, &db, sizeof (gdouble)) == 0; + } + break; + case G_TYPE_STRING: + ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); + break; + case G_TYPE_VARIANT: + ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); + break; + default: + if (G_VALUE_TYPE (a) == G_TYPE_STRV) + ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); + else + g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); + break; + } + return ret; +} + +/* ------------------------------------------------------------------------ + * Code for interface org.freedesktop.ConsoleKit.Session + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:ConsoleKitSession + * @title: ConsoleKitSession + * @short_description: Generated C code for the org.freedesktop.ConsoleKit.Session D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Session.top_of_page">org.freedesktop.ConsoleKit.Session</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.freedesktop.ConsoleKit.Session ---- */ + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_id_OUT_ARG_ssid = +{ + { + -1, + (gchar *) "ssid", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_id_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_id_OUT_ARG_ssid, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_id = +{ + { + -1, + (gchar *) "GetId", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_id_OUT_ARG_pointers, + NULL + }, + "handle-get-id", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_seat_id_OUT_ARG_sid = +{ + { + -1, + (gchar *) "sid", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_seat_id_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_seat_id_OUT_ARG_sid, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_seat_id = +{ + { + -1, + (gchar *) "GetSeatId", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_seat_id_OUT_ARG_pointers, + NULL + }, + "handle-get-seat-id", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_session_type_OUT_ARG_type = +{ + { + -1, + (gchar *) "type", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_session_type_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_session_type_OUT_ARG_type, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_session_type = +{ + { + -1, + (gchar *) "GetSessionType", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_session_type_OUT_ARG_pointers, + NULL + }, + "handle-get-session-type", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_user_OUT_ARG_uid = +{ + { + -1, + (gchar *) "uid", + (gchar *) "u", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_user_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_user_OUT_ARG_uid, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_user = +{ + { + -1, + (gchar *) "GetUser", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_user_OUT_ARG_pointers, + NULL + }, + "handle-get-user", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_unix_user_OUT_ARG_uid = +{ + { + -1, + (gchar *) "uid", + (gchar *) "u", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_unix_user_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_unix_user_OUT_ARG_uid, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_unix_user = +{ + { + -1, + (gchar *) "GetUnixUser", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_unix_user_OUT_ARG_pointers, + NULL + }, + "handle-get-unix-user", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_x11_display_OUT_ARG_display = +{ + { + -1, + (gchar *) "display", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_x11_display_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_x11_display_OUT_ARG_display, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_x11_display = +{ + { + -1, + (gchar *) "GetX11Display", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_x11_display_OUT_ARG_pointers, + NULL + }, + "handle-get-x11-display", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_x11_display_device_OUT_ARG_x11_display_device = +{ + { + -1, + (gchar *) "x11_display_device", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_x11_display_device_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_x11_display_device_OUT_ARG_x11_display_device, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_x11_display_device = +{ + { + -1, + (gchar *) "GetX11DisplayDevice", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_x11_display_device_OUT_ARG_pointers, + NULL + }, + "handle-get-x11-display-device", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_display_device_OUT_ARG_display_device = +{ + { + -1, + (gchar *) "display_device", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_display_device_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_display_device_OUT_ARG_display_device, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_display_device = +{ + { + -1, + (gchar *) "GetDisplayDevice", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_display_device_OUT_ARG_pointers, + NULL + }, + "handle-get-display-device", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_remote_host_name_OUT_ARG_remote_host_name = +{ + { + -1, + (gchar *) "remote_host_name", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_remote_host_name_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_remote_host_name_OUT_ARG_remote_host_name, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_remote_host_name = +{ + { + -1, + (gchar *) "GetRemoteHostName", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_remote_host_name_OUT_ARG_pointers, + NULL + }, + "handle-get-remote-host-name", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_login_session_id_OUT_ARG_login_session_id = +{ + { + -1, + (gchar *) "login_session_id", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_login_session_id_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_login_session_id_OUT_ARG_login_session_id, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_login_session_id = +{ + { + -1, + (gchar *) "GetLoginSessionId", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_login_session_id_OUT_ARG_pointers, + NULL + }, + "handle-get-login-session-id", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_is_active_OUT_ARG_active = +{ + { + -1, + (gchar *) "active", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_is_active_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_is_active_OUT_ARG_active, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_is_active = +{ + { + -1, + (gchar *) "IsActive", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_is_active_OUT_ARG_pointers, + NULL + }, + "handle-is-active", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_is_local_OUT_ARG_local = +{ + { + -1, + (gchar *) "local", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_is_local_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_is_local_OUT_ARG_local, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_is_local = +{ + { + -1, + (gchar *) "IsLocal", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_is_local_OUT_ARG_pointers, + NULL + }, + "handle-is-local", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_creation_time_OUT_ARG_iso8601_datetime = +{ + { + -1, + (gchar *) "iso8601_datetime", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_creation_time_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_creation_time_OUT_ARG_iso8601_datetime, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_creation_time = +{ + { + -1, + (gchar *) "GetCreationTime", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_creation_time_OUT_ARG_pointers, + NULL + }, + "handle-get-creation-time", + FALSE +}; + +static const GDBusAnnotationInfo _console_kit_session_method_activate_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_session_method_activate_annotation_info_pointers[] = +{ + &_console_kit_session_method_activate_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_activate = +{ + { + -1, + (gchar *) "Activate", + NULL, + NULL, + (GDBusAnnotationInfo **) &_console_kit_session_method_activate_annotation_info_pointers + }, + "handle-activate", + FALSE +}; + +static const GDBusAnnotationInfo _console_kit_session_method_lock_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_session_method_lock_annotation_info_pointers[] = +{ + &_console_kit_session_method_lock_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_lock = +{ + { + -1, + (gchar *) "Lock", + NULL, + NULL, + (GDBusAnnotationInfo **) &_console_kit_session_method_lock_annotation_info_pointers + }, + "handle-lock", + FALSE +}; + +static const GDBusAnnotationInfo _console_kit_session_method_unlock_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_session_method_unlock_annotation_info_pointers[] = +{ + &_console_kit_session_method_unlock_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_unlock = +{ + { + -1, + (gchar *) "Unlock", + NULL, + NULL, + (GDBusAnnotationInfo **) &_console_kit_session_method_unlock_annotation_info_pointers + }, + "handle-unlock", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_idle_hint_OUT_ARG_idle_hint = +{ + { + -1, + (gchar *) "idle_hint", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_idle_hint_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_idle_hint_OUT_ARG_idle_hint, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_idle_hint = +{ + { + -1, + (gchar *) "GetIdleHint", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_idle_hint_OUT_ARG_pointers, + NULL + }, + "handle-get-idle-hint", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_get_idle_since_hint_OUT_ARG_iso8601_datetime = +{ + { + -1, + (gchar *) "iso8601_datetime", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_get_idle_since_hint_OUT_ARG_pointers[] = +{ + &_console_kit_session_method_info_get_idle_since_hint_OUT_ARG_iso8601_datetime, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_get_idle_since_hint = +{ + { + -1, + (gchar *) "GetIdleSinceHint", + NULL, + (GDBusArgInfo **) &_console_kit_session_method_info_get_idle_since_hint_OUT_ARG_pointers, + NULL + }, + "handle-get-idle-since-hint", + FALSE +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_method_info_set_idle_hint_IN_ARG_idle_hint = +{ + { + -1, + (gchar *) "idle_hint", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_method_info_set_idle_hint_IN_ARG_pointers[] = +{ + &_console_kit_session_method_info_set_idle_hint_IN_ARG_idle_hint, + NULL +}; + +static const GDBusAnnotationInfo _console_kit_session_method_set_idle_hint_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _console_kit_session_method_set_idle_hint_annotation_info_pointers[] = +{ + &_console_kit_session_method_set_idle_hint_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _console_kit_session_method_info_set_idle_hint = +{ + { + -1, + (gchar *) "SetIdleHint", + (GDBusArgInfo **) &_console_kit_session_method_info_set_idle_hint_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_console_kit_session_method_set_idle_hint_annotation_info_pointers + }, + "handle-set-idle-hint", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _console_kit_session_method_info_pointers[] = +{ + &_console_kit_session_method_info_get_id, + &_console_kit_session_method_info_get_seat_id, + &_console_kit_session_method_info_get_session_type, + &_console_kit_session_method_info_get_user, + &_console_kit_session_method_info_get_unix_user, + &_console_kit_session_method_info_get_x11_display, + &_console_kit_session_method_info_get_x11_display_device, + &_console_kit_session_method_info_get_display_device, + &_console_kit_session_method_info_get_remote_host_name, + &_console_kit_session_method_info_get_login_session_id, + &_console_kit_session_method_info_is_active, + &_console_kit_session_method_info_is_local, + &_console_kit_session_method_info_get_creation_time, + &_console_kit_session_method_info_activate, + &_console_kit_session_method_info_lock, + &_console_kit_session_method_info_unlock, + &_console_kit_session_method_info_get_idle_hint, + &_console_kit_session_method_info_get_idle_since_hint, + &_console_kit_session_method_info_set_idle_hint, + NULL +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_signal_info_active_changed_ARG_is_active = +{ + { + -1, + (gchar *) "is_active", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_signal_info_active_changed_ARG_pointers[] = +{ + &_console_kit_session_signal_info_active_changed_ARG_is_active, + NULL +}; + +static const _ExtendedGDBusSignalInfo _console_kit_session_signal_info_active_changed = +{ + { + -1, + (gchar *) "ActiveChanged", + (GDBusArgInfo **) &_console_kit_session_signal_info_active_changed_ARG_pointers, + NULL + }, + "active-changed" +}; + +static const _ExtendedGDBusArgInfo _console_kit_session_signal_info_idle_hint_changed_ARG_hint = +{ + { + -1, + (gchar *) "hint", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _console_kit_session_signal_info_idle_hint_changed_ARG_pointers[] = +{ + &_console_kit_session_signal_info_idle_hint_changed_ARG_hint, + NULL +}; + +static const _ExtendedGDBusSignalInfo _console_kit_session_signal_info_idle_hint_changed = +{ + { + -1, + (gchar *) "IdleHintChanged", + (GDBusArgInfo **) &_console_kit_session_signal_info_idle_hint_changed_ARG_pointers, + NULL + }, + "idle-hint-changed" +}; + +static const _ExtendedGDBusSignalInfo _console_kit_session_signal_info_lock = +{ + { + -1, + (gchar *) "Lock", + NULL, + NULL + }, + "lock" +}; + +static const _ExtendedGDBusSignalInfo _console_kit_session_signal_info_unlock = +{ + { + -1, + (gchar *) "Unlock", + NULL, + NULL + }, + "unlock" +}; + +static const _ExtendedGDBusSignalInfo * const _console_kit_session_signal_info_pointers[] = +{ + &_console_kit_session_signal_info_active_changed, + &_console_kit_session_signal_info_idle_hint_changed, + &_console_kit_session_signal_info_lock, + &_console_kit_session_signal_info_unlock, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _console_kit_session_property_info_unix_user = +{ + { + -1, + (gchar *) "unix-user", + (gchar *) "u", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "unix-user", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _console_kit_session_property_info_user = +{ + { + -1, + (gchar *) "user", + (gchar *) "u", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "user", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _console_kit_session_property_info_session_type = +{ + { + -1, + (gchar *) "session-type", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "session-type", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _console_kit_session_property_info_remote_host_name = +{ + { + -1, + (gchar *) "remote-host-name", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "remote-host-name", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _console_kit_session_property_info_display_device = +{ + { + -1, + (gchar *) "display-device", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "display-device", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _console_kit_session_property_info_x11_display = +{ + { + -1, + (gchar *) "x11-display", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "x11-display", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _console_kit_session_property_info_x11_display_device = +{ + { + -1, + (gchar *) "x11-display-device", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "x11-display-device", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _console_kit_session_property_info_active = +{ + { + -1, + (gchar *) "active", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "active", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _console_kit_session_property_info_is_local = +{ + { + -1, + (gchar *) "is-local", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "is-local", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _console_kit_session_property_info_idle_hint = +{ + { + -1, + (gchar *) "idle-hint", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "idle-hint", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const _console_kit_session_property_info_pointers[] = +{ + &_console_kit_session_property_info_unix_user, + &_console_kit_session_property_info_user, + &_console_kit_session_property_info_session_type, + &_console_kit_session_property_info_remote_host_name, + &_console_kit_session_property_info_display_device, + &_console_kit_session_property_info_x11_display, + &_console_kit_session_property_info_x11_display_device, + &_console_kit_session_property_info_active, + &_console_kit_session_property_info_is_local, + &_console_kit_session_property_info_idle_hint, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _console_kit_session_interface_info = +{ + { + -1, + (gchar *) "org.freedesktop.ConsoleKit.Session", + (GDBusMethodInfo **) &_console_kit_session_method_info_pointers, + (GDBusSignalInfo **) &_console_kit_session_signal_info_pointers, + (GDBusPropertyInfo **) &_console_kit_session_property_info_pointers, + NULL + }, + "console-kit-session", +}; + + +/** + * console_kit_session_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Session.top_of_page">org.freedesktop.ConsoleKit.Session</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +console_kit_session_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_console_kit_session_interface_info; +} + +/** + * console_kit_session_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #ConsoleKitSession interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +console_kit_session_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "unix-user"); + g_object_class_override_property (klass, property_id_begin++, "user"); + g_object_class_override_property (klass, property_id_begin++, "session-type"); + g_object_class_override_property (klass, property_id_begin++, "remote-host-name"); + g_object_class_override_property (klass, property_id_begin++, "display-device"); + g_object_class_override_property (klass, property_id_begin++, "x11-display"); + g_object_class_override_property (klass, property_id_begin++, "x11-display-device"); + g_object_class_override_property (klass, property_id_begin++, "active"); + g_object_class_override_property (klass, property_id_begin++, "is-local"); + g_object_class_override_property (klass, property_id_begin++, "idle-hint"); + return property_id_begin - 1; +} + + + +/** + * ConsoleKitSession: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Session.top_of_page">org.freedesktop.ConsoleKit.Session</link>. + */ + +/** + * ConsoleKitSessionIface: + * @parent_iface: The parent interface. + * @handle_activate: Handler for the #ConsoleKitSession::handle-activate signal. + * @handle_get_creation_time: Handler for the #ConsoleKitSession::handle-get-creation-time signal. + * @handle_get_display_device: Handler for the #ConsoleKitSession::handle-get-display-device signal. + * @handle_get_id: Handler for the #ConsoleKitSession::handle-get-id signal. + * @handle_get_idle_hint: Handler for the #ConsoleKitSession::handle-get-idle-hint signal. + * @handle_get_idle_since_hint: Handler for the #ConsoleKitSession::handle-get-idle-since-hint signal. + * @handle_get_login_session_id: Handler for the #ConsoleKitSession::handle-get-login-session-id signal. + * @handle_get_remote_host_name: Handler for the #ConsoleKitSession::handle-get-remote-host-name signal. + * @handle_get_seat_id: Handler for the #ConsoleKitSession::handle-get-seat-id signal. + * @handle_get_session_type: Handler for the #ConsoleKitSession::handle-get-session-type signal. + * @handle_get_unix_user: Handler for the #ConsoleKitSession::handle-get-unix-user signal. + * @handle_get_user: Handler for the #ConsoleKitSession::handle-get-user signal. + * @handle_get_x11_display: Handler for the #ConsoleKitSession::handle-get-x11-display signal. + * @handle_get_x11_display_device: Handler for the #ConsoleKitSession::handle-get-x11-display-device signal. + * @handle_is_active: Handler for the #ConsoleKitSession::handle-is-active signal. + * @handle_is_local: Handler for the #ConsoleKitSession::handle-is-local signal. + * @handle_lock: Handler for the #ConsoleKitSession::handle-lock signal. + * @handle_set_idle_hint: Handler for the #ConsoleKitSession::handle-set-idle-hint signal. + * @handle_unlock: Handler for the #ConsoleKitSession::handle-unlock signal. + * @get_active: Getter for the #ConsoleKitSession:active property. + * @get_display_device: Getter for the #ConsoleKitSession:display-device property. + * @get_idle_hint: Getter for the #ConsoleKitSession:idle-hint property. + * @get_is_local: Getter for the #ConsoleKitSession:is-local property. + * @get_remote_host_name: Getter for the #ConsoleKitSession:remote-host-name property. + * @get_session_type: Getter for the #ConsoleKitSession:session-type property. + * @get_unix_user: Getter for the #ConsoleKitSession:unix-user property. + * @get_user: Getter for the #ConsoleKitSession:user property. + * @get_x11_display: Getter for the #ConsoleKitSession:x11-display property. + * @get_x11_display_device: Getter for the #ConsoleKitSession:x11-display-device property. + * @active_changed: Handler for the #ConsoleKitSession::active-changed signal. + * @idle_hint_changed: Handler for the #ConsoleKitSession::idle-hint-changed signal. + * @lock: Handler for the #ConsoleKitSession::lock signal. + * @unlock: Handler for the #ConsoleKitSession::unlock signal. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Session.top_of_page">org.freedesktop.ConsoleKit.Session</link>. + */ + +static void +console_kit_session_default_init (ConsoleKitSessionIface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * ConsoleKitSession::handle-get-id: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetId">GetId()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_id() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-id", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_id), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-get-seat-id: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetSeatId">GetSeatId()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_seat_id() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-seat-id", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_seat_id), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-get-session-type: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetSessionType">GetSessionType()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_session_type() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-session-type", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_session_type), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-get-user: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetUser">GetUser()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_user() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-user", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_user), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-get-unix-user: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetUnixUser">GetUnixUser()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_unix_user() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-unix-user", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_unix_user), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-get-x11-display: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetX11Display">GetX11Display()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_x11_display() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-x11-display", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_x11_display), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-get-x11-display-device: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetX11DisplayDevice">GetX11DisplayDevice()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_x11_display_device() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-x11-display-device", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_x11_display_device), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-get-display-device: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetDisplayDevice">GetDisplayDevice()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_display_device() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-display-device", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_display_device), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-get-remote-host-name: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetRemoteHostName">GetRemoteHostName()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_remote_host_name() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-remote-host-name", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_remote_host_name), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-get-login-session-id: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetLoginSessionId">GetLoginSessionId()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_login_session_id() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-login-session-id", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_login_session_id), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-is-active: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.IsActive">IsActive()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_is_active() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-is-active", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_is_active), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-is-local: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.IsLocal">IsLocal()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_is_local() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-is-local", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_is_local), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-get-creation-time: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetCreationTime">GetCreationTime()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_creation_time() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-creation-time", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_creation_time), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-activate: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.Activate">Activate()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_activate() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-activate", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_activate), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-lock: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.Lock">Lock()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_lock() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-lock", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_lock), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-unlock: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.Unlock">Unlock()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_unlock() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-unlock", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_unlock), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-get-idle-hint: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetIdleHint">GetIdleHint()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_idle_hint() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-idle-hint", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_idle_hint), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-get-idle-since-hint: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetIdleSinceHint">GetIdleSinceHint()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_get_idle_since_hint() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-get-idle-since-hint", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_get_idle_since_hint), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * ConsoleKitSession::handle-set-idle-hint: + * @object: A #ConsoleKitSession. + * @invocation: A #GDBusMethodInvocation. + * @arg_idle_hint: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.SetIdleHint">SetIdleHint()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call console_kit_session_complete_set_idle_hint() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-idle-hint", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, handle_set_idle_hint), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_BOOLEAN); + + /* GObject signals for received D-Bus signals: */ + /** + * ConsoleKitSession::active-changed: + * @object: A #ConsoleKitSession. + * @arg_is_active: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Session.ActiveChanged">"ActiveChanged"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("active-changed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, active_changed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_BOOLEAN); + + /** + * ConsoleKitSession::idle-hint-changed: + * @object: A #ConsoleKitSession. + * @arg_hint: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Session.IdleHintChanged">"IdleHintChanged"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("idle-hint-changed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, idle_hint_changed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_BOOLEAN); + + /** + * ConsoleKitSession::lock: + * @object: A #ConsoleKitSession. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Session.Lock">"Lock"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("lock", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, lock), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 0); + + /** + * ConsoleKitSession::unlock: + * @object: A #ConsoleKitSession. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Session.Unlock">"Unlock"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("unlock", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ConsoleKitSessionIface, unlock), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 0); + + /* GObject properties for D-Bus properties: */ + /** + * ConsoleKitSession:unix-user: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.unix-user">"unix-user"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_uint ("unix-user", "unix-user", "unix-user", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * ConsoleKitSession:user: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.user">"user"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_uint ("user", "user", "user", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * ConsoleKitSession:session-type: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.session-type">"session-type"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("session-type", "session-type", "session-type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * ConsoleKitSession:remote-host-name: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.remote-host-name">"remote-host-name"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("remote-host-name", "remote-host-name", "remote-host-name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * ConsoleKitSession:display-device: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.display-device">"display-device"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("display-device", "display-device", "display-device", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * ConsoleKitSession:x11-display: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.x11-display">"x11-display"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("x11-display", "x11-display", "x11-display", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * ConsoleKitSession:x11-display-device: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.x11-display-device">"x11-display-device"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("x11-display-device", "x11-display-device", "x11-display-device", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * ConsoleKitSession:active: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.active">"active"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("active", "active", "active", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * ConsoleKitSession:is-local: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.is-local">"is-local"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("is-local", "is-local", "is-local", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * ConsoleKitSession:idle-hint: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.idle-hint">"idle-hint"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("idle-hint", "idle-hint", "idle-hint", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +typedef ConsoleKitSessionIface ConsoleKitSessionInterface; +G_DEFINE_INTERFACE (ConsoleKitSession, console_kit_session, G_TYPE_OBJECT); + +/** + * console_kit_session_get_unix_user: (skip) + * @object: A #ConsoleKitSession. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.unix-user">"unix-user"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint +console_kit_session_get_unix_user (ConsoleKitSession *object) +{ + return CONSOLE_KIT_SESSION_GET_IFACE (object)->get_unix_user (object); +} + +/** + * console_kit_session_set_unix_user: (skip) + * @object: A #ConsoleKitSession. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.unix-user">"unix-user"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +console_kit_session_set_unix_user (ConsoleKitSession *object, guint value) +{ + g_object_set (G_OBJECT (object), "unix-user", value, NULL); +} + +/** + * console_kit_session_get_user: (skip) + * @object: A #ConsoleKitSession. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.user">"user"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint +console_kit_session_get_user (ConsoleKitSession *object) +{ + return CONSOLE_KIT_SESSION_GET_IFACE (object)->get_user (object); +} + +/** + * console_kit_session_set_user: (skip) + * @object: A #ConsoleKitSession. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.user">"user"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +console_kit_session_set_user (ConsoleKitSession *object, guint value) +{ + g_object_set (G_OBJECT (object), "user", value, NULL); +} + +/** + * console_kit_session_get_session_type: (skip) + * @object: A #ConsoleKitSession. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.session-type">"session-type"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use console_kit_session_dup_session_type() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +console_kit_session_get_session_type (ConsoleKitSession *object) +{ + return CONSOLE_KIT_SESSION_GET_IFACE (object)->get_session_type (object); +} + +/** + * console_kit_session_dup_session_type: (skip) + * @object: A #ConsoleKitSession. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.session-type">"session-type"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +console_kit_session_dup_session_type (ConsoleKitSession *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "session-type", &value, NULL); + return value; +} + +/** + * console_kit_session_set_session_type: (skip) + * @object: A #ConsoleKitSession. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.session-type">"session-type"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +console_kit_session_set_session_type (ConsoleKitSession *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "session-type", value, NULL); +} + +/** + * console_kit_session_get_remote_host_name: (skip) + * @object: A #ConsoleKitSession. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.remote-host-name">"remote-host-name"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use console_kit_session_dup_remote_host_name() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +console_kit_session_get_remote_host_name (ConsoleKitSession *object) +{ + return CONSOLE_KIT_SESSION_GET_IFACE (object)->get_remote_host_name (object); +} + +/** + * console_kit_session_dup_remote_host_name: (skip) + * @object: A #ConsoleKitSession. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.remote-host-name">"remote-host-name"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +console_kit_session_dup_remote_host_name (ConsoleKitSession *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "remote-host-name", &value, NULL); + return value; +} + +/** + * console_kit_session_set_remote_host_name: (skip) + * @object: A #ConsoleKitSession. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.remote-host-name">"remote-host-name"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +console_kit_session_set_remote_host_name (ConsoleKitSession *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "remote-host-name", value, NULL); +} + +/** + * console_kit_session_get_display_device: (skip) + * @object: A #ConsoleKitSession. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.display-device">"display-device"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use console_kit_session_dup_display_device() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +console_kit_session_get_display_device (ConsoleKitSession *object) +{ + return CONSOLE_KIT_SESSION_GET_IFACE (object)->get_display_device (object); +} + +/** + * console_kit_session_dup_display_device: (skip) + * @object: A #ConsoleKitSession. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.display-device">"display-device"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +console_kit_session_dup_display_device (ConsoleKitSession *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "display-device", &value, NULL); + return value; +} + +/** + * console_kit_session_set_display_device: (skip) + * @object: A #ConsoleKitSession. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.display-device">"display-device"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +console_kit_session_set_display_device (ConsoleKitSession *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "display-device", value, NULL); +} + +/** + * console_kit_session_get_x11_display: (skip) + * @object: A #ConsoleKitSession. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.x11-display">"x11-display"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use console_kit_session_dup_x11_display() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +console_kit_session_get_x11_display (ConsoleKitSession *object) +{ + return CONSOLE_KIT_SESSION_GET_IFACE (object)->get_x11_display (object); +} + +/** + * console_kit_session_dup_x11_display: (skip) + * @object: A #ConsoleKitSession. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.x11-display">"x11-display"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +console_kit_session_dup_x11_display (ConsoleKitSession *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "x11-display", &value, NULL); + return value; +} + +/** + * console_kit_session_set_x11_display: (skip) + * @object: A #ConsoleKitSession. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.x11-display">"x11-display"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +console_kit_session_set_x11_display (ConsoleKitSession *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "x11-display", value, NULL); +} + +/** + * console_kit_session_get_x11_display_device: (skip) + * @object: A #ConsoleKitSession. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.x11-display-device">"x11-display-device"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use console_kit_session_dup_x11_display_device() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +console_kit_session_get_x11_display_device (ConsoleKitSession *object) +{ + return CONSOLE_KIT_SESSION_GET_IFACE (object)->get_x11_display_device (object); +} + +/** + * console_kit_session_dup_x11_display_device: (skip) + * @object: A #ConsoleKitSession. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.x11-display-device">"x11-display-device"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +console_kit_session_dup_x11_display_device (ConsoleKitSession *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "x11-display-device", &value, NULL); + return value; +} + +/** + * console_kit_session_set_x11_display_device: (skip) + * @object: A #ConsoleKitSession. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.x11-display-device">"x11-display-device"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +console_kit_session_set_x11_display_device (ConsoleKitSession *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "x11-display-device", value, NULL); +} + +/** + * console_kit_session_get_active: (skip) + * @object: A #ConsoleKitSession. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.active">"active"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +console_kit_session_get_active (ConsoleKitSession *object) +{ + return CONSOLE_KIT_SESSION_GET_IFACE (object)->get_active (object); +} + +/** + * console_kit_session_set_active: (skip) + * @object: A #ConsoleKitSession. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.active">"active"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +console_kit_session_set_active (ConsoleKitSession *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "active", value, NULL); +} + +/** + * console_kit_session_get_is_local: (skip) + * @object: A #ConsoleKitSession. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.is-local">"is-local"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +console_kit_session_get_is_local (ConsoleKitSession *object) +{ + return CONSOLE_KIT_SESSION_GET_IFACE (object)->get_is_local (object); +} + +/** + * console_kit_session_set_is_local: (skip) + * @object: A #ConsoleKitSession. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.is-local">"is-local"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +console_kit_session_set_is_local (ConsoleKitSession *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "is-local", value, NULL); +} + +/** + * console_kit_session_get_idle_hint: (skip) + * @object: A #ConsoleKitSession. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.idle-hint">"idle-hint"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +console_kit_session_get_idle_hint (ConsoleKitSession *object) +{ + return CONSOLE_KIT_SESSION_GET_IFACE (object)->get_idle_hint (object); +} + +/** + * console_kit_session_set_idle_hint: (skip) + * @object: A #ConsoleKitSession. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-ConsoleKit-Session.idle-hint">"idle-hint"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +console_kit_session_set_idle_hint (ConsoleKitSession *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "idle-hint", value, NULL); +} + +/** + * console_kit_session_emit_active_changed: + * @object: A #ConsoleKitSession. + * @arg_is_active: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Session.ActiveChanged">"ActiveChanged"</link> D-Bus signal. + */ +void +console_kit_session_emit_active_changed ( + ConsoleKitSession *object, + gboolean arg_is_active) +{ + g_signal_emit_by_name (object, "active-changed", arg_is_active); +} + +/** + * console_kit_session_emit_idle_hint_changed: + * @object: A #ConsoleKitSession. + * @arg_hint: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Session.IdleHintChanged">"IdleHintChanged"</link> D-Bus signal. + */ +void +console_kit_session_emit_idle_hint_changed ( + ConsoleKitSession *object, + gboolean arg_hint) +{ + g_signal_emit_by_name (object, "idle-hint-changed", arg_hint); +} + +/** + * console_kit_session_emit_lock: + * @object: A #ConsoleKitSession. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Session.Lock">"Lock"</link> D-Bus signal. + */ +void +console_kit_session_emit_lock ( + ConsoleKitSession *object) +{ + g_signal_emit_by_name (object, "lock"); +} + +/** + * console_kit_session_emit_unlock: + * @object: A #ConsoleKitSession. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-ConsoleKit-Session.Unlock">"Unlock"</link> D-Bus signal. + */ +void +console_kit_session_emit_unlock ( + ConsoleKitSession *object) +{ + g_signal_emit_by_name (object, "unlock"); +} + +/** + * console_kit_session_call_get_id: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetId">GetId()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_id_finish() to get the result of the operation. + * + * See console_kit_session_call_get_id_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_id ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetId", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_id_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_ssid: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_id(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_id(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_id_finish ( + ConsoleKitSession *proxy, + gchar **out_ssid, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_ssid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_id_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_ssid: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetId">GetId()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_id() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_id_sync ( + ConsoleKitSession *proxy, + gchar **out_ssid, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetId", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_ssid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_seat_id: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetSeatId">GetSeatId()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_seat_id_finish() to get the result of the operation. + * + * See console_kit_session_call_get_seat_id_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_seat_id ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetSeatId", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_seat_id_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_sid: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_seat_id(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_seat_id(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_seat_id_finish ( + ConsoleKitSession *proxy, + gchar **out_sid, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_sid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_seat_id_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_sid: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetSeatId">GetSeatId()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_seat_id() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_seat_id_sync ( + ConsoleKitSession *proxy, + gchar **out_sid, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetSeatId", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_sid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_session_type: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetSessionType">GetSessionType()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_session_type_finish() to get the result of the operation. + * + * See console_kit_session_call_get_session_type_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_session_type ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetSessionType", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_session_type_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_type: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_session_type(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_session_type(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_session_type_finish ( + ConsoleKitSession *proxy, + gchar **out_type, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_type); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_session_type_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_type: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetSessionType">GetSessionType()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_session_type() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_session_type_sync ( + ConsoleKitSession *proxy, + gchar **out_type, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetSessionType", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_type); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_user: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetUser">GetUser()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_user_finish() to get the result of the operation. + * + * See console_kit_session_call_get_user_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_user ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetUser", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_user_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_uid: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_user(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_user(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_user_finish ( + ConsoleKitSession *proxy, + guint *out_uid, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(u)", + out_uid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_user_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_uid: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetUser">GetUser()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_user() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_user_sync ( + ConsoleKitSession *proxy, + guint *out_uid, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetUser", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(u)", + out_uid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_unix_user: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetUnixUser">GetUnixUser()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_unix_user_finish() to get the result of the operation. + * + * See console_kit_session_call_get_unix_user_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_unix_user ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetUnixUser", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_unix_user_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_uid: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_unix_user(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_unix_user(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_unix_user_finish ( + ConsoleKitSession *proxy, + guint *out_uid, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(u)", + out_uid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_unix_user_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_uid: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetUnixUser">GetUnixUser()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_unix_user() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_unix_user_sync ( + ConsoleKitSession *proxy, + guint *out_uid, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetUnixUser", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(u)", + out_uid); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_x11_display: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetX11Display">GetX11Display()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_x11_display_finish() to get the result of the operation. + * + * See console_kit_session_call_get_x11_display_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_x11_display ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetX11Display", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_x11_display_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_display: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_x11_display(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_x11_display(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_x11_display_finish ( + ConsoleKitSession *proxy, + gchar **out_display, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_display); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_x11_display_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_display: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetX11Display">GetX11Display()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_x11_display() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_x11_display_sync ( + ConsoleKitSession *proxy, + gchar **out_display, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetX11Display", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_display); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_x11_display_device: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetX11DisplayDevice">GetX11DisplayDevice()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_x11_display_device_finish() to get the result of the operation. + * + * See console_kit_session_call_get_x11_display_device_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_x11_display_device ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetX11DisplayDevice", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_x11_display_device_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_x11_display_device: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_x11_display_device(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_x11_display_device(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_x11_display_device_finish ( + ConsoleKitSession *proxy, + gchar **out_x11_display_device, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_x11_display_device); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_x11_display_device_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_x11_display_device: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetX11DisplayDevice">GetX11DisplayDevice()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_x11_display_device() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_x11_display_device_sync ( + ConsoleKitSession *proxy, + gchar **out_x11_display_device, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetX11DisplayDevice", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_x11_display_device); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_display_device: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetDisplayDevice">GetDisplayDevice()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_display_device_finish() to get the result of the operation. + * + * See console_kit_session_call_get_display_device_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_display_device ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetDisplayDevice", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_display_device_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_display_device: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_display_device(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_display_device(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_display_device_finish ( + ConsoleKitSession *proxy, + gchar **out_display_device, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_display_device); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_display_device_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_display_device: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetDisplayDevice">GetDisplayDevice()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_display_device() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_display_device_sync ( + ConsoleKitSession *proxy, + gchar **out_display_device, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetDisplayDevice", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_display_device); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_remote_host_name: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetRemoteHostName">GetRemoteHostName()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_remote_host_name_finish() to get the result of the operation. + * + * See console_kit_session_call_get_remote_host_name_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_remote_host_name ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetRemoteHostName", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_remote_host_name_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_remote_host_name: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_remote_host_name(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_remote_host_name(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_remote_host_name_finish ( + ConsoleKitSession *proxy, + gchar **out_remote_host_name, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_remote_host_name); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_remote_host_name_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_remote_host_name: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetRemoteHostName">GetRemoteHostName()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_remote_host_name() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_remote_host_name_sync ( + ConsoleKitSession *proxy, + gchar **out_remote_host_name, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetRemoteHostName", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_remote_host_name); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_login_session_id: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetLoginSessionId">GetLoginSessionId()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_login_session_id_finish() to get the result of the operation. + * + * See console_kit_session_call_get_login_session_id_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_login_session_id ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetLoginSessionId", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_login_session_id_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_login_session_id: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_login_session_id(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_login_session_id(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_login_session_id_finish ( + ConsoleKitSession *proxy, + gchar **out_login_session_id, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_login_session_id); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_login_session_id_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_login_session_id: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetLoginSessionId">GetLoginSessionId()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_login_session_id() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_login_session_id_sync ( + ConsoleKitSession *proxy, + gchar **out_login_session_id, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetLoginSessionId", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_login_session_id); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_is_active: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.IsActive">IsActive()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_is_active_finish() to get the result of the operation. + * + * See console_kit_session_call_is_active_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_is_active ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "IsActive", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_is_active_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_active: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_is_active(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_is_active(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_is_active_finish ( + ConsoleKitSession *proxy, + gboolean *out_active, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_active); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_is_active_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_active: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.IsActive">IsActive()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_is_active() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_is_active_sync ( + ConsoleKitSession *proxy, + gboolean *out_active, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "IsActive", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_active); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_is_local: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.IsLocal">IsLocal()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_is_local_finish() to get the result of the operation. + * + * See console_kit_session_call_is_local_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_is_local ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "IsLocal", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_is_local_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_local: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_is_local(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_is_local(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_is_local_finish ( + ConsoleKitSession *proxy, + gboolean *out_local, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_local); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_is_local_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_local: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.IsLocal">IsLocal()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_is_local() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_is_local_sync ( + ConsoleKitSession *proxy, + gboolean *out_local, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "IsLocal", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_local); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_creation_time: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetCreationTime">GetCreationTime()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_creation_time_finish() to get the result of the operation. + * + * See console_kit_session_call_get_creation_time_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_creation_time ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetCreationTime", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_creation_time_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_iso8601_datetime: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_creation_time(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_creation_time(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_creation_time_finish ( + ConsoleKitSession *proxy, + gchar **out_iso8601_datetime, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_iso8601_datetime); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_creation_time_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_iso8601_datetime: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetCreationTime">GetCreationTime()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_creation_time() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_creation_time_sync ( + ConsoleKitSession *proxy, + gchar **out_iso8601_datetime, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetCreationTime", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_iso8601_datetime); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_activate: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.Activate">Activate()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_activate_finish() to get the result of the operation. + * + * See console_kit_session_call_activate_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_activate ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Activate", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_activate_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_activate(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_activate(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_activate_finish ( + ConsoleKitSession *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_activate_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.Activate">Activate()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_activate() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_activate_sync ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Activate", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_lock: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.Lock">Lock()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_lock_finish() to get the result of the operation. + * + * See console_kit_session_call_lock_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_lock ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Lock", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_lock_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_lock(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_lock(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_lock_finish ( + ConsoleKitSession *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_lock_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.Lock">Lock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_lock() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_lock_sync ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Lock", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_unlock: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.Unlock">Unlock()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_unlock_finish() to get the result of the operation. + * + * See console_kit_session_call_unlock_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_unlock ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Unlock", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_unlock_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_unlock(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_unlock(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_unlock_finish ( + ConsoleKitSession *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_unlock_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.Unlock">Unlock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_unlock() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_unlock_sync ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Unlock", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_idle_hint: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetIdleHint">GetIdleHint()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_idle_hint_finish() to get the result of the operation. + * + * See console_kit_session_call_get_idle_hint_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_idle_hint ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetIdleHint", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_idle_hint_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_idle_hint: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_idle_hint(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_idle_hint(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_idle_hint_finish ( + ConsoleKitSession *proxy, + gboolean *out_idle_hint, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_idle_hint); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_idle_hint_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_idle_hint: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetIdleHint">GetIdleHint()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_idle_hint() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_idle_hint_sync ( + ConsoleKitSession *proxy, + gboolean *out_idle_hint, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetIdleHint", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_idle_hint); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_idle_since_hint: + * @proxy: A #ConsoleKitSessionProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetIdleSinceHint">GetIdleSinceHint()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_get_idle_since_hint_finish() to get the result of the operation. + * + * See console_kit_session_call_get_idle_since_hint_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_get_idle_since_hint ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetIdleSinceHint", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_get_idle_since_hint_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @out_iso8601_datetime: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_get_idle_since_hint(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_get_idle_since_hint(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_idle_since_hint_finish ( + ConsoleKitSession *proxy, + gchar **out_iso8601_datetime, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_iso8601_datetime); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_get_idle_since_hint_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @out_iso8601_datetime: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetIdleSinceHint">GetIdleSinceHint()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_get_idle_since_hint() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_get_idle_since_hint_sync ( + ConsoleKitSession *proxy, + gchar **out_iso8601_datetime, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetIdleSinceHint", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(s)", + out_iso8601_datetime); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_set_idle_hint: + * @proxy: A #ConsoleKitSessionProxy. + * @arg_idle_hint: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.SetIdleHint">SetIdleHint()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_call_set_idle_hint_finish() to get the result of the operation. + * + * See console_kit_session_call_set_idle_hint_sync() for the synchronous, blocking version of this method. + */ +void +console_kit_session_call_set_idle_hint ( + ConsoleKitSession *proxy, + gboolean arg_idle_hint, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetIdleHint", + g_variant_new ("(b)", + arg_idle_hint), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * console_kit_session_call_set_idle_hint_finish: + * @proxy: A #ConsoleKitSessionProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_call_set_idle_hint(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with console_kit_session_call_set_idle_hint(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_set_idle_hint_finish ( + ConsoleKitSession *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_call_set_idle_hint_sync: + * @proxy: A #ConsoleKitSessionProxy. + * @arg_idle_hint: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.SetIdleHint">SetIdleHint()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See console_kit_session_call_set_idle_hint() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +console_kit_session_call_set_idle_hint_sync ( + ConsoleKitSession *proxy, + gboolean arg_idle_hint, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetIdleHint", + g_variant_new ("(b)", + arg_idle_hint), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * console_kit_session_complete_get_id: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @ssid: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetId">GetId()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_id ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *ssid) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(o)", + ssid)); +} + +/** + * console_kit_session_complete_get_seat_id: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @sid: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetSeatId">GetSeatId()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_seat_id ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *sid) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(o)", + sid)); +} + +/** + * console_kit_session_complete_get_session_type: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @type: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetSessionType">GetSessionType()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_session_type ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *type) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(s)", + type)); +} + +/** + * console_kit_session_complete_get_user: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @uid: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetUser">GetUser()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_user ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + guint uid) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + uid)); +} + +/** + * console_kit_session_complete_get_unix_user: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @uid: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetUnixUser">GetUnixUser()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_unix_user ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + guint uid) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + uid)); +} + +/** + * console_kit_session_complete_get_x11_display: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @display: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetX11Display">GetX11Display()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_x11_display ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *display) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(s)", + display)); +} + +/** + * console_kit_session_complete_get_x11_display_device: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @x11_display_device: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetX11DisplayDevice">GetX11DisplayDevice()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_x11_display_device ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *x11_display_device) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(s)", + x11_display_device)); +} + +/** + * console_kit_session_complete_get_display_device: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @display_device: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetDisplayDevice">GetDisplayDevice()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_display_device ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *display_device) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(s)", + display_device)); +} + +/** + * console_kit_session_complete_get_remote_host_name: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @remote_host_name: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetRemoteHostName">GetRemoteHostName()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_remote_host_name ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *remote_host_name) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(s)", + remote_host_name)); +} + +/** + * console_kit_session_complete_get_login_session_id: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @login_session_id: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetLoginSessionId">GetLoginSessionId()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_login_session_id ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *login_session_id) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(s)", + login_session_id)); +} + +/** + * console_kit_session_complete_is_active: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @active: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.IsActive">IsActive()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_is_active ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + gboolean active) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(b)", + active)); +} + +/** + * console_kit_session_complete_is_local: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @local: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.IsLocal">IsLocal()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_is_local ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + gboolean local) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(b)", + local)); +} + +/** + * console_kit_session_complete_get_creation_time: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @iso8601_datetime: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetCreationTime">GetCreationTime()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_creation_time ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *iso8601_datetime) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(s)", + iso8601_datetime)); +} + +/** + * console_kit_session_complete_activate: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.Activate">Activate()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_activate ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * console_kit_session_complete_lock: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.Lock">Lock()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_lock ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * console_kit_session_complete_unlock: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.Unlock">Unlock()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_unlock ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * console_kit_session_complete_get_idle_hint: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @idle_hint: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetIdleHint">GetIdleHint()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_idle_hint ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + gboolean idle_hint) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(b)", + idle_hint)); +} + +/** + * console_kit_session_complete_get_idle_since_hint: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @iso8601_datetime: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.GetIdleSinceHint">GetIdleSinceHint()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_get_idle_since_hint ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *iso8601_datetime) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(s)", + iso8601_datetime)); +} + +/** + * console_kit_session_complete_set_idle_hint: + * @object: A #ConsoleKitSession. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-ConsoleKit-Session.SetIdleHint">SetIdleHint()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +console_kit_session_complete_set_idle_hint ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * ConsoleKitSessionProxy: + * + * The #ConsoleKitSessionProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * ConsoleKitSessionProxyClass: + * @parent_class: The parent class. + * + * Class structure for #ConsoleKitSessionProxy. + */ + +struct _ConsoleKitSessionProxyPrivate +{ + GData *qdata; +}; + +static void console_kit_session_proxy_iface_init (ConsoleKitSessionIface *iface); + +G_DEFINE_TYPE_WITH_CODE (ConsoleKitSessionProxy, console_kit_session_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_CONSOLE_KIT_SESSION, console_kit_session_proxy_iface_init)); + +static void +console_kit_session_proxy_finalize (GObject *object) +{ + ConsoleKitSessionProxy *proxy = CONSOLE_KIT_SESSION_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (console_kit_session_proxy_parent_class)->finalize (object); +} + +static void +console_kit_session_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 10); + info = _console_kit_session_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +console_kit_session_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + error = NULL; + if (!g_dbus_proxy_call_finish (proxy, res, &error)) + { + g_warning ("Error setting property `%s' on interface org.freedesktop.ConsoleKit.Session: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } +} + +static void +console_kit_session_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 10); + info = _console_kit_session_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.freedesktop.ConsoleKit.Session", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) console_kit_session_proxy_set_property_cb, (gpointer) info); + g_variant_unref (variant); +} + +static void +console_kit_session_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_console_kit_session_interface_info, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_CONSOLE_KIT_SESSION); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_CONSOLE_KIT_SESSION); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +console_kit_session_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + ConsoleKitSessionProxy *proxy = CONSOLE_KIT_SESSION_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_console_kit_session_interface_info, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_console_kit_session_interface_info, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static guint +console_kit_session_proxy_get_unix_user (ConsoleKitSession *object) +{ + ConsoleKitSessionProxy *proxy = CONSOLE_KIT_SESSION_PROXY (object); + GVariant *variant; + guint value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "unix-user"); + if (variant != NULL) + { + value = g_variant_get_uint32 (variant); + g_variant_unref (variant); + } + return value; +} + +static guint +console_kit_session_proxy_get_user (ConsoleKitSession *object) +{ + ConsoleKitSessionProxy *proxy = CONSOLE_KIT_SESSION_PROXY (object); + GVariant *variant; + guint value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "user"); + if (variant != NULL) + { + value = g_variant_get_uint32 (variant); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +console_kit_session_proxy_get_session_type (ConsoleKitSession *object) +{ + ConsoleKitSessionProxy *proxy = CONSOLE_KIT_SESSION_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "session-type"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +console_kit_session_proxy_get_remote_host_name (ConsoleKitSession *object) +{ + ConsoleKitSessionProxy *proxy = CONSOLE_KIT_SESSION_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "remote-host-name"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +console_kit_session_proxy_get_display_device (ConsoleKitSession *object) +{ + ConsoleKitSessionProxy *proxy = CONSOLE_KIT_SESSION_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "display-device"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +console_kit_session_proxy_get_x11_display (ConsoleKitSession *object) +{ + ConsoleKitSessionProxy *proxy = CONSOLE_KIT_SESSION_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "x11-display"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +console_kit_session_proxy_get_x11_display_device (ConsoleKitSession *object) +{ + ConsoleKitSessionProxy *proxy = CONSOLE_KIT_SESSION_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "x11-display-device"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static gboolean +console_kit_session_proxy_get_active (ConsoleKitSession *object) +{ + ConsoleKitSessionProxy *proxy = CONSOLE_KIT_SESSION_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "active"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +console_kit_session_proxy_get_is_local (ConsoleKitSession *object) +{ + ConsoleKitSessionProxy *proxy = CONSOLE_KIT_SESSION_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "is-local"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +console_kit_session_proxy_get_idle_hint (ConsoleKitSession *object) +{ + ConsoleKitSessionProxy *proxy = CONSOLE_KIT_SESSION_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "idle-hint"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static void +console_kit_session_proxy_init (ConsoleKitSessionProxy *proxy) +{ + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONSOLE_KIT_SESSION_PROXY, ConsoleKitSessionProxyPrivate); + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), console_kit_session_interface_info ()); +} + +static void +console_kit_session_proxy_class_init (ConsoleKitSessionProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + g_type_class_add_private (klass, sizeof (ConsoleKitSessionProxyPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = console_kit_session_proxy_finalize; + gobject_class->get_property = console_kit_session_proxy_get_property; + gobject_class->set_property = console_kit_session_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = console_kit_session_proxy_g_signal; + proxy_class->g_properties_changed = console_kit_session_proxy_g_properties_changed; + + + console_kit_session_override_properties (gobject_class, 1); +} + +static void +console_kit_session_proxy_iface_init (ConsoleKitSessionIface *iface) +{ + iface->get_unix_user = console_kit_session_proxy_get_unix_user; + iface->get_user = console_kit_session_proxy_get_user; + iface->get_session_type = console_kit_session_proxy_get_session_type; + iface->get_remote_host_name = console_kit_session_proxy_get_remote_host_name; + iface->get_display_device = console_kit_session_proxy_get_display_device; + iface->get_x11_display = console_kit_session_proxy_get_x11_display; + iface->get_x11_display_device = console_kit_session_proxy_get_x11_display_device; + iface->get_active = console_kit_session_proxy_get_active; + iface->get_is_local = console_kit_session_proxy_get_is_local; + iface->get_idle_hint = console_kit_session_proxy_get_idle_hint; +} + +/** + * console_kit_session_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Session.top_of_page">org.freedesktop.ConsoleKit.Session</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_proxy_new_finish() to get the result of the operation. + * + * See console_kit_session_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +console_kit_session_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_CONSOLE_KIT_SESSION_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.ConsoleKit.Session", NULL); +} + +/** + * console_kit_session_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with console_kit_session_proxy_new(). + * + * Returns: (transfer full) (type ConsoleKitSessionProxy): The constructed proxy object or %NULL if @error is set. + */ +ConsoleKitSession * +console_kit_session_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return CONSOLE_KIT_SESSION (ret); + else + return NULL; +} + +/** + * console_kit_session_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Session.top_of_page">org.freedesktop.ConsoleKit.Session</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See console_kit_session_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type ConsoleKitSessionProxy): The constructed proxy object or %NULL if @error is set. + */ +ConsoleKitSession * +console_kit_session_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_CONSOLE_KIT_SESSION_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.ConsoleKit.Session", NULL); + if (ret != NULL) + return CONSOLE_KIT_SESSION (ret); + else + return NULL; +} + + +/** + * console_kit_session_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like console_kit_session_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call console_kit_session_proxy_new_for_bus_finish() to get the result of the operation. + * + * See console_kit_session_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +console_kit_session_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_CONSOLE_KIT_SESSION_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.ConsoleKit.Session", NULL); +} + +/** + * console_kit_session_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to console_kit_session_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with console_kit_session_proxy_new_for_bus(). + * + * Returns: (transfer full) (type ConsoleKitSessionProxy): The constructed proxy object or %NULL if @error is set. + */ +ConsoleKitSession * +console_kit_session_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return CONSOLE_KIT_SESSION (ret); + else + return NULL; +} + +/** + * console_kit_session_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like console_kit_session_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See console_kit_session_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type ConsoleKitSessionProxy): The constructed proxy object or %NULL if @error is set. + */ +ConsoleKitSession * +console_kit_session_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_CONSOLE_KIT_SESSION_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.ConsoleKit.Session", NULL); + if (ret != NULL) + return CONSOLE_KIT_SESSION (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * ConsoleKitSessionSkeleton: + * + * The #ConsoleKitSessionSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * ConsoleKitSessionSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #ConsoleKitSessionSkeleton. + */ + +struct _ConsoleKitSessionSkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_console_kit_session_skeleton_handle_method_call ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_CONSOLE_KIT_SESSION); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_CONSOLE_KIT_SESSION); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + 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); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_console_kit_session_skeleton_handle_get_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_console_kit_session_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_console_kit_session_skeleton_handle_set_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_console_kit_session_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _console_kit_session_skeleton_vtable = +{ + _console_kit_session_skeleton_handle_method_call, + _console_kit_session_skeleton_handle_get_property, + _console_kit_session_skeleton_handle_set_property +}; + +static GDBusInterfaceInfo * +console_kit_session_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton) +{ + return console_kit_session_interface_info (); +} + +static GDBusInterfaceVTable * +console_kit_session_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton) +{ + return (GDBusInterfaceVTable *) &_console_kit_session_skeleton_vtable; +} + +static GVariant * +console_kit_session_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_console_kit_session_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _console_kit_session_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _console_kit_session_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _console_kit_session_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.ConsoleKit.Session", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean _console_kit_session_emit_changed (gpointer user_data); + +static void +console_kit_session_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (&skeleton->priv->lock); + + if (emit_changed) + _console_kit_session_emit_changed (skeleton); +} + +static void +_console_kit_session_on_signal_active_changed ( + ConsoleKitSession *object, + gboolean arg_is_active) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(b)", + arg_is_active)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.ConsoleKit.Session", "ActiveChanged", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_console_kit_session_on_signal_idle_hint_changed ( + ConsoleKitSession *object, + gboolean arg_hint) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(b)", + arg_hint)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.ConsoleKit.Session", "IdleHintChanged", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_console_kit_session_on_signal_lock ( + ConsoleKitSession *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("()")); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.ConsoleKit.Session", "Lock", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_console_kit_session_on_signal_unlock ( + ConsoleKitSession *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("()")); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.ConsoleKit.Session", "Unlock", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void console_kit_session_skeleton_iface_init (ConsoleKitSessionIface *iface); +G_DEFINE_TYPE_WITH_CODE (ConsoleKitSessionSkeleton, console_kit_session_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_CONSOLE_KIT_SESSION, console_kit_session_skeleton_iface_init)); + +static void +console_kit_session_skeleton_finalize (GObject *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + guint n; + for (n = 0; n < 10; n++) + g_value_unset (&skeleton->priv->properties[n]); + g_free (skeleton->priv->properties); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (console_kit_session_skeleton_parent_class)->finalize (object); +} + +static void +console_kit_session_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 10); + g_mutex_lock (&skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock (&skeleton->priv->lock); +} + +static gboolean +_console_kit_session_emit_changed (gpointer user_data) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (&skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *l; + GVariant *signal_variant; + signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.ConsoleKit.Session", + &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + signal_variant, + NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (&skeleton->priv->lock); + return FALSE; +} + +static void +_console_kit_session_schedule_emit_changed (ConsoleKitSessionSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +console_kit_session_skeleton_notify (GObject *object, + GParamSpec *pspec) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, _console_kit_session_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (&skeleton->priv->lock); +} + +static void +console_kit_session_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 10); + g_mutex_lock (&skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + _console_kit_session_schedule_emit_changed (skeleton, _console_kit_session_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (&skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +console_kit_session_skeleton_init (ConsoleKitSessionSkeleton *skeleton) +{ + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONSOLE_KIT_SESSION_SKELETON, ConsoleKitSessionSkeletonPrivate); + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); + skeleton->priv->properties = g_new0 (GValue, 10); + g_value_init (&skeleton->priv->properties[0], G_TYPE_UINT); + g_value_init (&skeleton->priv->properties[1], G_TYPE_UINT); + g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[5], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[6], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[7], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[8], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[9], G_TYPE_BOOLEAN); +} + +static guint +console_kit_session_skeleton_get_unix_user (ConsoleKitSession *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + guint value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_uint (&(skeleton->priv->properties[0])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static guint +console_kit_session_skeleton_get_user (ConsoleKitSession *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + guint value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_uint (&(skeleton->priv->properties[1])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +console_kit_session_skeleton_get_session_type (ConsoleKitSession *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[2])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +console_kit_session_skeleton_get_remote_host_name (ConsoleKitSession *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[3])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +console_kit_session_skeleton_get_display_device (ConsoleKitSession *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[4])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +console_kit_session_skeleton_get_x11_display (ConsoleKitSession *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[5])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +console_kit_session_skeleton_get_x11_display_device (ConsoleKitSession *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[6])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +console_kit_session_skeleton_get_active (ConsoleKitSession *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[7])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +console_kit_session_skeleton_get_is_local (ConsoleKitSession *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[8])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +console_kit_session_skeleton_get_idle_hint (ConsoleKitSession *object) +{ + ConsoleKitSessionSkeleton *skeleton = CONSOLE_KIT_SESSION_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[9])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static void +console_kit_session_skeleton_class_init (ConsoleKitSessionSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + g_type_class_add_private (klass, sizeof (ConsoleKitSessionSkeletonPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = console_kit_session_skeleton_finalize; + gobject_class->get_property = console_kit_session_skeleton_get_property; + gobject_class->set_property = console_kit_session_skeleton_set_property; + gobject_class->notify = console_kit_session_skeleton_notify; + + + console_kit_session_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = console_kit_session_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = console_kit_session_skeleton_dbus_interface_get_properties; + skeleton_class->flush = console_kit_session_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = console_kit_session_skeleton_dbus_interface_get_vtable; +} + +static void +console_kit_session_skeleton_iface_init (ConsoleKitSessionIface *iface) +{ + iface->active_changed = _console_kit_session_on_signal_active_changed; + iface->idle_hint_changed = _console_kit_session_on_signal_idle_hint_changed; + iface->lock = _console_kit_session_on_signal_lock; + iface->unlock = _console_kit_session_on_signal_unlock; + iface->get_unix_user = console_kit_session_skeleton_get_unix_user; + iface->get_user = console_kit_session_skeleton_get_user; + iface->get_session_type = console_kit_session_skeleton_get_session_type; + iface->get_remote_host_name = console_kit_session_skeleton_get_remote_host_name; + iface->get_display_device = console_kit_session_skeleton_get_display_device; + iface->get_x11_display = console_kit_session_skeleton_get_x11_display; + iface->get_x11_display_device = console_kit_session_skeleton_get_x11_display_device; + iface->get_active = console_kit_session_skeleton_get_active; + iface->get_is_local = console_kit_session_skeleton_get_is_local; + iface->get_idle_hint = console_kit_session_skeleton_get_idle_hint; +} + +/** + * console_kit_session_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-ConsoleKit-Session.top_of_page">org.freedesktop.ConsoleKit.Session</link>. + * + * Returns: (transfer full) (type ConsoleKitSessionSkeleton): The skeleton object. + */ +ConsoleKitSession * +console_kit_session_skeleton_new (void) +{ + return CONSOLE_KIT_SESSION (g_object_new (TYPE_CONSOLE_KIT_SESSION_SKELETON, NULL)); +} + diff --git a/src/dbus-consolekit-session.h b/src/dbus-consolekit-session.h new file mode 100644 index 0000000..5156522 --- /dev/null +++ b/src/dbus-consolekit-session.h @@ -0,0 +1,737 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __DBUS_CONSOLEKIT_SESSION_H__ +#define __DBUS_CONSOLEKIT_SESSION_H__ + +#include <gio/gio.h> + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.freedesktop.ConsoleKit.Session */ + +#define TYPE_CONSOLE_KIT_SESSION (console_kit_session_get_type ()) +#define CONSOLE_KIT_SESSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_CONSOLE_KIT_SESSION, ConsoleKitSession)) +#define IS_CONSOLE_KIT_SESSION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_CONSOLE_KIT_SESSION)) +#define CONSOLE_KIT_SESSION_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_CONSOLE_KIT_SESSION, ConsoleKitSessionIface)) + +struct _ConsoleKitSession; +typedef struct _ConsoleKitSession ConsoleKitSession; +typedef struct _ConsoleKitSessionIface ConsoleKitSessionIface; + +struct _ConsoleKitSessionIface +{ + GTypeInterface parent_iface; + + + + gboolean (*handle_activate) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_creation_time) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_display_device) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_id) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_idle_hint) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_idle_since_hint) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_login_session_id) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_remote_host_name) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_seat_id) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_session_type) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_unix_user) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_user) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_x11_display) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_x11_display_device) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_is_active) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_is_local) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_lock) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_set_idle_hint) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + gboolean arg_idle_hint); + + gboolean (*handle_unlock) ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + gboolean (*get_active) (ConsoleKitSession *object); + + const gchar * (*get_display_device) (ConsoleKitSession *object); + + gboolean (*get_idle_hint) (ConsoleKitSession *object); + + gboolean (*get_is_local) (ConsoleKitSession *object); + + const gchar * (*get_remote_host_name) (ConsoleKitSession *object); + + const gchar * (*get_session_type) (ConsoleKitSession *object); + + guint (*get_unix_user) (ConsoleKitSession *object); + + guint (*get_user) (ConsoleKitSession *object); + + const gchar * (*get_x11_display) (ConsoleKitSession *object); + + const gchar * (*get_x11_display_device) (ConsoleKitSession *object); + + void (*active_changed) ( + ConsoleKitSession *object, + gboolean arg_is_active); + + void (*idle_hint_changed) ( + ConsoleKitSession *object, + gboolean arg_hint); + + void (*lock) ( + ConsoleKitSession *object); + + void (*unlock) ( + ConsoleKitSession *object); + +}; + +GType console_kit_session_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *console_kit_session_interface_info (void); +guint console_kit_session_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void console_kit_session_complete_get_id ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *ssid); + +void console_kit_session_complete_get_seat_id ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *sid); + +void console_kit_session_complete_get_session_type ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *type); + +void console_kit_session_complete_get_user ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + guint uid); + +void console_kit_session_complete_get_unix_user ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + guint uid); + +void console_kit_session_complete_get_x11_display ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *display); + +void console_kit_session_complete_get_x11_display_device ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *x11_display_device); + +void console_kit_session_complete_get_display_device ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *display_device); + +void console_kit_session_complete_get_remote_host_name ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *remote_host_name); + +void console_kit_session_complete_get_login_session_id ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *login_session_id); + +void console_kit_session_complete_is_active ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + gboolean active); + +void console_kit_session_complete_is_local ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + gboolean local); + +void console_kit_session_complete_get_creation_time ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *iso8601_datetime); + +void console_kit_session_complete_activate ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + +void console_kit_session_complete_lock ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + +void console_kit_session_complete_unlock ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + +void console_kit_session_complete_get_idle_hint ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + gboolean idle_hint); + +void console_kit_session_complete_get_idle_since_hint ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation, + const gchar *iso8601_datetime); + +void console_kit_session_complete_set_idle_hint ( + ConsoleKitSession *object, + GDBusMethodInvocation *invocation); + + + +/* D-Bus signal emissions functions: */ +void console_kit_session_emit_active_changed ( + ConsoleKitSession *object, + gboolean arg_is_active); + +void console_kit_session_emit_idle_hint_changed ( + ConsoleKitSession *object, + gboolean arg_hint); + +void console_kit_session_emit_lock ( + ConsoleKitSession *object); + +void console_kit_session_emit_unlock ( + ConsoleKitSession *object); + + + +/* D-Bus method calls: */ +void console_kit_session_call_get_id ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_id_finish ( + ConsoleKitSession *proxy, + gchar **out_ssid, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_id_sync ( + ConsoleKitSession *proxy, + gchar **out_ssid, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_get_seat_id ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_seat_id_finish ( + ConsoleKitSession *proxy, + gchar **out_sid, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_seat_id_sync ( + ConsoleKitSession *proxy, + gchar **out_sid, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_get_session_type ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_session_type_finish ( + ConsoleKitSession *proxy, + gchar **out_type, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_session_type_sync ( + ConsoleKitSession *proxy, + gchar **out_type, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_get_user ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_user_finish ( + ConsoleKitSession *proxy, + guint *out_uid, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_user_sync ( + ConsoleKitSession *proxy, + guint *out_uid, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_get_unix_user ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_unix_user_finish ( + ConsoleKitSession *proxy, + guint *out_uid, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_unix_user_sync ( + ConsoleKitSession *proxy, + guint *out_uid, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_get_x11_display ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_x11_display_finish ( + ConsoleKitSession *proxy, + gchar **out_display, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_x11_display_sync ( + ConsoleKitSession *proxy, + gchar **out_display, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_get_x11_display_device ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_x11_display_device_finish ( + ConsoleKitSession *proxy, + gchar **out_x11_display_device, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_x11_display_device_sync ( + ConsoleKitSession *proxy, + gchar **out_x11_display_device, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_get_display_device ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_display_device_finish ( + ConsoleKitSession *proxy, + gchar **out_display_device, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_display_device_sync ( + ConsoleKitSession *proxy, + gchar **out_display_device, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_get_remote_host_name ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_remote_host_name_finish ( + ConsoleKitSession *proxy, + gchar **out_remote_host_name, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_remote_host_name_sync ( + ConsoleKitSession *proxy, + gchar **out_remote_host_name, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_get_login_session_id ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_login_session_id_finish ( + ConsoleKitSession *proxy, + gchar **out_login_session_id, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_login_session_id_sync ( + ConsoleKitSession *proxy, + gchar **out_login_session_id, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_is_active ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_is_active_finish ( + ConsoleKitSession *proxy, + gboolean *out_active, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_is_active_sync ( + ConsoleKitSession *proxy, + gboolean *out_active, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_is_local ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_is_local_finish ( + ConsoleKitSession *proxy, + gboolean *out_local, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_is_local_sync ( + ConsoleKitSession *proxy, + gboolean *out_local, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_get_creation_time ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_creation_time_finish ( + ConsoleKitSession *proxy, + gchar **out_iso8601_datetime, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_creation_time_sync ( + ConsoleKitSession *proxy, + gchar **out_iso8601_datetime, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_activate ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_activate_finish ( + ConsoleKitSession *proxy, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_activate_sync ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_lock ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_lock_finish ( + ConsoleKitSession *proxy, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_lock_sync ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_unlock ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_unlock_finish ( + ConsoleKitSession *proxy, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_unlock_sync ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_get_idle_hint ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_idle_hint_finish ( + ConsoleKitSession *proxy, + gboolean *out_idle_hint, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_idle_hint_sync ( + ConsoleKitSession *proxy, + gboolean *out_idle_hint, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_get_idle_since_hint ( + ConsoleKitSession *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_get_idle_since_hint_finish ( + ConsoleKitSession *proxy, + gchar **out_iso8601_datetime, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_get_idle_since_hint_sync ( + ConsoleKitSession *proxy, + gchar **out_iso8601_datetime, + GCancellable *cancellable, + GError **error); + +void console_kit_session_call_set_idle_hint ( + ConsoleKitSession *proxy, + gboolean arg_idle_hint, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean console_kit_session_call_set_idle_hint_finish ( + ConsoleKitSession *proxy, + GAsyncResult *res, + GError **error); + +gboolean console_kit_session_call_set_idle_hint_sync ( + ConsoleKitSession *proxy, + gboolean arg_idle_hint, + GCancellable *cancellable, + GError **error); + + + +/* D-Bus property accessors: */ +guint console_kit_session_get_unix_user (ConsoleKitSession *object); +void console_kit_session_set_unix_user (ConsoleKitSession *object, guint value); + +guint console_kit_session_get_user (ConsoleKitSession *object); +void console_kit_session_set_user (ConsoleKitSession *object, guint value); + +const gchar *console_kit_session_get_session_type (ConsoleKitSession *object); +gchar *console_kit_session_dup_session_type (ConsoleKitSession *object); +void console_kit_session_set_session_type (ConsoleKitSession *object, const gchar *value); + +const gchar *console_kit_session_get_remote_host_name (ConsoleKitSession *object); +gchar *console_kit_session_dup_remote_host_name (ConsoleKitSession *object); +void console_kit_session_set_remote_host_name (ConsoleKitSession *object, const gchar *value); + +const gchar *console_kit_session_get_display_device (ConsoleKitSession *object); +gchar *console_kit_session_dup_display_device (ConsoleKitSession *object); +void console_kit_session_set_display_device (ConsoleKitSession *object, const gchar *value); + +const gchar *console_kit_session_get_x11_display (ConsoleKitSession *object); +gchar *console_kit_session_dup_x11_display (ConsoleKitSession *object); +void console_kit_session_set_x11_display (ConsoleKitSession *object, const gchar *value); + +const gchar *console_kit_session_get_x11_display_device (ConsoleKitSession *object); +gchar *console_kit_session_dup_x11_display_device (ConsoleKitSession *object); +void console_kit_session_set_x11_display_device (ConsoleKitSession *object, const gchar *value); + +gboolean console_kit_session_get_active (ConsoleKitSession *object); +void console_kit_session_set_active (ConsoleKitSession *object, gboolean value); + +gboolean console_kit_session_get_is_local (ConsoleKitSession *object); +void console_kit_session_set_is_local (ConsoleKitSession *object, gboolean value); + +gboolean console_kit_session_get_idle_hint (ConsoleKitSession *object); +void console_kit_session_set_idle_hint (ConsoleKitSession *object, gboolean value); + + +/* ---- */ + +#define TYPE_CONSOLE_KIT_SESSION_PROXY (console_kit_session_proxy_get_type ()) +#define CONSOLE_KIT_SESSION_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_CONSOLE_KIT_SESSION_PROXY, ConsoleKitSessionProxy)) +#define CONSOLE_KIT_SESSION_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_CONSOLE_KIT_SESSION_PROXY, ConsoleKitSessionProxyClass)) +#define CONSOLE_KIT_SESSION_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_CONSOLE_KIT_SESSION_PROXY, ConsoleKitSessionProxyClass)) +#define IS_CONSOLE_KIT_SESSION_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_CONSOLE_KIT_SESSION_PROXY)) +#define IS_CONSOLE_KIT_SESSION_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_CONSOLE_KIT_SESSION_PROXY)) + +typedef struct _ConsoleKitSessionProxy ConsoleKitSessionProxy; +typedef struct _ConsoleKitSessionProxyClass ConsoleKitSessionProxyClass; +typedef struct _ConsoleKitSessionProxyPrivate ConsoleKitSessionProxyPrivate; + +struct _ConsoleKitSessionProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + ConsoleKitSessionProxyPrivate *priv; +}; + +struct _ConsoleKitSessionProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType console_kit_session_proxy_get_type (void) G_GNUC_CONST; + +void console_kit_session_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +ConsoleKitSession *console_kit_session_proxy_new_finish ( + GAsyncResult *res, + GError **error); +ConsoleKitSession *console_kit_session_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void console_kit_session_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +ConsoleKitSession *console_kit_session_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +ConsoleKitSession *console_kit_session_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_CONSOLE_KIT_SESSION_SKELETON (console_kit_session_skeleton_get_type ()) +#define CONSOLE_KIT_SESSION_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_CONSOLE_KIT_SESSION_SKELETON, ConsoleKitSessionSkeleton)) +#define CONSOLE_KIT_SESSION_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_CONSOLE_KIT_SESSION_SKELETON, ConsoleKitSessionSkeletonClass)) +#define CONSOLE_KIT_SESSION_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_CONSOLE_KIT_SESSION_SKELETON, ConsoleKitSessionSkeletonClass)) +#define IS_CONSOLE_KIT_SESSION_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_CONSOLE_KIT_SESSION_SKELETON)) +#define IS_CONSOLE_KIT_SESSION_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_CONSOLE_KIT_SESSION_SKELETON)) + +typedef struct _ConsoleKitSessionSkeleton ConsoleKitSessionSkeleton; +typedef struct _ConsoleKitSessionSkeletonClass ConsoleKitSessionSkeletonClass; +typedef struct _ConsoleKitSessionSkeletonPrivate ConsoleKitSessionSkeletonPrivate; + +struct _ConsoleKitSessionSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + ConsoleKitSessionSkeletonPrivate *priv; +}; + +struct _ConsoleKitSessionSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType console_kit_session_skeleton_get_type (void) G_GNUC_CONST; + +ConsoleKitSession *console_kit_session_skeleton_new (void); + + +G_END_DECLS + +#endif /* __DBUS_CONSOLEKIT_SESSION_H__ */ diff --git a/src/dbus-display-manager.c b/src/dbus-display-manager.c new file mode 100644 index 0000000..0545062 --- /dev/null +++ b/src/dbus-display-manager.c @@ -0,0 +1,1986 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "dbus-display-manager.h" + +#include <string.h> +#ifdef G_OS_UNIX +# include <gio/gunixfdlist.h> +#endif + +typedef struct +{ + GDBusArgInfo parent_struct; + gboolean use_gvariant; +} _ExtendedGDBusArgInfo; + +typedef struct +{ + GDBusMethodInfo parent_struct; + const gchar *signal_name; + gboolean pass_fdlist; +} _ExtendedGDBusMethodInfo; + +typedef struct +{ + GDBusSignalInfo parent_struct; + const gchar *signal_name; +} _ExtendedGDBusSignalInfo; + +typedef struct +{ + GDBusPropertyInfo parent_struct; + const gchar *hyphen_name; + gboolean use_gvariant; +} _ExtendedGDBusPropertyInfo; + +typedef struct +{ + GDBusInterfaceInfo parent_struct; + const gchar *hyphen_name; +} _ExtendedGDBusInterfaceInfo; + +typedef struct +{ + const _ExtendedGDBusPropertyInfo *info; + guint prop_id; + GValue orig_value; /* the value before the change */ +} ChangedProperty; + +static void +_changed_property_free (ChangedProperty *data) +{ + g_value_unset (&data->orig_value); + g_free (data); +} + +static gboolean +_g_strv_equal0 (gchar **a, gchar **b) +{ + gboolean ret = FALSE; + guint n; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + if (g_strv_length (a) != g_strv_length (b)) + goto out; + for (n = 0; a[n] != NULL; n++) + if (g_strcmp0 (a[n], b[n]) != 0) + goto out; + ret = TRUE; +out: + return ret; +} + +static gboolean +_g_variant_equal0 (GVariant *a, GVariant *b) +{ + gboolean ret = FALSE; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + ret = g_variant_equal (a, b); +out: + return ret; +} + +G_GNUC_UNUSED static gboolean +_g_value_equal (const GValue *a, const GValue *b) +{ + gboolean ret = FALSE; + g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); + switch (G_VALUE_TYPE (a)) + { + case G_TYPE_BOOLEAN: + ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); + break; + case G_TYPE_UCHAR: + ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); + break; + case G_TYPE_INT: + ret = (g_value_get_int (a) == g_value_get_int (b)); + break; + case G_TYPE_UINT: + ret = (g_value_get_uint (a) == g_value_get_uint (b)); + break; + case G_TYPE_INT64: + ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); + break; + case G_TYPE_UINT64: + ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); + break; + case G_TYPE_DOUBLE: + { + /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ + gdouble da = g_value_get_double (a); + gdouble db = g_value_get_double (b); + ret = memcmp (&da, &db, sizeof (gdouble)) == 0; + } + break; + case G_TYPE_STRING: + ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); + break; + case G_TYPE_VARIANT: + ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); + break; + default: + if (G_VALUE_TYPE (a) == G_TYPE_STRV) + ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); + else + g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); + break; + } + return ret; +} + +/* ------------------------------------------------------------------------ + * Code for interface org.freedesktop.DisplayManager.Seat + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:DisplayManagerSeat + * @title: DisplayManagerSeat + * @short_description: Generated C code for the org.freedesktop.DisplayManager.Seat D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-DisplayManager-Seat.top_of_page">org.freedesktop.DisplayManager.Seat</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.freedesktop.DisplayManager.Seat ---- */ + +static const _ExtendedGDBusMethodInfo _display_manager_seat_method_info_switch_to_greeter = +{ + { + -1, + (gchar *) "SwitchToGreeter", + NULL, + NULL, + NULL + }, + "handle-switch-to-greeter", + FALSE +}; + +static const _ExtendedGDBusArgInfo _display_manager_seat_method_info_switch_to_user_IN_ARG_username = +{ + { + -1, + (gchar *) "username", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo _display_manager_seat_method_info_switch_to_user_IN_ARG_session_name = +{ + { + -1, + (gchar *) "session_name", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _display_manager_seat_method_info_switch_to_user_IN_ARG_pointers[] = +{ + &_display_manager_seat_method_info_switch_to_user_IN_ARG_username, + &_display_manager_seat_method_info_switch_to_user_IN_ARG_session_name, + NULL +}; + +static const _ExtendedGDBusMethodInfo _display_manager_seat_method_info_switch_to_user = +{ + { + -1, + (gchar *) "SwitchToUser", + (GDBusArgInfo **) &_display_manager_seat_method_info_switch_to_user_IN_ARG_pointers, + NULL, + NULL + }, + "handle-switch-to-user", + FALSE +}; + +static const _ExtendedGDBusArgInfo _display_manager_seat_method_info_switch_to_guest_IN_ARG_session_name = +{ + { + -1, + (gchar *) "session_name", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _display_manager_seat_method_info_switch_to_guest_IN_ARG_pointers[] = +{ + &_display_manager_seat_method_info_switch_to_guest_IN_ARG_session_name, + NULL +}; + +static const _ExtendedGDBusMethodInfo _display_manager_seat_method_info_switch_to_guest = +{ + { + -1, + (gchar *) "SwitchToGuest", + (GDBusArgInfo **) &_display_manager_seat_method_info_switch_to_guest_IN_ARG_pointers, + NULL, + NULL + }, + "handle-switch-to-guest", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _display_manager_seat_method_info_lock = +{ + { + -1, + (gchar *) "Lock", + NULL, + NULL, + NULL + }, + "handle-lock", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _display_manager_seat_method_info_pointers[] = +{ + &_display_manager_seat_method_info_switch_to_greeter, + &_display_manager_seat_method_info_switch_to_user, + &_display_manager_seat_method_info_switch_to_guest, + &_display_manager_seat_method_info_lock, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _display_manager_seat_property_info_can_switch = +{ + { + -1, + (gchar *) "CanSwitch", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "can-switch", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _display_manager_seat_property_info_has_guest_account = +{ + { + -1, + (gchar *) "HasGuestAccount", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "has-guest-account", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _display_manager_seat_property_info_sessions = +{ + { + -1, + (gchar *) "Sessions", + (gchar *) "ao", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "sessions", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const _display_manager_seat_property_info_pointers[] = +{ + &_display_manager_seat_property_info_can_switch, + &_display_manager_seat_property_info_has_guest_account, + &_display_manager_seat_property_info_sessions, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _display_manager_seat_interface_info = +{ + { + -1, + (gchar *) "org.freedesktop.DisplayManager.Seat", + (GDBusMethodInfo **) &_display_manager_seat_method_info_pointers, + NULL, + (GDBusPropertyInfo **) &_display_manager_seat_property_info_pointers, + NULL + }, + "display-manager-seat", +}; + + +/** + * display_manager_seat_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-DisplayManager-Seat.top_of_page">org.freedesktop.DisplayManager.Seat</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +display_manager_seat_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_display_manager_seat_interface_info; +} + +/** + * display_manager_seat_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #DisplayManagerSeat interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +display_manager_seat_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "can-switch"); + g_object_class_override_property (klass, property_id_begin++, "has-guest-account"); + g_object_class_override_property (klass, property_id_begin++, "sessions"); + return property_id_begin - 1; +} + + + +/** + * DisplayManagerSeat: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DisplayManager-Seat.top_of_page">org.freedesktop.DisplayManager.Seat</link>. + */ + +/** + * DisplayManagerSeatIface: + * @parent_iface: The parent interface. + * @handle_lock: Handler for the #DisplayManagerSeat::handle-lock signal. + * @handle_switch_to_greeter: Handler for the #DisplayManagerSeat::handle-switch-to-greeter signal. + * @handle_switch_to_guest: Handler for the #DisplayManagerSeat::handle-switch-to-guest signal. + * @handle_switch_to_user: Handler for the #DisplayManagerSeat::handle-switch-to-user signal. + * @get_can_switch: Getter for the #DisplayManagerSeat:can-switch property. + * @get_has_guest_account: Getter for the #DisplayManagerSeat:has-guest-account property. + * @get_sessions: Getter for the #DisplayManagerSeat:sessions property. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DisplayManager-Seat.top_of_page">org.freedesktop.DisplayManager.Seat</link>. + */ + +static void +display_manager_seat_default_init (DisplayManagerSeatIface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * DisplayManagerSeat::handle-switch-to-greeter: + * @object: A #DisplayManagerSeat. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.SwitchToGreeter">SwitchToGreeter()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call display_manager_seat_complete_switch_to_greeter() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-switch-to-greeter", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DisplayManagerSeatIface, handle_switch_to_greeter), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * DisplayManagerSeat::handle-switch-to-user: + * @object: A #DisplayManagerSeat. + * @invocation: A #GDBusMethodInvocation. + * @arg_username: Argument passed by remote caller. + * @arg_session_name: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.SwitchToUser">SwitchToUser()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call display_manager_seat_complete_switch_to_user() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-switch-to-user", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DisplayManagerSeatIface, handle_switch_to_user), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 3, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); + + /** + * DisplayManagerSeat::handle-switch-to-guest: + * @object: A #DisplayManagerSeat. + * @invocation: A #GDBusMethodInvocation. + * @arg_session_name: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.SwitchToGuest">SwitchToGuest()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call display_manager_seat_complete_switch_to_guest() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-switch-to-guest", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DisplayManagerSeatIface, handle_switch_to_guest), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * DisplayManagerSeat::handle-lock: + * @object: A #DisplayManagerSeat. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.Lock">Lock()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call display_manager_seat_complete_lock() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-lock", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DisplayManagerSeatIface, handle_lock), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /* GObject properties for D-Bus properties: */ + /** + * DisplayManagerSeat:can-switch: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-DisplayManager-Seat.CanSwitch">"CanSwitch"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("can-switch", "CanSwitch", "CanSwitch", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * DisplayManagerSeat:has-guest-account: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-DisplayManager-Seat.HasGuestAccount">"HasGuestAccount"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("has-guest-account", "HasGuestAccount", "HasGuestAccount", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * DisplayManagerSeat:sessions: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-DisplayManager-Seat.Sessions">"Sessions"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boxed ("sessions", "Sessions", "Sessions", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +typedef DisplayManagerSeatIface DisplayManagerSeatInterface; +G_DEFINE_INTERFACE (DisplayManagerSeat, display_manager_seat, G_TYPE_OBJECT); + +/** + * display_manager_seat_get_can_switch: (skip) + * @object: A #DisplayManagerSeat. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-DisplayManager-Seat.CanSwitch">"CanSwitch"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +display_manager_seat_get_can_switch (DisplayManagerSeat *object) +{ + return DISPLAY_MANAGER_SEAT_GET_IFACE (object)->get_can_switch (object); +} + +/** + * display_manager_seat_set_can_switch: (skip) + * @object: A #DisplayManagerSeat. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-DisplayManager-Seat.CanSwitch">"CanSwitch"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +display_manager_seat_set_can_switch (DisplayManagerSeat *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "can-switch", value, NULL); +} + +/** + * display_manager_seat_get_has_guest_account: (skip) + * @object: A #DisplayManagerSeat. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-DisplayManager-Seat.HasGuestAccount">"HasGuestAccount"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +display_manager_seat_get_has_guest_account (DisplayManagerSeat *object) +{ + return DISPLAY_MANAGER_SEAT_GET_IFACE (object)->get_has_guest_account (object); +} + +/** + * display_manager_seat_set_has_guest_account: (skip) + * @object: A #DisplayManagerSeat. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-DisplayManager-Seat.HasGuestAccount">"HasGuestAccount"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +display_manager_seat_set_has_guest_account (DisplayManagerSeat *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "has-guest-account", value, NULL); +} + +/** + * display_manager_seat_get_sessions: (skip) + * @object: A #DisplayManagerSeat. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-DisplayManager-Seat.Sessions">"Sessions"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use display_manager_seat_dup_sessions() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar *const * +display_manager_seat_get_sessions (DisplayManagerSeat *object) +{ + return DISPLAY_MANAGER_SEAT_GET_IFACE (object)->get_sessions (object); +} + +/** + * display_manager_seat_dup_sessions: (skip) + * @object: A #DisplayManagerSeat. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-DisplayManager-Seat.Sessions">"Sessions"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). + */ +gchar ** +display_manager_seat_dup_sessions (DisplayManagerSeat *object) +{ + gchar **value; + g_object_get (G_OBJECT (object), "sessions", &value, NULL); + return value; +} + +/** + * display_manager_seat_set_sessions: (skip) + * @object: A #DisplayManagerSeat. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-DisplayManager-Seat.Sessions">"Sessions"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +display_manager_seat_set_sessions (DisplayManagerSeat *object, const gchar *const *value) +{ + g_object_set (G_OBJECT (object), "sessions", value, NULL); +} + +/** + * display_manager_seat_call_switch_to_greeter: + * @proxy: A #DisplayManagerSeatProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.SwitchToGreeter">SwitchToGreeter()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call display_manager_seat_call_switch_to_greeter_finish() to get the result of the operation. + * + * See display_manager_seat_call_switch_to_greeter_sync() for the synchronous, blocking version of this method. + */ +void +display_manager_seat_call_switch_to_greeter ( + DisplayManagerSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SwitchToGreeter", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * display_manager_seat_call_switch_to_greeter_finish: + * @proxy: A #DisplayManagerSeatProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to display_manager_seat_call_switch_to_greeter(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with display_manager_seat_call_switch_to_greeter(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +display_manager_seat_call_switch_to_greeter_finish ( + DisplayManagerSeat *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * display_manager_seat_call_switch_to_greeter_sync: + * @proxy: A #DisplayManagerSeatProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.SwitchToGreeter">SwitchToGreeter()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See display_manager_seat_call_switch_to_greeter() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +display_manager_seat_call_switch_to_greeter_sync ( + DisplayManagerSeat *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SwitchToGreeter", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * display_manager_seat_call_switch_to_user: + * @proxy: A #DisplayManagerSeatProxy. + * @arg_username: Argument to pass with the method invocation. + * @arg_session_name: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.SwitchToUser">SwitchToUser()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call display_manager_seat_call_switch_to_user_finish() to get the result of the operation. + * + * See display_manager_seat_call_switch_to_user_sync() for the synchronous, blocking version of this method. + */ +void +display_manager_seat_call_switch_to_user ( + DisplayManagerSeat *proxy, + const gchar *arg_username, + const gchar *arg_session_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SwitchToUser", + g_variant_new ("(ss)", + arg_username, + arg_session_name), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * display_manager_seat_call_switch_to_user_finish: + * @proxy: A #DisplayManagerSeatProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to display_manager_seat_call_switch_to_user(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with display_manager_seat_call_switch_to_user(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +display_manager_seat_call_switch_to_user_finish ( + DisplayManagerSeat *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * display_manager_seat_call_switch_to_user_sync: + * @proxy: A #DisplayManagerSeatProxy. + * @arg_username: Argument to pass with the method invocation. + * @arg_session_name: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.SwitchToUser">SwitchToUser()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See display_manager_seat_call_switch_to_user() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +display_manager_seat_call_switch_to_user_sync ( + DisplayManagerSeat *proxy, + const gchar *arg_username, + const gchar *arg_session_name, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SwitchToUser", + g_variant_new ("(ss)", + arg_username, + arg_session_name), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * display_manager_seat_call_switch_to_guest: + * @proxy: A #DisplayManagerSeatProxy. + * @arg_session_name: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.SwitchToGuest">SwitchToGuest()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call display_manager_seat_call_switch_to_guest_finish() to get the result of the operation. + * + * See display_manager_seat_call_switch_to_guest_sync() for the synchronous, blocking version of this method. + */ +void +display_manager_seat_call_switch_to_guest ( + DisplayManagerSeat *proxy, + const gchar *arg_session_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SwitchToGuest", + g_variant_new ("(s)", + arg_session_name), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * display_manager_seat_call_switch_to_guest_finish: + * @proxy: A #DisplayManagerSeatProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to display_manager_seat_call_switch_to_guest(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with display_manager_seat_call_switch_to_guest(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +display_manager_seat_call_switch_to_guest_finish ( + DisplayManagerSeat *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * display_manager_seat_call_switch_to_guest_sync: + * @proxy: A #DisplayManagerSeatProxy. + * @arg_session_name: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.SwitchToGuest">SwitchToGuest()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See display_manager_seat_call_switch_to_guest() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +display_manager_seat_call_switch_to_guest_sync ( + DisplayManagerSeat *proxy, + const gchar *arg_session_name, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SwitchToGuest", + g_variant_new ("(s)", + arg_session_name), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * display_manager_seat_call_lock: + * @proxy: A #DisplayManagerSeatProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.Lock">Lock()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call display_manager_seat_call_lock_finish() to get the result of the operation. + * + * See display_manager_seat_call_lock_sync() for the synchronous, blocking version of this method. + */ +void +display_manager_seat_call_lock ( + DisplayManagerSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Lock", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * display_manager_seat_call_lock_finish: + * @proxy: A #DisplayManagerSeatProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to display_manager_seat_call_lock(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with display_manager_seat_call_lock(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +display_manager_seat_call_lock_finish ( + DisplayManagerSeat *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * display_manager_seat_call_lock_sync: + * @proxy: A #DisplayManagerSeatProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.Lock">Lock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See display_manager_seat_call_lock() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +display_manager_seat_call_lock_sync ( + DisplayManagerSeat *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Lock", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * display_manager_seat_complete_switch_to_greeter: + * @object: A #DisplayManagerSeat. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.SwitchToGreeter">SwitchToGreeter()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +display_manager_seat_complete_switch_to_greeter ( + DisplayManagerSeat *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * display_manager_seat_complete_switch_to_user: + * @object: A #DisplayManagerSeat. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.SwitchToUser">SwitchToUser()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +display_manager_seat_complete_switch_to_user ( + DisplayManagerSeat *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * display_manager_seat_complete_switch_to_guest: + * @object: A #DisplayManagerSeat. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.SwitchToGuest">SwitchToGuest()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +display_manager_seat_complete_switch_to_guest ( + DisplayManagerSeat *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * display_manager_seat_complete_lock: + * @object: A #DisplayManagerSeat. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-DisplayManager-Seat.Lock">Lock()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +display_manager_seat_complete_lock ( + DisplayManagerSeat *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * DisplayManagerSeatProxy: + * + * The #DisplayManagerSeatProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * DisplayManagerSeatProxyClass: + * @parent_class: The parent class. + * + * Class structure for #DisplayManagerSeatProxy. + */ + +struct _DisplayManagerSeatProxyPrivate +{ + GData *qdata; +}; + +static void display_manager_seat_proxy_iface_init (DisplayManagerSeatIface *iface); + +G_DEFINE_TYPE_WITH_CODE (DisplayManagerSeatProxy, display_manager_seat_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_DISPLAY_MANAGER_SEAT, display_manager_seat_proxy_iface_init)); + +static void +display_manager_seat_proxy_finalize (GObject *object) +{ + DisplayManagerSeatProxy *proxy = DISPLAY_MANAGER_SEAT_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (display_manager_seat_proxy_parent_class)->finalize (object); +} + +static void +display_manager_seat_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 3); + info = _display_manager_seat_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +display_manager_seat_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + error = NULL; + if (!g_dbus_proxy_call_finish (proxy, res, &error)) + { + g_warning ("Error setting property `%s' on interface org.freedesktop.DisplayManager.Seat: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } +} + +static void +display_manager_seat_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 3); + info = _display_manager_seat_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.freedesktop.DisplayManager.Seat", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) display_manager_seat_proxy_set_property_cb, (gpointer) info); + g_variant_unref (variant); +} + +static void +display_manager_seat_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_display_manager_seat_interface_info, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_DISPLAY_MANAGER_SEAT); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_DISPLAY_MANAGER_SEAT); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +display_manager_seat_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + DisplayManagerSeatProxy *proxy = DISPLAY_MANAGER_SEAT_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_display_manager_seat_interface_info, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_display_manager_seat_interface_info, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static gboolean +display_manager_seat_proxy_get_can_switch (DisplayManagerSeat *object) +{ + DisplayManagerSeatProxy *proxy = DISPLAY_MANAGER_SEAT_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "CanSwitch"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +display_manager_seat_proxy_get_has_guest_account (DisplayManagerSeat *object) +{ + DisplayManagerSeatProxy *proxy = DISPLAY_MANAGER_SEAT_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "HasGuestAccount"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static const gchar *const * +display_manager_seat_proxy_get_sessions (DisplayManagerSeat *object) +{ + DisplayManagerSeatProxy *proxy = DISPLAY_MANAGER_SEAT_PROXY (object); + GVariant *variant; + const gchar *const *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Sessions"); + if (variant != NULL) + { + value = g_variant_get_objv (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static void +display_manager_seat_proxy_init (DisplayManagerSeatProxy *proxy) +{ + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_DISPLAY_MANAGER_SEAT_PROXY, DisplayManagerSeatProxyPrivate); + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), display_manager_seat_interface_info ()); +} + +static void +display_manager_seat_proxy_class_init (DisplayManagerSeatProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + g_type_class_add_private (klass, sizeof (DisplayManagerSeatProxyPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = display_manager_seat_proxy_finalize; + gobject_class->get_property = display_manager_seat_proxy_get_property; + gobject_class->set_property = display_manager_seat_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = display_manager_seat_proxy_g_signal; + proxy_class->g_properties_changed = display_manager_seat_proxy_g_properties_changed; + + + display_manager_seat_override_properties (gobject_class, 1); +} + +static void +display_manager_seat_proxy_iface_init (DisplayManagerSeatIface *iface) +{ + iface->get_can_switch = display_manager_seat_proxy_get_can_switch; + iface->get_has_guest_account = display_manager_seat_proxy_get_has_guest_account; + iface->get_sessions = display_manager_seat_proxy_get_sessions; +} + +/** + * display_manager_seat_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DisplayManager-Seat.top_of_page">org.freedesktop.DisplayManager.Seat</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call display_manager_seat_proxy_new_finish() to get the result of the operation. + * + * See display_manager_seat_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +display_manager_seat_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + 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); +} + +/** + * display_manager_seat_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to display_manager_seat_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with display_manager_seat_proxy_new(). + * + * Returns: (transfer full) (type DisplayManagerSeatProxy): The constructed proxy object or %NULL if @error is set. + */ +DisplayManagerSeat * +display_manager_seat_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return DISPLAY_MANAGER_SEAT (ret); + else + return NULL; +} + +/** + * display_manager_seat_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DisplayManager-Seat.top_of_page">org.freedesktop.DisplayManager.Seat</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See display_manager_seat_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type DisplayManagerSeatProxy): The constructed proxy object or %NULL if @error is set. + */ +DisplayManagerSeat * +display_manager_seat_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + 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); + if (ret != NULL) + return DISPLAY_MANAGER_SEAT (ret); + else + return NULL; +} + + +/** + * display_manager_seat_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like display_manager_seat_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call display_manager_seat_proxy_new_for_bus_finish() to get the result of the operation. + * + * See display_manager_seat_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +display_manager_seat_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + 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); +} + +/** + * display_manager_seat_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to display_manager_seat_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with display_manager_seat_proxy_new_for_bus(). + * + * Returns: (transfer full) (type DisplayManagerSeatProxy): The constructed proxy object or %NULL if @error is set. + */ +DisplayManagerSeat * +display_manager_seat_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return DISPLAY_MANAGER_SEAT (ret); + else + return NULL; +} + +/** + * display_manager_seat_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like display_manager_seat_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See display_manager_seat_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type DisplayManagerSeatProxy): The constructed proxy object or %NULL if @error is set. + */ +DisplayManagerSeat * +display_manager_seat_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + 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); + if (ret != NULL) + return DISPLAY_MANAGER_SEAT (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * DisplayManagerSeatSkeleton: + * + * The #DisplayManagerSeatSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * DisplayManagerSeatSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #DisplayManagerSeatSkeleton. + */ + +struct _DisplayManagerSeatSkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_display_manager_seat_skeleton_handle_method_call ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_DISPLAY_MANAGER_SEAT); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_DISPLAY_MANAGER_SEAT); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + 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); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_display_manager_seat_skeleton_handle_get_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_display_manager_seat_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_display_manager_seat_skeleton_handle_set_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_display_manager_seat_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _display_manager_seat_skeleton_vtable = +{ + _display_manager_seat_skeleton_handle_method_call, + _display_manager_seat_skeleton_handle_get_property, + _display_manager_seat_skeleton_handle_set_property +}; + +static GDBusInterfaceInfo * +display_manager_seat_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton) +{ + return display_manager_seat_interface_info (); +} + +static GDBusInterfaceVTable * +display_manager_seat_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton) +{ + return (GDBusInterfaceVTable *) &_display_manager_seat_skeleton_vtable; +} + +static GVariant * +display_manager_seat_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_display_manager_seat_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _display_manager_seat_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _display_manager_seat_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + 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); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean _display_manager_seat_emit_changed (gpointer user_data); + +static void +display_manager_seat_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (&skeleton->priv->lock); + + if (emit_changed) + _display_manager_seat_emit_changed (skeleton); +} + +static void display_manager_seat_skeleton_iface_init (DisplayManagerSeatIface *iface); +G_DEFINE_TYPE_WITH_CODE (DisplayManagerSeatSkeleton, display_manager_seat_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_DISPLAY_MANAGER_SEAT, display_manager_seat_skeleton_iface_init)); + +static void +display_manager_seat_skeleton_finalize (GObject *object) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object); + guint n; + for (n = 0; n < 3; n++) + g_value_unset (&skeleton->priv->properties[n]); + g_free (skeleton->priv->properties); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (display_manager_seat_skeleton_parent_class)->finalize (object); +} + +static void +display_manager_seat_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 3); + g_mutex_lock (&skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock (&skeleton->priv->lock); +} + +static gboolean +_display_manager_seat_emit_changed (gpointer user_data) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (&skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *l; + GVariant *signal_variant; + signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.DisplayManager.Seat", + &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + signal_variant, + NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (&skeleton->priv->lock); + return FALSE; +} + +static void +_display_manager_seat_schedule_emit_changed (DisplayManagerSeatSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +display_manager_seat_skeleton_notify (GObject *object, + GParamSpec *pspec) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object); + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, _display_manager_seat_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (&skeleton->priv->lock); +} + +static void +display_manager_seat_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 3); + g_mutex_lock (&skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + _display_manager_seat_schedule_emit_changed (skeleton, _display_manager_seat_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (&skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +display_manager_seat_skeleton_init (DisplayManagerSeatSkeleton *skeleton) +{ + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_DISPLAY_MANAGER_SEAT_SKELETON, DisplayManagerSeatSkeletonPrivate); + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); + skeleton->priv->properties = g_new0 (GValue, 3); + g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[1], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[2], G_TYPE_STRV); +} + +static gboolean +display_manager_seat_skeleton_get_can_switch (DisplayManagerSeat *object) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[0])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +display_manager_seat_skeleton_get_has_guest_account (DisplayManagerSeat *object) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[1])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar *const * +display_manager_seat_skeleton_get_sessions (DisplayManagerSeat *object) +{ + DisplayManagerSeatSkeleton *skeleton = DISPLAY_MANAGER_SEAT_SKELETON (object); + const gchar *const *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boxed (&(skeleton->priv->properties[2])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static void +display_manager_seat_skeleton_class_init (DisplayManagerSeatSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + g_type_class_add_private (klass, sizeof (DisplayManagerSeatSkeletonPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = display_manager_seat_skeleton_finalize; + gobject_class->get_property = display_manager_seat_skeleton_get_property; + gobject_class->set_property = display_manager_seat_skeleton_set_property; + gobject_class->notify = display_manager_seat_skeleton_notify; + + + display_manager_seat_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = display_manager_seat_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = display_manager_seat_skeleton_dbus_interface_get_properties; + skeleton_class->flush = display_manager_seat_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = display_manager_seat_skeleton_dbus_interface_get_vtable; +} + +static void +display_manager_seat_skeleton_iface_init (DisplayManagerSeatIface *iface) +{ + iface->get_can_switch = display_manager_seat_skeleton_get_can_switch; + iface->get_has_guest_account = display_manager_seat_skeleton_get_has_guest_account; + iface->get_sessions = display_manager_seat_skeleton_get_sessions; +} + +/** + * display_manager_seat_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DisplayManager-Seat.top_of_page">org.freedesktop.DisplayManager.Seat</link>. + * + * Returns: (transfer full) (type DisplayManagerSeatSkeleton): The skeleton object. + */ +DisplayManagerSeat * +display_manager_seat_skeleton_new (void) +{ + return DISPLAY_MANAGER_SEAT (g_object_new (TYPE_DISPLAY_MANAGER_SEAT_SKELETON, NULL)); +} + diff --git a/src/dbus-display-manager.h b/src/dbus-display-manager.h new file mode 100644 index 0000000..7feec38 --- /dev/null +++ b/src/dbus-display-manager.h @@ -0,0 +1,267 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __DBUS_DISPLAY_MANAGER_H__ +#define __DBUS_DISPLAY_MANAGER_H__ + +#include <gio/gio.h> + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.freedesktop.DisplayManager.Seat */ + +#define TYPE_DISPLAY_MANAGER_SEAT (display_manager_seat_get_type ()) +#define DISPLAY_MANAGER_SEAT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DISPLAY_MANAGER_SEAT, DisplayManagerSeat)) +#define IS_DISPLAY_MANAGER_SEAT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DISPLAY_MANAGER_SEAT)) +#define DISPLAY_MANAGER_SEAT_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_DISPLAY_MANAGER_SEAT, DisplayManagerSeatIface)) + +struct _DisplayManagerSeat; +typedef struct _DisplayManagerSeat DisplayManagerSeat; +typedef struct _DisplayManagerSeatIface DisplayManagerSeatIface; + +struct _DisplayManagerSeatIface +{ + GTypeInterface parent_iface; + + + gboolean (*handle_lock) ( + DisplayManagerSeat *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_switch_to_greeter) ( + DisplayManagerSeat *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_switch_to_guest) ( + DisplayManagerSeat *object, + GDBusMethodInvocation *invocation, + const gchar *arg_session_name); + + gboolean (*handle_switch_to_user) ( + DisplayManagerSeat *object, + GDBusMethodInvocation *invocation, + const gchar *arg_username, + const gchar *arg_session_name); + + gboolean (*get_can_switch) (DisplayManagerSeat *object); + + gboolean (*get_has_guest_account) (DisplayManagerSeat *object); + + const gchar *const * (*get_sessions) (DisplayManagerSeat *object); + +}; + +GType display_manager_seat_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *display_manager_seat_interface_info (void); +guint display_manager_seat_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void display_manager_seat_complete_switch_to_greeter ( + DisplayManagerSeat *object, + GDBusMethodInvocation *invocation); + +void display_manager_seat_complete_switch_to_user ( + DisplayManagerSeat *object, + GDBusMethodInvocation *invocation); + +void display_manager_seat_complete_switch_to_guest ( + DisplayManagerSeat *object, + GDBusMethodInvocation *invocation); + +void display_manager_seat_complete_lock ( + DisplayManagerSeat *object, + GDBusMethodInvocation *invocation); + + + +/* D-Bus method calls: */ +void display_manager_seat_call_switch_to_greeter ( + DisplayManagerSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean display_manager_seat_call_switch_to_greeter_finish ( + DisplayManagerSeat *proxy, + GAsyncResult *res, + GError **error); + +gboolean display_manager_seat_call_switch_to_greeter_sync ( + DisplayManagerSeat *proxy, + GCancellable *cancellable, + GError **error); + +void display_manager_seat_call_switch_to_user ( + DisplayManagerSeat *proxy, + const gchar *arg_username, + const gchar *arg_session_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean display_manager_seat_call_switch_to_user_finish ( + DisplayManagerSeat *proxy, + GAsyncResult *res, + GError **error); + +gboolean display_manager_seat_call_switch_to_user_sync ( + DisplayManagerSeat *proxy, + const gchar *arg_username, + const gchar *arg_session_name, + GCancellable *cancellable, + GError **error); + +void display_manager_seat_call_switch_to_guest ( + DisplayManagerSeat *proxy, + const gchar *arg_session_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean display_manager_seat_call_switch_to_guest_finish ( + DisplayManagerSeat *proxy, + GAsyncResult *res, + GError **error); + +gboolean display_manager_seat_call_switch_to_guest_sync ( + DisplayManagerSeat *proxy, + const gchar *arg_session_name, + GCancellable *cancellable, + GError **error); + +void display_manager_seat_call_lock ( + DisplayManagerSeat *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean display_manager_seat_call_lock_finish ( + DisplayManagerSeat *proxy, + GAsyncResult *res, + GError **error); + +gboolean display_manager_seat_call_lock_sync ( + DisplayManagerSeat *proxy, + GCancellable *cancellable, + GError **error); + + + +/* D-Bus property accessors: */ +gboolean display_manager_seat_get_can_switch (DisplayManagerSeat *object); +void display_manager_seat_set_can_switch (DisplayManagerSeat *object, gboolean value); + +gboolean display_manager_seat_get_has_guest_account (DisplayManagerSeat *object); +void display_manager_seat_set_has_guest_account (DisplayManagerSeat *object, gboolean value); + +const gchar *const *display_manager_seat_get_sessions (DisplayManagerSeat *object); +gchar **display_manager_seat_dup_sessions (DisplayManagerSeat *object); +void display_manager_seat_set_sessions (DisplayManagerSeat *object, const gchar *const *value); + + +/* ---- */ + +#define TYPE_DISPLAY_MANAGER_SEAT_PROXY (display_manager_seat_proxy_get_type ()) +#define DISPLAY_MANAGER_SEAT_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DISPLAY_MANAGER_SEAT_PROXY, DisplayManagerSeatProxy)) +#define DISPLAY_MANAGER_SEAT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_DISPLAY_MANAGER_SEAT_PROXY, DisplayManagerSeatProxyClass)) +#define DISPLAY_MANAGER_SEAT_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DISPLAY_MANAGER_SEAT_PROXY, DisplayManagerSeatProxyClass)) +#define IS_DISPLAY_MANAGER_SEAT_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DISPLAY_MANAGER_SEAT_PROXY)) +#define IS_DISPLAY_MANAGER_SEAT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DISPLAY_MANAGER_SEAT_PROXY)) + +typedef struct _DisplayManagerSeatProxy DisplayManagerSeatProxy; +typedef struct _DisplayManagerSeatProxyClass DisplayManagerSeatProxyClass; +typedef struct _DisplayManagerSeatProxyPrivate DisplayManagerSeatProxyPrivate; + +struct _DisplayManagerSeatProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + DisplayManagerSeatProxyPrivate *priv; +}; + +struct _DisplayManagerSeatProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType display_manager_seat_proxy_get_type (void) G_GNUC_CONST; + +void display_manager_seat_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +DisplayManagerSeat *display_manager_seat_proxy_new_finish ( + GAsyncResult *res, + GError **error); +DisplayManagerSeat *display_manager_seat_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void display_manager_seat_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +DisplayManagerSeat *display_manager_seat_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +DisplayManagerSeat *display_manager_seat_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_DISPLAY_MANAGER_SEAT_SKELETON (display_manager_seat_skeleton_get_type ()) +#define DISPLAY_MANAGER_SEAT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DISPLAY_MANAGER_SEAT_SKELETON, DisplayManagerSeatSkeleton)) +#define DISPLAY_MANAGER_SEAT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_DISPLAY_MANAGER_SEAT_SKELETON, DisplayManagerSeatSkeletonClass)) +#define DISPLAY_MANAGER_SEAT_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DISPLAY_MANAGER_SEAT_SKELETON, DisplayManagerSeatSkeletonClass)) +#define IS_DISPLAY_MANAGER_SEAT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DISPLAY_MANAGER_SEAT_SKELETON)) +#define IS_DISPLAY_MANAGER_SEAT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DISPLAY_MANAGER_SEAT_SKELETON)) + +typedef struct _DisplayManagerSeatSkeleton DisplayManagerSeatSkeleton; +typedef struct _DisplayManagerSeatSkeletonClass DisplayManagerSeatSkeletonClass; +typedef struct _DisplayManagerSeatSkeletonPrivate DisplayManagerSeatSkeletonPrivate; + +struct _DisplayManagerSeatSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + DisplayManagerSeatSkeletonPrivate *priv; +}; + +struct _DisplayManagerSeatSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType display_manager_seat_skeleton_get_type (void) G_GNUC_CONST; + +DisplayManagerSeat *display_manager_seat_skeleton_new (void); + + +G_END_DECLS + +#endif /* __DBUS_DISPLAY_MANAGER_H__ */ diff --git a/src/dbus-upower.c b/src/dbus-upower.c new file mode 100644 index 0000000..687849b --- /dev/null +++ b/src/dbus-upower.c @@ -0,0 +1,3189 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "dbus-upower.h" + +#include <string.h> +#ifdef G_OS_UNIX +# include <gio/gunixfdlist.h> +#endif + +typedef struct +{ + GDBusArgInfo parent_struct; + gboolean use_gvariant; +} _ExtendedGDBusArgInfo; + +typedef struct +{ + GDBusMethodInfo parent_struct; + const gchar *signal_name; + gboolean pass_fdlist; +} _ExtendedGDBusMethodInfo; + +typedef struct +{ + GDBusSignalInfo parent_struct; + const gchar *signal_name; +} _ExtendedGDBusSignalInfo; + +typedef struct +{ + GDBusPropertyInfo parent_struct; + const gchar *hyphen_name; + gboolean use_gvariant; +} _ExtendedGDBusPropertyInfo; + +typedef struct +{ + GDBusInterfaceInfo parent_struct; + const gchar *hyphen_name; +} _ExtendedGDBusInterfaceInfo; + +typedef struct +{ + const _ExtendedGDBusPropertyInfo *info; + guint prop_id; + GValue orig_value; /* the value before the change */ +} ChangedProperty; + +static void +_changed_property_free (ChangedProperty *data) +{ + g_value_unset (&data->orig_value); + g_free (data); +} + +static gboolean +_g_strv_equal0 (gchar **a, gchar **b) +{ + gboolean ret = FALSE; + guint n; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + if (g_strv_length (a) != g_strv_length (b)) + goto out; + for (n = 0; a[n] != NULL; n++) + if (g_strcmp0 (a[n], b[n]) != 0) + goto out; + ret = TRUE; +out: + return ret; +} + +static gboolean +_g_variant_equal0 (GVariant *a, GVariant *b) +{ + gboolean ret = FALSE; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + ret = g_variant_equal (a, b); +out: + return ret; +} + +G_GNUC_UNUSED static gboolean +_g_value_equal (const GValue *a, const GValue *b) +{ + gboolean ret = FALSE; + g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); + switch (G_VALUE_TYPE (a)) + { + case G_TYPE_BOOLEAN: + ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); + break; + case G_TYPE_UCHAR: + ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); + break; + case G_TYPE_INT: + ret = (g_value_get_int (a) == g_value_get_int (b)); + break; + case G_TYPE_UINT: + ret = (g_value_get_uint (a) == g_value_get_uint (b)); + break; + case G_TYPE_INT64: + ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); + break; + case G_TYPE_UINT64: + ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); + break; + case G_TYPE_DOUBLE: + { + /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ + gdouble da = g_value_get_double (a); + gdouble db = g_value_get_double (b); + ret = memcmp (&da, &db, sizeof (gdouble)) == 0; + } + break; + case G_TYPE_STRING: + ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); + break; + case G_TYPE_VARIANT: + ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); + break; + default: + if (G_VALUE_TYPE (a) == G_TYPE_STRV) + ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); + else + g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); + break; + } + return ret; +} + +/* ------------------------------------------------------------------------ + * Code for interface org.freedesktop.UPower + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:DBusUPower + * @title: DBusUPower + * @short_description: Generated C code for the org.freedesktop.UPower D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-UPower.top_of_page">org.freedesktop.UPower</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.freedesktop.UPower ---- */ + +static const _ExtendedGDBusArgInfo _dbus_upower_method_info_enumerate_devices_OUT_ARG_devices = +{ + { + -1, + (gchar *) "devices", + (gchar *) "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _dbus_upower_method_info_enumerate_devices_OUT_ARG_pointers[] = +{ + &_dbus_upower_method_info_enumerate_devices_OUT_ARG_devices, + NULL +}; + +static const GDBusAnnotationInfo _dbus_upower_method_enumerate_devices_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _dbus_upower_method_enumerate_devices_annotation_info_pointers[] = +{ + &_dbus_upower_method_enumerate_devices_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _dbus_upower_method_info_enumerate_devices = +{ + { + -1, + (gchar *) "EnumerateDevices", + NULL, + (GDBusArgInfo **) &_dbus_upower_method_info_enumerate_devices_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_dbus_upower_method_enumerate_devices_annotation_info_pointers + }, + "handle-enumerate-devices", + FALSE +}; + +static const GDBusAnnotationInfo _dbus_upower_method_about_to_sleep_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _dbus_upower_method_about_to_sleep_annotation_info_pointers[] = +{ + &_dbus_upower_method_about_to_sleep_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _dbus_upower_method_info_about_to_sleep = +{ + { + -1, + (gchar *) "AboutToSleep", + NULL, + NULL, + (GDBusAnnotationInfo **) &_dbus_upower_method_about_to_sleep_annotation_info_pointers + }, + "handle-about-to-sleep", + FALSE +}; + +static const GDBusAnnotationInfo _dbus_upower_method_suspend_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _dbus_upower_method_suspend_annotation_info_pointers[] = +{ + &_dbus_upower_method_suspend_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _dbus_upower_method_info_suspend = +{ + { + -1, + (gchar *) "Suspend", + NULL, + NULL, + (GDBusAnnotationInfo **) &_dbus_upower_method_suspend_annotation_info_pointers + }, + "handle-suspend", + FALSE +}; + +static const _ExtendedGDBusArgInfo _dbus_upower_method_info_suspend_allowed_OUT_ARG_allowed = +{ + { + -1, + (gchar *) "allowed", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _dbus_upower_method_info_suspend_allowed_OUT_ARG_pointers[] = +{ + &_dbus_upower_method_info_suspend_allowed_OUT_ARG_allowed, + NULL +}; + +static const GDBusAnnotationInfo _dbus_upower_method_suspend_allowed_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _dbus_upower_method_suspend_allowed_annotation_info_pointers[] = +{ + &_dbus_upower_method_suspend_allowed_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _dbus_upower_method_info_suspend_allowed = +{ + { + -1, + (gchar *) "SuspendAllowed", + NULL, + (GDBusArgInfo **) &_dbus_upower_method_info_suspend_allowed_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_dbus_upower_method_suspend_allowed_annotation_info_pointers + }, + "handle-suspend-allowed", + FALSE +}; + +static const GDBusAnnotationInfo _dbus_upower_method_hibernate_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _dbus_upower_method_hibernate_annotation_info_pointers[] = +{ + &_dbus_upower_method_hibernate_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _dbus_upower_method_info_hibernate = +{ + { + -1, + (gchar *) "Hibernate", + NULL, + NULL, + (GDBusAnnotationInfo **) &_dbus_upower_method_hibernate_annotation_info_pointers + }, + "handle-hibernate", + FALSE +}; + +static const _ExtendedGDBusArgInfo _dbus_upower_method_info_hibernate_allowed_OUT_ARG_allowed = +{ + { + -1, + (gchar *) "allowed", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _dbus_upower_method_info_hibernate_allowed_OUT_ARG_pointers[] = +{ + &_dbus_upower_method_info_hibernate_allowed_OUT_ARG_allowed, + NULL +}; + +static const GDBusAnnotationInfo _dbus_upower_method_hibernate_allowed_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _dbus_upower_method_hibernate_allowed_annotation_info_pointers[] = +{ + &_dbus_upower_method_hibernate_allowed_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _dbus_upower_method_info_hibernate_allowed = +{ + { + -1, + (gchar *) "HibernateAllowed", + NULL, + (GDBusArgInfo **) &_dbus_upower_method_info_hibernate_allowed_OUT_ARG_pointers, + (GDBusAnnotationInfo **) &_dbus_upower_method_hibernate_allowed_annotation_info_pointers + }, + "handle-hibernate-allowed", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _dbus_upower_method_info_pointers[] = +{ + &_dbus_upower_method_info_enumerate_devices, + &_dbus_upower_method_info_about_to_sleep, + &_dbus_upower_method_info_suspend, + &_dbus_upower_method_info_suspend_allowed, + &_dbus_upower_method_info_hibernate, + &_dbus_upower_method_info_hibernate_allowed, + NULL +}; + +static const _ExtendedGDBusArgInfo _dbus_upower_signal_info_device_added_ARG_device = +{ + { + -1, + (gchar *) "device", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _dbus_upower_signal_info_device_added_ARG_pointers[] = +{ + &_dbus_upower_signal_info_device_added_ARG_device, + NULL +}; + +static const _ExtendedGDBusSignalInfo _dbus_upower_signal_info_device_added = +{ + { + -1, + (gchar *) "DeviceAdded", + (GDBusArgInfo **) &_dbus_upower_signal_info_device_added_ARG_pointers, + NULL + }, + "device-added" +}; + +static const _ExtendedGDBusArgInfo _dbus_upower_signal_info_device_removed_ARG_device = +{ + { + -1, + (gchar *) "device", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _dbus_upower_signal_info_device_removed_ARG_pointers[] = +{ + &_dbus_upower_signal_info_device_removed_ARG_device, + NULL +}; + +static const _ExtendedGDBusSignalInfo _dbus_upower_signal_info_device_removed = +{ + { + -1, + (gchar *) "DeviceRemoved", + (GDBusArgInfo **) &_dbus_upower_signal_info_device_removed_ARG_pointers, + NULL + }, + "device-removed" +}; + +static const _ExtendedGDBusArgInfo _dbus_upower_signal_info_device_changed_ARG_device = +{ + { + -1, + (gchar *) "device", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _dbus_upower_signal_info_device_changed_ARG_pointers[] = +{ + &_dbus_upower_signal_info_device_changed_ARG_device, + NULL +}; + +static const _ExtendedGDBusSignalInfo _dbus_upower_signal_info_device_changed = +{ + { + -1, + (gchar *) "DeviceChanged", + (GDBusArgInfo **) &_dbus_upower_signal_info_device_changed_ARG_pointers, + NULL + }, + "device-changed" +}; + +static const _ExtendedGDBusSignalInfo _dbus_upower_signal_info_changed = +{ + { + -1, + (gchar *) "Changed", + NULL, + NULL + }, + "changed" +}; + +static const _ExtendedGDBusSignalInfo _dbus_upower_signal_info_sleeping = +{ + { + -1, + (gchar *) "Sleeping", + NULL, + NULL + }, + "sleeping" +}; + +static const _ExtendedGDBusSignalInfo _dbus_upower_signal_info_resuming = +{ + { + -1, + (gchar *) "Resuming", + NULL, + NULL + }, + "resuming" +}; + +static const _ExtendedGDBusSignalInfo * const _dbus_upower_signal_info_pointers[] = +{ + &_dbus_upower_signal_info_device_added, + &_dbus_upower_signal_info_device_removed, + &_dbus_upower_signal_info_device_changed, + &_dbus_upower_signal_info_changed, + &_dbus_upower_signal_info_sleeping, + &_dbus_upower_signal_info_resuming, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _dbus_upower_property_info_daemon_version = +{ + { + -1, + (gchar *) "DaemonVersion", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "daemon-version", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _dbus_upower_property_info_can_suspend = +{ + { + -1, + (gchar *) "CanSuspend", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "can-suspend", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _dbus_upower_property_info_can_hibernate = +{ + { + -1, + (gchar *) "CanHibernate", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "can-hibernate", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _dbus_upower_property_info_on_battery = +{ + { + -1, + (gchar *) "OnBattery", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "on-battery", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _dbus_upower_property_info_on_low_battery = +{ + { + -1, + (gchar *) "OnLowBattery", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "on-low-battery", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _dbus_upower_property_info_lid_is_closed = +{ + { + -1, + (gchar *) "LidIsClosed", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "lid-is-closed", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _dbus_upower_property_info_lid_is_present = +{ + { + -1, + (gchar *) "LidIsPresent", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "lid-is-present", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const _dbus_upower_property_info_pointers[] = +{ + &_dbus_upower_property_info_daemon_version, + &_dbus_upower_property_info_can_suspend, + &_dbus_upower_property_info_can_hibernate, + &_dbus_upower_property_info_on_battery, + &_dbus_upower_property_info_on_low_battery, + &_dbus_upower_property_info_lid_is_closed, + &_dbus_upower_property_info_lid_is_present, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _dbus_upower_interface_info = +{ + { + -1, + (gchar *) "org.freedesktop.UPower", + (GDBusMethodInfo **) &_dbus_upower_method_info_pointers, + (GDBusSignalInfo **) &_dbus_upower_signal_info_pointers, + (GDBusPropertyInfo **) &_dbus_upower_property_info_pointers, + NULL + }, + "upower", +}; + + +/** + * dbus_upower_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-UPower.top_of_page">org.freedesktop.UPower</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +dbus_upower_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_dbus_upower_interface_info; +} + +/** + * dbus_upower_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #DBusUPower interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +dbus_upower_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "daemon-version"); + g_object_class_override_property (klass, property_id_begin++, "can-suspend"); + g_object_class_override_property (klass, property_id_begin++, "can-hibernate"); + g_object_class_override_property (klass, property_id_begin++, "on-battery"); + g_object_class_override_property (klass, property_id_begin++, "on-low-battery"); + g_object_class_override_property (klass, property_id_begin++, "lid-is-closed"); + g_object_class_override_property (klass, property_id_begin++, "lid-is-present"); + return property_id_begin - 1; +} + + + +/** + * DBusUPower: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-UPower.top_of_page">org.freedesktop.UPower</link>. + */ + +/** + * DBusUPowerIface: + * @parent_iface: The parent interface. + * @handle_about_to_sleep: Handler for the #DBusUPower::handle-about-to-sleep signal. + * @handle_enumerate_devices: Handler for the #DBusUPower::handle-enumerate-devices signal. + * @handle_hibernate: Handler for the #DBusUPower::handle-hibernate signal. + * @handle_hibernate_allowed: Handler for the #DBusUPower::handle-hibernate-allowed signal. + * @handle_suspend: Handler for the #DBusUPower::handle-suspend signal. + * @handle_suspend_allowed: Handler for the #DBusUPower::handle-suspend-allowed signal. + * @get_can_hibernate: Getter for the #DBusUPower:can-hibernate property. + * @get_can_suspend: Getter for the #DBusUPower:can-suspend property. + * @get_daemon_version: Getter for the #DBusUPower:daemon-version property. + * @get_lid_is_closed: Getter for the #DBusUPower:lid-is-closed property. + * @get_lid_is_present: Getter for the #DBusUPower:lid-is-present property. + * @get_on_battery: Getter for the #DBusUPower:on-battery property. + * @get_on_low_battery: Getter for the #DBusUPower:on-low-battery property. + * @changed: Handler for the #DBusUPower::changed signal. + * @device_added: Handler for the #DBusUPower::device-added signal. + * @device_changed: Handler for the #DBusUPower::device-changed signal. + * @device_removed: Handler for the #DBusUPower::device-removed signal. + * @resuming: Handler for the #DBusUPower::resuming signal. + * @sleeping: Handler for the #DBusUPower::sleeping signal. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-UPower.top_of_page">org.freedesktop.UPower</link>. + */ + +static void +dbus_upower_default_init (DBusUPowerIface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * DBusUPower::handle-enumerate-devices: + * @object: A #DBusUPower. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-UPower.EnumerateDevices">EnumerateDevices()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call dbus_upower_complete_enumerate_devices() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-enumerate-devices", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DBusUPowerIface, handle_enumerate_devices), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * DBusUPower::handle-about-to-sleep: + * @object: A #DBusUPower. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-UPower.AboutToSleep">AboutToSleep()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call dbus_upower_complete_about_to_sleep() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-about-to-sleep", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DBusUPowerIface, handle_about_to_sleep), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * DBusUPower::handle-suspend: + * @object: A #DBusUPower. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-UPower.Suspend">Suspend()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call dbus_upower_complete_suspend() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-suspend", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DBusUPowerIface, handle_suspend), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * DBusUPower::handle-suspend-allowed: + * @object: A #DBusUPower. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-UPower.SuspendAllowed">SuspendAllowed()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call dbus_upower_complete_suspend_allowed() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-suspend-allowed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DBusUPowerIface, handle_suspend_allowed), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * DBusUPower::handle-hibernate: + * @object: A #DBusUPower. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-UPower.Hibernate">Hibernate()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call dbus_upower_complete_hibernate() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-hibernate", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DBusUPowerIface, handle_hibernate), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * DBusUPower::handle-hibernate-allowed: + * @object: A #DBusUPower. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-UPower.HibernateAllowed">HibernateAllowed()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call dbus_upower_complete_hibernate_allowed() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-hibernate-allowed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DBusUPowerIface, handle_hibernate_allowed), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /* GObject signals for received D-Bus signals: */ + /** + * DBusUPower::device-added: + * @object: A #DBusUPower. + * @arg_device: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-UPower.DeviceAdded">"DeviceAdded"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("device-added", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DBusUPowerIface, device_added), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * DBusUPower::device-removed: + * @object: A #DBusUPower. + * @arg_device: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-UPower.DeviceRemoved">"DeviceRemoved"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("device-removed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DBusUPowerIface, device_removed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * DBusUPower::device-changed: + * @object: A #DBusUPower. + * @arg_device: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-UPower.DeviceChanged">"DeviceChanged"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("device-changed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DBusUPowerIface, device_changed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * DBusUPower::changed: + * @object: A #DBusUPower. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-UPower.Changed">"Changed"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("changed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DBusUPowerIface, changed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 0); + + /** + * DBusUPower::sleeping: + * @object: A #DBusUPower. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-UPower.Sleeping">"Sleeping"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("sleeping", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DBusUPowerIface, sleeping), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 0); + + /** + * DBusUPower::resuming: + * @object: A #DBusUPower. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-UPower.Resuming">"Resuming"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("resuming", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DBusUPowerIface, resuming), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 0); + + /* GObject properties for D-Bus properties: */ + /** + * DBusUPower:daemon-version: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower.DaemonVersion">"DaemonVersion"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("daemon-version", "DaemonVersion", "DaemonVersion", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * DBusUPower:can-suspend: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower.CanSuspend">"CanSuspend"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("can-suspend", "CanSuspend", "CanSuspend", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * DBusUPower:can-hibernate: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower.CanHibernate">"CanHibernate"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("can-hibernate", "CanHibernate", "CanHibernate", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * DBusUPower:on-battery: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower.OnBattery">"OnBattery"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("on-battery", "OnBattery", "OnBattery", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * DBusUPower:on-low-battery: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower.OnLowBattery">"OnLowBattery"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("on-low-battery", "OnLowBattery", "OnLowBattery", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * DBusUPower:lid-is-closed: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower.LidIsClosed">"LidIsClosed"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("lid-is-closed", "LidIsClosed", "LidIsClosed", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * DBusUPower:lid-is-present: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-UPower.LidIsPresent">"LidIsPresent"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("lid-is-present", "LidIsPresent", "LidIsPresent", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +typedef DBusUPowerIface DBusUPowerInterface; +G_DEFINE_INTERFACE (DBusUPower, dbus_upower, G_TYPE_OBJECT); + +/** + * dbus_upower_get_daemon_version: (skip) + * @object: A #DBusUPower. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower.DaemonVersion">"DaemonVersion"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use dbus_upower_dup_daemon_version() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +dbus_upower_get_daemon_version (DBusUPower *object) +{ + return DBUS_UPOWER_GET_IFACE (object)->get_daemon_version (object); +} + +/** + * dbus_upower_dup_daemon_version: (skip) + * @object: A #DBusUPower. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-UPower.DaemonVersion">"DaemonVersion"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +dbus_upower_dup_daemon_version (DBusUPower *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "daemon-version", &value, NULL); + return value; +} + +/** + * dbus_upower_set_daemon_version: (skip) + * @object: A #DBusUPower. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-UPower.DaemonVersion">"DaemonVersion"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +dbus_upower_set_daemon_version (DBusUPower *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "daemon-version", value, NULL); +} + +/** + * dbus_upower_get_can_suspend: (skip) + * @object: A #DBusUPower. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower.CanSuspend">"CanSuspend"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +dbus_upower_get_can_suspend (DBusUPower *object) +{ + return DBUS_UPOWER_GET_IFACE (object)->get_can_suspend (object); +} + +/** + * dbus_upower_set_can_suspend: (skip) + * @object: A #DBusUPower. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-UPower.CanSuspend">"CanSuspend"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +dbus_upower_set_can_suspend (DBusUPower *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "can-suspend", value, NULL); +} + +/** + * dbus_upower_get_can_hibernate: (skip) + * @object: A #DBusUPower. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower.CanHibernate">"CanHibernate"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +dbus_upower_get_can_hibernate (DBusUPower *object) +{ + return DBUS_UPOWER_GET_IFACE (object)->get_can_hibernate (object); +} + +/** + * dbus_upower_set_can_hibernate: (skip) + * @object: A #DBusUPower. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-UPower.CanHibernate">"CanHibernate"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +dbus_upower_set_can_hibernate (DBusUPower *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "can-hibernate", value, NULL); +} + +/** + * dbus_upower_get_on_battery: (skip) + * @object: A #DBusUPower. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower.OnBattery">"OnBattery"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +dbus_upower_get_on_battery (DBusUPower *object) +{ + return DBUS_UPOWER_GET_IFACE (object)->get_on_battery (object); +} + +/** + * dbus_upower_set_on_battery: (skip) + * @object: A #DBusUPower. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-UPower.OnBattery">"OnBattery"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +dbus_upower_set_on_battery (DBusUPower *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "on-battery", value, NULL); +} + +/** + * dbus_upower_get_on_low_battery: (skip) + * @object: A #DBusUPower. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower.OnLowBattery">"OnLowBattery"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +dbus_upower_get_on_low_battery (DBusUPower *object) +{ + return DBUS_UPOWER_GET_IFACE (object)->get_on_low_battery (object); +} + +/** + * dbus_upower_set_on_low_battery: (skip) + * @object: A #DBusUPower. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-UPower.OnLowBattery">"OnLowBattery"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +dbus_upower_set_on_low_battery (DBusUPower *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "on-low-battery", value, NULL); +} + +/** + * dbus_upower_get_lid_is_closed: (skip) + * @object: A #DBusUPower. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower.LidIsClosed">"LidIsClosed"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +dbus_upower_get_lid_is_closed (DBusUPower *object) +{ + return DBUS_UPOWER_GET_IFACE (object)->get_lid_is_closed (object); +} + +/** + * dbus_upower_set_lid_is_closed: (skip) + * @object: A #DBusUPower. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-UPower.LidIsClosed">"LidIsClosed"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +dbus_upower_set_lid_is_closed (DBusUPower *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "lid-is-closed", value, NULL); +} + +/** + * dbus_upower_get_lid_is_present: (skip) + * @object: A #DBusUPower. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-UPower.LidIsPresent">"LidIsPresent"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +dbus_upower_get_lid_is_present (DBusUPower *object) +{ + return DBUS_UPOWER_GET_IFACE (object)->get_lid_is_present (object); +} + +/** + * dbus_upower_set_lid_is_present: (skip) + * @object: A #DBusUPower. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-UPower.LidIsPresent">"LidIsPresent"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +dbus_upower_set_lid_is_present (DBusUPower *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "lid-is-present", value, NULL); +} + +/** + * dbus_upower_emit_device_added: + * @object: A #DBusUPower. + * @arg_device: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-UPower.DeviceAdded">"DeviceAdded"</link> D-Bus signal. + */ +void +dbus_upower_emit_device_added ( + DBusUPower *object, + const gchar *arg_device) +{ + g_signal_emit_by_name (object, "device-added", arg_device); +} + +/** + * dbus_upower_emit_device_removed: + * @object: A #DBusUPower. + * @arg_device: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-UPower.DeviceRemoved">"DeviceRemoved"</link> D-Bus signal. + */ +void +dbus_upower_emit_device_removed ( + DBusUPower *object, + const gchar *arg_device) +{ + g_signal_emit_by_name (object, "device-removed", arg_device); +} + +/** + * dbus_upower_emit_device_changed: + * @object: A #DBusUPower. + * @arg_device: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-UPower.DeviceChanged">"DeviceChanged"</link> D-Bus signal. + */ +void +dbus_upower_emit_device_changed ( + DBusUPower *object, + const gchar *arg_device) +{ + g_signal_emit_by_name (object, "device-changed", arg_device); +} + +/** + * dbus_upower_emit_changed: + * @object: A #DBusUPower. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-UPower.Changed">"Changed"</link> D-Bus signal. + */ +void +dbus_upower_emit_changed ( + DBusUPower *object) +{ + g_signal_emit_by_name (object, "changed"); +} + +/** + * dbus_upower_emit_sleeping: + * @object: A #DBusUPower. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-UPower.Sleeping">"Sleeping"</link> D-Bus signal. + */ +void +dbus_upower_emit_sleeping ( + DBusUPower *object) +{ + g_signal_emit_by_name (object, "sleeping"); +} + +/** + * dbus_upower_emit_resuming: + * @object: A #DBusUPower. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-UPower.Resuming">"Resuming"</link> D-Bus signal. + */ +void +dbus_upower_emit_resuming ( + DBusUPower *object) +{ + g_signal_emit_by_name (object, "resuming"); +} + +/** + * dbus_upower_call_enumerate_devices: + * @proxy: A #DBusUPowerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower.EnumerateDevices">EnumerateDevices()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call dbus_upower_call_enumerate_devices_finish() to get the result of the operation. + * + * See dbus_upower_call_enumerate_devices_sync() for the synchronous, blocking version of this method. + */ +void +dbus_upower_call_enumerate_devices ( + DBusUPower *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "EnumerateDevices", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * dbus_upower_call_enumerate_devices_finish: + * @proxy: A #DBusUPowerProxy. + * @out_devices: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_upower_call_enumerate_devices(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with dbus_upower_call_enumerate_devices(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +dbus_upower_call_enumerate_devices_finish ( + DBusUPower *proxy, + gchar ***out_devices, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_devices); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * dbus_upower_call_enumerate_devices_sync: + * @proxy: A #DBusUPowerProxy. + * @out_devices: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower.EnumerateDevices">EnumerateDevices()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See dbus_upower_call_enumerate_devices() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +dbus_upower_call_enumerate_devices_sync ( + DBusUPower *proxy, + gchar ***out_devices, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "EnumerateDevices", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_devices); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * dbus_upower_call_about_to_sleep: + * @proxy: A #DBusUPowerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower.AboutToSleep">AboutToSleep()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call dbus_upower_call_about_to_sleep_finish() to get the result of the operation. + * + * See dbus_upower_call_about_to_sleep_sync() for the synchronous, blocking version of this method. + */ +void +dbus_upower_call_about_to_sleep ( + DBusUPower *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "AboutToSleep", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * dbus_upower_call_about_to_sleep_finish: + * @proxy: A #DBusUPowerProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_upower_call_about_to_sleep(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with dbus_upower_call_about_to_sleep(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +dbus_upower_call_about_to_sleep_finish ( + DBusUPower *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * dbus_upower_call_about_to_sleep_sync: + * @proxy: A #DBusUPowerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower.AboutToSleep">AboutToSleep()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See dbus_upower_call_about_to_sleep() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +dbus_upower_call_about_to_sleep_sync ( + DBusUPower *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "AboutToSleep", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * dbus_upower_call_suspend: + * @proxy: A #DBusUPowerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower.Suspend">Suspend()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call dbus_upower_call_suspend_finish() to get the result of the operation. + * + * See dbus_upower_call_suspend_sync() for the synchronous, blocking version of this method. + */ +void +dbus_upower_call_suspend ( + DBusUPower *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Suspend", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * dbus_upower_call_suspend_finish: + * @proxy: A #DBusUPowerProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_upower_call_suspend(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with dbus_upower_call_suspend(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +dbus_upower_call_suspend_finish ( + DBusUPower *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * dbus_upower_call_suspend_sync: + * @proxy: A #DBusUPowerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower.Suspend">Suspend()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See dbus_upower_call_suspend() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +dbus_upower_call_suspend_sync ( + DBusUPower *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Suspend", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * dbus_upower_call_suspend_allowed: + * @proxy: A #DBusUPowerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower.SuspendAllowed">SuspendAllowed()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call dbus_upower_call_suspend_allowed_finish() to get the result of the operation. + * + * See dbus_upower_call_suspend_allowed_sync() for the synchronous, blocking version of this method. + */ +void +dbus_upower_call_suspend_allowed ( + DBusUPower *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SuspendAllowed", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * dbus_upower_call_suspend_allowed_finish: + * @proxy: A #DBusUPowerProxy. + * @out_allowed: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_upower_call_suspend_allowed(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with dbus_upower_call_suspend_allowed(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +dbus_upower_call_suspend_allowed_finish ( + DBusUPower *proxy, + gboolean *out_allowed, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_allowed); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * dbus_upower_call_suspend_allowed_sync: + * @proxy: A #DBusUPowerProxy. + * @out_allowed: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower.SuspendAllowed">SuspendAllowed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See dbus_upower_call_suspend_allowed() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +dbus_upower_call_suspend_allowed_sync ( + DBusUPower *proxy, + gboolean *out_allowed, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SuspendAllowed", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_allowed); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * dbus_upower_call_hibernate: + * @proxy: A #DBusUPowerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower.Hibernate">Hibernate()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call dbus_upower_call_hibernate_finish() to get the result of the operation. + * + * See dbus_upower_call_hibernate_sync() for the synchronous, blocking version of this method. + */ +void +dbus_upower_call_hibernate ( + DBusUPower *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Hibernate", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * dbus_upower_call_hibernate_finish: + * @proxy: A #DBusUPowerProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_upower_call_hibernate(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with dbus_upower_call_hibernate(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +dbus_upower_call_hibernate_finish ( + DBusUPower *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * dbus_upower_call_hibernate_sync: + * @proxy: A #DBusUPowerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower.Hibernate">Hibernate()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See dbus_upower_call_hibernate() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +dbus_upower_call_hibernate_sync ( + DBusUPower *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Hibernate", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * dbus_upower_call_hibernate_allowed: + * @proxy: A #DBusUPowerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower.HibernateAllowed">HibernateAllowed()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call dbus_upower_call_hibernate_allowed_finish() to get the result of the operation. + * + * See dbus_upower_call_hibernate_allowed_sync() for the synchronous, blocking version of this method. + */ +void +dbus_upower_call_hibernate_allowed ( + DBusUPower *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "HibernateAllowed", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * dbus_upower_call_hibernate_allowed_finish: + * @proxy: A #DBusUPowerProxy. + * @out_allowed: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_upower_call_hibernate_allowed(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with dbus_upower_call_hibernate_allowed(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +dbus_upower_call_hibernate_allowed_finish ( + DBusUPower *proxy, + gboolean *out_allowed, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_allowed); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * dbus_upower_call_hibernate_allowed_sync: + * @proxy: A #DBusUPowerProxy. + * @out_allowed: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-UPower.HibernateAllowed">HibernateAllowed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See dbus_upower_call_hibernate_allowed() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +dbus_upower_call_hibernate_allowed_sync ( + DBusUPower *proxy, + gboolean *out_allowed, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "HibernateAllowed", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(b)", + out_allowed); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * dbus_upower_complete_enumerate_devices: + * @object: A #DBusUPower. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @devices: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-UPower.EnumerateDevices">EnumerateDevices()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +dbus_upower_complete_enumerate_devices ( + DBusUPower *object, + GDBusMethodInvocation *invocation, + const gchar *const *devices) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^ao)", + devices)); +} + +/** + * dbus_upower_complete_about_to_sleep: + * @object: A #DBusUPower. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-UPower.AboutToSleep">AboutToSleep()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +dbus_upower_complete_about_to_sleep ( + DBusUPower *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * dbus_upower_complete_suspend: + * @object: A #DBusUPower. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-UPower.Suspend">Suspend()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +dbus_upower_complete_suspend ( + DBusUPower *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * dbus_upower_complete_suspend_allowed: + * @object: A #DBusUPower. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @allowed: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-UPower.SuspendAllowed">SuspendAllowed()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +dbus_upower_complete_suspend_allowed ( + DBusUPower *object, + GDBusMethodInvocation *invocation, + gboolean allowed) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(b)", + allowed)); +} + +/** + * dbus_upower_complete_hibernate: + * @object: A #DBusUPower. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-UPower.Hibernate">Hibernate()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +dbus_upower_complete_hibernate ( + DBusUPower *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * dbus_upower_complete_hibernate_allowed: + * @object: A #DBusUPower. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @allowed: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-UPower.HibernateAllowed">HibernateAllowed()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +dbus_upower_complete_hibernate_allowed ( + DBusUPower *object, + GDBusMethodInvocation *invocation, + gboolean allowed) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(b)", + allowed)); +} + +/* ------------------------------------------------------------------------ */ + +/** + * DBusUPowerProxy: + * + * The #DBusUPowerProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * DBusUPowerProxyClass: + * @parent_class: The parent class. + * + * Class structure for #DBusUPowerProxy. + */ + +struct _DBusUPowerProxyPrivate +{ + GData *qdata; +}; + +static void dbus_upower_proxy_iface_init (DBusUPowerIface *iface); + +G_DEFINE_TYPE_WITH_CODE (DBusUPowerProxy, dbus_upower_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (DBUS_TYPE_UPOWER, dbus_upower_proxy_iface_init)); + +static void +dbus_upower_proxy_finalize (GObject *object) +{ + DBusUPowerProxy *proxy = DBUS_UPOWER_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (dbus_upower_proxy_parent_class)->finalize (object); +} + +static void +dbus_upower_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 7); + info = _dbus_upower_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +dbus_upower_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + error = NULL; + if (!g_dbus_proxy_call_finish (proxy, res, &error)) + { + g_warning ("Error setting property `%s' on interface org.freedesktop.UPower: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } +} + +static void +dbus_upower_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 7); + info = _dbus_upower_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.freedesktop.UPower", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) dbus_upower_proxy_set_property_cb, (gpointer) info); + g_variant_unref (variant); +} + +static void +dbus_upower_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_dbus_upower_interface_info, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], DBUS_TYPE_UPOWER); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, DBUS_TYPE_UPOWER); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +dbus_upower_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + DBusUPowerProxy *proxy = DBUS_UPOWER_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_upower_interface_info, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_upower_interface_info, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static const gchar * +dbus_upower_proxy_get_daemon_version (DBusUPower *object) +{ + DBusUPowerProxy *proxy = DBUS_UPOWER_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "DaemonVersion"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static gboolean +dbus_upower_proxy_get_can_suspend (DBusUPower *object) +{ + DBusUPowerProxy *proxy = DBUS_UPOWER_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "CanSuspend"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +dbus_upower_proxy_get_can_hibernate (DBusUPower *object) +{ + DBusUPowerProxy *proxy = DBUS_UPOWER_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "CanHibernate"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +dbus_upower_proxy_get_on_battery (DBusUPower *object) +{ + DBusUPowerProxy *proxy = DBUS_UPOWER_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "OnBattery"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +dbus_upower_proxy_get_on_low_battery (DBusUPower *object) +{ + DBusUPowerProxy *proxy = DBUS_UPOWER_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "OnLowBattery"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +dbus_upower_proxy_get_lid_is_closed (DBusUPower *object) +{ + DBusUPowerProxy *proxy = DBUS_UPOWER_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "LidIsClosed"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +dbus_upower_proxy_get_lid_is_present (DBusUPower *object) +{ + DBusUPowerProxy *proxy = DBUS_UPOWER_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "LidIsPresent"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static void +dbus_upower_proxy_init (DBusUPowerProxy *proxy) +{ + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, DBUS_TYPE_UPOWER_PROXY, DBusUPowerProxyPrivate); + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), dbus_upower_interface_info ()); +} + +static void +dbus_upower_proxy_class_init (DBusUPowerProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + g_type_class_add_private (klass, sizeof (DBusUPowerProxyPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = dbus_upower_proxy_finalize; + gobject_class->get_property = dbus_upower_proxy_get_property; + gobject_class->set_property = dbus_upower_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = dbus_upower_proxy_g_signal; + proxy_class->g_properties_changed = dbus_upower_proxy_g_properties_changed; + + + dbus_upower_override_properties (gobject_class, 1); +} + +static void +dbus_upower_proxy_iface_init (DBusUPowerIface *iface) +{ + iface->get_daemon_version = dbus_upower_proxy_get_daemon_version; + iface->get_can_suspend = dbus_upower_proxy_get_can_suspend; + iface->get_can_hibernate = dbus_upower_proxy_get_can_hibernate; + iface->get_on_battery = dbus_upower_proxy_get_on_battery; + iface->get_on_low_battery = dbus_upower_proxy_get_on_low_battery; + iface->get_lid_is_closed = dbus_upower_proxy_get_lid_is_closed; + iface->get_lid_is_present = dbus_upower_proxy_get_lid_is_present; +} + +/** + * dbus_upower_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-UPower.top_of_page">org.freedesktop.UPower</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call dbus_upower_proxy_new_finish() to get the result of the operation. + * + * See dbus_upower_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +dbus_upower_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (DBUS_TYPE_UPOWER_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.UPower", NULL); +} + +/** + * dbus_upower_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_upower_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with dbus_upower_proxy_new(). + * + * Returns: (transfer full) (type DBusUPowerProxy): The constructed proxy object or %NULL if @error is set. + */ +DBusUPower * +dbus_upower_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return DBUS_UPOWER (ret); + else + return NULL; +} + +/** + * dbus_upower_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-UPower.top_of_page">org.freedesktop.UPower</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See dbus_upower_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type DBusUPowerProxy): The constructed proxy object or %NULL if @error is set. + */ +DBusUPower * +dbus_upower_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (DBUS_TYPE_UPOWER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.UPower", NULL); + if (ret != NULL) + return DBUS_UPOWER (ret); + else + return NULL; +} + + +/** + * dbus_upower_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like dbus_upower_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call dbus_upower_proxy_new_for_bus_finish() to get the result of the operation. + * + * See dbus_upower_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +dbus_upower_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (DBUS_TYPE_UPOWER_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.UPower", NULL); +} + +/** + * dbus_upower_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_upower_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with dbus_upower_proxy_new_for_bus(). + * + * Returns: (transfer full) (type DBusUPowerProxy): The constructed proxy object or %NULL if @error is set. + */ +DBusUPower * +dbus_upower_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return DBUS_UPOWER (ret); + else + return NULL; +} + +/** + * dbus_upower_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like dbus_upower_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See dbus_upower_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type DBusUPowerProxy): The constructed proxy object or %NULL if @error is set. + */ +DBusUPower * +dbus_upower_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (DBUS_TYPE_UPOWER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.UPower", NULL); + if (ret != NULL) + return DBUS_UPOWER (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * DBusUPowerSkeleton: + * + * The #DBusUPowerSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * DBusUPowerSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #DBusUPowerSkeleton. + */ + +struct _DBusUPowerSkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_dbus_upower_skeleton_handle_method_call ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], DBUS_TYPE_UPOWER); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, DBUS_TYPE_UPOWER); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + 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); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_dbus_upower_skeleton_handle_get_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_upower_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_dbus_upower_skeleton_handle_set_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_upower_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _dbus_upower_skeleton_vtable = +{ + _dbus_upower_skeleton_handle_method_call, + _dbus_upower_skeleton_handle_get_property, + _dbus_upower_skeleton_handle_set_property +}; + +static GDBusInterfaceInfo * +dbus_upower_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton) +{ + return dbus_upower_interface_info (); +} + +static GDBusInterfaceVTable * +dbus_upower_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton) +{ + return (GDBusInterfaceVTable *) &_dbus_upower_skeleton_vtable; +} + +static GVariant * +dbus_upower_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_dbus_upower_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _dbus_upower_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _dbus_upower_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _dbus_upower_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.UPower", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean _dbus_upower_emit_changed (gpointer user_data); + +static void +dbus_upower_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (&skeleton->priv->lock); + + if (emit_changed) + _dbus_upower_emit_changed (skeleton); +} + +static void +_dbus_upower_on_signal_device_added ( + DBusUPower *object, + const gchar *arg_device) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o)", + arg_device)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.UPower", "DeviceAdded", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_dbus_upower_on_signal_device_removed ( + DBusUPower *object, + const gchar *arg_device) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o)", + arg_device)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.UPower", "DeviceRemoved", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_dbus_upower_on_signal_device_changed ( + DBusUPower *object, + const gchar *arg_device) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(s)", + arg_device)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.UPower", "DeviceChanged", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_dbus_upower_on_signal_changed ( + DBusUPower *object) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("()")); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.UPower", "Changed", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_dbus_upower_on_signal_sleeping ( + DBusUPower *object) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("()")); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.UPower", "Sleeping", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_dbus_upower_on_signal_resuming ( + DBusUPower *object) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("()")); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.UPower", "Resuming", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void dbus_upower_skeleton_iface_init (DBusUPowerIface *iface); +G_DEFINE_TYPE_WITH_CODE (DBusUPowerSkeleton, dbus_upower_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (DBUS_TYPE_UPOWER, dbus_upower_skeleton_iface_init)); + +static void +dbus_upower_skeleton_finalize (GObject *object) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + guint n; + for (n = 0; n < 7; n++) + g_value_unset (&skeleton->priv->properties[n]); + g_free (skeleton->priv->properties); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (dbus_upower_skeleton_parent_class)->finalize (object); +} + +static void +dbus_upower_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 7); + g_mutex_lock (&skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock (&skeleton->priv->lock); +} + +static gboolean +_dbus_upower_emit_changed (gpointer user_data) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (&skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *l; + GVariant *signal_variant; + signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.UPower", + &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + signal_variant, + NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (&skeleton->priv->lock); + return FALSE; +} + +static void +_dbus_upower_schedule_emit_changed (DBusUPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +dbus_upower_skeleton_notify (GObject *object, + GParamSpec *pspec) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, _dbus_upower_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (&skeleton->priv->lock); +} + +static void +dbus_upower_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 7); + g_mutex_lock (&skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + _dbus_upower_schedule_emit_changed (skeleton, _dbus_upower_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (&skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +dbus_upower_skeleton_init (DBusUPowerSkeleton *skeleton) +{ + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, DBUS_TYPE_UPOWER_SKELETON, DBusUPowerSkeletonPrivate); + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); + skeleton->priv->properties = g_new0 (GValue, 7); + g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[1], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[2], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[3], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[5], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[6], G_TYPE_BOOLEAN); +} + +static const gchar * +dbus_upower_skeleton_get_daemon_version (DBusUPower *object) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[0])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +dbus_upower_skeleton_get_can_suspend (DBusUPower *object) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[1])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +dbus_upower_skeleton_get_can_hibernate (DBusUPower *object) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[2])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +dbus_upower_skeleton_get_on_battery (DBusUPower *object) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[3])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +dbus_upower_skeleton_get_on_low_battery (DBusUPower *object) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[4])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +dbus_upower_skeleton_get_lid_is_closed (DBusUPower *object) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[5])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +dbus_upower_skeleton_get_lid_is_present (DBusUPower *object) +{ + DBusUPowerSkeleton *skeleton = DBUS_UPOWER_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[6])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static void +dbus_upower_skeleton_class_init (DBusUPowerSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + g_type_class_add_private (klass, sizeof (DBusUPowerSkeletonPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = dbus_upower_skeleton_finalize; + gobject_class->get_property = dbus_upower_skeleton_get_property; + gobject_class->set_property = dbus_upower_skeleton_set_property; + gobject_class->notify = dbus_upower_skeleton_notify; + + + dbus_upower_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = dbus_upower_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = dbus_upower_skeleton_dbus_interface_get_properties; + skeleton_class->flush = dbus_upower_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = dbus_upower_skeleton_dbus_interface_get_vtable; +} + +static void +dbus_upower_skeleton_iface_init (DBusUPowerIface *iface) +{ + iface->device_added = _dbus_upower_on_signal_device_added; + iface->device_removed = _dbus_upower_on_signal_device_removed; + iface->device_changed = _dbus_upower_on_signal_device_changed; + iface->changed = _dbus_upower_on_signal_changed; + iface->sleeping = _dbus_upower_on_signal_sleeping; + iface->resuming = _dbus_upower_on_signal_resuming; + iface->get_daemon_version = dbus_upower_skeleton_get_daemon_version; + iface->get_can_suspend = dbus_upower_skeleton_get_can_suspend; + iface->get_can_hibernate = dbus_upower_skeleton_get_can_hibernate; + iface->get_on_battery = dbus_upower_skeleton_get_on_battery; + iface->get_on_low_battery = dbus_upower_skeleton_get_on_low_battery; + iface->get_lid_is_closed = dbus_upower_skeleton_get_lid_is_closed; + iface->get_lid_is_present = dbus_upower_skeleton_get_lid_is_present; +} + +/** + * dbus_upower_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-UPower.top_of_page">org.freedesktop.UPower</link>. + * + * Returns: (transfer full) (type DBusUPowerSkeleton): The skeleton object. + */ +DBusUPower * +dbus_upower_skeleton_new (void) +{ + return DBUS_UPOWER (g_object_new (DBUS_TYPE_UPOWER_SKELETON, NULL)); +} + diff --git a/src/dbus-upower.h b/src/dbus-upower.h new file mode 100644 index 0000000..f02f23f --- /dev/null +++ b/src/dbus-upower.h @@ -0,0 +1,381 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __DBUS_UPOWER_H__ +#define __DBUS_UPOWER_H__ + +#include <gio/gio.h> + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.freedesktop.UPower */ + +#define DBUS_TYPE_UPOWER (dbus_upower_get_type ()) +#define DBUS_UPOWER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DBUS_TYPE_UPOWER, DBusUPower)) +#define DBUS_IS_UPOWER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DBUS_TYPE_UPOWER)) +#define DBUS_UPOWER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), DBUS_TYPE_UPOWER, DBusUPowerIface)) + +struct _DBusUPower; +typedef struct _DBusUPower DBusUPower; +typedef struct _DBusUPowerIface DBusUPowerIface; + +struct _DBusUPowerIface +{ + GTypeInterface parent_iface; + + + + gboolean (*handle_about_to_sleep) ( + DBusUPower *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_enumerate_devices) ( + DBusUPower *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_hibernate) ( + DBusUPower *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_hibernate_allowed) ( + DBusUPower *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_suspend) ( + DBusUPower *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_suspend_allowed) ( + DBusUPower *object, + GDBusMethodInvocation *invocation); + + gboolean (*get_can_hibernate) (DBusUPower *object); + + gboolean (*get_can_suspend) (DBusUPower *object); + + const gchar * (*get_daemon_version) (DBusUPower *object); + + gboolean (*get_lid_is_closed) (DBusUPower *object); + + gboolean (*get_lid_is_present) (DBusUPower *object); + + gboolean (*get_on_battery) (DBusUPower *object); + + gboolean (*get_on_low_battery) (DBusUPower *object); + + void (*changed) ( + DBusUPower *object); + + void (*device_added) ( + DBusUPower *object, + const gchar *arg_device); + + void (*device_changed) ( + DBusUPower *object, + const gchar *arg_device); + + void (*device_removed) ( + DBusUPower *object, + const gchar *arg_device); + + void (*resuming) ( + DBusUPower *object); + + void (*sleeping) ( + DBusUPower *object); + +}; + +GType dbus_upower_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *dbus_upower_interface_info (void); +guint dbus_upower_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void dbus_upower_complete_enumerate_devices ( + DBusUPower *object, + GDBusMethodInvocation *invocation, + const gchar *const *devices); + +void dbus_upower_complete_about_to_sleep ( + DBusUPower *object, + GDBusMethodInvocation *invocation); + +void dbus_upower_complete_suspend ( + DBusUPower *object, + GDBusMethodInvocation *invocation); + +void dbus_upower_complete_suspend_allowed ( + DBusUPower *object, + GDBusMethodInvocation *invocation, + gboolean allowed); + +void dbus_upower_complete_hibernate ( + DBusUPower *object, + GDBusMethodInvocation *invocation); + +void dbus_upower_complete_hibernate_allowed ( + DBusUPower *object, + GDBusMethodInvocation *invocation, + gboolean allowed); + + + +/* D-Bus signal emissions functions: */ +void dbus_upower_emit_device_added ( + DBusUPower *object, + const gchar *arg_device); + +void dbus_upower_emit_device_removed ( + DBusUPower *object, + const gchar *arg_device); + +void dbus_upower_emit_device_changed ( + DBusUPower *object, + const gchar *arg_device); + +void dbus_upower_emit_changed ( + DBusUPower *object); + +void dbus_upower_emit_sleeping ( + DBusUPower *object); + +void dbus_upower_emit_resuming ( + DBusUPower *object); + + + +/* D-Bus method calls: */ +void dbus_upower_call_enumerate_devices ( + DBusUPower *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean dbus_upower_call_enumerate_devices_finish ( + DBusUPower *proxy, + gchar ***out_devices, + GAsyncResult *res, + GError **error); + +gboolean dbus_upower_call_enumerate_devices_sync ( + DBusUPower *proxy, + gchar ***out_devices, + GCancellable *cancellable, + GError **error); + +void dbus_upower_call_about_to_sleep ( + DBusUPower *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean dbus_upower_call_about_to_sleep_finish ( + DBusUPower *proxy, + GAsyncResult *res, + GError **error); + +gboolean dbus_upower_call_about_to_sleep_sync ( + DBusUPower *proxy, + GCancellable *cancellable, + GError **error); + +void dbus_upower_call_suspend ( + DBusUPower *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean dbus_upower_call_suspend_finish ( + DBusUPower *proxy, + GAsyncResult *res, + GError **error); + +gboolean dbus_upower_call_suspend_sync ( + DBusUPower *proxy, + GCancellable *cancellable, + GError **error); + +void dbus_upower_call_suspend_allowed ( + DBusUPower *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean dbus_upower_call_suspend_allowed_finish ( + DBusUPower *proxy, + gboolean *out_allowed, + GAsyncResult *res, + GError **error); + +gboolean dbus_upower_call_suspend_allowed_sync ( + DBusUPower *proxy, + gboolean *out_allowed, + GCancellable *cancellable, + GError **error); + +void dbus_upower_call_hibernate ( + DBusUPower *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean dbus_upower_call_hibernate_finish ( + DBusUPower *proxy, + GAsyncResult *res, + GError **error); + +gboolean dbus_upower_call_hibernate_sync ( + DBusUPower *proxy, + GCancellable *cancellable, + GError **error); + +void dbus_upower_call_hibernate_allowed ( + DBusUPower *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean dbus_upower_call_hibernate_allowed_finish ( + DBusUPower *proxy, + gboolean *out_allowed, + GAsyncResult *res, + GError **error); + +gboolean dbus_upower_call_hibernate_allowed_sync ( + DBusUPower *proxy, + gboolean *out_allowed, + GCancellable *cancellable, + GError **error); + + + +/* D-Bus property accessors: */ +const gchar *dbus_upower_get_daemon_version (DBusUPower *object); +gchar *dbus_upower_dup_daemon_version (DBusUPower *object); +void dbus_upower_set_daemon_version (DBusUPower *object, const gchar *value); + +gboolean dbus_upower_get_can_suspend (DBusUPower *object); +void dbus_upower_set_can_suspend (DBusUPower *object, gboolean value); + +gboolean dbus_upower_get_can_hibernate (DBusUPower *object); +void dbus_upower_set_can_hibernate (DBusUPower *object, gboolean value); + +gboolean dbus_upower_get_on_battery (DBusUPower *object); +void dbus_upower_set_on_battery (DBusUPower *object, gboolean value); + +gboolean dbus_upower_get_on_low_battery (DBusUPower *object); +void dbus_upower_set_on_low_battery (DBusUPower *object, gboolean value); + +gboolean dbus_upower_get_lid_is_closed (DBusUPower *object); +void dbus_upower_set_lid_is_closed (DBusUPower *object, gboolean value); + +gboolean dbus_upower_get_lid_is_present (DBusUPower *object); +void dbus_upower_set_lid_is_present (DBusUPower *object, gboolean value); + + +/* ---- */ + +#define DBUS_TYPE_UPOWER_PROXY (dbus_upower_proxy_get_type ()) +#define DBUS_UPOWER_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DBUS_TYPE_UPOWER_PROXY, DBusUPowerProxy)) +#define DBUS_UPOWER_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), DBUS_TYPE_UPOWER_PROXY, DBusUPowerProxyClass)) +#define DBUS_UPOWER_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DBUS_TYPE_UPOWER_PROXY, DBusUPowerProxyClass)) +#define DBUS_IS_UPOWER_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DBUS_TYPE_UPOWER_PROXY)) +#define DBUS_IS_UPOWER_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DBUS_TYPE_UPOWER_PROXY)) + +typedef struct _DBusUPowerProxy DBusUPowerProxy; +typedef struct _DBusUPowerProxyClass DBusUPowerProxyClass; +typedef struct _DBusUPowerProxyPrivate DBusUPowerProxyPrivate; + +struct _DBusUPowerProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + DBusUPowerProxyPrivate *priv; +}; + +struct _DBusUPowerProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType dbus_upower_proxy_get_type (void) G_GNUC_CONST; + +void dbus_upower_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +DBusUPower *dbus_upower_proxy_new_finish ( + GAsyncResult *res, + GError **error); +DBusUPower *dbus_upower_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void dbus_upower_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +DBusUPower *dbus_upower_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +DBusUPower *dbus_upower_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define DBUS_TYPE_UPOWER_SKELETON (dbus_upower_skeleton_get_type ()) +#define DBUS_UPOWER_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DBUS_TYPE_UPOWER_SKELETON, DBusUPowerSkeleton)) +#define DBUS_UPOWER_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), DBUS_TYPE_UPOWER_SKELETON, DBusUPowerSkeletonClass)) +#define DBUS_UPOWER_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DBUS_TYPE_UPOWER_SKELETON, DBusUPowerSkeletonClass)) +#define DBUS_IS_UPOWER_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DBUS_TYPE_UPOWER_SKELETON)) +#define DBUS_IS_UPOWER_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DBUS_TYPE_UPOWER_SKELETON)) + +typedef struct _DBusUPowerSkeleton DBusUPowerSkeleton; +typedef struct _DBusUPowerSkeletonClass DBusUPowerSkeletonClass; +typedef struct _DBusUPowerSkeletonPrivate DBusUPowerSkeletonPrivate; + +struct _DBusUPowerSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + DBusUPowerSkeletonPrivate *priv; +}; + +struct _DBusUPowerSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType dbus_upower_skeleton_get_type (void) G_GNUC_CONST; + +DBusUPower *dbus_upower_skeleton_new (void); + + +G_END_DECLS + +#endif /* __DBUS_UPOWER_H__ */ diff --git a/src/dbus-user.c b/src/dbus-user.c new file mode 100644 index 0000000..2b46f01 --- /dev/null +++ b/src/dbus-user.c @@ -0,0 +1,5392 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "dbus-user.h" + +#include <string.h> +#ifdef G_OS_UNIX +# include <gio/gunixfdlist.h> +#endif + +typedef struct +{ + GDBusArgInfo parent_struct; + gboolean use_gvariant; +} _ExtendedGDBusArgInfo; + +typedef struct +{ + GDBusMethodInfo parent_struct; + const gchar *signal_name; + gboolean pass_fdlist; +} _ExtendedGDBusMethodInfo; + +typedef struct +{ + GDBusSignalInfo parent_struct; + const gchar *signal_name; +} _ExtendedGDBusSignalInfo; + +typedef struct +{ + GDBusPropertyInfo parent_struct; + const gchar *hyphen_name; + gboolean use_gvariant; +} _ExtendedGDBusPropertyInfo; + +typedef struct +{ + GDBusInterfaceInfo parent_struct; + const gchar *hyphen_name; +} _ExtendedGDBusInterfaceInfo; + +typedef struct +{ + const _ExtendedGDBusPropertyInfo *info; + guint prop_id; + GValue orig_value; /* the value before the change */ +} ChangedProperty; + +static void +_changed_property_free (ChangedProperty *data) +{ + g_value_unset (&data->orig_value); + g_free (data); +} + +static gboolean +_g_strv_equal0 (gchar **a, gchar **b) +{ + gboolean ret = FALSE; + guint n; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + if (g_strv_length (a) != g_strv_length (b)) + goto out; + for (n = 0; a[n] != NULL; n++) + if (g_strcmp0 (a[n], b[n]) != 0) + goto out; + ret = TRUE; +out: + return ret; +} + +static gboolean +_g_variant_equal0 (GVariant *a, GVariant *b) +{ + gboolean ret = FALSE; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + ret = g_variant_equal (a, b); +out: + return ret; +} + +G_GNUC_UNUSED static gboolean +_g_value_equal (const GValue *a, const GValue *b) +{ + gboolean ret = FALSE; + g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); + switch (G_VALUE_TYPE (a)) + { + case G_TYPE_BOOLEAN: + ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); + break; + case G_TYPE_UCHAR: + ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); + break; + case G_TYPE_INT: + ret = (g_value_get_int (a) == g_value_get_int (b)); + break; + case G_TYPE_UINT: + ret = (g_value_get_uint (a) == g_value_get_uint (b)); + break; + case G_TYPE_INT64: + ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); + break; + case G_TYPE_UINT64: + ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); + break; + case G_TYPE_DOUBLE: + { + /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ + gdouble da = g_value_get_double (a); + gdouble db = g_value_get_double (b); + ret = memcmp (&da, &db, sizeof (gdouble)) == 0; + } + break; + case G_TYPE_STRING: + ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); + break; + case G_TYPE_VARIANT: + ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); + break; + default: + if (G_VALUE_TYPE (a) == G_TYPE_STRV) + ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); + else + g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); + break; + } + return ret; +} + +/* ------------------------------------------------------------------------ + * Code for interface org.freedesktop.Accounts.User + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:AccountsUser + * @title: AccountsUser + * @short_description: Generated C code for the org.freedesktop.Accounts.User D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-Accounts-User.top_of_page">org.freedesktop.Accounts.User</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.freedesktop.Accounts.User ---- */ + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_user_name_IN_ARG_name = +{ + { + -1, + (gchar *) "name", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_user_name_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_user_name_IN_ARG_name, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_user_name_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_user_name_annotation_info_pointers[] = +{ + &_accounts_user_method_set_user_name_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_user_name = +{ + { + -1, + (gchar *) "SetUserName", + (GDBusArgInfo **) &_accounts_user_method_info_set_user_name_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_user_name_annotation_info_pointers + }, + "handle-set-user-name", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_real_name_IN_ARG_name = +{ + { + -1, + (gchar *) "name", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_real_name_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_real_name_IN_ARG_name, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_real_name_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_real_name_annotation_info_pointers[] = +{ + &_accounts_user_method_set_real_name_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_real_name = +{ + { + -1, + (gchar *) "SetRealName", + (GDBusArgInfo **) &_accounts_user_method_info_set_real_name_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_real_name_annotation_info_pointers + }, + "handle-set-real-name", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_email_IN_ARG_email = +{ + { + -1, + (gchar *) "email", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_email_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_email_IN_ARG_email, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_email_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_email_annotation_info_pointers[] = +{ + &_accounts_user_method_set_email_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_email = +{ + { + -1, + (gchar *) "SetEmail", + (GDBusArgInfo **) &_accounts_user_method_info_set_email_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_email_annotation_info_pointers + }, + "handle-set-email", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_language_IN_ARG_language = +{ + { + -1, + (gchar *) "language", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_language_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_language_IN_ARG_language, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_language_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_language_annotation_info_pointers[] = +{ + &_accounts_user_method_set_language_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_language = +{ + { + -1, + (gchar *) "SetLanguage", + (GDBusArgInfo **) &_accounts_user_method_info_set_language_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_language_annotation_info_pointers + }, + "handle-set-language", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_xsession_IN_ARG_x_session = +{ + { + -1, + (gchar *) "x_session", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_xsession_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_xsession_IN_ARG_x_session, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_xsession_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_xsession_annotation_info_1 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.CSymbol", + (gchar *) "user_set_x_session", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_xsession_annotation_info_pointers[] = +{ + &_accounts_user_method_set_xsession_annotation_info_0, + &_accounts_user_method_set_xsession_annotation_info_1, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_xsession = +{ + { + -1, + (gchar *) "SetXSession", + (GDBusArgInfo **) &_accounts_user_method_info_set_xsession_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_xsession_annotation_info_pointers + }, + "handle-set-xsession", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_location_IN_ARG_location = +{ + { + -1, + (gchar *) "location", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_location_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_location_IN_ARG_location, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_location_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_location_annotation_info_pointers[] = +{ + &_accounts_user_method_set_location_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_location = +{ + { + -1, + (gchar *) "SetLocation", + (GDBusArgInfo **) &_accounts_user_method_info_set_location_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_location_annotation_info_pointers + }, + "handle-set-location", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_home_directory_IN_ARG_homedir = +{ + { + -1, + (gchar *) "homedir", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_home_directory_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_home_directory_IN_ARG_homedir, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_home_directory_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_home_directory_annotation_info_pointers[] = +{ + &_accounts_user_method_set_home_directory_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_home_directory = +{ + { + -1, + (gchar *) "SetHomeDirectory", + (GDBusArgInfo **) &_accounts_user_method_info_set_home_directory_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_home_directory_annotation_info_pointers + }, + "handle-set-home-directory", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_shell_IN_ARG_shell = +{ + { + -1, + (gchar *) "shell", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_shell_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_shell_IN_ARG_shell, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_shell_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_shell_annotation_info_pointers[] = +{ + &_accounts_user_method_set_shell_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_shell = +{ + { + -1, + (gchar *) "SetShell", + (GDBusArgInfo **) &_accounts_user_method_info_set_shell_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_shell_annotation_info_pointers + }, + "handle-set-shell", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_icon_file_IN_ARG_filename = +{ + { + -1, + (gchar *) "filename", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_icon_file_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_icon_file_IN_ARG_filename, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_icon_file_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_icon_file_annotation_info_pointers[] = +{ + &_accounts_user_method_set_icon_file_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_icon_file = +{ + { + -1, + (gchar *) "SetIconFile", + (GDBusArgInfo **) &_accounts_user_method_info_set_icon_file_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_icon_file_annotation_info_pointers + }, + "handle-set-icon-file", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_locked_IN_ARG_locked = +{ + { + -1, + (gchar *) "locked", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_locked_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_locked_IN_ARG_locked, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_locked_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_locked_annotation_info_pointers[] = +{ + &_accounts_user_method_set_locked_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_locked = +{ + { + -1, + (gchar *) "SetLocked", + (GDBusArgInfo **) &_accounts_user_method_info_set_locked_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_locked_annotation_info_pointers + }, + "handle-set-locked", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_account_type_IN_ARG_accountType = +{ + { + -1, + (gchar *) "accountType", + (gchar *) "i", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_account_type_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_account_type_IN_ARG_accountType, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_account_type_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_account_type_annotation_info_pointers[] = +{ + &_accounts_user_method_set_account_type_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_account_type = +{ + { + -1, + (gchar *) "SetAccountType", + (GDBusArgInfo **) &_accounts_user_method_info_set_account_type_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_account_type_annotation_info_pointers + }, + "handle-set-account-type", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_password_mode_IN_ARG_mode = +{ + { + -1, + (gchar *) "mode", + (gchar *) "i", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_password_mode_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_password_mode_IN_ARG_mode, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_password_mode_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_password_mode_annotation_info_pointers[] = +{ + &_accounts_user_method_set_password_mode_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_password_mode = +{ + { + -1, + (gchar *) "SetPasswordMode", + (GDBusArgInfo **) &_accounts_user_method_info_set_password_mode_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_password_mode_annotation_info_pointers + }, + "handle-set-password-mode", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_password_IN_ARG_password = +{ + { + -1, + (gchar *) "password", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_password_IN_ARG_hint = +{ + { + -1, + (gchar *) "hint", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_password_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_password_IN_ARG_password, + &_accounts_user_method_info_set_password_IN_ARG_hint, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_password_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_password_annotation_info_pointers[] = +{ + &_accounts_user_method_set_password_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_password = +{ + { + -1, + (gchar *) "SetPassword", + (GDBusArgInfo **) &_accounts_user_method_info_set_password_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_password_annotation_info_pointers + }, + "handle-set-password", + FALSE +}; + +static const _ExtendedGDBusArgInfo _accounts_user_method_info_set_automatic_login_IN_ARG_enabled = +{ + { + -1, + (gchar *) "enabled", + (gchar *) "b", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _accounts_user_method_info_set_automatic_login_IN_ARG_pointers[] = +{ + &_accounts_user_method_info_set_automatic_login_IN_ARG_enabled, + NULL +}; + +static const GDBusAnnotationInfo _accounts_user_method_set_automatic_login_annotation_info_0 = +{ + -1, + (gchar *) "org.freedesktop.DBus.GLib.Async", + (gchar *) "", + NULL +}; + +static const GDBusAnnotationInfo * const _accounts_user_method_set_automatic_login_annotation_info_pointers[] = +{ + &_accounts_user_method_set_automatic_login_annotation_info_0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _accounts_user_method_info_set_automatic_login = +{ + { + -1, + (gchar *) "SetAutomaticLogin", + (GDBusArgInfo **) &_accounts_user_method_info_set_automatic_login_IN_ARG_pointers, + NULL, + (GDBusAnnotationInfo **) &_accounts_user_method_set_automatic_login_annotation_info_pointers + }, + "handle-set-automatic-login", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _accounts_user_method_info_pointers[] = +{ + &_accounts_user_method_info_set_user_name, + &_accounts_user_method_info_set_real_name, + &_accounts_user_method_info_set_email, + &_accounts_user_method_info_set_language, + &_accounts_user_method_info_set_xsession, + &_accounts_user_method_info_set_location, + &_accounts_user_method_info_set_home_directory, + &_accounts_user_method_info_set_shell, + &_accounts_user_method_info_set_icon_file, + &_accounts_user_method_info_set_locked, + &_accounts_user_method_info_set_account_type, + &_accounts_user_method_info_set_password_mode, + &_accounts_user_method_info_set_password, + &_accounts_user_method_info_set_automatic_login, + NULL +}; + +static const _ExtendedGDBusSignalInfo _accounts_user_signal_info_changed = +{ + { + -1, + (gchar *) "Changed", + NULL, + NULL + }, + "changed" +}; + +static const _ExtendedGDBusSignalInfo * const _accounts_user_signal_info_pointers[] = +{ + &_accounts_user_signal_info_changed, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_uid = +{ + { + -1, + (gchar *) "Uid", + (gchar *) "t", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "uid", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_user_name = +{ + { + -1, + (gchar *) "UserName", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "user-name", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_real_name = +{ + { + -1, + (gchar *) "RealName", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "real-name", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_account_type = +{ + { + -1, + (gchar *) "AccountType", + (gchar *) "i", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "account-type", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_home_directory = +{ + { + -1, + (gchar *) "HomeDirectory", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "home-directory", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_shell = +{ + { + -1, + (gchar *) "Shell", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "shell", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_email = +{ + { + -1, + (gchar *) "Email", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "email", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_language = +{ + { + -1, + (gchar *) "Language", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "language", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_xsession = +{ + { + -1, + (gchar *) "XSession", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "xsession", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_location = +{ + { + -1, + (gchar *) "Location", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "location", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_login_frequency = +{ + { + -1, + (gchar *) "LoginFrequency", + (gchar *) "t", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "login-frequency", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_icon_file = +{ + { + -1, + (gchar *) "IconFile", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "icon-file", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_locked = +{ + { + -1, + (gchar *) "Locked", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "locked", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_password_mode = +{ + { + -1, + (gchar *) "PasswordMode", + (gchar *) "i", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "password-mode", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_password_hint = +{ + { + -1, + (gchar *) "PasswordHint", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "password-hint", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_automatic_login = +{ + { + -1, + (gchar *) "AutomaticLogin", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "automatic-login", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _accounts_user_property_info_system_account = +{ + { + -1, + (gchar *) "SystemAccount", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "system-account", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const _accounts_user_property_info_pointers[] = +{ + &_accounts_user_property_info_uid, + &_accounts_user_property_info_user_name, + &_accounts_user_property_info_real_name, + &_accounts_user_property_info_account_type, + &_accounts_user_property_info_home_directory, + &_accounts_user_property_info_shell, + &_accounts_user_property_info_email, + &_accounts_user_property_info_language, + &_accounts_user_property_info_xsession, + &_accounts_user_property_info_location, + &_accounts_user_property_info_login_frequency, + &_accounts_user_property_info_icon_file, + &_accounts_user_property_info_locked, + &_accounts_user_property_info_password_mode, + &_accounts_user_property_info_password_hint, + &_accounts_user_property_info_automatic_login, + &_accounts_user_property_info_system_account, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _accounts_user_interface_info = +{ + { + -1, + (gchar *) "org.freedesktop.Accounts.User", + (GDBusMethodInfo **) &_accounts_user_method_info_pointers, + (GDBusSignalInfo **) &_accounts_user_signal_info_pointers, + (GDBusPropertyInfo **) &_accounts_user_property_info_pointers, + NULL + }, + "accounts-user", +}; + + +/** + * accounts_user_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-Accounts-User.top_of_page">org.freedesktop.Accounts.User</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +accounts_user_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_accounts_user_interface_info; +} + +/** + * accounts_user_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #AccountsUser interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +accounts_user_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "uid"); + g_object_class_override_property (klass, property_id_begin++, "user-name"); + g_object_class_override_property (klass, property_id_begin++, "real-name"); + g_object_class_override_property (klass, property_id_begin++, "account-type"); + g_object_class_override_property (klass, property_id_begin++, "home-directory"); + g_object_class_override_property (klass, property_id_begin++, "shell"); + g_object_class_override_property (klass, property_id_begin++, "email"); + g_object_class_override_property (klass, property_id_begin++, "language"); + g_object_class_override_property (klass, property_id_begin++, "xsession"); + g_object_class_override_property (klass, property_id_begin++, "location"); + g_object_class_override_property (klass, property_id_begin++, "login-frequency"); + g_object_class_override_property (klass, property_id_begin++, "icon-file"); + g_object_class_override_property (klass, property_id_begin++, "locked"); + g_object_class_override_property (klass, property_id_begin++, "password-mode"); + g_object_class_override_property (klass, property_id_begin++, "password-hint"); + g_object_class_override_property (klass, property_id_begin++, "automatic-login"); + g_object_class_override_property (klass, property_id_begin++, "system-account"); + return property_id_begin - 1; +} + + + +/** + * AccountsUser: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Accounts-User.top_of_page">org.freedesktop.Accounts.User</link>. + */ + +/** + * AccountsUserIface: + * @parent_iface: The parent interface. + * @handle_set_account_type: Handler for the #AccountsUser::handle-set-account-type signal. + * @handle_set_automatic_login: Handler for the #AccountsUser::handle-set-automatic-login signal. + * @handle_set_email: Handler for the #AccountsUser::handle-set-email signal. + * @handle_set_home_directory: Handler for the #AccountsUser::handle-set-home-directory signal. + * @handle_set_icon_file: Handler for the #AccountsUser::handle-set-icon-file signal. + * @handle_set_language: Handler for the #AccountsUser::handle-set-language signal. + * @handle_set_location: Handler for the #AccountsUser::handle-set-location signal. + * @handle_set_locked: Handler for the #AccountsUser::handle-set-locked signal. + * @handle_set_password: Handler for the #AccountsUser::handle-set-password signal. + * @handle_set_password_mode: Handler for the #AccountsUser::handle-set-password-mode signal. + * @handle_set_real_name: Handler for the #AccountsUser::handle-set-real-name signal. + * @handle_set_shell: Handler for the #AccountsUser::handle-set-shell signal. + * @handle_set_user_name: Handler for the #AccountsUser::handle-set-user-name signal. + * @handle_set_xsession: Handler for the #AccountsUser::handle-set-xsession signal. + * @get_account_type: Getter for the #AccountsUser:account-type property. + * @get_automatic_login: Getter for the #AccountsUser:automatic-login property. + * @get_email: Getter for the #AccountsUser:email property. + * @get_home_directory: Getter for the #AccountsUser:home-directory property. + * @get_icon_file: Getter for the #AccountsUser:icon-file property. + * @get_language: Getter for the #AccountsUser:language property. + * @get_location: Getter for the #AccountsUser:location property. + * @get_locked: Getter for the #AccountsUser:locked property. + * @get_login_frequency: Getter for the #AccountsUser:login-frequency property. + * @get_password_hint: Getter for the #AccountsUser:password-hint property. + * @get_password_mode: Getter for the #AccountsUser:password-mode property. + * @get_real_name: Getter for the #AccountsUser:real-name property. + * @get_shell: Getter for the #AccountsUser:shell property. + * @get_system_account: Getter for the #AccountsUser:system-account property. + * @get_uid: Getter for the #AccountsUser:uid property. + * @get_user_name: Getter for the #AccountsUser:user-name property. + * @get_xsession: Getter for the #AccountsUser:xsession property. + * @changed: Handler for the #AccountsUser::changed signal. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Accounts-User.top_of_page">org.freedesktop.Accounts.User</link>. + */ + +static void +accounts_user_default_init (AccountsUserIface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * AccountsUser::handle-set-user-name: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_name: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetUserName">SetUserName()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_user_name() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-user-name", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_user_name), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * AccountsUser::handle-set-real-name: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_name: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetRealName">SetRealName()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_real_name() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-real-name", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_real_name), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * AccountsUser::handle-set-email: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_email: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetEmail">SetEmail()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_email() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-email", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_email), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * AccountsUser::handle-set-language: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_language: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetLanguage">SetLanguage()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_language() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-language", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_language), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * AccountsUser::handle-set-xsession: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_x_session: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetXSession">SetXSession()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_xsession() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-xsession", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_xsession), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * AccountsUser::handle-set-location: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_location: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetLocation">SetLocation()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_location() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-location", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_location), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * AccountsUser::handle-set-home-directory: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_homedir: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetHomeDirectory">SetHomeDirectory()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_home_directory() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-home-directory", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_home_directory), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * AccountsUser::handle-set-shell: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_shell: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetShell">SetShell()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_shell() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-shell", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_shell), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * AccountsUser::handle-set-icon-file: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_filename: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetIconFile">SetIconFile()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_icon_file() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-icon-file", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_icon_file), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * AccountsUser::handle-set-locked: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_locked: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetLocked">SetLocked()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_locked() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-locked", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_locked), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_BOOLEAN); + + /** + * AccountsUser::handle-set-account-type: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_accountType: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetAccountType">SetAccountType()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_account_type() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-account-type", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_account_type), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); + + /** + * AccountsUser::handle-set-password-mode: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_mode: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetPasswordMode">SetPasswordMode()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_password_mode() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-password-mode", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_password_mode), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); + + /** + * AccountsUser::handle-set-password: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_password: Argument passed by remote caller. + * @arg_hint: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetPassword">SetPassword()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_password() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-password", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_password), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 3, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); + + /** + * AccountsUser::handle-set-automatic-login: + * @object: A #AccountsUser. + * @invocation: A #GDBusMethodInvocation. + * @arg_enabled: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetAutomaticLogin">SetAutomaticLogin()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call accounts_user_complete_set_automatic_login() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-set-automatic-login", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, handle_set_automatic_login), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_BOOLEAN); + + /* GObject signals for received D-Bus signals: */ + /** + * AccountsUser::changed: + * @object: A #AccountsUser. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-Accounts-User.Changed">"Changed"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("changed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AccountsUserIface, changed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 0); + + /* GObject properties for D-Bus properties: */ + /** + * AccountsUser:uid: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.Uid">"Uid"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_uint64 ("uid", "Uid", "Uid", 0, G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:user-name: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.UserName">"UserName"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("user-name", "UserName", "UserName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:real-name: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.RealName">"RealName"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("real-name", "RealName", "RealName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:account-type: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.AccountType">"AccountType"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_int ("account-type", "AccountType", "AccountType", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:home-directory: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.HomeDirectory">"HomeDirectory"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("home-directory", "HomeDirectory", "HomeDirectory", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:shell: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.Shell">"Shell"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("shell", "Shell", "Shell", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:email: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.Email">"Email"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("email", "Email", "Email", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:language: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.Language">"Language"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("language", "Language", "Language", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:xsession: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.XSession">"XSession"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("xsession", "XSession", "XSession", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:location: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.Location">"Location"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("location", "Location", "Location", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:login-frequency: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.LoginFrequency">"LoginFrequency"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_uint64 ("login-frequency", "LoginFrequency", "LoginFrequency", 0, G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:icon-file: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.IconFile">"IconFile"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("icon-file", "IconFile", "IconFile", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:locked: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.Locked">"Locked"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("locked", "Locked", "Locked", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:password-mode: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.PasswordMode">"PasswordMode"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_int ("password-mode", "PasswordMode", "PasswordMode", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:password-hint: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.PasswordHint">"PasswordHint"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("password-hint", "PasswordHint", "PasswordHint", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:automatic-login: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.AutomaticLogin">"AutomaticLogin"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("automatic-login", "AutomaticLogin", "AutomaticLogin", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AccountsUser:system-account: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-Accounts-User.SystemAccount">"SystemAccount"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("system-account", "SystemAccount", "SystemAccount", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +typedef AccountsUserIface AccountsUserInterface; +G_DEFINE_INTERFACE (AccountsUser, accounts_user, G_TYPE_OBJECT); + +/** + * accounts_user_get_uid: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Uid">"Uid"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint64 +accounts_user_get_uid (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_uid (object); +} + +/** + * accounts_user_set_uid: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Uid">"Uid"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_uid (AccountsUser *object, guint64 value) +{ + g_object_set (G_OBJECT (object), "uid", value, NULL); +} + +/** + * accounts_user_get_user_name: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.UserName">"UserName"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use accounts_user_dup_user_name() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +accounts_user_get_user_name (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_user_name (object); +} + +/** + * accounts_user_dup_user_name: (skip) + * @object: A #AccountsUser. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.UserName">"UserName"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +accounts_user_dup_user_name (AccountsUser *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "user-name", &value, NULL); + return value; +} + +/** + * accounts_user_set_user_name: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.UserName">"UserName"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_user_name (AccountsUser *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "user-name", value, NULL); +} + +/** + * accounts_user_get_real_name: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.RealName">"RealName"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use accounts_user_dup_real_name() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +accounts_user_get_real_name (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_real_name (object); +} + +/** + * accounts_user_dup_real_name: (skip) + * @object: A #AccountsUser. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.RealName">"RealName"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +accounts_user_dup_real_name (AccountsUser *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "real-name", &value, NULL); + return value; +} + +/** + * accounts_user_set_real_name: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.RealName">"RealName"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_real_name (AccountsUser *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "real-name", value, NULL); +} + +/** + * accounts_user_get_account_type: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.AccountType">"AccountType"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gint +accounts_user_get_account_type (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_account_type (object); +} + +/** + * accounts_user_set_account_type: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.AccountType">"AccountType"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_account_type (AccountsUser *object, gint value) +{ + g_object_set (G_OBJECT (object), "account-type", value, NULL); +} + +/** + * accounts_user_get_home_directory: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.HomeDirectory">"HomeDirectory"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use accounts_user_dup_home_directory() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +accounts_user_get_home_directory (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_home_directory (object); +} + +/** + * accounts_user_dup_home_directory: (skip) + * @object: A #AccountsUser. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.HomeDirectory">"HomeDirectory"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +accounts_user_dup_home_directory (AccountsUser *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "home-directory", &value, NULL); + return value; +} + +/** + * accounts_user_set_home_directory: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.HomeDirectory">"HomeDirectory"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_home_directory (AccountsUser *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "home-directory", value, NULL); +} + +/** + * accounts_user_get_shell: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Shell">"Shell"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use accounts_user_dup_shell() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +accounts_user_get_shell (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_shell (object); +} + +/** + * accounts_user_dup_shell: (skip) + * @object: A #AccountsUser. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Shell">"Shell"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +accounts_user_dup_shell (AccountsUser *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "shell", &value, NULL); + return value; +} + +/** + * accounts_user_set_shell: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Shell">"Shell"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_shell (AccountsUser *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "shell", value, NULL); +} + +/** + * accounts_user_get_email: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Email">"Email"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use accounts_user_dup_email() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +accounts_user_get_email (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_email (object); +} + +/** + * accounts_user_dup_email: (skip) + * @object: A #AccountsUser. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Email">"Email"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +accounts_user_dup_email (AccountsUser *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "email", &value, NULL); + return value; +} + +/** + * accounts_user_set_email: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Email">"Email"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_email (AccountsUser *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "email", value, NULL); +} + +/** + * accounts_user_get_language: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Language">"Language"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use accounts_user_dup_language() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +accounts_user_get_language (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_language (object); +} + +/** + * accounts_user_dup_language: (skip) + * @object: A #AccountsUser. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Language">"Language"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +accounts_user_dup_language (AccountsUser *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "language", &value, NULL); + return value; +} + +/** + * accounts_user_set_language: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Language">"Language"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_language (AccountsUser *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "language", value, NULL); +} + +/** + * accounts_user_get_xsession: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.XSession">"XSession"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use accounts_user_dup_xsession() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +accounts_user_get_xsession (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_xsession (object); +} + +/** + * accounts_user_dup_xsession: (skip) + * @object: A #AccountsUser. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.XSession">"XSession"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +accounts_user_dup_xsession (AccountsUser *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "xsession", &value, NULL); + return value; +} + +/** + * accounts_user_set_xsession: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.XSession">"XSession"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_xsession (AccountsUser *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "xsession", value, NULL); +} + +/** + * accounts_user_get_location: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Location">"Location"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use accounts_user_dup_location() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +accounts_user_get_location (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_location (object); +} + +/** + * accounts_user_dup_location: (skip) + * @object: A #AccountsUser. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Location">"Location"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +accounts_user_dup_location (AccountsUser *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "location", &value, NULL); + return value; +} + +/** + * accounts_user_set_location: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Location">"Location"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_location (AccountsUser *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "location", value, NULL); +} + +/** + * accounts_user_get_login_frequency: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.LoginFrequency">"LoginFrequency"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint64 +accounts_user_get_login_frequency (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_login_frequency (object); +} + +/** + * accounts_user_set_login_frequency: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.LoginFrequency">"LoginFrequency"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_login_frequency (AccountsUser *object, guint64 value) +{ + g_object_set (G_OBJECT (object), "login-frequency", value, NULL); +} + +/** + * accounts_user_get_icon_file: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.IconFile">"IconFile"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use accounts_user_dup_icon_file() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +accounts_user_get_icon_file (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_icon_file (object); +} + +/** + * accounts_user_dup_icon_file: (skip) + * @object: A #AccountsUser. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.IconFile">"IconFile"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +accounts_user_dup_icon_file (AccountsUser *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "icon-file", &value, NULL); + return value; +} + +/** + * accounts_user_set_icon_file: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.IconFile">"IconFile"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_icon_file (AccountsUser *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "icon-file", value, NULL); +} + +/** + * accounts_user_get_locked: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Locked">"Locked"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +accounts_user_get_locked (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_locked (object); +} + +/** + * accounts_user_set_locked: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.Locked">"Locked"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_locked (AccountsUser *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "locked", value, NULL); +} + +/** + * accounts_user_get_password_mode: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.PasswordMode">"PasswordMode"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gint +accounts_user_get_password_mode (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_password_mode (object); +} + +/** + * accounts_user_set_password_mode: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.PasswordMode">"PasswordMode"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_password_mode (AccountsUser *object, gint value) +{ + g_object_set (G_OBJECT (object), "password-mode", value, NULL); +} + +/** + * accounts_user_get_password_hint: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.PasswordHint">"PasswordHint"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use accounts_user_dup_password_hint() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +accounts_user_get_password_hint (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_password_hint (object); +} + +/** + * accounts_user_dup_password_hint: (skip) + * @object: A #AccountsUser. + * + * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.PasswordHint">"PasswordHint"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +accounts_user_dup_password_hint (AccountsUser *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "password-hint", &value, NULL); + return value; +} + +/** + * accounts_user_set_password_hint: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.PasswordHint">"PasswordHint"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_password_hint (AccountsUser *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "password-hint", value, NULL); +} + +/** + * accounts_user_get_automatic_login: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.AutomaticLogin">"AutomaticLogin"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +accounts_user_get_automatic_login (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_automatic_login (object); +} + +/** + * accounts_user_set_automatic_login: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.AutomaticLogin">"AutomaticLogin"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_automatic_login (AccountsUser *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "automatic-login", value, NULL); +} + +/** + * accounts_user_get_system_account: (skip) + * @object: A #AccountsUser. + * + * Gets the value of the <link linkend="gdbus-property-org-freedesktop-Accounts-User.SystemAccount">"SystemAccount"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +accounts_user_get_system_account (AccountsUser *object) +{ + return ACCOUNTS_USER_GET_IFACE (object)->get_system_account (object); +} + +/** + * accounts_user_set_system_account: (skip) + * @object: A #AccountsUser. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-freedesktop-Accounts-User.SystemAccount">"SystemAccount"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +accounts_user_set_system_account (AccountsUser *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "system-account", value, NULL); +} + +/** + * accounts_user_emit_changed: + * @object: A #AccountsUser. + * + * Emits the <link linkend="gdbus-signal-org-freedesktop-Accounts-User.Changed">"Changed"</link> D-Bus signal. + */ +void +accounts_user_emit_changed ( + AccountsUser *object) +{ + g_signal_emit_by_name (object, "changed"); +} + +/** + * accounts_user_call_set_user_name: + * @proxy: A #AccountsUserProxy. + * @arg_name: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetUserName">SetUserName()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_user_name_finish() to get the result of the operation. + * + * See accounts_user_call_set_user_name_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_user_name ( + AccountsUser *proxy, + const gchar *arg_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetUserName", + g_variant_new ("(s)", + arg_name), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_user_name_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_user_name(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_user_name(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_user_name_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_user_name_sync: + * @proxy: A #AccountsUserProxy. + * @arg_name: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetUserName">SetUserName()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_user_name() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_user_name_sync ( + AccountsUser *proxy, + const gchar *arg_name, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetUserName", + g_variant_new ("(s)", + arg_name), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_real_name: + * @proxy: A #AccountsUserProxy. + * @arg_name: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetRealName">SetRealName()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_real_name_finish() to get the result of the operation. + * + * See accounts_user_call_set_real_name_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_real_name ( + AccountsUser *proxy, + const gchar *arg_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetRealName", + g_variant_new ("(s)", + arg_name), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_real_name_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_real_name(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_real_name(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_real_name_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_real_name_sync: + * @proxy: A #AccountsUserProxy. + * @arg_name: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetRealName">SetRealName()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_real_name() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_real_name_sync ( + AccountsUser *proxy, + const gchar *arg_name, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetRealName", + g_variant_new ("(s)", + arg_name), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_email: + * @proxy: A #AccountsUserProxy. + * @arg_email: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetEmail">SetEmail()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_email_finish() to get the result of the operation. + * + * See accounts_user_call_set_email_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_email ( + AccountsUser *proxy, + const gchar *arg_email, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetEmail", + g_variant_new ("(s)", + arg_email), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_email_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_email(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_email(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_email_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_email_sync: + * @proxy: A #AccountsUserProxy. + * @arg_email: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetEmail">SetEmail()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_email() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_email_sync ( + AccountsUser *proxy, + const gchar *arg_email, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetEmail", + g_variant_new ("(s)", + arg_email), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_language: + * @proxy: A #AccountsUserProxy. + * @arg_language: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetLanguage">SetLanguage()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_language_finish() to get the result of the operation. + * + * See accounts_user_call_set_language_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_language ( + AccountsUser *proxy, + const gchar *arg_language, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetLanguage", + g_variant_new ("(s)", + arg_language), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_language_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_language(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_language(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_language_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_language_sync: + * @proxy: A #AccountsUserProxy. + * @arg_language: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetLanguage">SetLanguage()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_language() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_language_sync ( + AccountsUser *proxy, + const gchar *arg_language, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetLanguage", + g_variant_new ("(s)", + arg_language), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_xsession: + * @proxy: A #AccountsUserProxy. + * @arg_x_session: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetXSession">SetXSession()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_xsession_finish() to get the result of the operation. + * + * See accounts_user_call_set_xsession_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_xsession ( + AccountsUser *proxy, + const gchar *arg_x_session, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetXSession", + g_variant_new ("(s)", + arg_x_session), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_xsession_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_xsession(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_xsession(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_xsession_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_xsession_sync: + * @proxy: A #AccountsUserProxy. + * @arg_x_session: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetXSession">SetXSession()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_xsession() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_xsession_sync ( + AccountsUser *proxy, + const gchar *arg_x_session, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetXSession", + g_variant_new ("(s)", + arg_x_session), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_location: + * @proxy: A #AccountsUserProxy. + * @arg_location: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetLocation">SetLocation()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_location_finish() to get the result of the operation. + * + * See accounts_user_call_set_location_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_location ( + AccountsUser *proxy, + const gchar *arg_location, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetLocation", + g_variant_new ("(s)", + arg_location), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_location_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_location(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_location(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_location_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_location_sync: + * @proxy: A #AccountsUserProxy. + * @arg_location: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetLocation">SetLocation()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_location() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_location_sync ( + AccountsUser *proxy, + const gchar *arg_location, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetLocation", + g_variant_new ("(s)", + arg_location), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_home_directory: + * @proxy: A #AccountsUserProxy. + * @arg_homedir: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetHomeDirectory">SetHomeDirectory()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_home_directory_finish() to get the result of the operation. + * + * See accounts_user_call_set_home_directory_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_home_directory ( + AccountsUser *proxy, + const gchar *arg_homedir, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetHomeDirectory", + g_variant_new ("(s)", + arg_homedir), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_home_directory_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_home_directory(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_home_directory(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_home_directory_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_home_directory_sync: + * @proxy: A #AccountsUserProxy. + * @arg_homedir: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetHomeDirectory">SetHomeDirectory()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_home_directory() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_home_directory_sync ( + AccountsUser *proxy, + const gchar *arg_homedir, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetHomeDirectory", + g_variant_new ("(s)", + arg_homedir), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_shell: + * @proxy: A #AccountsUserProxy. + * @arg_shell: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetShell">SetShell()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_shell_finish() to get the result of the operation. + * + * See accounts_user_call_set_shell_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_shell ( + AccountsUser *proxy, + const gchar *arg_shell, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetShell", + g_variant_new ("(s)", + arg_shell), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_shell_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_shell(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_shell(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_shell_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_shell_sync: + * @proxy: A #AccountsUserProxy. + * @arg_shell: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetShell">SetShell()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_shell() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_shell_sync ( + AccountsUser *proxy, + const gchar *arg_shell, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetShell", + g_variant_new ("(s)", + arg_shell), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_icon_file: + * @proxy: A #AccountsUserProxy. + * @arg_filename: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetIconFile">SetIconFile()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_icon_file_finish() to get the result of the operation. + * + * See accounts_user_call_set_icon_file_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_icon_file ( + AccountsUser *proxy, + const gchar *arg_filename, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetIconFile", + g_variant_new ("(s)", + arg_filename), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_icon_file_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_icon_file(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_icon_file(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_icon_file_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_icon_file_sync: + * @proxy: A #AccountsUserProxy. + * @arg_filename: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetIconFile">SetIconFile()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_icon_file() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_icon_file_sync ( + AccountsUser *proxy, + const gchar *arg_filename, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetIconFile", + g_variant_new ("(s)", + arg_filename), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_locked: + * @proxy: A #AccountsUserProxy. + * @arg_locked: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetLocked">SetLocked()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_locked_finish() to get the result of the operation. + * + * See accounts_user_call_set_locked_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_locked ( + AccountsUser *proxy, + gboolean arg_locked, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetLocked", + g_variant_new ("(b)", + arg_locked), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_locked_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_locked(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_locked(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_locked_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_locked_sync: + * @proxy: A #AccountsUserProxy. + * @arg_locked: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetLocked">SetLocked()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_locked() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_locked_sync ( + AccountsUser *proxy, + gboolean arg_locked, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetLocked", + g_variant_new ("(b)", + arg_locked), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_account_type: + * @proxy: A #AccountsUserProxy. + * @arg_accountType: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetAccountType">SetAccountType()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_account_type_finish() to get the result of the operation. + * + * See accounts_user_call_set_account_type_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_account_type ( + AccountsUser *proxy, + gint arg_accountType, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetAccountType", + g_variant_new ("(i)", + arg_accountType), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_account_type_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_account_type(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_account_type(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_account_type_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_account_type_sync: + * @proxy: A #AccountsUserProxy. + * @arg_accountType: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetAccountType">SetAccountType()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_account_type() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_account_type_sync ( + AccountsUser *proxy, + gint arg_accountType, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetAccountType", + g_variant_new ("(i)", + arg_accountType), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_password_mode: + * @proxy: A #AccountsUserProxy. + * @arg_mode: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetPasswordMode">SetPasswordMode()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_password_mode_finish() to get the result of the operation. + * + * See accounts_user_call_set_password_mode_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_password_mode ( + AccountsUser *proxy, + gint arg_mode, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetPasswordMode", + g_variant_new ("(i)", + arg_mode), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_password_mode_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_password_mode(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_password_mode(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_password_mode_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_password_mode_sync: + * @proxy: A #AccountsUserProxy. + * @arg_mode: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetPasswordMode">SetPasswordMode()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_password_mode() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_password_mode_sync ( + AccountsUser *proxy, + gint arg_mode, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetPasswordMode", + g_variant_new ("(i)", + arg_mode), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_password: + * @proxy: A #AccountsUserProxy. + * @arg_password: Argument to pass with the method invocation. + * @arg_hint: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetPassword">SetPassword()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_password_finish() to get the result of the operation. + * + * See accounts_user_call_set_password_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_password ( + AccountsUser *proxy, + const gchar *arg_password, + const gchar *arg_hint, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetPassword", + g_variant_new ("(ss)", + arg_password, + arg_hint), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_password_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_password(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_password(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_password_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_password_sync: + * @proxy: A #AccountsUserProxy. + * @arg_password: Argument to pass with the method invocation. + * @arg_hint: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetPassword">SetPassword()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_password() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_password_sync ( + AccountsUser *proxy, + const gchar *arg_password, + const gchar *arg_hint, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetPassword", + g_variant_new ("(ss)", + arg_password, + arg_hint), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_automatic_login: + * @proxy: A #AccountsUserProxy. + * @arg_enabled: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetAutomaticLogin">SetAutomaticLogin()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_call_set_automatic_login_finish() to get the result of the operation. + * + * See accounts_user_call_set_automatic_login_sync() for the synchronous, blocking version of this method. + */ +void +accounts_user_call_set_automatic_login ( + AccountsUser *proxy, + gboolean arg_enabled, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetAutomaticLogin", + g_variant_new ("(b)", + arg_enabled), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * accounts_user_call_set_automatic_login_finish: + * @proxy: A #AccountsUserProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_call_set_automatic_login(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with accounts_user_call_set_automatic_login(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_automatic_login_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_call_set_automatic_login_sync: + * @proxy: A #AccountsUserProxy. + * @arg_enabled: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetAutomaticLogin">SetAutomaticLogin()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See accounts_user_call_set_automatic_login() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +accounts_user_call_set_automatic_login_sync ( + AccountsUser *proxy, + gboolean arg_enabled, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetAutomaticLogin", + g_variant_new ("(b)", + arg_enabled), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * accounts_user_complete_set_user_name: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetUserName">SetUserName()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_user_name ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_real_name: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetRealName">SetRealName()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_real_name ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_email: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetEmail">SetEmail()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_email ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_language: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetLanguage">SetLanguage()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_language ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_xsession: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetXSession">SetXSession()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_xsession ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_location: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetLocation">SetLocation()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_location ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_home_directory: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetHomeDirectory">SetHomeDirectory()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_home_directory ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_shell: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetShell">SetShell()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_shell ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_icon_file: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetIconFile">SetIconFile()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_icon_file ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_locked: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetLocked">SetLocked()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_locked ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_account_type: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetAccountType">SetAccountType()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_account_type ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_password_mode: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetPasswordMode">SetPasswordMode()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_password_mode ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_password: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetPassword">SetPassword()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_password ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * accounts_user_complete_set_automatic_login: + * @object: A #AccountsUser. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Accounts-User.SetAutomaticLogin">SetAutomaticLogin()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +accounts_user_complete_set_automatic_login ( + AccountsUser *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * AccountsUserProxy: + * + * The #AccountsUserProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * AccountsUserProxyClass: + * @parent_class: The parent class. + * + * Class structure for #AccountsUserProxy. + */ + +struct _AccountsUserProxyPrivate +{ + GData *qdata; +}; + +static void accounts_user_proxy_iface_init (AccountsUserIface *iface); + +G_DEFINE_TYPE_WITH_CODE (AccountsUserProxy, accounts_user_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_ACCOUNTS_USER, accounts_user_proxy_iface_init)); + +static void +accounts_user_proxy_finalize (GObject *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (accounts_user_proxy_parent_class)->finalize (object); +} + +static void +accounts_user_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 17); + info = _accounts_user_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +accounts_user_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + error = NULL; + if (!g_dbus_proxy_call_finish (proxy, res, &error)) + { + g_warning ("Error setting property `%s' on interface org.freedesktop.Accounts.User: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } +} + +static void +accounts_user_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 17); + info = _accounts_user_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.freedesktop.Accounts.User", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) accounts_user_proxy_set_property_cb, (gpointer) info); + g_variant_unref (variant); +} + +static void +accounts_user_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_accounts_user_interface_info, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_ACCOUNTS_USER); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_ACCOUNTS_USER); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +accounts_user_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_accounts_user_interface_info, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_accounts_user_interface_info, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static guint64 +accounts_user_proxy_get_uid (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + guint64 value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Uid"); + if (variant != NULL) + { + value = g_variant_get_uint64 (variant); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +accounts_user_proxy_get_user_name (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "UserName"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +accounts_user_proxy_get_real_name (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "RealName"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static gint +accounts_user_proxy_get_account_type (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + gint value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "AccountType"); + if (variant != NULL) + { + value = g_variant_get_int32 (variant); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +accounts_user_proxy_get_home_directory (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "HomeDirectory"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +accounts_user_proxy_get_shell (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Shell"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +accounts_user_proxy_get_email (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Email"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +accounts_user_proxy_get_language (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Language"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +accounts_user_proxy_get_xsession (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "XSession"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +accounts_user_proxy_get_location (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Location"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static guint64 +accounts_user_proxy_get_login_frequency (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + guint64 value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "LoginFrequency"); + if (variant != NULL) + { + value = g_variant_get_uint64 (variant); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +accounts_user_proxy_get_icon_file (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "IconFile"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static gboolean +accounts_user_proxy_get_locked (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Locked"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gint +accounts_user_proxy_get_password_mode (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + gint value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "PasswordMode"); + if (variant != NULL) + { + value = g_variant_get_int32 (variant); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +accounts_user_proxy_get_password_hint (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "PasswordHint"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static gboolean +accounts_user_proxy_get_automatic_login (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "AutomaticLogin"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +accounts_user_proxy_get_system_account (AccountsUser *object) +{ + AccountsUserProxy *proxy = ACCOUNTS_USER_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "SystemAccount"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static void +accounts_user_proxy_init (AccountsUserProxy *proxy) +{ + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_ACCOUNTS_USER_PROXY, AccountsUserProxyPrivate); + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), accounts_user_interface_info ()); +} + +static void +accounts_user_proxy_class_init (AccountsUserProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + g_type_class_add_private (klass, sizeof (AccountsUserProxyPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = accounts_user_proxy_finalize; + gobject_class->get_property = accounts_user_proxy_get_property; + gobject_class->set_property = accounts_user_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = accounts_user_proxy_g_signal; + proxy_class->g_properties_changed = accounts_user_proxy_g_properties_changed; + + + accounts_user_override_properties (gobject_class, 1); +} + +static void +accounts_user_proxy_iface_init (AccountsUserIface *iface) +{ + iface->get_uid = accounts_user_proxy_get_uid; + iface->get_user_name = accounts_user_proxy_get_user_name; + iface->get_real_name = accounts_user_proxy_get_real_name; + iface->get_account_type = accounts_user_proxy_get_account_type; + iface->get_home_directory = accounts_user_proxy_get_home_directory; + iface->get_shell = accounts_user_proxy_get_shell; + iface->get_email = accounts_user_proxy_get_email; + iface->get_language = accounts_user_proxy_get_language; + iface->get_xsession = accounts_user_proxy_get_xsession; + iface->get_location = accounts_user_proxy_get_location; + iface->get_login_frequency = accounts_user_proxy_get_login_frequency; + iface->get_icon_file = accounts_user_proxy_get_icon_file; + iface->get_locked = accounts_user_proxy_get_locked; + iface->get_password_mode = accounts_user_proxy_get_password_mode; + iface->get_password_hint = accounts_user_proxy_get_password_hint; + iface->get_automatic_login = accounts_user_proxy_get_automatic_login; + iface->get_system_account = accounts_user_proxy_get_system_account; +} + +/** + * accounts_user_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Accounts-User.top_of_page">org.freedesktop.Accounts.User</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_proxy_new_finish() to get the result of the operation. + * + * See accounts_user_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +accounts_user_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_ACCOUNTS_USER_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.User", NULL); +} + +/** + * accounts_user_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with accounts_user_proxy_new(). + * + * Returns: (transfer full) (type AccountsUserProxy): The constructed proxy object or %NULL if @error is set. + */ +AccountsUser * +accounts_user_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return ACCOUNTS_USER (ret); + else + return NULL; +} + +/** + * accounts_user_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Accounts-User.top_of_page">org.freedesktop.Accounts.User</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See accounts_user_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type AccountsUserProxy): The constructed proxy object or %NULL if @error is set. + */ +AccountsUser * +accounts_user_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_ACCOUNTS_USER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.Accounts.User", NULL); + if (ret != NULL) + return ACCOUNTS_USER (ret); + else + return NULL; +} + + +/** + * accounts_user_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like accounts_user_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call accounts_user_proxy_new_for_bus_finish() to get the result of the operation. + * + * See accounts_user_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +accounts_user_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_ACCOUNTS_USER_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.User", NULL); +} + +/** + * accounts_user_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to accounts_user_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with accounts_user_proxy_new_for_bus(). + * + * Returns: (transfer full) (type AccountsUserProxy): The constructed proxy object or %NULL if @error is set. + */ +AccountsUser * +accounts_user_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return ACCOUNTS_USER (ret); + else + return NULL; +} + +/** + * accounts_user_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like accounts_user_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See accounts_user_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type AccountsUserProxy): The constructed proxy object or %NULL if @error is set. + */ +AccountsUser * +accounts_user_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_ACCOUNTS_USER_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.User", NULL); + if (ret != NULL) + return ACCOUNTS_USER (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * AccountsUserSkeleton: + * + * The #AccountsUserSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * AccountsUserSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #AccountsUserSkeleton. + */ + +struct _AccountsUserSkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_accounts_user_skeleton_handle_method_call ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_ACCOUNTS_USER); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_ACCOUNTS_USER); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + 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); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_accounts_user_skeleton_handle_get_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_accounts_user_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_accounts_user_skeleton_handle_set_property ( + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_accounts_user_interface_info, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _accounts_user_skeleton_vtable = +{ + _accounts_user_skeleton_handle_method_call, + _accounts_user_skeleton_handle_get_property, + _accounts_user_skeleton_handle_set_property +}; + +static GDBusInterfaceInfo * +accounts_user_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton) +{ + return accounts_user_interface_info (); +} + +static GDBusInterfaceVTable * +accounts_user_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton) +{ + return (GDBusInterfaceVTable *) &_accounts_user_skeleton_vtable; +} + +static GVariant * +accounts_user_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_accounts_user_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _accounts_user_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _accounts_user_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _accounts_user_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.User", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean _accounts_user_emit_changed (gpointer user_data); + +static void +accounts_user_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (&skeleton->priv->lock); + + if (emit_changed) + _accounts_user_emit_changed (skeleton); +} + +static void +_accounts_user_on_signal_changed ( + AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("()")); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Accounts.User", "Changed", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void accounts_user_skeleton_iface_init (AccountsUserIface *iface); +G_DEFINE_TYPE_WITH_CODE (AccountsUserSkeleton, accounts_user_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_ACCOUNTS_USER, accounts_user_skeleton_iface_init)); + +static void +accounts_user_skeleton_finalize (GObject *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + guint n; + for (n = 0; n < 17; n++) + g_value_unset (&skeleton->priv->properties[n]); + g_free (skeleton->priv->properties); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (accounts_user_skeleton_parent_class)->finalize (object); +} + +static void +accounts_user_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 17); + g_mutex_lock (&skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock (&skeleton->priv->lock); +} + +static gboolean +_accounts_user_emit_changed (gpointer user_data) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (&skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *l; + GVariant *signal_variant; + signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.Accounts.User", + &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + signal_variant, + NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (&skeleton->priv->lock); + return FALSE; +} + +static void +_accounts_user_schedule_emit_changed (AccountsUserSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +accounts_user_skeleton_notify (GObject *object, + GParamSpec *pspec) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, _accounts_user_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (&skeleton->priv->lock); +} + +static void +accounts_user_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 17); + g_mutex_lock (&skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + _accounts_user_schedule_emit_changed (skeleton, _accounts_user_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (&skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +accounts_user_skeleton_init (AccountsUserSkeleton *skeleton) +{ + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_ACCOUNTS_USER_SKELETON, AccountsUserSkeletonPrivate); + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); + skeleton->priv->properties = g_new0 (GValue, 17); + g_value_init (&skeleton->priv->properties[0], G_TYPE_UINT64); + g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[3], G_TYPE_INT); + g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[5], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[6], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[7], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[8], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[9], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[10], G_TYPE_UINT64); + g_value_init (&skeleton->priv->properties[11], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[12], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[13], G_TYPE_INT); + g_value_init (&skeleton->priv->properties[14], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[15], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[16], G_TYPE_BOOLEAN); +} + +static guint64 +accounts_user_skeleton_get_uid (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + guint64 value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_uint64 (&(skeleton->priv->properties[0])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +accounts_user_skeleton_get_user_name (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[1])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +accounts_user_skeleton_get_real_name (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[2])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gint +accounts_user_skeleton_get_account_type (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + gint value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_int (&(skeleton->priv->properties[3])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +accounts_user_skeleton_get_home_directory (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[4])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +accounts_user_skeleton_get_shell (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[5])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +accounts_user_skeleton_get_email (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[6])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +accounts_user_skeleton_get_language (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[7])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +accounts_user_skeleton_get_xsession (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[8])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +accounts_user_skeleton_get_location (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[9])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static guint64 +accounts_user_skeleton_get_login_frequency (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + guint64 value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_uint64 (&(skeleton->priv->properties[10])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +accounts_user_skeleton_get_icon_file (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[11])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +accounts_user_skeleton_get_locked (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[12])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gint +accounts_user_skeleton_get_password_mode (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + gint value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_int (&(skeleton->priv->properties[13])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +accounts_user_skeleton_get_password_hint (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[14])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +accounts_user_skeleton_get_automatic_login (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[15])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +accounts_user_skeleton_get_system_account (AccountsUser *object) +{ + AccountsUserSkeleton *skeleton = ACCOUNTS_USER_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[16])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static void +accounts_user_skeleton_class_init (AccountsUserSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + g_type_class_add_private (klass, sizeof (AccountsUserSkeletonPrivate)); + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = accounts_user_skeleton_finalize; + gobject_class->get_property = accounts_user_skeleton_get_property; + gobject_class->set_property = accounts_user_skeleton_set_property; + gobject_class->notify = accounts_user_skeleton_notify; + + + accounts_user_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = accounts_user_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = accounts_user_skeleton_dbus_interface_get_properties; + skeleton_class->flush = accounts_user_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = accounts_user_skeleton_dbus_interface_get_vtable; +} + +static void +accounts_user_skeleton_iface_init (AccountsUserIface *iface) +{ + iface->changed = _accounts_user_on_signal_changed; + iface->get_uid = accounts_user_skeleton_get_uid; + iface->get_user_name = accounts_user_skeleton_get_user_name; + iface->get_real_name = accounts_user_skeleton_get_real_name; + iface->get_account_type = accounts_user_skeleton_get_account_type; + iface->get_home_directory = accounts_user_skeleton_get_home_directory; + iface->get_shell = accounts_user_skeleton_get_shell; + iface->get_email = accounts_user_skeleton_get_email; + iface->get_language = accounts_user_skeleton_get_language; + iface->get_xsession = accounts_user_skeleton_get_xsession; + iface->get_location = accounts_user_skeleton_get_location; + iface->get_login_frequency = accounts_user_skeleton_get_login_frequency; + iface->get_icon_file = accounts_user_skeleton_get_icon_file; + iface->get_locked = accounts_user_skeleton_get_locked; + iface->get_password_mode = accounts_user_skeleton_get_password_mode; + iface->get_password_hint = accounts_user_skeleton_get_password_hint; + iface->get_automatic_login = accounts_user_skeleton_get_automatic_login; + iface->get_system_account = accounts_user_skeleton_get_system_account; +} + +/** + * accounts_user_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Accounts-User.top_of_page">org.freedesktop.Accounts.User</link>. + * + * Returns: (transfer full) (type AccountsUserSkeleton): The skeleton object. + */ +AccountsUser * +accounts_user_skeleton_new (void) +{ + return ACCOUNTS_USER (g_object_new (TYPE_ACCOUNTS_USER_SKELETON, NULL)); +} + diff --git a/src/dbus-user.h b/src/dbus-user.h new file mode 100644 index 0000000..b331459 --- /dev/null +++ b/src/dbus-user.h @@ -0,0 +1,632 @@ +/* + * Generated by gdbus-codegen 2.33.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __DBUS_USER_H__ +#define __DBUS_USER_H__ + +#include <gio/gio.h> + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.freedesktop.Accounts.User */ + +#define TYPE_ACCOUNTS_USER (accounts_user_get_type ()) +#define ACCOUNTS_USER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ACCOUNTS_USER, AccountsUser)) +#define IS_ACCOUNTS_USER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ACCOUNTS_USER)) +#define ACCOUNTS_USER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_ACCOUNTS_USER, AccountsUserIface)) + +struct _AccountsUser; +typedef struct _AccountsUser AccountsUser; +typedef struct _AccountsUserIface AccountsUserIface; + +struct _AccountsUserIface +{ + GTypeInterface parent_iface; + + + + gboolean (*handle_set_account_type) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + gint arg_accountType); + + gboolean (*handle_set_automatic_login) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + gboolean arg_enabled); + + gboolean (*handle_set_email) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + const gchar *arg_email); + + gboolean (*handle_set_home_directory) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + const gchar *arg_homedir); + + gboolean (*handle_set_icon_file) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + const gchar *arg_filename); + + gboolean (*handle_set_language) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + const gchar *arg_language); + + gboolean (*handle_set_location) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + const gchar *arg_location); + + gboolean (*handle_set_locked) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + gboolean arg_locked); + + gboolean (*handle_set_password) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + const gchar *arg_password, + const gchar *arg_hint); + + gboolean (*handle_set_password_mode) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + gint arg_mode); + + gboolean (*handle_set_real_name) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + const gchar *arg_name); + + gboolean (*handle_set_shell) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + const gchar *arg_shell); + + gboolean (*handle_set_user_name) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + const gchar *arg_name); + + gboolean (*handle_set_xsession) ( + AccountsUser *object, + GDBusMethodInvocation *invocation, + const gchar *arg_x_session); + + gint (*get_account_type) (AccountsUser *object); + + gboolean (*get_automatic_login) (AccountsUser *object); + + const gchar * (*get_email) (AccountsUser *object); + + const gchar * (*get_home_directory) (AccountsUser *object); + + const gchar * (*get_icon_file) (AccountsUser *object); + + const gchar * (*get_language) (AccountsUser *object); + + const gchar * (*get_location) (AccountsUser *object); + + gboolean (*get_locked) (AccountsUser *object); + + guint64 (*get_login_frequency) (AccountsUser *object); + + const gchar * (*get_password_hint) (AccountsUser *object); + + gint (*get_password_mode) (AccountsUser *object); + + const gchar * (*get_real_name) (AccountsUser *object); + + const gchar * (*get_shell) (AccountsUser *object); + + gboolean (*get_system_account) (AccountsUser *object); + + guint64 (*get_uid) (AccountsUser *object); + + const gchar * (*get_user_name) (AccountsUser *object); + + const gchar * (*get_xsession) (AccountsUser *object); + + void (*changed) ( + AccountsUser *object); + +}; + +GType accounts_user_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *accounts_user_interface_info (void); +guint accounts_user_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void accounts_user_complete_set_user_name ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_real_name ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_email ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_language ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_xsession ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_location ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_home_directory ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_shell ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_icon_file ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_locked ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_account_type ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_password_mode ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_password ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + +void accounts_user_complete_set_automatic_login ( + AccountsUser *object, + GDBusMethodInvocation *invocation); + + + +/* D-Bus signal emissions functions: */ +void accounts_user_emit_changed ( + AccountsUser *object); + + + +/* D-Bus method calls: */ +void accounts_user_call_set_user_name ( + AccountsUser *proxy, + const gchar *arg_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_user_name_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_user_name_sync ( + AccountsUser *proxy, + const gchar *arg_name, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_real_name ( + AccountsUser *proxy, + const gchar *arg_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_real_name_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_real_name_sync ( + AccountsUser *proxy, + const gchar *arg_name, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_email ( + AccountsUser *proxy, + const gchar *arg_email, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_email_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_email_sync ( + AccountsUser *proxy, + const gchar *arg_email, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_language ( + AccountsUser *proxy, + const gchar *arg_language, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_language_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_language_sync ( + AccountsUser *proxy, + const gchar *arg_language, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_xsession ( + AccountsUser *proxy, + const gchar *arg_x_session, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_xsession_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_xsession_sync ( + AccountsUser *proxy, + const gchar *arg_x_session, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_location ( + AccountsUser *proxy, + const gchar *arg_location, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_location_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_location_sync ( + AccountsUser *proxy, + const gchar *arg_location, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_home_directory ( + AccountsUser *proxy, + const gchar *arg_homedir, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_home_directory_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_home_directory_sync ( + AccountsUser *proxy, + const gchar *arg_homedir, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_shell ( + AccountsUser *proxy, + const gchar *arg_shell, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_shell_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_shell_sync ( + AccountsUser *proxy, + const gchar *arg_shell, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_icon_file ( + AccountsUser *proxy, + const gchar *arg_filename, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_icon_file_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_icon_file_sync ( + AccountsUser *proxy, + const gchar *arg_filename, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_locked ( + AccountsUser *proxy, + gboolean arg_locked, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_locked_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_locked_sync ( + AccountsUser *proxy, + gboolean arg_locked, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_account_type ( + AccountsUser *proxy, + gint arg_accountType, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_account_type_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_account_type_sync ( + AccountsUser *proxy, + gint arg_accountType, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_password_mode ( + AccountsUser *proxy, + gint arg_mode, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_password_mode_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_password_mode_sync ( + AccountsUser *proxy, + gint arg_mode, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_password ( + AccountsUser *proxy, + const gchar *arg_password, + const gchar *arg_hint, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_password_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_password_sync ( + AccountsUser *proxy, + const gchar *arg_password, + const gchar *arg_hint, + GCancellable *cancellable, + GError **error); + +void accounts_user_call_set_automatic_login ( + AccountsUser *proxy, + gboolean arg_enabled, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean accounts_user_call_set_automatic_login_finish ( + AccountsUser *proxy, + GAsyncResult *res, + GError **error); + +gboolean accounts_user_call_set_automatic_login_sync ( + AccountsUser *proxy, + gboolean arg_enabled, + GCancellable *cancellable, + GError **error); + + + +/* D-Bus property accessors: */ +guint64 accounts_user_get_uid (AccountsUser *object); +void accounts_user_set_uid (AccountsUser *object, guint64 value); + +const gchar *accounts_user_get_user_name (AccountsUser *object); +gchar *accounts_user_dup_user_name (AccountsUser *object); +void accounts_user_set_user_name (AccountsUser *object, const gchar *value); + +const gchar *accounts_user_get_real_name (AccountsUser *object); +gchar *accounts_user_dup_real_name (AccountsUser *object); +void accounts_user_set_real_name (AccountsUser *object, const gchar *value); + +gint accounts_user_get_account_type (AccountsUser *object); +void accounts_user_set_account_type (AccountsUser *object, gint value); + +const gchar *accounts_user_get_home_directory (AccountsUser *object); +gchar *accounts_user_dup_home_directory (AccountsUser *object); +void accounts_user_set_home_directory (AccountsUser *object, const gchar *value); + +const gchar *accounts_user_get_shell (AccountsUser *object); +gchar *accounts_user_dup_shell (AccountsUser *object); +void accounts_user_set_shell (AccountsUser *object, const gchar *value); + +const gchar *accounts_user_get_email (AccountsUser *object); +gchar *accounts_user_dup_email (AccountsUser *object); +void accounts_user_set_email (AccountsUser *object, const gchar *value); + +const gchar *accounts_user_get_language (AccountsUser *object); +gchar *accounts_user_dup_language (AccountsUser *object); +void accounts_user_set_language (AccountsUser *object, const gchar *value); + +const gchar *accounts_user_get_xsession (AccountsUser *object); +gchar *accounts_user_dup_xsession (AccountsUser *object); +void accounts_user_set_xsession (AccountsUser *object, const gchar *value); + +const gchar *accounts_user_get_location (AccountsUser *object); +gchar *accounts_user_dup_location (AccountsUser *object); +void accounts_user_set_location (AccountsUser *object, const gchar *value); + +guint64 accounts_user_get_login_frequency (AccountsUser *object); +void accounts_user_set_login_frequency (AccountsUser *object, guint64 value); + +const gchar *accounts_user_get_icon_file (AccountsUser *object); +gchar *accounts_user_dup_icon_file (AccountsUser *object); +void accounts_user_set_icon_file (AccountsUser *object, const gchar *value); + +gboolean accounts_user_get_locked (AccountsUser *object); +void accounts_user_set_locked (AccountsUser *object, gboolean value); + +gint accounts_user_get_password_mode (AccountsUser *object); +void accounts_user_set_password_mode (AccountsUser *object, gint value); + +const gchar *accounts_user_get_password_hint (AccountsUser *object); +gchar *accounts_user_dup_password_hint (AccountsUser *object); +void accounts_user_set_password_hint (AccountsUser *object, const gchar *value); + +gboolean accounts_user_get_automatic_login (AccountsUser *object); +void accounts_user_set_automatic_login (AccountsUser *object, gboolean value); + +gboolean accounts_user_get_system_account (AccountsUser *object); +void accounts_user_set_system_account (AccountsUser *object, gboolean value); + + +/* ---- */ + +#define TYPE_ACCOUNTS_USER_PROXY (accounts_user_proxy_get_type ()) +#define ACCOUNTS_USER_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ACCOUNTS_USER_PROXY, AccountsUserProxy)) +#define ACCOUNTS_USER_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_ACCOUNTS_USER_PROXY, AccountsUserProxyClass)) +#define ACCOUNTS_USER_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ACCOUNTS_USER_PROXY, AccountsUserProxyClass)) +#define IS_ACCOUNTS_USER_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ACCOUNTS_USER_PROXY)) +#define IS_ACCOUNTS_USER_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ACCOUNTS_USER_PROXY)) + +typedef struct _AccountsUserProxy AccountsUserProxy; +typedef struct _AccountsUserProxyClass AccountsUserProxyClass; +typedef struct _AccountsUserProxyPrivate AccountsUserProxyPrivate; + +struct _AccountsUserProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + AccountsUserProxyPrivate *priv; +}; + +struct _AccountsUserProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType accounts_user_proxy_get_type (void) G_GNUC_CONST; + +void accounts_user_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +AccountsUser *accounts_user_proxy_new_finish ( + GAsyncResult *res, + GError **error); +AccountsUser *accounts_user_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void accounts_user_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +AccountsUser *accounts_user_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +AccountsUser *accounts_user_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_ACCOUNTS_USER_SKELETON (accounts_user_skeleton_get_type ()) +#define ACCOUNTS_USER_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ACCOUNTS_USER_SKELETON, AccountsUserSkeleton)) +#define ACCOUNTS_USER_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_ACCOUNTS_USER_SKELETON, AccountsUserSkeletonClass)) +#define ACCOUNTS_USER_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ACCOUNTS_USER_SKELETON, AccountsUserSkeletonClass)) +#define IS_ACCOUNTS_USER_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ACCOUNTS_USER_SKELETON)) +#define IS_ACCOUNTS_USER_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ACCOUNTS_USER_SKELETON)) + +typedef struct _AccountsUserSkeleton AccountsUserSkeleton; +typedef struct _AccountsUserSkeletonClass AccountsUserSkeletonClass; +typedef struct _AccountsUserSkeletonPrivate AccountsUserSkeletonPrivate; + +struct _AccountsUserSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + AccountsUserSkeletonPrivate *priv; +}; + +struct _AccountsUserSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType accounts_user_skeleton_get_type (void) G_GNUC_CONST; + +AccountsUser *accounts_user_skeleton_new (void); + + +G_END_DECLS + +#endif /* __DBUS_USER_H__ */ diff --git a/src/dbusmenu-shared.h b/src/dbusmenu-shared.h deleted file mode 100644 index 1ef179b..0000000 --- a/src/dbusmenu-shared.h +++ /dev/null @@ -1,4 +0,0 @@ - -#define MENU_SWITCH_TYPE "x-canonical-switch-from" -#define MENU_SWITCH_USER "x-canonical-switch-username" - diff --git a/src/device-menu-mgr.c b/src/device-menu-mgr.c deleted file mode 100644 index d081937..0000000 --- a/src/device-menu-mgr.c +++ /dev/null @@ -1,795 +0,0 @@ -/* -Copyright 2011 Canonical Ltd. - -Authors: - Conor Curran <conor.curran@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <config.h> -#include <libdbusmenu-glib/client.h> - -#include "device-menu-mgr.h" -#include "settings-helper.h" -#include "dbus-shared-names.h" -#include "dbusmenu-shared.h" -#include "lock-helper.h" -#include "upower-client.h" - -#ifdef HAVE_APT -#include "apt-watcher.h" -#endif /* HAVE_APT */ - -#ifdef HAS_GUDEV -#include "udev-mgr.h" -#endif /* HAS_GUDEV */ - -#define UP_ADDRESS "org.freedesktop.UPower" -#define UP_OBJECT "/org/freedesktop/UPower" -#define UP_INTERFACE "org.freedesktop.UPower" - -#define EXTRA_LAUNCHER_DIR "/usr/share/indicators/session/applications" - -struct _DeviceMenuMgr -{ - GObject parent_instance; - DbusmenuMenuitem* root_item; - SessionDbus* session_dbus_interface; -#ifdef HAVE_APT - AptWatcher* apt_watcher; -#endif /* HAVE_APT */ -#ifdef HAS_GUDEV - UdevMgr* udev_mgr; -#endif /* HAS_GUDEV */ -}; - -static GSettings *lockdown_settings = NULL; -static GSettings *keybinding_settings = NULL; -static DbusmenuMenuitem *lock_menuitem = NULL; -static DbusmenuMenuitem *system_settings_menuitem = NULL; -static DbusmenuMenuitem *display_settings_menuitem = NULL; -static DbusmenuMenuitem *login_settings_menuitem = NULL; -#ifdef HAVE_APT -static DbusmenuMenuitem *software_updates_menuitem = NULL; -#endif /* HAVE_APT */ -static DbusmenuMenuitem *printers_menuitem = NULL; -static DbusmenuMenuitem *scanners_menuitem = NULL; -static DbusmenuMenuitem *webcam_menuitem = NULL; - -static DBusGProxyCall * suspend_call = NULL; -static DBusGProxyCall * hibernate_call = NULL; - -static DbusmenuMenuitem * hibernate_mi = NULL; -static DbusmenuMenuitem * suspend_mi = NULL; -static DbusmenuMenuitem * logout_mi = NULL; -static DbusmenuMenuitem * shutdown_mi = NULL; - -static gboolean can_hibernate = TRUE; -static gboolean can_suspend = TRUE; -static gboolean allow_hibernate = TRUE; -static gboolean allow_suspend = TRUE; - -static DBusGProxy * up_main_proxy = NULL; -static DBusGProxy * up_prop_proxy = NULL; - -static void device_menu_mgr_ensure_settings_client (DeviceMenuMgr* self); -static void setup_up (DeviceMenuMgr* self); -static void device_menu_mgr_rebuild_items (DeviceMenuMgr *self); -static void machine_sleep_with_context (DeviceMenuMgr* self, - gchar* type); -static void show_system_settings_with_context (DbusmenuMenuitem * mi, - guint timestamp, - gchar * type); - -static void device_menu_mgr_show_simple_scan (DbusmenuMenuitem * mi, - guint timestamp, - gchar * type); -static void device_menu_mgr_show_cheese (DbusmenuMenuitem * mi, - guint timestamp, - gchar * type); - -static void -machine_sleep_from_hibernate (DbusmenuMenuitem * mi, - guint timestamp, - gpointer userdata); -static void -machine_sleep_from_suspend (DbusmenuMenuitem * mi, - guint timestamp, - gpointer userdata); - -G_DEFINE_TYPE (DeviceMenuMgr, device_menu_mgr, G_TYPE_OBJECT); - -static void -device_menu_mgr_init (DeviceMenuMgr *self) -{ -#ifdef HAVE_APT - self->apt_watcher = NULL; -#endif /* HAVE_APT */ - self->root_item = dbusmenu_menuitem_new (); - setup_up(self); - g_idle_add(lock_screen_setup, NULL); -} - -static void -device_menu_mgr_finalize (GObject *object) -{ - G_OBJECT_CLASS (device_menu_mgr_parent_class)->finalize (object); -} - -// TODO refactor into one helper method for both menu mgrs. -static void -device_menu_mgr_class_init (DeviceMenuMgrClass *klass) -{ - GObjectClass* object_class = G_OBJECT_CLASS (klass); - object_class->finalize = device_menu_mgr_finalize; -} - -// TODO -// Is this needed anymore -static void -lockdown_changed (GSettings * settings, - const gchar * key, - gpointer user_data) -{ - DeviceMenuMgr* self = DEVICE_MENU_MGR (user_data); - - if (key == NULL) { - return; - } - - if (g_strcmp0 (key, LOCKDOWN_KEY_USER) == 0 || - g_strcmp0 (key, LOCKDOWN_KEY_SCREENSAVER) == 0) { - device_menu_mgr_rebuild_items(self); - } - - return; -} - -static void -keybinding_changed (GSettings *settings, - const gchar *key, - gpointer user_data) -{ - if (key == NULL) { - return; - } - - if (g_strcmp0 (key, KEY_LOCK_SCREEN) == 0) { - gchar * val = g_settings_get_string(settings, key); - g_debug("Keybinding changed to: %s", val); - if (lock_menuitem != NULL) { - dbusmenu_menuitem_property_set_shortcut_string (lock_menuitem, val); - } - g_free (val); - } - return; -} - -static void -machine_sleep_from_suspend (DbusmenuMenuitem * mi, - guint timestamp, - gpointer userdata) -{ - DeviceMenuMgr* self = DEVICE_MENU_MGR (userdata); - machine_sleep_with_context (self, "Suspend"); -} - -static void -machine_sleep_from_hibernate (DbusmenuMenuitem * mi, - guint timestamp, - gpointer userdata) -{ - DeviceMenuMgr* self = DEVICE_MENU_MGR (userdata); - machine_sleep_with_context (self, "Hibernate"); -} - -/* Let's put this machine to sleep, with some info on how - it should sleep. */ -static void -machine_sleep_with_context (DeviceMenuMgr* self, gchar* type) -{ - if (up_main_proxy == NULL) { - g_warning("Can not %s as no upower proxy", type); - } - - dbus_g_proxy_begin_call(up_main_proxy, - type, - NULL, - NULL, - NULL, - G_TYPE_INVALID); - - return; -} - -/* A response to getting the suspend property */ -static void -suspend_prop_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer userdata) -{ - suspend_call = NULL; - DeviceMenuMgr* self = DEVICE_MENU_MGR (userdata); - - GValue candoit = {0}; - GError * error = NULL; - dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &candoit, G_TYPE_INVALID); - if (error != NULL) { - g_warning("Unable to check suspend: %s", error->message); - g_error_free(error); - return; - } - g_debug("Got Suspend: %s", g_value_get_boolean(&candoit) ? "true" : "false"); - - gboolean local_can_suspend = g_value_get_boolean(&candoit); - if (local_can_suspend != can_suspend) { - can_suspend = local_can_suspend; - // TODO figure out what needs updating on the menu - // And add or remove it but just don't rebuild the whole menu - // a waste - device_menu_mgr_rebuild_items(self); - } - return; -} - -/* Response to getting the hibernate property */ -static void -hibernate_prop_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer userdata) -{ - hibernate_call = NULL; - DeviceMenuMgr* self = DEVICE_MENU_MGR (userdata); - - GValue candoit = {0}; - GError * error = NULL; - dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &candoit, G_TYPE_INVALID); - if (error != NULL) { - g_warning("Unable to check hibernate: %s", error->message); - g_error_free(error); - return; - } - g_debug("Got Hibernate: %s", g_value_get_boolean(&candoit) ? "true" : "false"); - - gboolean local_can_hibernate = g_value_get_boolean(&candoit); - if (local_can_hibernate != can_hibernate) { - can_hibernate = local_can_hibernate; - device_menu_mgr_rebuild_items(self); - } -} - -/* A signal that we need to recheck to ensure we can still - hibernate and/or suspend */ -static void -up_changed_cb (DBusGProxy * proxy, gpointer user_data) -{ - /* Start Async call to see if we can hibernate */ - if (suspend_call == NULL) { - suspend_call = dbus_g_proxy_begin_call(up_prop_proxy, - "Get", - suspend_prop_cb, - user_data, - NULL, - G_TYPE_STRING, - UP_INTERFACE, - G_TYPE_STRING, - "CanSuspend", - G_TYPE_INVALID, - G_TYPE_VALUE, - G_TYPE_INVALID); - } - - /* Start Async call to see if we can suspend */ - if (hibernate_call == NULL) { - hibernate_call = dbus_g_proxy_begin_call(up_prop_proxy, - "Get", - hibernate_prop_cb, - user_data, - NULL, - G_TYPE_STRING, - UP_INTERFACE, - G_TYPE_STRING, - "CanHibernate", - G_TYPE_INVALID, - G_TYPE_VALUE, - G_TYPE_INVALID); - } -} -/* Handle the callback from the allow functions to check and - see if we're changing the value, and if so, rebuilding the - menus based on that info. */ -static void -allowed_suspend_cb (DBusGProxy *proxy, - gboolean OUT_allowed, - GError *error, - gpointer userdata) -{ - if (error != NULL) { - g_warning("Unable to get information on what is allowed from UPower: %s", - error->message); - return; - } - - if (OUT_allowed != allow_suspend) { - allow_suspend = OUT_allowed; - device_menu_mgr_rebuild_items(DEVICE_MENU_MGR (userdata)); - } -} - -/* Handle the callback from the allow functions to check and - see if we're changing the value, and if so, rebuilding the - menus based on that info. */ -static void -allowed_hibernate_cb (DBusGProxy *proxy, - gboolean OUT_allowed, - GError *error, - gpointer userdata) -{ - if (error != NULL) { - g_warning("Unable to get information on what is allowed from UPower: %s", - error->message); - return; - } - - if (OUT_allowed != allow_hibernate) { - allow_hibernate = OUT_allowed; - device_menu_mgr_rebuild_items(DEVICE_MENU_MGR (userdata)); - } -} - -/* This function goes through and sets up what we need for - DKp checking. We're even setting up the calls for the props - we need */ -static void -setup_up (DeviceMenuMgr* self) { - DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); - g_return_if_fail(bus != NULL); - - if (up_main_proxy == NULL) { - up_main_proxy = dbus_g_proxy_new_for_name(bus, - UP_ADDRESS, - UP_OBJECT, - UP_INTERFACE); - } - g_return_if_fail(up_main_proxy != NULL); - - if (up_prop_proxy == NULL) { - up_prop_proxy = dbus_g_proxy_new_for_name(bus, - UP_ADDRESS, - UP_OBJECT, - DBUS_INTERFACE_PROPERTIES); - /* Connect to changed signal */ - dbus_g_proxy_add_signal(up_main_proxy, - "Changed", - G_TYPE_INVALID); - - dbus_g_proxy_connect_signal(up_main_proxy, - "Changed", - G_CALLBACK(up_changed_cb), - self, - NULL); - } - g_return_if_fail(up_prop_proxy != NULL); - - - /* Force an original "changed" event */ - up_changed_cb(up_main_proxy, self); - - /* Check to see if these are getting blocked by PolicyKit */ - org_freedesktop_UPower_suspend_allowed_async(up_main_proxy, - allowed_suspend_cb, - self); - org_freedesktop_UPower_hibernate_allowed_async(up_main_proxy, - allowed_hibernate_cb, - self); - - return; -} - -/* This is the function to show a dialog on actions that - can destroy data. Currently it just calls the GTK version - but it seems that in the future it should figure out - what's going on and something better. */ -static void -show_dialog (DbusmenuMenuitem * mi, guint timestamp, gchar * type) -{ - -#ifdef HAVE_GTKLOGOUTHELPER - gchar * helper = g_build_filename(LIBEXECDIR, "gtk-logout-helper", NULL); -#else - gchar * helper = g_build_filename("gnome-session-quit", NULL); -#endif /* HAVE_GTKLOGOUTHELPER */ - gchar * dialog_line = g_strdup_printf("%s --%s", helper, type); - g_free(helper); - - g_debug("Showing dialog '%s'", dialog_line); - - GError * error = NULL; - if (!g_spawn_command_line_async(dialog_line, &error)) { - g_warning("Unable to show dialog: %s", error->message); - g_error_free(error); - } - g_free(dialog_line); -} - -static void -show_session_properties (DbusmenuMenuitem * mi, - guint timestamp, - gchar * type) -{ - GError * error = NULL; - if (!g_spawn_command_line_async("gnome-session-properties", &error)) - { - g_warning("Unable to show dialog: %s", error->message); - g_error_free(error); - } -} - -static void -show_printer_properties (DbusmenuMenuitem * mi, - guint timestamp, - gchar * type) -{ - GError * error = NULL; - if (!g_spawn_command_line_async("system-config-printer", &error)) - { - g_warning("Unable to show dialog: %s", error->message); - g_error_free(error); - } -} - -static void -show_system_settings_with_context (DbusmenuMenuitem * mi, - guint timestamp, - gchar * type) -{ - gchar * control_centre_command = g_strdup_printf("%s %s", - "gnome-control-center", - type); - - g_debug("Command centre exec call '%s'", control_centre_command); - - GError * error = NULL; - if (!g_spawn_command_line_async(control_centre_command, &error)) - { - g_warning("Unable to show dialog: %s", error->message); - g_error_free(error); - } - g_free(control_centre_command); -} - -// TODO: refactor both of these down to the one method. -static void device_menu_mgr_show_simple_scan (DbusmenuMenuitem * mi, - guint timestamp, - gchar * type) -{ - GError * error = NULL; - if (!g_spawn_command_line_async("simple-scan", &error)) - { - g_warning("Unable to launch simple-scan: %s", error->message); - g_error_free(error); -#ifdef HAVE_APT - if (!g_spawn_command_line_async("software-center simple-scan", &error)) - { - g_warning ("Unable to launch software-centre simple-scan: %s", - error->message); - g_error_free(error); - } -#endif /* HAVE_APT */ - } -} - -static void device_menu_mgr_show_cheese (DbusmenuMenuitem * mi, - guint timestamp, - gchar * type) -{ - GError * error = NULL; - if (!g_spawn_command_line_async("cheese", &error)) - { - g_warning("Unable to launch cheese: %s", error->message); - g_error_free(error); -#ifdef HAVE_APT - if (!g_spawn_command_line_async("software-center cheese", &error)) - { - g_warning ("Unable to launch software-centre cheese: %s", - error->message); - g_error_free(error); - } -#endif /* HAVE_APT */ - } -} - -static void -device_menu_mgr_build_settings_items (DeviceMenuMgr* self) -{ - system_settings_menuitem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (system_settings_menuitem, - DBUSMENU_MENUITEM_PROP_LABEL, - _("System Settings…")); - g_signal_connect (G_OBJECT(system_settings_menuitem), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(show_system_settings_with_context), ""); - dbusmenu_menuitem_child_add_position(self->root_item, - system_settings_menuitem, - 0); - - display_settings_menuitem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (display_settings_menuitem, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Displays…")); - g_signal_connect (G_OBJECT(display_settings_menuitem), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(show_system_settings_with_context), "display"); - dbusmenu_menuitem_child_add_position(self->root_item, - display_settings_menuitem, - 1); - login_settings_menuitem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (login_settings_menuitem, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Startup Applications…")); - g_signal_connect (G_OBJECT(login_settings_menuitem), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(show_session_properties), - "login"); - dbusmenu_menuitem_child_add_position(self->root_item, - login_settings_menuitem, - 2); -#ifdef HAVE_APT - software_updates_menuitem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (software_updates_menuitem, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Software Up to Date")); - dbusmenu_menuitem_child_add_position(self->root_item, - software_updates_menuitem, - 3); -#endif /* HAVE_APT */ - - DbusmenuMenuitem * separator1 = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (separator1, - DBUSMENU_MENUITEM_PROP_TYPE, - DBUSMENU_CLIENT_TYPES_SEPARATOR); - dbusmenu_menuitem_child_add_position (self->root_item, separator1, 4); -} - -static void -device_menu_mgr_build_devices_items (DeviceMenuMgr* self) -{ - DbusmenuMenuitem * device_heading = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (device_heading, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Attached Devices")); - dbusmenu_menuitem_property_set_bool (device_heading, - DBUSMENU_MENUITEM_PROP_ENABLED, - FALSE); - dbusmenu_menuitem_child_add_position (self->root_item, - device_heading, - 5); - - printers_menuitem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (printers_menuitem, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Printers")); - g_signal_connect (G_OBJECT(printers_menuitem), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(show_printer_properties), - "printers"); - dbusmenu_menuitem_child_add_position(self->root_item, - printers_menuitem, - 6); - scanners_menuitem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (scanners_menuitem, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Scanners")); - g_signal_connect (G_OBJECT(scanners_menuitem), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(device_menu_mgr_show_simple_scan), - NULL); - dbusmenu_menuitem_child_add_position (self->root_item, - scanners_menuitem, - 7); - dbusmenu_menuitem_property_set_bool (scanners_menuitem, - DBUSMENU_MENUITEM_PROP_VISIBLE, - FALSE); - - webcam_menuitem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (webcam_menuitem, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Webcam")); - g_signal_connect (G_OBJECT(webcam_menuitem), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(device_menu_mgr_show_cheese), - NULL); - dbusmenu_menuitem_child_add_position (self->root_item, - webcam_menuitem, - 8); - dbusmenu_menuitem_property_set_bool (webcam_menuitem, - DBUSMENU_MENUITEM_PROP_VISIBLE, - FALSE); - - DbusmenuMenuitem * separator3 = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (separator3, - DBUSMENU_MENUITEM_PROP_TYPE, - DBUSMENU_CLIENT_TYPES_SEPARATOR); - dbusmenu_menuitem_child_add_position (self->root_item, separator3, 9); -} - -static void -device_menu_mgr_build_static_items (DeviceMenuMgr* self, gboolean greeter_mode) -{ - // Static Setting items - if (!greeter_mode) { - device_menu_mgr_build_settings_items (self); - } - - // Devices control - if (!greeter_mode) { - device_menu_mgr_build_devices_items (self); - } - - // Session control - if (!greeter_mode) { - gboolean can_lockscreen; - - /* Make sure we have a valid GConf client, and build one - if needed */ - device_menu_mgr_ensure_settings_client (self); - can_lockscreen = !g_settings_get_boolean (lockdown_settings, - LOCKDOWN_KEY_SCREENSAVER); - /* Lock screen item */ - if (can_lockscreen) { - lock_menuitem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (lock_menuitem, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Lock Screen")); - - gchar * shortcut = g_settings_get_string(keybinding_settings, KEY_LOCK_SCREEN); - if (shortcut != NULL) { - g_debug("Lock screen shortcut: %s", shortcut); - dbusmenu_menuitem_property_set_shortcut_string(lock_menuitem, shortcut); - g_free(shortcut); - } - else { - g_debug("Unable to get lock screen shortcut."); - } - - g_signal_connect (G_OBJECT(lock_menuitem), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(lock_screen), NULL); - dbusmenu_menuitem_child_append(self->root_item, lock_menuitem); - } - - logout_mi = dbusmenu_menuitem_new(); - - if (supress_confirmations()) { - dbusmenu_menuitem_property_set (logout_mi, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Log Out")); - } - else { - dbusmenu_menuitem_property_set (logout_mi, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Log Out\342\200\246")); - } - dbusmenu_menuitem_property_set_bool (logout_mi, - DBUSMENU_MENUITEM_PROP_VISIBLE, - show_logout()); - dbusmenu_menuitem_child_append(self->root_item, logout_mi); - g_signal_connect( G_OBJECT(logout_mi), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(show_dialog), "logout"); - } - - if (can_suspend && allow_suspend) { - suspend_mi = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (suspend_mi, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Suspend")); - dbusmenu_menuitem_child_append (self->root_item, suspend_mi); - g_signal_connect( G_OBJECT(suspend_mi), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(machine_sleep_from_suspend), - self); - } - - if (can_hibernate && allow_hibernate) { - hibernate_mi = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (hibernate_mi, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Hibernate")); - dbusmenu_menuitem_child_append(self->root_item, hibernate_mi); - g_signal_connect (G_OBJECT(hibernate_mi), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(machine_sleep_from_hibernate), self); - } - - shutdown_mi = dbusmenu_menuitem_new(); - - if (supress_confirmations()) { - dbusmenu_menuitem_property_set (shutdown_mi, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Shut Down")); - } - else { - dbusmenu_menuitem_property_set (shutdown_mi, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Shut Down\342\200\246")); - } - dbusmenu_menuitem_property_set_bool (shutdown_mi, - DBUSMENU_MENUITEM_PROP_VISIBLE, - show_shutdown()); - dbusmenu_menuitem_child_append (self->root_item, shutdown_mi); - g_signal_connect (G_OBJECT(shutdown_mi), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, -#ifdef HAVE_GTKLOGOUTHELPER - G_CALLBACK(show_dialog), "shutdown"); -#else - G_CALLBACK(show_dialog), "power-off"); -#endif /* HAVE_GTKLOGOUTHELPER */ - - RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi = g_new0 (RestartShutdownLogoutMenuItems, 1); - restart_shutdown_logout_mi->logout_mi = logout_mi; - restart_shutdown_logout_mi->shutdown_mi = shutdown_mi; - - update_menu_entries(restart_shutdown_logout_mi); -#ifdef HAS_GUDEV - // Time to create the udev mgr and hand it the static relevant items. - self->udev_mgr = udev_mgr_new (scanners_menuitem, webcam_menuitem); -#endif -} - -static void -device_menu_mgr_rebuild_items (DeviceMenuMgr* self) -{ - dbusmenu_menuitem_property_set_bool (hibernate_mi, - DBUSMENU_MENUITEM_PROP_VISIBLE, - can_hibernate && allow_hibernate); - dbusmenu_menuitem_property_set_bool (suspend_mi, - DBUSMENU_MENUITEM_PROP_VISIBLE, - can_suspend && allow_suspend); -} - -/* Ensures that we have a GConf client and if we build one - set up the signal handler. */ -static void -device_menu_mgr_ensure_settings_client (DeviceMenuMgr* self) -{ - if (!lockdown_settings) { - lockdown_settings = g_settings_new (LOCKDOWN_SCHEMA); - g_signal_connect(lockdown_settings, "changed", G_CALLBACK(lockdown_changed), self); - } - if (!keybinding_settings) { - keybinding_settings = g_settings_new (KEYBINDING_SCHEMA); - g_signal_connect(lockdown_settings, "changed::" KEY_LOCK_SCREEN, G_CALLBACK(keybinding_changed), self); - } - return; -} - -DbusmenuMenuitem* -device_mgr_get_root_item (DeviceMenuMgr* self) -{ - return self->root_item; -} - -/* - * Clean Entry Point - */ -DeviceMenuMgr* device_menu_mgr_new (SessionDbus* session_dbus, gboolean greeter_mode) -{ - DeviceMenuMgr* device_mgr = g_object_new (DEVICE_TYPE_MENU_MGR, NULL); - device_mgr->session_dbus_interface = session_dbus; - device_menu_mgr_build_static_items (device_mgr, greeter_mode); -#ifdef HAVE_APT - if (software_updates_menuitem != NULL) { - device_mgr->apt_watcher = apt_watcher_new (session_dbus, - software_updates_menuitem); - } -#endif /* HAVE_APT */ - return device_mgr; -} diff --git a/src/device-menu-mgr.h b/src/device-menu-mgr.h deleted file mode 100644 index d3c3a5a..0000000 --- a/src/device-menu-mgr.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2011 Canonical Ltd. - -Authors: - Conor Curran <conor.curran@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - - -#ifndef _DEVICE_MENU_MGR_H_ -#define _DEVICE_MENU_MGR_H_ - -#include <glib-object.h> - -#include "session-dbus.h" - -G_BEGIN_DECLS - -#define DEVICE_TYPE_MENU_MGR (device_menu_mgr_get_type ()) -#define DEVICE_MENU_MGR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEVICE_TYPE_MENU_MGR, DeviceMenuMgr)) -#define DEVICE_MENU_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEVICE_TYPE_MENU_MGR, DeviceMenuMgrClass)) -#define DEVICE_IS_MENU_MGR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEVICE_TYPE_MENU_MGR)) -#define DEVICE_IS_MENU_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEVICE_TYPE_MENU_MGR)) -#define DEVICE_MENU_MGR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEVICE_TYPE_MENU_MGR, DeviceMenuMgrClass)) - -typedef struct _DeviceMenuMgrClass DeviceMenuMgrClass; -typedef struct _DeviceMenuMgr DeviceMenuMgr; - -struct _DeviceMenuMgrClass -{ - GObjectClass parent_class; -}; - -GType device_menu_mgr_get_type (void) G_GNUC_CONST; - -DeviceMenuMgr* device_menu_mgr_new (SessionDbus* session_dbus, gboolean greeter_mode); - -DbusmenuMenuitem* device_mgr_get_root_item (DeviceMenuMgr* self); - -G_END_DECLS - -#endif /* _DEVICE_MENU_MGR_H_ */ diff --git a/src/dialog.c b/src/dialog.c index 4b139ca..c46ac80 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -7,16 +7,16 @@ Copyright 2010 Canonical Ltd. Authors: Ted Gould <ted@canonical.com> -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along +You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -26,7 +26,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <glib/gi18n.h> -#include "consolekit-manager-client.h" +#include "dbus-consolekit-manager.h" #include "dialog.h" /* Strings */ @@ -34,7 +34,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. static const gchar * title_strings[LOGOUT_DIALOG_TYPE_CNT] = { /* LOGOUT_DIALOG_LOGOUT, */ NC_("title", "Log Out"), /* LOGOUT_DIALOG_RESTART, */ NC_("title", "Restart"), - /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("title", "Shut Down") + /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("title", "Switch Off") }; static const gchar * body_strings[LOGOUT_DIALOG_TYPE_CNT] = { @@ -46,7 +46,7 @@ static const gchar * body_strings[LOGOUT_DIALOG_TYPE_CNT] = { static const gchar * button_strings[LOGOUT_DIALOG_TYPE_CNT] = { /* LOGOUT_DIALOG_LOGOUT, */ NC_("button", "Log Out"), /* LOGOUT_DIALOG_RESTART, */ NC_("button", "Restart"), - /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button", "Shut Down") + /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button", "Switch Off") }; /* TRANSLATORS: These strings have an ellipsis so that the user knows @@ -54,7 +54,7 @@ static const gchar * button_strings[LOGOUT_DIALOG_TYPE_CNT] = { static const gchar * button_auth_strings[LOGOUT_DIALOG_TYPE_CNT] = { /* LOGOUT_DIALOG_LOGOUT, */ NC_("button auth", "Log Out"), /* LOGOUT_DIALOG_RESTART, */ NC_("button auth", "Restart…"), - /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button auth", "Shut Down…") + /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button auth", "Switch Off…") }; /* TRANSLATORS: This button appears on the logout dialog when @@ -137,30 +137,31 @@ check_restart_required (void) static gboolean ck_check_allowed (LogoutDialogType type) { - DBusGConnection * system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL); - g_return_val_if_fail(system_bus != NULL, TRUE); - - DBusGProxy * ck_proxy = dbus_g_proxy_new_for_name (system_bus, - "org.freedesktop.ConsoleKit", - "/org/freedesktop/ConsoleKit/Manager", - "org.freedesktop.ConsoleKit.Manager"); - g_return_val_if_fail(ck_proxy != NULL, TRUE); - - gboolean retval = TRUE; - switch (type) { - case LOGOUT_DIALOG_TYPE_RESTART: - org_freedesktop_ConsoleKit_Manager_can_restart(ck_proxy, &retval, NULL); - break; - case LOGOUT_DIALOG_TYPE_SHUTDOWN: - org_freedesktop_ConsoleKit_Manager_can_stop(ck_proxy, &retval, NULL); - break; - default: - break; - } + gboolean allowed = TRUE; + + ConsoleKitManager * ck_proxy = console_kit_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + "org.freedesktop.ConsoleKit", + "/org/freedesktop/ConsoleKit/Manager", + NULL, + NULL); + if (ck_proxy != NULL) + { + switch (type) { + case LOGOUT_DIALOG_TYPE_RESTART: + console_kit_manager_call_can_restart_sync (ck_proxy, &allowed, NULL, NULL); + break; + case LOGOUT_DIALOG_TYPE_SHUTDOWN: + console_kit_manager_call_can_stop_sync (ck_proxy, &allowed, NULL, NULL); + break; + default: + break; + } - g_object_unref(ck_proxy); + g_object_unref(ck_proxy); + } - return retval; + return allowed; } LogoutDialog * @@ -225,17 +226,17 @@ logout_dialog_new (LogoutDialogType type) button_text, GTK_RESPONSE_OK, NULL); } - - if (type == LOGOUT_DIALOG_TYPE_SHUTDOWN){ - const gchar * restart_text; + + if (type == LOGOUT_DIALOG_TYPE_SHUTDOWN) { + const gchar * restart_text; restart_text = g_dpgettext2 (NULL, "button", button_strings[LOGOUT_DIALOG_TYPE_RESTART]); - gtk_dialog_add_button (GTK_DIALOG(dialog), restart_text, GTK_RESPONSE_HELP); - } + gtk_dialog_add_button (GTK_DIALOG(dialog), restart_text, GTK_RESPONSE_HELP); + } gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); - /* The following is a workaround to fix an issue in GtkMessageDialog - in which the user can tab through the text in addition to + /* The following is a workaround to fix an issue in GtkMessageDialog + in which the user can tab through the text in addition to the buttons. */ GtkWidget *message_area = gtk_message_dialog_get_message_area(GTK_MESSAGE_DIALOG(dialog)); GList *children = gtk_container_get_children(GTK_CONTAINER(message_area)); diff --git a/src/display-manager.xml b/src/display-manager.xml index 92f5e05..07b5f29 100644 --- a/src/display-manager.xml +++ b/src/display-manager.xml @@ -1,20 +1,30 @@ <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> + <node> <interface name="org.freedesktop.DisplayManager.Seat"> + <property name="CanSwitch" type="b" access="read"/> + + <property name="HasGuestAccount" type="b" access="read"/> + + <property name="Sessions" type="ao" access="read"/> + <!-- Show greeter to allow new login / switch users --> <method name="SwitchToGreeter"/> <!-- Switch to a user, starting a new display if required --> <method name="SwitchToUser"> <arg name="username" direction="in" type="s"/> - <arg name="session" direction="in" type="s"/> + <arg name="session_name" direction="in" type="s"/> </method> <!-- Switch to the guest user --> <method name="SwitchToGuest"> - <arg name="session" direction="in" type="s"/> + <arg name="session_name" direction="in" type="s"/> </method> + <method name='Lock'/> + </interface> + </node> diff --git a/src/gtk-logout-helper.c b/src/gtk-logout-helper.c index f5c11ba..7868978 100644 --- a/src/gtk-logout-helper.c +++ b/src/gtk-logout-helper.c @@ -8,26 +8,28 @@ Authors: Ted Gould <ted@canonical.com> Christoph Korn <c_korn@gmx.de> -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along +You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <config.h> +#include "config.h" + #include <locale.h> #include <glib.h> -#include <gtk/gtk.h> +#include <glib/gi18n.h> /* textdomain(), bindtextdomain() */ #include <dbus/dbus-glib.h> +#include <gtk/gtk.h> #include "dialog.h" -#include "settings-helper.h" +#include "shared-names.h" static void consolekit_fallback (LogoutDialogType action) @@ -90,7 +92,7 @@ session_action (LogoutDialogType action) GError * error = NULL; gboolean res = FALSE; - sbus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + sbus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); if (sbus == NULL) { g_warning("Unable to get DBus session bus."); return; @@ -112,15 +114,15 @@ session_action (LogoutDialogType action) if (action == LOGOUT_DIALOG_TYPE_LOG_OUT) { g_debug("Asking Session manager to 'Logout'"); - res = dbus_g_proxy_call_with_timeout (sm_proxy, "Logout", INT_MAX, &error, + res = dbus_g_proxy_call_with_timeout (sm_proxy, "Logout", INT_MAX, &error, G_TYPE_UINT, 1, G_TYPE_INVALID, G_TYPE_INVALID); } else if (action == LOGOUT_DIALOG_TYPE_SHUTDOWN) { g_debug("Asking Session manager to 'RequestShutdown'"); - res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestShutdown", INT_MAX, &error, + res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestShutdown", INT_MAX, &error, G_TYPE_INVALID, G_TYPE_INVALID); } else if (action == LOGOUT_DIALOG_TYPE_RESTART) { g_debug("Asking Session manager to 'RequestReboot'"); - res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestReboot", INT_MAX, &error, + res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestReboot", INT_MAX, &error, G_TYPE_INVALID, G_TYPE_INVALID); } else { g_warning ("Unknown session action"); @@ -137,10 +139,7 @@ session_action (LogoutDialogType action) } g_object_unref(sm_proxy); - - if (error != NULL) { - g_error_free(error); - } + g_clear_error (&error); return; } @@ -179,6 +178,17 @@ static GOptionEntry options[] = { {NULL} }; +static gboolean +suppress_confirmations (void) +{ + GSettings * s = g_settings_new (SESSION_SCHEMA); + const gboolean suppress = g_settings_get_boolean (s, SUPPRESS_KEY); + g_clear_object (&s); + return suppress; +} + + + int main (int argc, char * argv[]) { @@ -207,7 +217,7 @@ main (int argc, char * argv[]) INDICATOR_ICONS_DIR); GtkWidget * dialog = NULL; - if (!supress_confirmations()) { + if (!suppress_confirmations()) { g_debug("Showing dialog to ask for user confirmation"); dialog = GTK_WIDGET(logout_dialog_new(type)); } diff --git a/src/indicator-session.c b/src/indicator-session.c index c6f4d9c..53ff87e 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -1,23 +1,23 @@ /* A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. +into the gnome-panel using its applet interface. Copyright 2009 Canonical Ltd. Authors: Ted Gould <ted@canonical.com> Conor Curran <conor.curran@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along +You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -38,8 +38,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <libindicator/indicator-service-manager.h> #include <libindicator/indicator-image-helper.h> -#include "dbus-shared-names.h" -#include "dbusmenu-shared.h" +#include "shared-names.h" #include "user-widget.h" #define INDICATOR_SESSION_TYPE (indicator_session_get_type ()) @@ -52,18 +51,19 @@ with this program. If not, see <http://www.gnu.org/licenses/>. typedef struct _IndicatorSession IndicatorSession; typedef struct _IndicatorSessionClass IndicatorSessionClass; -struct _IndicatorSessionClass { - IndicatorObjectClass parent_class; +struct _IndicatorSessionClass +{ + IndicatorObjectClass parent_class; }; -struct _IndicatorSession { - IndicatorObject parent; - IndicatorServiceManager * service; - IndicatorObjectEntry users; - IndicatorObjectEntry devices; - gboolean show_users_entry; - GCancellable * service_proxy_cancel; - GDBusProxy * service_proxy; +struct _IndicatorSession +{ + IndicatorObject parent; + IndicatorServiceManager * service; + IndicatorObjectEntry entry; + GCancellable * service_proxy_cancel; + GDBusProxy * service_proxy; + GSettings * settings; }; static gboolean greeter_mode; @@ -75,10 +75,6 @@ INDICATOR_SET_VERSION INDICATOR_SET_TYPE(INDICATOR_SESSION_TYPE) /* Prototypes */ -static gboolean build_menu_switch (DbusmenuMenuitem * newitem, - DbusmenuMenuitem * parent, - DbusmenuClient * client, - gpointer user_data); static gboolean new_user_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client, @@ -93,7 +89,6 @@ static void service_connection_cb (IndicatorServiceManager * sm, gboolean connec static void receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, GVariant * parameters, gpointer user_data); static void service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data); static void user_real_name_get_cb (GObject * obj, GAsyncResult * res, gpointer user_data); -static void user_menu_visibility_get_cb (GObject* obj, GAsyncResult* res, gpointer user_data); static void indicator_session_class_init (IndicatorSessionClass *klass); static void indicator_session_init (IndicatorSession *self); @@ -102,10 +97,10 @@ static void indicator_session_finalize (GObject *object); static GList* indicator_session_get_entries (IndicatorObject* obj); static guint indicator_session_get_location (IndicatorObject * io, IndicatorObjectEntry * entry); - + G_DEFINE_TYPE (IndicatorSession, indicator_session, INDICATOR_OBJECT_TYPE); -static void +static void indicator_session_class_init (IndicatorSessionClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -122,126 +117,64 @@ indicator_session_class_init (IndicatorSessionClass *klass) static void indicator_session_init (IndicatorSession *self) { - self->service = NULL; - self->service_proxy_cancel = NULL; - self->service_proxy = NULL; - self->show_users_entry = FALSE; - - /* Now let's fire these guys up. */ - self->service = indicator_service_manager_new_version(INDICATOR_SESSION_DBUS_NAME, + self->settings = g_settings_new ("com.canonical.indicator.session"); + + /* Now let's fire these guys up. */ + self->service = indicator_service_manager_new_version(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_VERSION); - g_signal_connect(G_OBJECT(self->service), - INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, - G_CALLBACK(service_connection_cb), self); - - GtkWidget* avatar_icon = NULL; - // users - self->users.name_hint = PACKAGE"-users"; - self->users.menu = GTK_MENU (dbusmenu_gtkmenu_new (INDICATOR_USERS_DBUS_NAME, - INDICATOR_USERS_DBUS_OBJECT)); - // Set the image to the default avator image - GdkPixbuf* pixbuf = NULL; - GError* error = NULL; - pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), - "avatar-default", - 17, - GTK_ICON_LOOKUP_FORCE_SIZE, - &error); - - // I think the avatar image is available always but just in case have a fallback - if (error != NULL) { - g_warning ("Could not load the default avatar image for some reason"); - self->users.image = indicator_image_helper (USER_ITEM_ICON_DEFAULT); - } - else{ - avatar_icon = gtk_image_new (); - gtk_image_set_from_pixbuf (GTK_IMAGE (avatar_icon), pixbuf); - self->users.image = GTK_IMAGE (avatar_icon); - g_object_unref (pixbuf); - g_error_free (error); - } - - self->users.label = GTK_LABEL (gtk_label_new (NULL)); - self->users.accessible_desc = _("User Menu"); - - const gchar *greeter_var; - greeter_var = g_getenv("INDICATOR_GREETER_MODE"); - greeter_mode = g_strcmp0(greeter_var, "1") == 0; - - // devices - self->devices.name_hint = PACKAGE"-devices"; - self->devices.accessible_desc = _("Device Menu"); - self->devices.menu = GTK_MENU (dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, - INDICATOR_SESSION_DBUS_OBJECT)); - if (greeter_mode){ - self->devices.image = indicator_image_helper (GREETER_ICON_DEFAULT); - } - else{ - self->devices.image = indicator_image_helper (ICON_DEFAULT); - } - - gtk_widget_show (GTK_WIDGET(self->devices.menu)); - gtk_widget_show (GTK_WIDGET(self->devices.image)); - gtk_widget_show (GTK_WIDGET(self->users.image)); - gtk_widget_show (GTK_WIDGET(self->users.menu)); - - g_object_ref_sink (self->users.menu); - g_object_ref_sink (self->users.image); - g_object_ref_sink (self->devices.menu); - g_object_ref_sink (self->devices.image); - - // Setup the handlers for users - DbusmenuClient * users_client = DBUSMENU_CLIENT(dbusmenu_gtkmenu_get_client(DBUSMENU_GTKMENU(self->users.menu))); - dbusmenu_client_add_type_handler (users_client, + g_signal_connect (G_OBJECT(self->service), + INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, + G_CALLBACK(service_connection_cb), self); + + greeter_mode = !g_strcmp0(g_getenv("INDICATOR_GREETER_MODE"), "1"); + + self->entry.name_hint = PACKAGE; + self->entry.accessible_desc = _("Session Menu"); + self->entry.label = GTK_LABEL (gtk_label_new ("User Name")); + self->entry.image = greeter_mode + ? indicator_image_helper (GREETER_ICON_DEFAULT) + : indicator_image_helper (ICON_DEFAULT); + self->entry.menu = GTK_MENU (dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, + INDICATOR_SESSION_DBUS_OBJECT)); + g_settings_bind (self->settings, "show-real-name-on-panel", + self->entry.label, "visible", + G_SETTINGS_BIND_GET); + + gtk_widget_show (GTK_WIDGET(self->entry.menu)); + gtk_widget_show (GTK_WIDGET(self->entry.image)); + g_object_ref_sink (self->entry.menu); + g_object_ref_sink (self->entry.image); + + // set up the handlers + DbusmenuClient * menu_client = DBUSMENU_CLIENT(dbusmenu_gtkmenu_get_client(DBUSMENU_GTKMENU(self->entry.menu))); + dbusmenu_client_add_type_handler (menu_client, USER_ITEM_TYPE, new_user_item); - dbusmenu_client_add_type_handler_full (users_client, - MENU_SWITCH_TYPE, - build_menu_switch, - self, NULL); - - // Setup the handlers for devices - DbusmenuClient * devices_client = DBUSMENU_CLIENT(dbusmenu_gtkmenu_get_client(DBUSMENU_GTKMENU(self->devices.menu))); - dbusmenu_client_add_type_handler (devices_client, + dbusmenu_client_add_type_handler (menu_client, RESTART_ITEM_TYPE, build_restart_item); - - GtkAccelGroup * agroup = gtk_accel_group_new(); - dbusmenu_gtkclient_set_accel_group(DBUSMENU_GTKCLIENT(devices_client), agroup); - return; + dbusmenu_gtkclient_set_accel_group (DBUSMENU_GTKCLIENT(menu_client), + gtk_accel_group_new()); } static void indicator_session_dispose (GObject *object) { - IndicatorSession * self = INDICATOR_SESSION(object); + IndicatorSession * self = INDICATOR_SESSION(object); - if (self->service != NULL) { - g_object_unref(G_OBJECT(self->service)); - self->service = NULL; - } + g_clear_object (&self->settings); + g_clear_object (&self->service); + g_clear_object (&self->service_proxy); - if (self->service_proxy != NULL) { - g_object_unref(self->service_proxy); - self->service_proxy = NULL; - } + if (self->service_proxy_cancel != NULL) + { + g_cancellable_cancel(self->service_proxy_cancel); + g_clear_object (&self->service_proxy_cancel); + } - if (self->service_proxy_cancel != NULL) { - g_cancellable_cancel(self->service_proxy_cancel); - g_object_unref(self->service_proxy_cancel); - self->service_proxy_cancel = NULL; - } - - if (self->users.menu != NULL) { - g_object_unref (self->users.menu); - } - - if (self->devices.menu != NULL) { - g_object_unref (self->devices.menu); - } + g_clear_object (&self->entry.menu); - G_OBJECT_CLASS (indicator_session_parent_class)->dispose (object); - return; + G_OBJECT_CLASS (indicator_session_parent_class)->dispose (object); } static void @@ -255,35 +188,16 @@ indicator_session_finalize (GObject *object) static GList* indicator_session_get_entries (IndicatorObject* obj) { - g_return_val_if_fail(IS_INDICATOR_SESSION(obj), NULL); - IndicatorSession* self = INDICATOR_SESSION (obj); - - g_debug ("get entries"); - GList * retval = NULL; - // Only show the users menu if we have more than one - if (self->show_users_entry == TRUE){ - retval = g_list_prepend (retval, &self->users); - } - retval = g_list_prepend (retval, &self->devices); + g_return_val_if_fail(IS_INDICATOR_SESSION(obj), NULL); - if (retval != NULL) { - retval = g_list_reverse(retval); - } - return retval; + IndicatorSession* self = INDICATOR_SESSION (obj); + return g_list_append (NULL, &self->entry); } static guint indicator_session_get_location (IndicatorObject * io, IndicatorObjectEntry * entry) -{ - IndicatorSession * self = INDICATOR_SESSION (io); - if (entry == &self->users){ - return 0; - } - else if (entry == &self->devices){ - return 1; - } - g_warning ("IOEntry handed to us to position but we don't own it!"); +{ return 0; } @@ -298,24 +212,16 @@ service_connection_cb (IndicatorServiceManager * sm, gboolean connected, gpointe // Its a reconnect ! // Fetch synchronisation data and return (proxy is still legit) g_dbus_proxy_call (self->service_proxy, - "GetUserMenuVisibility", - NULL, - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - user_menu_visibility_get_cb, - user_data); - g_dbus_proxy_call (self->service_proxy, "GetUserRealName", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, user_real_name_get_cb, - user_data); + user_data); return; } - + self->service_proxy_cancel = g_cancellable_new(); g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, @@ -326,7 +232,7 @@ service_connection_cb (IndicatorServiceManager * sm, gboolean connected, gpointe self->service_proxy_cancel, service_proxy_cb, self); - } + } return; } @@ -341,10 +247,7 @@ service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error); - if (self->service_proxy_cancel != NULL) { - g_object_unref(self->service_proxy_cancel); - self->service_proxy_cancel = NULL; - } + g_clear_object (&self->service_proxy_cancel); if (error != NULL) { g_warning("Could not grab DBus proxy for %s: %s", INDICATOR_SESSION_DBUS_NAME, error->message); @@ -357,17 +260,7 @@ service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) self->service_proxy = proxy; g_signal_connect(proxy, "g-signal", G_CALLBACK(receive_signal), self); - - // Figure out whether we should show the user menu at all. - g_dbus_proxy_call (self->service_proxy, - "GetUserMenuVisibility", - NULL, - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - user_menu_visibility_get_cb, - user_data); - + // Fetch the user's real name for the user entry label g_dbus_proxy_call (self->service_proxy, "GetUserRealName", @@ -384,17 +277,13 @@ service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) static gboolean new_user_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, - DbusmenuClient * client, - gpointer user_data) + DbusmenuClient * client, + gpointer user_data) { - + g_return_val_if_fail (DBUSMENU_IS_MENUITEM(newitem), FALSE); + g_return_val_if_fail (DBUSMENU_IS_GTKCLIENT(client), FALSE); - GtkWidget* user_item = NULL; - - g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); - g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); - - user_item = user_widget_new(newitem); + GtkWidget * user_item = user_widget_new (newitem); GtkMenuItem *user_widget = GTK_MENU_ITEM(user_item); @@ -415,191 +304,51 @@ new_user_item (DbusmenuMenuitem * newitem, static void user_real_name_get_cb (GObject * obj, GAsyncResult * res, gpointer user_data) { - IndicatorSession * self = INDICATOR_SESSION(user_data); - GError * error = NULL; - GVariant * result; + IndicatorSession * self = INDICATOR_SESSION(user_data); - result = g_dbus_proxy_call_finish(self->service_proxy, res, &error); + GError * error = NULL; + GVariant * result = g_dbus_proxy_call_finish(self->service_proxy, res, &error); - if (error != NULL) { - g_warning ("unable to complete real name dbus query"); - g_error_free (error); - return; - } - - const gchar* username = NULL; - g_variant_get (result, "(&s)", &username); - indicator_session_update_users_label (self, username); - return; -} - -static void -user_menu_visibility_get_cb (GObject* obj, GAsyncResult* res, gpointer user_data) -{ - IndicatorSession * self = INDICATOR_SESSION(user_data); - GError * error = NULL; - GVariant * result; - - result = g_dbus_proxy_call_finish(self->service_proxy, res, &error); - - if (error != NULL) { - g_warning ("unable to complete real name dbus query"); - g_error_free (error); - return; - } - gboolean update; - g_variant_get (result, "(b)", &update); - - // If it is what we had before no need to do anything... - if (self->show_users_entry == update){ - return; - } - //Otherwise - self->show_users_entry = update; - - if (self->show_users_entry == TRUE){ - g_signal_emit_by_name ((gpointer)self, - "entry-added", - &self->users); - } - else{ - g_signal_emit_by_name ((gpointer)self, - "entry-removed", - &self->users); - } + if (error != NULL) + { + g_warning ("Unable to complete real name dbus query: %s", error->message); + g_clear_error (&error); + } + else + { + const gchar * username = NULL; + g_variant_get (result, "(&s)", &username); + indicator_session_update_users_label (self, username); + g_variant_unref (result); + } } /* Receives all signals from the service, routed to the appropriate functions */ static void receive_signal (GDBusProxy * proxy, - gchar * sender_name, - gchar * signal_name, - GVariant * parameters, - gpointer user_data) + gchar * sender_name, + gchar * signal_name, + GVariant * parameters, + gpointer user_data) { - IndicatorSession * self = INDICATOR_SESSION(user_data); + IndicatorSession * self = INDICATOR_SESSION(user_data); - if (g_strcmp0(signal_name, "UserRealNameUpdated") == 0) { - const gchar* username = NULL; - g_variant_get (parameters, "(&s)", &username); - indicator_session_update_users_label (self, username); - } - else if (g_strcmp0(signal_name, "UserMenuIsVisible") == 0) { - gboolean update; - g_variant_get (parameters, "(b)", &update); - - // If it is what we had before no need to do anything... - if (self->show_users_entry == update){ - return; - } - - //Otherwise - self->show_users_entry = update; - - if (self->show_users_entry == TRUE){ - g_signal_emit_by_name ((gpointer)self, - "entry-added", - &self->users); - - } - else{ - g_signal_emit_by_name ((gpointer)self, - "entry-removed", - &self->users); + if (!g_strcmp0(signal_name, "UserRealNameUpdated")) + { + const gchar * username = NULL; + g_variant_get (parameters, "(&s)", &username); + indicator_session_update_users_label (self, username); } - } - else if (g_strcmp0(signal_name, "RestartRequired") == 0) { - if (greeter_mode == TRUE){ - indicator_image_helper_update(self->devices.image, GREETER_ICON_RESTART); - } - else{ - g_debug ("reboot required"); - indicator_image_helper_update(self->devices.image, ICON_RESTART); + else if (!g_strcmp0(signal_name, "RestartRequired")) + { + indicator_image_helper_update (self->entry.image, greeter_mode ? GREETER_ICON_RESTART : ICON_RESTART); + self->entry.accessible_desc = _("Device Menu (reboot required)"); + g_signal_emit (G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, 0, &self->entry); } - self->devices.accessible_desc = _("Device Menu (reboot required)"); - g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, 0, &(self->devices)); - } } -static void -switch_property_change (DbusmenuMenuitem * item, - const gchar * property, - GVariant * variant, - gpointer user_data) -{ - if (g_strcmp0 (property, MENU_SWITCH_USER) != 0) { - return; - } - - GtkMenuItem * gmi = dbusmenu_gtkclient_menuitem_get(DBUSMENU_GTKCLIENT(user_data), item); - gchar * finalstring = NULL; - gboolean set_ellipsize = FALSE; - gboolean no_name_in_lang = FALSE; - - const gchar * translate = C_("session_menu:switchfrom", "1"); - if (g_strcmp0(translate, "1") != 0) { - no_name_in_lang = TRUE; - } - - GSettings* settings = g_settings_new ("com.canonical.indicator.session"); - gboolean use_username = g_settings_get_boolean (settings, - "use-username-in-switch-item"); - g_object_unref (settings); - - if (variant == NULL || g_variant_get_string(variant, NULL) == NULL || - g_variant_get_string(variant, NULL)[0] == '\0' || no_name_in_lang - || use_username == FALSE) { - finalstring = _("Switch User Account…"); - set_ellipsize = FALSE; - } - - if (finalstring == NULL) { - const gchar * username = g_variant_get_string(variant, NULL); - GtkStyle * style = gtk_widget_get_style(GTK_WIDGET(gmi)); - - PangoLayout * layout = pango_layout_new(gtk_widget_get_pango_context(GTK_WIDGET(gmi))); - pango_layout_set_text (layout, username, -1); - pango_layout_set_font_description(layout, style->font_desc); - - gint width; - pango_layout_get_pixel_size(layout, &width, NULL); - g_object_unref(layout); - g_debug("Username width %dpx", width); - - gint point = pango_font_description_get_size(style->font_desc); - g_debug("Font size %f pt", (gfloat)point / PANGO_SCALE); - - gdouble dpi = gdk_screen_get_resolution(gdk_screen_get_default()); - g_debug("Screen DPI %f", dpi); - - gdouble pixels_per_em = ((point * dpi) / 72.0f) / PANGO_SCALE; - gdouble ems = width / pixels_per_em; - g_debug("Username width %fem", ems); - - finalstring = g_strdup_printf(_("Switch From %s…"), username); - if (ems >= 20.0f) { - set_ellipsize = TRUE; - } else { - set_ellipsize = FALSE; - } - - } - gtk_menu_item_set_label(gmi, finalstring); - - GtkLabel * label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(gmi))); - if (label != NULL) { - if (set_ellipsize) { - gtk_label_set_ellipsize(label, PANGO_ELLIPSIZE_END); - } else { - gtk_label_set_ellipsize(label, PANGO_ELLIPSIZE_NONE); - } - } - return; -} - -static const gchar * dbusmenu_item_data = "dbusmenu-item"; static void restart_property_change (DbusmenuMenuitem * item, @@ -657,64 +406,8 @@ build_restart_item (DbusmenuMenuitem * newitem, } static void -switch_style_set (GtkWidget * widget, - GtkStyle * prev_style, - gpointer user_data) +indicator_session_update_users_label (IndicatorSession * self, + const gchar * name) { - DbusmenuGtkClient * client = DBUSMENU_GTKCLIENT(user_data); - DbusmenuMenuitem * mi = DBUSMENU_MENUITEM(g_object_get_data(G_OBJECT(widget), - dbusmenu_item_data)); - - switch_property_change (mi, - MENU_SWITCH_USER, - dbusmenu_menuitem_property_get_variant(mi, MENU_SWITCH_USER), - client); - return; -} - -static gboolean -build_menu_switch (DbusmenuMenuitem * newitem, - DbusmenuMenuitem * parent, - DbusmenuClient * client, - gpointer user_data) -{ - GtkMenuItem * gmi = GTK_MENU_ITEM(gtk_menu_item_new()); - if (gmi == NULL) { - return FALSE; - } - - g_object_set_data(G_OBJECT(gmi), dbusmenu_item_data, newitem); - - dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent); - - g_signal_connect (G_OBJECT(newitem), - DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, - G_CALLBACK(switch_property_change), - client); - g_signal_connect (G_OBJECT(gmi), - "style-set", - G_CALLBACK(switch_style_set), - client); - - switch_property_change (newitem, - MENU_SWITCH_USER, - dbusmenu_menuitem_property_get_variant(newitem, MENU_SWITCH_USER), client); - - return TRUE; -} - -static void -indicator_session_update_users_label (IndicatorSession* self, - const gchar* name) -{ - if (name == NULL){ - gtk_widget_hide(GTK_WIDGET(self->users.label)); - return; - } - - GSettings* settings = g_settings_new ("com.canonical.indicator.session"); - const gboolean use_name = g_settings_get_boolean (settings, "show-real-name-on-panel"); - gtk_label_set_text (self->users.label, name); - gtk_widget_set_visible (GTK_WIDGET(self->users.label), use_name); - g_object_unref (settings); + gtk_label_set_text (self->entry.label, name ? name : ""); } diff --git a/src/lock-helper.c b/src/lock-helper.c deleted file mode 100644 index 8eae674..0000000 --- a/src/lock-helper.c +++ /dev/null @@ -1,157 +0,0 @@ -/* -A small helper for locking the screen. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <glib/gi18n.h> -#include <gio/gio.h> -#include <dbus/dbus-glib.h> -#include "lock-helper.h" - -#define SCREENSAVER_SCHEMA "org.gnome.desktop.screensaver" -#define SCREENSAVER_LOCK_ENABLED_KEY "lock-enabled" - -static DBusGProxy * gss_proxy = NULL; -static GMainLoop * gss_mainloop = NULL; - -static gboolean is_guest = FALSE; - -static GSettings * settings = NULL; - -void build_gss_proxy (void); - -/* This is our logic on whether the screen should be locked - or not. It effects everything else. */ -gboolean -will_lock_screen (void) -{ - if (is_guest) { - return FALSE; - } - - if (settings == NULL) { - settings = g_settings_new (SCREENSAVER_SCHEMA); - } - - return g_settings_get_boolean (settings, SCREENSAVER_LOCK_ENABLED_KEY); -} - -/* When the screensave go active, if we've got a mainloop - running we should quit it. */ -static void -gss_active_changed (DBusGProxy * proxy, gboolean active, gpointer data) -{ - if (active && gss_mainloop != NULL) { - g_main_loop_quit(gss_mainloop); - } - - return; -} - -static gboolean -get_greeter_mode (void) -{ - const gchar *var; - var = g_getenv("INDICATOR_GREETER_MODE"); - return (g_strcmp0(var, "1") == 0); -} - -/* Build the gss proxy and set up it's signals */ -void -build_gss_proxy (void) -{ - if (gss_proxy == NULL) { - if (get_greeter_mode ()) - return; /* Don't start/lock the screensaver from the login screen */ - - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_return_if_fail(session_bus != NULL); - - gss_proxy = dbus_g_proxy_new_for_name(session_bus, - "org.gnome.ScreenSaver", - "/", - "org.gnome.ScreenSaver"); - g_return_if_fail(gss_proxy != NULL); - - dbus_g_proxy_add_signal(gss_proxy, "ActiveChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(gss_proxy, "ActiveChanged", G_CALLBACK(gss_active_changed), NULL, NULL); - } - - return; -} - -/* This is a timeout, we only want to wait for the screen to - lock for a little bit, but not forever. */ -static gboolean -activate_timeout (gpointer data) -{ - /* Clear the ID for the timeout */ - guint * address = (guint *)data; - *address = 0; - - /* Quit the mainloop */ - if (gss_mainloop != NULL) { - g_main_loop_quit(gss_mainloop); - } - - return FALSE; -} - -/* A fun little function to actually lock the screen. If, - that's what you want, let's do it! */ -void -lock_screen (DbusmenuMenuitem * mi, guint timestamp, gpointer data) -{ - g_debug("Lock Screen"); - - build_gss_proxy(); - g_return_if_fail(gss_proxy != NULL); - - dbus_g_proxy_call_no_reply(gss_proxy, - "Lock", - G_TYPE_INVALID, - G_TYPE_INVALID); - - if (gss_mainloop == NULL) { - gss_mainloop = g_main_loop_new(NULL, FALSE); - } - - guint timer = g_timeout_add_seconds(1, activate_timeout, &timer); - - g_main_loop_run(gss_mainloop); - - if (timer != 0) { - g_source_remove(timer); - } - - return; -} - -/* Do what it takes to make the lock screen function work - and be happy. */ -gboolean -lock_screen_setup (gpointer data) -{ - if (!g_strcmp0(g_get_user_name(), "guest")) { - is_guest = TRUE; - } - - return FALSE; -} - diff --git a/src/lock-helper.h b/src/lock-helper.h deleted file mode 100644 index e2d5106..0000000 --- a/src/lock-helper.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -A small helper for locking the screen. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef LOCK_HELPER_H__ -#define LOCK_HELPER_H__ - -#include <libdbusmenu-glib/menuitem.h> - -gboolean will_lock_screen (void); -void lock_screen (DbusmenuMenuitem * mi, guint timestamp, gpointer data); -gboolean lock_screen_setup (gpointer data); - -#endif /* LOCK_HELPER_H__ */ diff --git a/src/accounts-service-user.xml b/src/org.freedesktop.Accounts.User.xml index bd4cb21..53f54d4 100644 --- a/src/accounts-service-user.xml +++ b/src/org.freedesktop.Accounts.User.xml @@ -2,6 +2,7 @@ "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd" > <node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"> + <interface name="org.freedesktop.Accounts.User"> <method name="SetUserName"> @@ -125,10 +126,10 @@ <doc:para> Sets the users language. </doc:para> - <doc:language> + <doc:para> The expectation is that display managers will start the users session with this locale. - </doc:language> + </doc:para> </doc:description> <doc:permission> The caller needs one of the following PolicyKit authorizations: @@ -150,6 +151,46 @@ </doc:doc> </method> + <method name="SetXSession"> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="user_set_x_session"/> + <arg name="x_session" direction="in" type="s"> + <doc:doc> + <doc:summary> + The new xsession to start (e.g. "gnome") + </doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para> + Sets the users x session. + </doc:para> + <doc:para> + The expectation is that display managers will log the user in to this + specified session, if available. + </doc:para> + </doc:description> + <doc:permission> + The caller needs one of the following PolicyKit authorizations: + <doc:list> + <doc:item> + <doc:term>org.freedesktop.accounts.change-own-user-data</doc:term> + <doc:definition>To change his own language</doc:definition> + </doc:item> + <doc:item> + <doc:term>org.freedesktop.accounts.user-administration</doc:term> + <doc:definition>To change the language of another user</doc:definition> + </doc:item> + </doc:list> + </doc:permission> + <doc:errors> + <doc:error name="org.freedesktop.Accounts.Error.PermissionDenied">if the caller lacks the appropriate PolicyKit authorization</doc:error> + <doc:error name="org.freedesktop.Accounts.Error.Failed">if the operation failed</doc:error> + </doc:errors> + </doc:doc> + </method> + <method name="SetLocation"> <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> <arg name="location" direction="in" type="s"> @@ -340,10 +381,6 @@ <doc:term>1</doc:term> <doc:definition>Administrator</doc:definition> </doc:item> - <doc:item> - <doc:term>2</doc:term> - <doc:definition>Supervised user</doc:definition> - </doc:item> </doc:list> </doc:summary> </doc:doc> @@ -541,10 +578,6 @@ <doc:term>1</doc:term> <doc:definition>Administrator</doc:definition> </doc:item> - <doc:item> - <doc:term>2</doc:term> - <doc:definition>Supervised user</doc:definition> - </doc:item> </doc:list> </doc:para> </doc:description> @@ -591,6 +624,16 @@ </doc:doc> </property> + <property name="XSession" type="s" access="read"> + <doc:doc> + <doc:description> + <doc:para> + The users x session. + </doc:para> + </doc:description> + </doc:doc> + </property> + <property name="Location" type="s" access="read"> <doc:doc> <doc:description> @@ -675,6 +718,18 @@ </doc:doc> </property> + <property name="SystemAccount" type="b" access="read"> + <doc:doc> + <doc:description> + <doc:para> + Whether this is a 'system' account, like 'root' or 'nobody'. + System accounts should normally not appear in lists of + users, and ListCachedUsers will not include such accounts. + </doc:para> + </doc:description> + </doc:doc> + </property> + <signal name="Changed"> <doc:doc> <doc:description> diff --git a/src/accounts-service.xml b/src/org.freedesktop.Accounts.xml index 9c19761..9c19761 100644 --- a/src/accounts-service.xml +++ b/src/org.freedesktop.Accounts.xml diff --git a/src/org.freedesktop.ConsoleKit.Seat.xml b/src/org.freedesktop.ConsoleKit.Seat.xml index d95990b..58c2ce7 100644 --- a/src/org.freedesktop.ConsoleKit.Seat.xml +++ b/src/org.freedesktop.ConsoleKit.Seat.xml @@ -101,7 +101,7 @@ seat at a time.</doc:para> </method> <signal name="ActiveSessionChanged"> - <arg name="ssid" type="o"> + <arg name="ssid" type="s"> <doc:doc> <doc:summary>Session ID</doc:summary> </doc:doc> diff --git a/src/sane-rules.h b/src/sane-rules.h deleted file mode 100644 index 0b72e52..0000000 --- a/src/sane-rules.h +++ /dev/null @@ -1,778 +0,0 @@ -void populate_scsi_scanners (GHashTable* scanners) -{ - GList* epson = NULL; - epson = g_list_append (epson, g_strdup ("GT-9700")); - epson = g_list_append (epson, g_strdup ("GT-9800")); - epson = g_list_append (epson, g_strdup ("Perfection1200")); - epson = g_list_append (epson, g_strdup ("Perfection636")); - epson = g_list_append (epson, g_strdup ("SCANNER GT-7000")); - g_hash_table_insert (scanners, - g_strdup("EPSON"), - epson); - - - GList* hp = NULL; - hp = g_list_append (hp, g_strdup ("C1130A")); - hp = g_list_append (hp, g_strdup ("C1750A")); - hp = g_list_append (hp, g_strdup ("C1790A")); - hp = g_list_append (hp, g_strdup ("C2500A")); - hp = g_list_append (hp, g_strdup ("C2520A")); - hp = g_list_append (hp, g_strdup ("C5110A")); - hp = g_list_append (hp, g_strdup ("C6270A")); - hp = g_list_append (hp, g_strdup ("C7670A")); - g_hash_table_insert (scanners, - g_strdup("HP"), - hp); -} - - - -void populate_usb_scanners (GHashTable* scanners) -{ - GList* hp = NULL; - - hp = g_list_append (hp, g_strdup ("0101")); - hp = g_list_append (hp, g_strdup ("0105")); - hp = g_list_append (hp, g_strdup ("0201")); - hp = g_list_append (hp, g_strdup ("0205")); - hp = g_list_append (hp, g_strdup ("0305")); - hp = g_list_append (hp, g_strdup ("0401")); - hp = g_list_append (hp, g_strdup ("0405")); - hp = g_list_append (hp, g_strdup ("0505")); - hp = g_list_append (hp, g_strdup ("0601")); - hp = g_list_append (hp, g_strdup ("0605")); - hp = g_list_append (hp, g_strdup ("0701")); - hp = g_list_append (hp, g_strdup ("0705")); - hp = g_list_append (hp, g_strdup ("0801")); - hp = g_list_append (hp, g_strdup ("0805")); - hp = g_list_append (hp, g_strdup ("0901")); - hp = g_list_append (hp, g_strdup ("0a01")); - hp = g_list_append (hp, g_strdup ("0b01")); - hp = g_list_append (hp, g_strdup ("1005")); - hp = g_list_append (hp, g_strdup ("1105")); - hp = g_list_append (hp, g_strdup ("1205")); - hp = g_list_append (hp, g_strdup ("1305")); - hp = g_list_append (hp, g_strdup ("1405")); - hp = g_list_append (hp, g_strdup ("1705")); - hp = g_list_append (hp, g_strdup ("1805")); - hp = g_list_append (hp, g_strdup ("2005")); - hp = g_list_append (hp, g_strdup ("2205")); - hp = g_list_append (hp, g_strdup ("2305")); - hp = g_list_append (hp, g_strdup ("2405")); - hp = g_list_append (hp, g_strdup ("2605")); - hp = g_list_append (hp, g_strdup ("2805")); - hp = g_list_append (hp, g_strdup ("3805")); - hp = g_list_append (hp, g_strdup ("3905")); - hp = g_list_append (hp, g_strdup ("3B17")); - hp = g_list_append (hp, g_strdup ("4105")); - hp = g_list_append (hp, g_strdup ("4205")); - hp = g_list_append (hp, g_strdup ("4305")); - hp = g_list_append (hp, g_strdup ("4505")); - hp = g_list_append (hp, g_strdup ("4605")); - hp = g_list_append (hp, g_strdup ("5617")); - hp = g_list_append (hp, g_strdup ("5717")); - - g_hash_table_insert (scanners, - g_strdup("03f0"), - hp); - - GList* mustek_2 = NULL; - mustek_2 = g_list_append (mustek_2, g_strdup ("1000")); - mustek_2 = g_list_append (mustek_2, g_strdup ("1001")); - g_hash_table_insert (scanners, - g_strdup("0400"), - mustek_2); - - GList* kodak = NULL; - kodak = g_list_append (kodak, g_strdup ("6001")); - kodak = g_list_append (kodak, g_strdup ("6002")); - kodak = g_list_append (kodak, g_strdup ("6003")); - kodak = g_list_append (kodak, g_strdup ("6004")); - kodak = g_list_append (kodak, g_strdup ("6005")); - g_hash_table_insert (scanners, - g_strdup("040a"), - kodak); - - GList* creative = NULL; - - creative = g_list_append (creative, g_strdup ("4007")); - - g_hash_table_insert (scanners, - g_strdup("041e"), - creative); - - GList* lexmark = NULL; - - lexmark = g_list_append (lexmark, g_strdup("002d")); - lexmark = g_list_append (lexmark, g_strdup("0060")); - lexmark = g_list_append (lexmark, g_strdup("007c")); - lexmark = g_list_append (lexmark, g_strdup("007d")); - - g_hash_table_insert (scanners, - g_strdup("043d"), - lexmark); - - - GList* genius = NULL; - genius = g_list_append (genius, g_strdup("2004")); - genius = g_list_append (genius, g_strdup("2007")); - genius = g_list_append (genius, g_strdup("2008")); - genius = g_list_append (genius, g_strdup("2009")); - genius = g_list_append (genius, g_strdup("2011")); - genius = g_list_append (genius, g_strdup("2013")); - genius = g_list_append (genius, g_strdup("2014")); - genius = g_list_append (genius, g_strdup("2015")); - genius = g_list_append (genius, g_strdup("2016")); - genius = g_list_append (genius, g_strdup("2017")); - genius = g_list_append (genius, g_strdup("201a")); - genius = g_list_append (genius, g_strdup("201b")); - genius = g_list_append (genius, g_strdup("201d")); - genius = g_list_append (genius, g_strdup("201e")); - genius = g_list_append (genius, g_strdup("201f")); - genius = g_list_append (genius, g_strdup("20c1")); - g_hash_table_insert (scanners, - g_strdup("0458"), - genius); - - GList* medion = NULL; - medion = g_list_append (medion, g_strdup("0377")); - g_hash_table_insert (scanners, - g_strdup("0461"), - medion); - - GList* trust = NULL; - trust = g_list_append (trust, g_strdup("1000")); - trust = g_list_append (trust, g_strdup("1002")); - g_hash_table_insert (scanners, - g_strdup("047b"), - trust); - - GList* kyocera = NULL; - kyocera = g_list_append (kyocera, g_strdup("0335")); - g_hash_table_insert (scanners, - g_strdup("0482"), - kyocera); - - GList* compaq = NULL; - compaq = g_list_append (compaq, g_strdup("001a")); - g_hash_table_insert (scanners, - g_strdup("049f"), - compaq); - GList* benq = NULL; - benq = g_list_append (benq, g_strdup("1a20")); - benq = g_list_append (benq, g_strdup("1a2a")); - benq = g_list_append (benq, g_strdup("2022")); - benq = g_list_append (benq, g_strdup("2040")); - benq = g_list_append (benq, g_strdup("2060")); - benq = g_list_append (benq, g_strdup("207e")); - benq = g_list_append (benq, g_strdup("20b0")); - benq = g_list_append (benq, g_strdup("20be")); - benq = g_list_append (benq, g_strdup("20c0")); - benq = g_list_append (benq, g_strdup("20de")); - benq = g_list_append (benq, g_strdup("20f8")); - benq = g_list_append (benq, g_strdup("20fc")); - benq = g_list_append (benq, g_strdup("20fe")); - benq = g_list_append (benq, g_strdup("2137")); - benq = g_list_append (benq, g_strdup("2211")); - g_hash_table_insert (scanners, - g_strdup("04a5"), - benq); - - GList* visioneer = NULL; - visioneer = g_list_append (visioneer, g_strdup("0229")); - visioneer = g_list_append (visioneer, g_strdup("0390")); - visioneer = g_list_append (visioneer, g_strdup("0420")); - visioneer = g_list_append (visioneer, g_strdup("0421")); - visioneer = g_list_append (visioneer, g_strdup("0422")); - visioneer = g_list_append (visioneer, g_strdup("0423")); - visioneer = g_list_append (visioneer, g_strdup("0424")); - visioneer = g_list_append (visioneer, g_strdup("0426")); - visioneer = g_list_append (visioneer, g_strdup("0427")); - visioneer = g_list_append (visioneer, g_strdup("0444")); - visioneer = g_list_append (visioneer, g_strdup("0446")); - visioneer = g_list_append (visioneer, g_strdup("0447")); - visioneer = g_list_append (visioneer, g_strdup("0448")); - visioneer = g_list_append (visioneer, g_strdup("0449")); - visioneer = g_list_append (visioneer, g_strdup("044c")); - visioneer = g_list_append (visioneer, g_strdup("0474")); - visioneer = g_list_append (visioneer, g_strdup("0475")); - visioneer = g_list_append (visioneer, g_strdup("0477")); - visioneer = g_list_append (visioneer, g_strdup("0478")); - visioneer = g_list_append (visioneer, g_strdup("0479")); - visioneer = g_list_append (visioneer, g_strdup("047a")); - visioneer = g_list_append (visioneer, g_strdup("047b")); - visioneer = g_list_append (visioneer, g_strdup("047c")); - visioneer = g_list_append (visioneer, g_strdup("048c")); - visioneer = g_list_append (visioneer, g_strdup("048d")); - visioneer = g_list_append (visioneer, g_strdup("048e")); - visioneer = g_list_append (visioneer, g_strdup("048f")); - visioneer = g_list_append (visioneer, g_strdup("0490")); - visioneer = g_list_append (visioneer, g_strdup("0491")); - visioneer = g_list_append (visioneer, g_strdup("0492")); - visioneer = g_list_append (visioneer, g_strdup("0493")); - visioneer = g_list_append (visioneer, g_strdup("0494")); - visioneer = g_list_append (visioneer, g_strdup("0495")); - visioneer = g_list_append (visioneer, g_strdup("0497")); - visioneer = g_list_append (visioneer, g_strdup("0498")); - visioneer = g_list_append (visioneer, g_strdup("0499")); - visioneer = g_list_append (visioneer, g_strdup("049a")); - visioneer = g_list_append (visioneer, g_strdup("049b")); - visioneer = g_list_append (visioneer, g_strdup("049c")); - visioneer = g_list_append (visioneer, g_strdup("049d")); - visioneer = g_list_append (visioneer, g_strdup("04a7")); - visioneer = g_list_append (visioneer, g_strdup("04ac")); - g_hash_table_insert (scanners, - g_strdup("04a7"), - visioneer); - GList* canon = NULL; - canon = g_list_append (canon, g_strdup("1601")); - canon = g_list_append (canon, g_strdup("1602")); - canon = g_list_append (canon, g_strdup("1603")); - canon = g_list_append (canon, g_strdup("1604")); - canon = g_list_append (canon, g_strdup("1606")); - canon = g_list_append (canon, g_strdup("1607")); - canon = g_list_append (canon, g_strdup("1608")); - canon = g_list_append (canon, g_strdup("1609")); - canon = g_list_append (canon, g_strdup("160a")); - canon = g_list_append (canon, g_strdup("160b")); - canon = g_list_append (canon, g_strdup("1706")); - canon = g_list_append (canon, g_strdup("1707")); - canon = g_list_append (canon, g_strdup("1708")); - canon = g_list_append (canon, g_strdup("1709")); - canon = g_list_append (canon, g_strdup("170a")); - canon = g_list_append (canon, g_strdup("170b")); - canon = g_list_append (canon, g_strdup("170c")); - canon = g_list_append (canon, g_strdup("170d")); - canon = g_list_append (canon, g_strdup("170e")); - canon = g_list_append (canon, g_strdup("1712")); - canon = g_list_append (canon, g_strdup("1713")); - canon = g_list_append (canon, g_strdup("1714")); - canon = g_list_append (canon, g_strdup("1715")); - canon = g_list_append (canon, g_strdup("1716")); - canon = g_list_append (canon, g_strdup("1717")); - canon = g_list_append (canon, g_strdup("1718")); - canon = g_list_append (canon, g_strdup("1719")); - canon = g_list_append (canon, g_strdup("171a")); - canon = g_list_append (canon, g_strdup("171b")); - canon = g_list_append (canon, g_strdup("171c")); - canon = g_list_append (canon, g_strdup("1721")); - canon = g_list_append (canon, g_strdup("1722")); - canon = g_list_append (canon, g_strdup("1723")); - canon = g_list_append (canon, g_strdup("1724")); - canon = g_list_append (canon, g_strdup("1725")); - canon = g_list_append (canon, g_strdup("1726")); - canon = g_list_append (canon, g_strdup("1727")); - canon = g_list_append (canon, g_strdup("1728")); - canon = g_list_append (canon, g_strdup("1729")); - canon = g_list_append (canon, g_strdup("172b")); - canon = g_list_append (canon, g_strdup("172c")); - canon = g_list_append (canon, g_strdup("172d")); - canon = g_list_append (canon, g_strdup("172e")); - canon = g_list_append (canon, g_strdup("172f")); - canon = g_list_append (canon, g_strdup("1730")); - canon = g_list_append (canon, g_strdup("1731")); - canon = g_list_append (canon, g_strdup("1732")); - canon = g_list_append (canon, g_strdup("1733")); - canon = g_list_append (canon, g_strdup("1734")); - canon = g_list_append (canon, g_strdup("1735")); - canon = g_list_append (canon, g_strdup("1736")); - canon = g_list_append (canon, g_strdup("173a")); - canon = g_list_append (canon, g_strdup("173b")); - canon = g_list_append (canon, g_strdup("173c")); - canon = g_list_append (canon, g_strdup("173d")); - canon = g_list_append (canon, g_strdup("173e")); - canon = g_list_append (canon, g_strdup("173f")); - canon = g_list_append (canon, g_strdup("1740")); - canon = g_list_append (canon, g_strdup("1741")); - canon = g_list_append (canon, g_strdup("1742")); - canon = g_list_append (canon, g_strdup("1901")); - canon = g_list_append (canon, g_strdup("1904")); - canon = g_list_append (canon, g_strdup("1905")); - canon = g_list_append (canon, g_strdup("1909")); - canon = g_list_append (canon, g_strdup("190a")); - canon = g_list_append (canon, g_strdup("2204")); - canon = g_list_append (canon, g_strdup("2206")); - canon = g_list_append (canon, g_strdup("2207")); - canon = g_list_append (canon, g_strdup("2208")); - canon = g_list_append (canon, g_strdup("220d")); - canon = g_list_append (canon, g_strdup("220e")); - canon = g_list_append (canon, g_strdup("2213")); - canon = g_list_append (canon, g_strdup("221c")); - canon = g_list_append (canon, g_strdup("2220")); - canon = g_list_append (canon, g_strdup("2222")); - canon = g_list_append (canon, g_strdup("262f")); - canon = g_list_append (canon, g_strdup("2630")); - canon = g_list_append (canon, g_strdup("263c")); - canon = g_list_append (canon, g_strdup("263d")); - canon = g_list_append (canon, g_strdup("263e")); - canon = g_list_append (canon, g_strdup("263f")); - canon = g_list_append (canon, g_strdup("264c")); - canon = g_list_append (canon, g_strdup("264d")); - canon = g_list_append (canon, g_strdup("264e")); - canon = g_list_append (canon, g_strdup("264f")); - canon = g_list_append (canon, g_strdup("2659")); - canon = g_list_append (canon, g_strdup("265d")); - canon = g_list_append (canon, g_strdup("265e")); - canon = g_list_append (canon, g_strdup("265f")); - canon = g_list_append (canon, g_strdup("2660")); - canon = g_list_append (canon, g_strdup("2684")); - canon = g_list_append (canon, g_strdup("2686")); - canon = g_list_append (canon, g_strdup("26a3")); - canon = g_list_append (canon, g_strdup("26b0")); - canon = g_list_append (canon, g_strdup("26b4")); - canon = g_list_append (canon, g_strdup("26b5")); - canon = g_list_append (canon, g_strdup("26ec")); - canon = g_list_append (canon, g_strdup("26ed")); - canon = g_list_append (canon, g_strdup("26ee")); - g_hash_table_insert (scanners, - g_strdup("04a9"), - canon); - - GList* nikon = NULL; - nikon = g_list_append (nikon, g_strdup ("4000")); - nikon = g_list_append (nikon, g_strdup ("4001")); - nikon = g_list_append (nikon, g_strdup ("4002")); - g_hash_table_insert (scanners, - g_strdup("04b0"), - nikon); - - GList* epson = NULL; - - // for testing (its a printer not a scanner!) - //epson = g_list_append (epson, g_strdup ("0001")); - - epson = g_list_append (epson, g_strdup("0101")); - epson = g_list_append (epson, g_strdup("0103")); - epson = g_list_append (epson, g_strdup("0104")); - epson = g_list_append (epson, g_strdup("0105")); - epson = g_list_append (epson, g_strdup("0106")); - epson = g_list_append (epson, g_strdup("0107")); - epson = g_list_append (epson, g_strdup("0109")); - epson = g_list_append (epson, g_strdup("010a")); - epson = g_list_append (epson, g_strdup("010b")); - epson = g_list_append (epson, g_strdup("010c")); - epson = g_list_append (epson, g_strdup("010e")); - epson = g_list_append (epson, g_strdup("010f")); - epson = g_list_append (epson, g_strdup("0110")); - epson = g_list_append (epson, g_strdup("0112")); - epson = g_list_append (epson, g_strdup("0114")); - epson = g_list_append (epson, g_strdup("011b")); - epson = g_list_append (epson, g_strdup("011c")); - epson = g_list_append (epson, g_strdup("011d")); - epson = g_list_append (epson, g_strdup("011e")); - epson = g_list_append (epson, g_strdup("011f")); - epson = g_list_append (epson, g_strdup("0120")); - epson = g_list_append (epson, g_strdup("0121")); - epson = g_list_append (epson, g_strdup("0122")); - epson = g_list_append (epson, g_strdup("0126")); - epson = g_list_append (epson, g_strdup("0128")); - epson = g_list_append (epson, g_strdup("0129")); - epson = g_list_append (epson, g_strdup("012a")); - epson = g_list_append (epson, g_strdup("012b")); - epson = g_list_append (epson, g_strdup("012c")); - epson = g_list_append (epson, g_strdup("0135")); - epson = g_list_append (epson, g_strdup("0801")); - epson = g_list_append (epson, g_strdup("0802")); - epson = g_list_append (epson, g_strdup("0805")); - epson = g_list_append (epson, g_strdup("0806")); - epson = g_list_append (epson, g_strdup("0807")); - epson = g_list_append (epson, g_strdup("0808")); - epson = g_list_append (epson, g_strdup("080c")); - epson = g_list_append (epson, g_strdup("080d")); - epson = g_list_append (epson, g_strdup("080e")); - epson = g_list_append (epson, g_strdup("080f")); - epson = g_list_append (epson, g_strdup("0810")); - epson = g_list_append (epson, g_strdup("0811")); - epson = g_list_append (epson, g_strdup("0813")); - epson = g_list_append (epson, g_strdup("0814")); - epson = g_list_append (epson, g_strdup("0815")); - epson = g_list_append (epson, g_strdup("0817")); - epson = g_list_append (epson, g_strdup("0818")); - epson = g_list_append (epson, g_strdup("0819")); - epson = g_list_append (epson, g_strdup("081a")); - epson = g_list_append (epson, g_strdup("081c")); - epson = g_list_append (epson, g_strdup("081d")); - epson = g_list_append (epson, g_strdup("081f")); - epson = g_list_append (epson, g_strdup("0820")); - epson = g_list_append (epson, g_strdup("0827")); - epson = g_list_append (epson, g_strdup("0828")); - epson = g_list_append (epson, g_strdup("0829")); - epson = g_list_append (epson, g_strdup("082a")); - epson = g_list_append (epson, g_strdup("082b")); - epson = g_list_append (epson, g_strdup("082e")); - epson = g_list_append (epson, g_strdup("082f")); - epson = g_list_append (epson, g_strdup("0830")); - epson = g_list_append (epson, g_strdup("0833")); - epson = g_list_append (epson, g_strdup("0834")); - epson = g_list_append (epson, g_strdup("0835")); - epson = g_list_append (epson, g_strdup("0836")); - epson = g_list_append (epson, g_strdup("0837")); - epson = g_list_append (epson, g_strdup("0838")); - epson = g_list_append (epson, g_strdup("0839")); - epson = g_list_append (epson, g_strdup("083a")); - epson = g_list_append (epson, g_strdup("083c")); - epson = g_list_append (epson, g_strdup("0841")); - epson = g_list_append (epson, g_strdup("0843")); - epson = g_list_append (epson, g_strdup("0844")); - epson = g_list_append (epson, g_strdup("0846")); - epson = g_list_append (epson, g_strdup("0847")); - epson = g_list_append (epson, g_strdup("0848")); - epson = g_list_append (epson, g_strdup("0849")); - epson = g_list_append (epson, g_strdup("084a")); - epson = g_list_append (epson, g_strdup("084c")); - epson = g_list_append (epson, g_strdup("084d")); - epson = g_list_append (epson, g_strdup("084f")); - epson = g_list_append (epson, g_strdup("0851")); - epson = g_list_append (epson, g_strdup("0854")); - epson = g_list_append (epson, g_strdup("0856")); - g_hash_table_insert (scanners, - g_strdup("04b8"), - epson); - - GList* fujitsu = NULL; - fujitsu = g_list_append (fujitsu, g_strdup ("1029")); - fujitsu = g_list_append (fujitsu, g_strdup ("1041")); - fujitsu = g_list_append (fujitsu, g_strdup ("1042")); - fujitsu = g_list_append (fujitsu, g_strdup ("1078")); - fujitsu = g_list_append (fujitsu, g_strdup ("1095")); - fujitsu = g_list_append (fujitsu, g_strdup ("1096")); - fujitsu = g_list_append (fujitsu, g_strdup ("1097")); - fujitsu = g_list_append (fujitsu, g_strdup ("10ad")); - fujitsu = g_list_append (fujitsu, g_strdup ("10ae")); - fujitsu = g_list_append (fujitsu, g_strdup ("10af")); - fujitsu = g_list_append (fujitsu, g_strdup ("10c7")); - fujitsu = g_list_append (fujitsu, g_strdup ("10cf")); - fujitsu = g_list_append (fujitsu, g_strdup ("10e0")); - fujitsu = g_list_append (fujitsu, g_strdup ("10e1")); - fujitsu = g_list_append (fujitsu, g_strdup ("10e2")); - fujitsu = g_list_append (fujitsu, g_strdup ("10e6")); - fujitsu = g_list_append (fujitsu, g_strdup ("10e7")); - fujitsu = g_list_append (fujitsu, g_strdup ("10ef")); - fujitsu = g_list_append (fujitsu, g_strdup ("10f2")); - fujitsu = g_list_append (fujitsu, g_strdup ("10fe")); - fujitsu = g_list_append (fujitsu, g_strdup ("1135")); - fujitsu = g_list_append (fujitsu, g_strdup ("114a")); - fujitsu = g_list_append (fujitsu, g_strdup ("114d")); - fujitsu = g_list_append (fujitsu, g_strdup ("114e")); - fujitsu = g_list_append (fujitsu, g_strdup ("114f")); - fujitsu = g_list_append (fujitsu, g_strdup ("1150")); - fujitsu = g_list_append (fujitsu, g_strdup ("1155")); - fujitsu = g_list_append (fujitsu, g_strdup ("1156")); - fujitsu = g_list_append (fujitsu, g_strdup ("116f")); - fujitsu = g_list_append (fujitsu, g_strdup ("1174")); - fujitsu = g_list_append (fujitsu, g_strdup ("1175")); - fujitsu = g_list_append (fujitsu, g_strdup ("1176")); - fujitsu = g_list_append (fujitsu, g_strdup ("1177")); - fujitsu = g_list_append (fujitsu, g_strdup ("1178")); - fujitsu = g_list_append (fujitsu, g_strdup ("117f")); - fujitsu = g_list_append (fujitsu, g_strdup ("119d")); - fujitsu = g_list_append (fujitsu, g_strdup ("119e")); - fujitsu = g_list_append (fujitsu, g_strdup ("119f")); - fujitsu = g_list_append (fujitsu, g_strdup ("11a0")); - fujitsu = g_list_append (fujitsu, g_strdup ("11a2")); - fujitsu = g_list_append (fujitsu, g_strdup ("11ed")); - fujitsu = g_list_append (fujitsu, g_strdup ("11ee")); - fujitsu = g_list_append (fujitsu, g_strdup ("11ef")); - fujitsu = g_list_append (fujitsu, g_strdup ("11f1")); - fujitsu = g_list_append (fujitsu, g_strdup ("11f2")); - fujitsu = g_list_append (fujitsu, g_strdup ("11f3")); - fujitsu = g_list_append (fujitsu, g_strdup ("11f4")); - fujitsu = g_list_append (fujitsu, g_strdup ("11fc")); - g_hash_table_insert (scanners, - g_strdup("04c5"), - fujitsu); - GList* konica = NULL; - konica = g_list_append (konica, g_strdup ("0722")); - g_hash_table_insert (scanners, - g_strdup("04c8"), - konica); - GList* panasonic = NULL; - panasonic = g_list_append (panasonic, g_strdup ("1000")); - panasonic = g_list_append (panasonic, g_strdup ("1001")); - panasonic = g_list_append (panasonic, g_strdup ("1006")); - panasonic = g_list_append (panasonic, g_strdup ("1007")); - panasonic = g_list_append (panasonic, g_strdup ("1009")); - panasonic = g_list_append (panasonic, g_strdup ("100a")); - panasonic = g_list_append (panasonic, g_strdup ("100f")); - panasonic = g_list_append (panasonic, g_strdup ("1010")); - g_hash_table_insert (scanners, - g_strdup("04da"), - panasonic); - - GList* samsung = NULL; - - samsung = g_list_append (samsung, g_strdup ("341b")); - samsung = g_list_append (samsung, g_strdup ("341f")); - samsung = g_list_append (samsung, g_strdup ("3426")); - samsung = g_list_append (samsung, g_strdup ("342a")); - samsung = g_list_append (samsung, g_strdup ("342b")); - samsung = g_list_append (samsung, g_strdup ("342c")); - samsung = g_list_append (samsung, g_strdup ("3433")); - samsung = g_list_append (samsung, g_strdup ("3434")); - samsung = g_list_append (samsung, g_strdup ("343c")); - samsung = g_list_append (samsung, g_strdup ("3434")); - g_hash_table_insert (scanners, - g_strdup("04e8"), - samsung); - - GList* pentax = NULL; - pentax = g_list_append (pentax, g_strdup ("2038")); - g_hash_table_insert (scanners, - g_strdup("04f9"), - pentax); - - GList* apitek = NULL; - apitek = g_list_append (apitek, g_strdup ("0202")); - g_hash_table_insert (scanners, - g_strdup("0553"), - apitek); - - GList* mustek = NULL; - mustek = g_list_append (mustek, g_strdup ("0001")); - mustek = g_list_append (mustek, g_strdup ("0002")); - mustek = g_list_append (mustek, g_strdup ("0006")); - mustek = g_list_append (mustek, g_strdup ("0008")); - mustek = g_list_append (mustek, g_strdup ("0010")); - mustek = g_list_append (mustek, g_strdup ("0210")); - mustek = g_list_append (mustek, g_strdup ("0218")); - mustek = g_list_append (mustek, g_strdup ("0219")); - mustek = g_list_append (mustek, g_strdup ("021a")); - mustek = g_list_append (mustek, g_strdup ("021b")); - mustek = g_list_append (mustek, g_strdup ("021c")); - mustek = g_list_append (mustek, g_strdup ("021d")); - mustek = g_list_append (mustek, g_strdup ("021e")); - mustek = g_list_append (mustek, g_strdup ("021f")); - mustek = g_list_append (mustek, g_strdup ("0409")); - g_hash_table_insert (scanners, - g_strdup("055f"), - mustek); - GList* artec = NULL; - artec = g_list_append (artec, g_strdup ("4002")); - artec = g_list_append (artec, g_strdup ("4003")); - artec = g_list_append (artec, g_strdup ("4004")); - artec = g_list_append (artec, g_strdup ("4005")); - artec = g_list_append (artec, g_strdup ("4006")); - artec = g_list_append (artec, g_strdup ("4007")); - artec = g_list_append (artec, g_strdup ("4009")); - artec = g_list_append (artec, g_strdup ("4010")); - artec = g_list_append (artec, g_strdup ("4011")); - g_hash_table_insert (scanners, - g_strdup("05d8"), - artec); - - GList* microtek = NULL; - microtek = g_list_append (microtek, g_strdup ("0099")); - microtek = g_list_append (microtek, g_strdup ("009a")); - microtek = g_list_append (microtek, g_strdup ("00a3")); - microtek = g_list_append (microtek, g_strdup ("00b6")); - microtek = g_list_append (microtek, g_strdup ("30cf")); - microtek = g_list_append (microtek, g_strdup ("30d4")); - microtek = g_list_append (microtek, g_strdup ("40b3")); - microtek = g_list_append (microtek, g_strdup ("40b8")); - microtek = g_list_append (microtek, g_strdup ("40ca")); - microtek = g_list_append (microtek, g_strdup ("40cb")); - microtek = g_list_append (microtek, g_strdup ("40dd")); - microtek = g_list_append (microtek, g_strdup ("40ff")); - microtek = g_list_append (microtek, g_strdup ("80a3")); - g_hash_table_insert (scanners, - g_strdup("05da"), - microtek); - - GList* avision = NULL; - avision = g_list_append (avision, g_strdup ("0268")); - avision = g_list_append (avision, g_strdup ("026a")); - avision = g_list_append (avision, g_strdup ("0a13")); - avision = g_list_append (avision, g_strdup ("0a15")); - avision = g_list_append (avision, g_strdup ("0a16")); - avision = g_list_append (avision, g_strdup ("0a18")); - avision = g_list_append (avision, g_strdup ("0a19")); - avision = g_list_append (avision, g_strdup ("0a23")); - avision = g_list_append (avision, g_strdup ("0a24")); - avision = g_list_append (avision, g_strdup ("0a25")); - avision = g_list_append (avision, g_strdup ("0a27")); - avision = g_list_append (avision, g_strdup ("0a2a")); - avision = g_list_append (avision, g_strdup ("0a2b")); - avision = g_list_append (avision, g_strdup ("0a2c")); - avision = g_list_append (avision, g_strdup ("0a2d")); - avision = g_list_append (avision, g_strdup ("0a2e")); - avision = g_list_append (avision, g_strdup ("0a2f")); - avision = g_list_append (avision, g_strdup ("0a33")); - avision = g_list_append (avision, g_strdup ("0a3a")); - avision = g_list_append (avision, g_strdup ("0a3c")); - avision = g_list_append (avision, g_strdup ("0a40")); - avision = g_list_append (avision, g_strdup ("0a41")); - avision = g_list_append (avision, g_strdup ("0a45")); - avision = g_list_append (avision, g_strdup ("0a4d")); - avision = g_list_append (avision, g_strdup ("0a4e")); - avision = g_list_append (avision, g_strdup ("0a4f")); - avision = g_list_append (avision, g_strdup ("0a5e")); - avision = g_list_append (avision, g_strdup ("0a61")); - avision = g_list_append (avision, g_strdup ("0a65")); - avision = g_list_append (avision, g_strdup ("0a66")); - avision = g_list_append (avision, g_strdup ("0a68")); - avision = g_list_append (avision, g_strdup ("0a82")); - avision = g_list_append (avision, g_strdup ("0a84")); - avision = g_list_append (avision, g_strdup ("0a93")); - avision = g_list_append (avision, g_strdup ("0a94")); - avision = g_list_append (avision, g_strdup ("0aa1")); - avision = g_list_append (avision, g_strdup ("1a35")); - g_hash_table_insert (scanners, - g_strdup("0638"), - avision); - GList* minolta = NULL; - minolta = g_list_append (minolta, g_strdup ("4004")); - minolta = g_list_append (minolta, g_strdup ("400d")); - minolta = g_list_append (minolta, g_strdup ("400e")); - g_hash_table_insert (scanners, - g_strdup("0686"), - minolta); - - GList* agfa = NULL; - agfa = g_list_append (agfa, g_strdup ("0001")); - agfa = g_list_append (agfa, g_strdup ("0002")); - agfa = g_list_append (agfa, g_strdup ("0100")); - agfa = g_list_append (agfa, g_strdup ("2061")); - agfa = g_list_append (agfa, g_strdup ("208d")); - agfa = g_list_append (agfa, g_strdup ("208f")); - agfa = g_list_append (agfa, g_strdup ("2091")); - agfa = g_list_append (agfa, g_strdup ("2093")); - agfa = g_list_append (agfa, g_strdup ("2095")); - agfa = g_list_append (agfa, g_strdup ("2097")); - agfa = g_list_append (agfa, g_strdup ("20fd")); - agfa = g_list_append (agfa, g_strdup ("20ff")); - g_hash_table_insert (scanners, - g_strdup("06bd"), - minolta); - - GList* umax_2 = NULL; - umax_2 = g_list_append (umax_2, g_strdup ("0020")); - g_hash_table_insert (scanners, - g_strdup("06dc"), - umax_2); - - GList* plustek = NULL; - - plustek = g_list_append (plustek, g_strdup ("0001")); - plustek = g_list_append (plustek, g_strdup ("0010")); - plustek = g_list_append (plustek, g_strdup ("0011")); - plustek = g_list_append (plustek, g_strdup ("0013")); - plustek = g_list_append (plustek, g_strdup ("0015")); - plustek = g_list_append (plustek, g_strdup ("0017")); - plustek = g_list_append (plustek, g_strdup ("0400")); - plustek = g_list_append (plustek, g_strdup ("0401")); - plustek = g_list_append (plustek, g_strdup ("0402")); - plustek = g_list_append (plustek, g_strdup ("0403")); - plustek = g_list_append (plustek, g_strdup ("040b")); - plustek = g_list_append (plustek, g_strdup ("040e")); - plustek = g_list_append (plustek, g_strdup ("0412")); - plustek = g_list_append (plustek, g_strdup ("0413")); - plustek = g_list_append (plustek, g_strdup ("0422")); - plustek = g_list_append (plustek, g_strdup ("0454")); - plustek = g_list_append (plustek, g_strdup ("045f")); - plustek = g_list_append (plustek, g_strdup ("0462")); - plustek = g_list_append (plustek, g_strdup ("0900")); - g_hash_table_insert (scanners, - g_strdup("07b3"), - plustek); - - GList* corex = NULL; - corex = g_list_append (corex, g_strdup ("0002")); - corex = g_list_append (corex, g_strdup ("0005")); - g_hash_table_insert (scanners, - g_strdup("08f0"), - corex); - - GList* xerox = NULL; - xerox = g_list_append (xerox, g_strdup ("3d5d")); - xerox = g_list_append (xerox, g_strdup ("3da4")); - xerox = g_list_append (xerox, g_strdup ("420c")); - xerox = g_list_append (xerox, g_strdup ("4265")); - xerox = g_list_append (xerox, g_strdup ("4293")); - xerox = g_list_append (xerox, g_strdup ("4294")); - g_hash_table_insert (scanners, - g_strdup("0924"), - xerox); - - GList* pentax_2 = NULL; - pentax_2 = g_list_append (pentax_2, g_strdup ("3210")); - g_hash_table_insert (scanners, - g_strdup("0a17"), - pentax_2); - - GList* portable = NULL; - portable = g_list_append (portable, g_strdup ("1000")); - g_hash_table_insert (scanners, - g_strdup("0a53"), - portable); - - GList* syscan = NULL; - syscan = g_list_append (syscan, g_strdup ("4600")); - syscan = g_list_append (syscan, g_strdup ("4802")); - syscan = g_list_append (syscan, g_strdup ("4803")); - syscan = g_list_append (syscan, g_strdup ("480c")); - syscan = g_list_append (syscan, g_strdup ("4810")); - syscan = g_list_append (syscan, g_strdup ("6620")); - g_hash_table_insert (scanners, - g_strdup("0a82"), - syscan); - - GList* canon_2 = NULL; - canon_2 = g_list_append (canon_2, g_strdup ("160c")); - canon_2 = g_list_append (canon_2, g_strdup ("160f")); - canon_2 = g_list_append (canon_2, g_strdup ("1614")); - canon_2 = g_list_append (canon_2, g_strdup ("1617")); - canon_2 = g_list_append (canon_2, g_strdup ("1618")); - canon_2 = g_list_append (canon_2, g_strdup ("161a")); - canon_2 = g_list_append (canon_2, g_strdup ("161b")); - canon_2 = g_list_append (canon_2, g_strdup ("161d")); - canon_2 = g_list_append (canon_2, g_strdup ("1620")); - canon_2 = g_list_append (canon_2, g_strdup ("1622")); - canon_2 = g_list_append (canon_2, g_strdup ("1623")); - canon_2 = g_list_append (canon_2, g_strdup ("1624")); - canon_2 = g_list_append (canon_2, g_strdup ("1626")); - canon_2 = g_list_append (canon_2, g_strdup ("162b")); - canon_2 = g_list_append (canon_2, g_strdup ("1638")); - canon_2 = g_list_append (canon_2, g_strdup ("1639")); - g_hash_table_insert (scanners, - g_strdup("1083"), - canon_2); - - GList* digital = NULL; - digital = g_list_append (digital, g_strdup ("0001")); - g_hash_table_insert (scanners, - g_strdup("1183"), - digital); - - GList* konica_2 = NULL; - konica_2 = g_list_append (konica_2, g_strdup ("2089")); - g_hash_table_insert (scanners, - g_strdup("132b"), - konica_2); - - GList* umax = NULL; - umax = g_list_append (umax, g_strdup ("0010")); - umax = g_list_append (umax, g_strdup ("0030")); - umax = g_list_append (umax, g_strdup ("0050")); - umax = g_list_append (umax, g_strdup ("0060")); - umax = g_list_append (umax, g_strdup ("0070")); - umax = g_list_append (umax, g_strdup ("0130")); - umax = g_list_append (umax, g_strdup ("0160")); - umax = g_list_append (umax, g_strdup ("0230")); - g_hash_table_insert (scanners, - g_strdup("1606"), - umax); - - GList* docketport = NULL; - docketport = g_list_append (docketport, g_strdup ("4810")); - g_hash_table_insert (scanners, - g_strdup("1dcc"), - docketport); - - GList* dell = NULL; - dell = g_list_append (dell, g_strdup ("5105")); - dell = g_list_append (dell, g_strdup ("5124")); - dell = g_list_append (dell, g_strdup ("5250")); - g_hash_table_insert (scanners, - g_strdup("413c"), - dell); -} diff --git a/src/session-dbus.c b/src/session-dbus.c index 232e440..4ece444 100644 --- a/src/session-dbus.c +++ b/src/session-dbus.c @@ -7,16 +7,16 @@ Authors: Ted Gould <ted@canonical.com> Conor Curran <conor.curran@canonical.com> -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along +You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -27,7 +27,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <gio/gio.h> #include "session-dbus.h" -#include "dbus-shared-names.h" +#include "shared-names.h" static GVariant * get_users_real_name (SessionDbus * service); static void bus_get_cb (GObject * object, GAsyncResult * res, gpointer user_data); @@ -38,7 +38,6 @@ static void bus_method_call (GDBusConnection * connection, const gchar * sender, typedef struct _SessionDbusPrivate SessionDbusPrivate; struct _SessionDbusPrivate { gchar * name; - gboolean user_menu_is_visible; GDBusConnection * bus; GCancellable * bus_cancel; guint dbus_registration; @@ -104,7 +103,6 @@ session_dbus_init (SessionDbus *self) priv->bus = NULL; priv->bus_cancel = NULL; priv->dbus_registration = 0; - priv->user_menu_is_visible = FALSE; priv->bus_cancel = g_cancellable_new(); g_bus_get(G_BUS_TYPE_SESSION, @@ -164,16 +162,12 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, GDBusMethodInvocation * invocation, gpointer user_data) { SessionDbus * service = SESSION_DBUS (user_data); - SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE (service); GVariant * retval = NULL; if (g_strcmp0(method, "GetUserRealName") == 0) { retval = get_users_real_name (service); } - else if (g_strcmp0 (method, "GetUserMenuVisibility") == 0){ - retval = g_variant_new ("(b)", priv->user_menu_is_visible); - } else { g_warning("Calling method '%s' on the indicator service and it's unknown", method); } @@ -212,10 +206,7 @@ session_dbus_finalize (GObject *object) { SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(object); - if (priv->name != NULL) { - g_free(priv->name); - priv->name = NULL; - } + g_clear_pointer (&priv->name, g_free); G_OBJECT_CLASS (session_dbus_parent_class)->finalize (object); return; @@ -225,7 +216,7 @@ static GVariant * get_users_real_name (SessionDbus * service) { SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(service); - return g_variant_new ("(s)", priv->name); + return g_variant_new ("(s)", priv->name ? priv->name : ""); } SessionDbus * @@ -244,11 +235,8 @@ session_dbus_set_users_real_name (SessionDbus * session, const gchar * name) { SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(session); GError * error = NULL; - if (priv->name != NULL) { - g_free(priv->name); - priv->name = NULL; - } - + + g_free (priv->name); priv->name = g_strdup(name); if (priv->bus != NULL) { @@ -269,36 +257,11 @@ session_dbus_set_users_real_name (SessionDbus * session, const gchar * name) return; } -void -session_dbus_set_user_menu_visibility (SessionDbus* session, - gboolean visible) -{ - SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(session); - GError * error = NULL; - - priv->user_menu_is_visible = visible; - - if (priv->bus != NULL) { - g_dbus_connection_emit_signal (priv->bus, - NULL, - INDICATOR_SESSION_SERVICE_DBUS_OBJECT, - INDICATOR_SESSION_SERVICE_DBUS_IFACE, - "UserMenuIsVisible", - g_variant_new ("(b)", priv->user_menu_is_visible), - &error); - - if (error != NULL) { - g_warning("Unable to send UserMenuIsVisible signal: %s", error->message); - g_error_free(error); - } - } -} - void session_dbus_restart_required (SessionDbus* session) { SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(session); GError * error = NULL; - + if (priv->bus != NULL) { g_debug("About to send RebootRequired signal"); @@ -314,6 +277,6 @@ void session_dbus_restart_required (SessionDbus* session) g_warning("Unable to send reboot-required signal: %s", error->message); g_error_free(error); } - } - + } + } diff --git a/src/session-dbus.h b/src/session-dbus.h index 4dc340a..7520f06 100644 --- a/src/session-dbus.h +++ b/src/session-dbus.h @@ -50,7 +50,6 @@ GType session_dbus_get_type (void); SessionDbus * session_dbus_new (void); void session_dbus_set_name (SessionDbus * session, const gchar * name); void session_dbus_set_users_real_name (SessionDbus * session, const gchar * name); -void session_dbus_set_user_menu_visibility (SessionDbus* session, gboolean visible); void session_dbus_restart_required (SessionDbus* session); G_END_DECLS diff --git a/src/session-menu-mgr.c b/src/session-menu-mgr.c new file mode 100644 index 0000000..96fc2a0 --- /dev/null +++ b/src/session-menu-mgr.c @@ -0,0 +1,1172 @@ +/* +Copyright 2011 Canonical Ltd. + +Authors: + Charles Kerr <charles.kerr@canonical.com> + Conor Curran <conor.curran@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "config.h" + +#include <sys/types.h> +#include <pwd.h> /* geteuid(), getpwuid() */ + +#include <glib.h> +#include <glib/gi18n.h> + +#include <libdbusmenu-glib/client.h> +#include <libdbusmenu-gtk/menuitem.h> + +#include "dbus-upower.h" +#include "session-menu-mgr.h" +#include "shared-names.h" +#include "users-service-dbus.h" + +#define DEBUG_SHOW_ALL FALSE + +#define UPOWER_ADDRESS "org.freedesktop.UPower" +#define UPOWER_PATH "/org/freedesktop/UPower" + +#define CMD_HELP "yelp" +#define CMD_INFO "gnome-control-center info" +#define CMD_SYSTEM_SETTINGS "gnome-control-center" +#ifdef HAVE_GTKLOGOUTHELPER + #define HAVE_RESTART_CMD TRUE + #define CMD_RESTART LIBEXECDIR"/gtk-logout-helper --restart" + #define CMD_LOGOUT LIBEXECDIR"/gtk-logout-helper --logout" + #define CMD_SHUTDOWN LIBEXECDIR"/gtk-logout-helper --shutdown" +#else + #define HAVE_RESTART_CMD FALSE /* hmm, no gnome-session-quit --restart? */ + #define CMD_RESTART "" + #define CMD_LOGOUT "gnome-session-quit --logout" + #define CMD_SHUTDOWN "gnome-session-quit --power-off" +#endif + +/** + * Which switch menuitem to show -- based on lockdown settings, + * greeter mode, number of users in the system, and so on. + * See get_switcher_mode() + */ +typedef enum +{ + SWITCHER_MODE_SCREENSAVER, + SWITCHER_MODE_LOCK, + SWITCHER_MODE_SWITCH, + SWITCHER_MODE_SWITCH_OR_LOCK +} +SwitcherMode; + +/** + * Creates and manages the menumodel and associated actions for the + * session menu described at <https://wiki.ubuntu.com/SystemMenu>. + * + * This is a pretty straightforward class: it creates the menumodel + * and listens for events that can affect the model's properties. + * + * Simple event sources, such as GSettings and a UPower DBus proxy, + * are handled here. More involved event sources are delegated to the + * UsersServiceDBus facade class. + */ +struct _SessionMenuMgr +{ + GObject parent_instance; + + DbusmenuMenuitem * top_mi; + DbusmenuMenuitem * screensaver_mi; + DbusmenuMenuitem * lock_mi; + DbusmenuMenuitem * lock_switch_mi; + DbusmenuMenuitem * guest_mi; + DbusmenuMenuitem * logout_mi; + DbusmenuMenuitem * suspend_mi; + DbusmenuMenuitem * hibernate_mi; + DbusmenuMenuitem * restart_mi; + DbusmenuMenuitem * shutdown_mi; + + GSList * user_menuitems; + gint user_menuitem_index; + + GSettings * lockdown_settings; + GSettings * indicator_settings; + GSettings * keybinding_settings; + + /* cached settings taken from the upower proxy */ + gboolean can_hibernate; + gboolean can_suspend; + gboolean allow_hibernate; + gboolean allow_suspend; + + gboolean greeter_mode; + + GCancellable * cancellable; + DBusUPower * upower_proxy; + SessionDbus * session_dbus; + UsersServiceDbus * users_dbus_facade; +}; + +static SwitcherMode get_switcher_mode (SessionMenuMgr *); + +static void init_upower_proxy (SessionMenuMgr *); + +static void update_screensaver_shortcut (SessionMenuMgr *); +static void update_user_menuitems (SessionMenuMgr *); +static void update_session_menuitems (SessionMenuMgr *); +static void update_confirmation_labels (SessionMenuMgr *); + +static void action_func_lock (SessionMenuMgr *); +static void action_func_suspend (SessionMenuMgr *); +static void action_func_hibernate (SessionMenuMgr *); +static void action_func_switch_to_lockscreen (SessionMenuMgr *); +static void action_func_switch_to_greeter (SessionMenuMgr *); +static void action_func_switch_to_guest (SessionMenuMgr *); +static void action_func_switch_to_user (AccountsUser *); +static void action_func_spawn_async (const char * cmd); + +static gboolean is_this_guest_session (void); +static gboolean is_this_live_session (void); + +static void on_guest_logged_in_changed (UsersServiceDbus *, + SessionMenuMgr *); + +static void on_user_logged_in_changed (UsersServiceDbus *, + AccountsUser *, + SessionMenuMgr *); + +/** +*** GObject init / dispose +**/ + +G_DEFINE_TYPE (SessionMenuMgr, session_menu_mgr, G_TYPE_OBJECT); + +static void +session_menu_mgr_init (SessionMenuMgr *mgr) +{ + mgr->top_mi = dbusmenu_menuitem_new (); + + /* Lockdown settings */ + GSettings * s = g_settings_new ("org.gnome.desktop.lockdown"); + g_signal_connect_swapped (s, "changed::disable-log-out", + G_CALLBACK(update_session_menuitems), mgr); + g_signal_connect_swapped (s, "changed::disable-lock-screen", + G_CALLBACK(update_user_menuitems), mgr); + g_signal_connect_swapped (s, "changed::disable-user-switching", + G_CALLBACK(update_user_menuitems), mgr); + mgr->lockdown_settings = s; + + /* Indicator settings */ + s = g_settings_new ("com.canonical.indicator.session"); + g_signal_connect_swapped (s, "changed::suppress-logout-restart-shutdown", + G_CALLBACK(update_confirmation_labels), mgr); + g_signal_connect_swapped (s, "changed::suppress-logout-menuitem", + G_CALLBACK(update_session_menuitems), mgr); + g_signal_connect_swapped (s, "changed::suppress-restart-menuitem", + G_CALLBACK(update_session_menuitems), mgr); + g_signal_connect_swapped (s, "changed::suppress-shutdown-menuitem", + G_CALLBACK(update_session_menuitems), mgr); + mgr->indicator_settings = s; + + /* Keybinding settings */ + s = g_settings_new ("org.gnome.settings-daemon.plugins.media-keys"); + g_signal_connect_swapped (s, "changed::screensaver", + G_CALLBACK(update_screensaver_shortcut), mgr); + mgr->keybinding_settings = s; + + /* listen for user events */ + mgr->users_dbus_facade = g_object_new (USERS_SERVICE_DBUS_TYPE, NULL); + g_signal_connect_swapped (mgr->users_dbus_facade, "user-list-changed", + G_CALLBACK (update_user_menuitems), mgr); + g_signal_connect (mgr->users_dbus_facade, "user-logged-in-changed", + G_CALLBACK(on_user_logged_in_changed), mgr); + g_signal_connect (mgr->users_dbus_facade, "guest-logged-in-changed", + G_CALLBACK(on_guest_logged_in_changed), mgr); + + init_upower_proxy (mgr); +} + +static void +session_menu_mgr_dispose (GObject *object) +{ + SessionMenuMgr * mgr = SESSION_MENU_MGR (object); + + if (mgr->cancellable != NULL) + { + g_cancellable_cancel (mgr->cancellable); + g_clear_object (&mgr->cancellable); + } + + g_clear_object (&mgr->indicator_settings); + g_clear_object (&mgr->lockdown_settings); + g_clear_object (&mgr->keybinding_settings); + g_clear_object (&mgr->upower_proxy); + g_clear_object (&mgr->users_dbus_facade); + g_clear_object (&mgr->top_mi); + g_clear_object (&mgr->session_dbus); + + g_slist_free (mgr->user_menuitems); + mgr->user_menuitems = NULL; + + G_OBJECT_CLASS (session_menu_mgr_parent_class)->dispose (object); +} + +static void +session_menu_mgr_class_init (SessionMenuMgrClass * klass) +{ + GObjectClass* object_class = G_OBJECT_CLASS (klass); + object_class->dispose = session_menu_mgr_dispose; +} + +/*** +**** UPower Proxy: +**** +**** 1. While bootstrapping, we invoke the AllowSuspend and AllowHibernate +**** methods to find out whether or not those features are allowed. +**** 2. While bootstrapping, we get the CanSuspend and CanHibernate properties +**** and also listen for property changes. +**** 3. These four values are used to set suspend and hibernate's visibility. +**** +***/ + +static void +on_upower_properties_changed (SessionMenuMgr * mgr) +{ + gboolean b; + gboolean need_refresh = FALSE; + + /* suspend */ + b = dbus_upower_get_can_suspend (mgr->upower_proxy); + if (mgr->can_suspend != b) + { + mgr->can_suspend = b; + need_refresh = TRUE; + } + + /* hibernate */ + b = dbus_upower_get_can_hibernate (mgr->upower_proxy); + if (mgr->can_hibernate != b) + { + mgr->can_hibernate = b; + need_refresh = TRUE; + } + + if (need_refresh) + { + update_session_menuitems (mgr); + } +} + +static void +init_upower_proxy (SessionMenuMgr * mgr) +{ + /* default values */ + mgr->can_suspend = TRUE; + mgr->can_hibernate = TRUE; + mgr->allow_suspend = TRUE; + mgr->allow_hibernate = TRUE; + + mgr->cancellable = g_cancellable_new (); + + GError * error = NULL; + mgr->upower_proxy = dbus_upower_proxy_new_for_bus_sync ( + G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + UPOWER_ADDRESS, + UPOWER_PATH, + NULL, + &error); + if (error != NULL) + { + g_warning ("Error creating upower proxy: %s", error->message); + g_clear_error (&error); + } + else + { + dbus_upower_call_suspend_allowed_sync (mgr->upower_proxy, + &mgr->allow_suspend, + NULL, + &error); + if (error != NULL) + { + g_warning ("%s: %s", G_STRFUNC, error->message); + g_clear_error (&error); + } + + dbus_upower_call_hibernate_allowed_sync (mgr->upower_proxy, + &mgr->allow_hibernate, + NULL, + &error); + if (error != NULL) + { + g_warning ("%s: %s", G_STRFUNC, error->message); + g_clear_error (&error); + } + + on_upower_properties_changed (mgr); + g_signal_connect_swapped (mgr->upower_proxy, "changed", + G_CALLBACK(on_upower_properties_changed), mgr); + } +} + +/*** +**** Menuitem Helpers +***/ + +static inline void +mi_set_label (DbusmenuMenuitem * mi, const char * str) +{ + dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, str); +} + +static inline void +mi_set_type (DbusmenuMenuitem * mi, const char * str) +{ + dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_TYPE, str); +} + +static inline void +mi_set_visible (DbusmenuMenuitem * mi, gboolean b) +{ + dbusmenu_menuitem_property_set_bool (mi, DBUSMENU_MENUITEM_PROP_VISIBLE, + b || DEBUG_SHOW_ALL); +} + +static inline void +mi_set_logged_in (DbusmenuMenuitem * mi, gboolean b) +{ + dbusmenu_menuitem_property_set_bool (mi, USER_ITEM_PROP_LOGGED_IN, b); +} + +static DbusmenuMenuitem* +mi_new_separator (void) +{ + DbusmenuMenuitem * mi = dbusmenu_menuitem_new (); + mi_set_type (mi, DBUSMENU_CLIENT_TYPES_SEPARATOR); + return mi; +} + +static DbusmenuMenuitem* +mi_new (const char * label) +{ + DbusmenuMenuitem * mi = dbusmenu_menuitem_new (); + mi_set_label (mi, label); + return mi; +} + +/*** +**** Admin Menuitems +**** <https://wiki.ubuntu.com/SystemMenu#Admin_items> +***/ + +static void +build_admin_menuitems (SessionMenuMgr * mgr) +{ + if (!mgr->greeter_mode) + { + DbusmenuMenuitem * mi; + const gboolean show_settings = !mgr->greeter_mode; + + mi = mi_new (_("About This Computer")); + dbusmenu_menuitem_child_append (mgr->top_mi, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK(action_func_spawn_async), CMD_INFO); + + mi = mi_new (_("Ubuntu Help")); + dbusmenu_menuitem_child_append (mgr->top_mi, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK(action_func_spawn_async), CMD_HELP); + + mi = mi_new_separator (); + mi_set_visible (mi, show_settings); + dbusmenu_menuitem_child_append (mgr->top_mi, mi); + + mi = mi_new (_("System Settings\342\200\246")); + mi_set_visible (mi, show_settings); + dbusmenu_menuitem_child_append (mgr->top_mi, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK(action_func_spawn_async), + CMD_SYSTEM_SETTINGS); + + mi = mi_new_separator (); + dbusmenu_menuitem_child_append (mgr->top_mi, mi); + } +} + +/*** +**** Session Menuitems +**** <https://wiki.ubuntu.com/SystemMenu#Session_items> +***/ + +static void +update_session_menuitems (SessionMenuMgr * mgr) +{ + gboolean v; + GSettings * s = mgr->indicator_settings; + + v = !mgr->greeter_mode + && !is_this_live_session() + && !g_settings_get_boolean (mgr->lockdown_settings, "disable-log-out") + && !g_settings_get_boolean (s, "suppress-logout-menuitem"); + mi_set_visible (mgr->logout_mi, v); + + v = mgr->can_suspend + && mgr->allow_suspend; + mi_set_visible (mgr->suspend_mi, v); + + v = mgr->can_hibernate + && mgr->allow_hibernate; + mi_set_visible (mgr->hibernate_mi, v); + + v = HAVE_RESTART_CMD + && !g_settings_get_boolean (s, "suppress-restart-menuitem"); + mi_set_visible (mgr->restart_mi, v); + + v = !g_settings_get_boolean (s, "suppress-shutdown-menuitem"); + mi_set_visible (mgr->shutdown_mi, v); +} + +/* Update the ellipses when the confirmation setting changes. + * + * <http://developer.gnome.org/hig-book/3.0/menus-design.html.en>: + * "Label the menu item with a trailing ellipsis ("...") only if the + * command requires further input from the user before it can be performed." + */ +static void +update_confirmation_labels (SessionMenuMgr * mgr) +{ + const gboolean confirm_needed = !g_settings_get_boolean ( + mgr->indicator_settings, + "suppress-logout-restart-shutdown"); + + mi_set_label (mgr->logout_mi, confirm_needed ? _("Log Out\342\200\246") + : _("Log Out")); + + mi_set_label (mgr->shutdown_mi, confirm_needed ? _("Switch Off\342\200\246") + : _("Switch Off")); + + dbusmenu_menuitem_property_set (mgr->restart_mi, RESTART_ITEM_LABEL, + confirm_needed ? _("Restart\342\200\246") + : _("Restart")); +} + +static void +build_session_menuitems (SessionMenuMgr* mgr) +{ + DbusmenuMenuitem * mi; + + mi = mgr->logout_mi = mi_new (_("Log Out\342\200\246")); + dbusmenu_menuitem_child_append (mgr->top_mi, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK(action_func_spawn_async), CMD_LOGOUT); + + mi = mgr->suspend_mi = mi_new ("Suspend"); + dbusmenu_menuitem_child_append (mgr->top_mi, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK(action_func_suspend), mgr); + + mi = mgr->hibernate_mi = mi_new (_("Hibernate")); + dbusmenu_menuitem_child_append (mgr->top_mi, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK(action_func_hibernate), mgr); + + mi = mgr->restart_mi = dbusmenu_menuitem_new (); + mi_set_type (mi, RESTART_ITEM_TYPE); + dbusmenu_menuitem_property_set (mi, RESTART_ITEM_LABEL, _("Restart\342\200\246")); + dbusmenu_menuitem_child_append (mgr->top_mi, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK(action_func_spawn_async), CMD_RESTART); + + mi = mgr->shutdown_mi = mi_new (_("Switch Off\342\200\246")); + dbusmenu_menuitem_child_append (mgr->top_mi, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK(action_func_spawn_async), CMD_SHUTDOWN); + + update_confirmation_labels (mgr); + update_session_menuitems (mgr); +} + +/**** +***** User Menuitems +***** https://wiki.ubuntu.com/SystemMenu#Account-switching_items +****/ + +/* Local extensions to AccountsUser */ + +static GQuark +get_menuitem_quark (void) +{ + static GQuark q = 0; + + if (G_UNLIKELY(!q)) + { + q = g_quark_from_static_string ("menuitem"); + } + + return q; +} + +static DbusmenuMenuitem* +user_get_menuitem (AccountsUser * user) +{ + return g_object_get_qdata (G_OBJECT(user), get_menuitem_quark()); +} + +static void +user_clear_menuitem (AccountsUser * user) +{ + g_object_steal_qdata (G_OBJECT(user), get_menuitem_quark()); +} + +static void +user_set_menuitem (AccountsUser * user, DbusmenuMenuitem * mi) +{ + g_object_set_qdata (G_OBJECT(user), get_menuitem_quark(), mi); + + g_object_weak_ref (G_OBJECT(mi), (GWeakNotify)user_clear_menuitem, user); +} + +/***/ + +static GQuark +get_mgr_quark (void) +{ + static GQuark q = 0; + + if (G_UNLIKELY(!q)) + { + q = g_quark_from_static_string ("session-menu-mgr"); + } + + return q; +} + +static SessionMenuMgr* +user_get_mgr (AccountsUser * user) +{ + return g_object_get_qdata (G_OBJECT(user), get_mgr_quark()); +} + +static void +user_set_mgr (AccountsUser * user, SessionMenuMgr * mgr) +{ + g_object_set_qdata (G_OBJECT(user), get_mgr_quark(), mgr); +} + +/***/ + +static GQuark +get_collision_quark (void) +{ + static GQuark q = 0; + + if (G_UNLIKELY(!q)) + { + q = g_quark_from_static_string ("name-collision"); + } + + return q; +} + +static gboolean +user_has_name_collision (AccountsUser * u) +{ + return g_object_get_qdata (G_OBJECT(u), get_collision_quark()) != NULL; +} + +static void +user_set_name_collision (AccountsUser * u, gboolean b) +{ + g_object_set_qdata (G_OBJECT(u), get_collision_quark(), GINT_TO_POINTER(b)); +} + +/*** +**** +***/ + +static void +on_guest_logged_in_changed (UsersServiceDbus * usd, + SessionMenuMgr * mgr) +{ + if (mgr->guest_mi != NULL) + { + mi_set_logged_in (mgr->guest_mi, + users_service_dbus_is_guest_logged_in (usd)); + } +} + +/* When a user's login state changes, + update the corresponding menuitem's LOGGED_IN property */ +static void +on_user_logged_in_changed (UsersServiceDbus * usd, + AccountsUser * user, + SessionMenuMgr * mgr) +{ + DbusmenuMenuitem * mi = user_get_menuitem (user); + + if (mi != NULL) + { + mi_set_logged_in (mi, users_service_dbus_is_user_logged_in (usd, user)); + } +} + +static void +update_screensaver_shortcut (SessionMenuMgr * mgr) +{ + gchar * s = g_settings_get_string (mgr->keybinding_settings, "screensaver"); + g_debug ("%s Screensaver shortcut changed to: '%s'", G_STRLOC, s); + + if (mgr->lock_mi != NULL) + { + dbusmenu_menuitem_property_set_shortcut_string (mgr->lock_mi, s); + } + + if (mgr->lock_switch_mi != NULL) + { + dbusmenu_menuitem_property_set_shortcut_string (mgr->lock_switch_mi, s); + } + + if (mgr->screensaver_mi != NULL) + { + dbusmenu_menuitem_property_set_shortcut_string (mgr->screensaver_mi, s); + } + + g_free (s); +} + +static void +update_user_menuitem_icon (DbusmenuMenuitem * mi, AccountsUser * user) +{ + const gchar * str = accounts_user_get_icon_file (user); + + if (!str || !*str) + { + str = USER_ITEM_ICON_DEFAULT; + } + + dbusmenu_menuitem_property_set (mi, USER_ITEM_PROP_ICON, str); +} + +static void +update_user_menuitem_name (DbusmenuMenuitem * mi, AccountsUser * user) +{ + GString * gstr = g_string_new (accounts_user_get_real_name (user)); + + if (user_has_name_collision (user)) + { + g_string_append_printf (gstr, " (%s)", accounts_user_get_user_name(user)); + } + + dbusmenu_menuitem_property_set (mi, USER_ITEM_PROP_NAME, gstr->str); + g_string_free (gstr, TRUE); +} + +static void +on_user_property_changed (AccountsUser * user, + GParamSpec * pspec, + DbusmenuMenuitem * mi) +{ + static const char * interned_icon_file = NULL; + static const char * interned_real_name = NULL; + static const char * interned_user_name = NULL; + + if (G_UNLIKELY (interned_icon_file == NULL)) + { + interned_icon_file = g_intern_static_string ("icon-file"); + interned_user_name = g_intern_static_string ("user-name"); + interned_real_name = g_intern_static_string ("real-name"); + } + + if (pspec->name == interned_icon_file) + { + update_user_menuitem_icon (mi, user); + } + else if ((pspec->name == interned_real_name) + || (pspec->name == interned_user_name)) + { + /* name changing can affect other menuitems too by invalidating + the sort order or name collision flags... so let's rebuild */ + update_user_menuitems (user_get_mgr (user)); + } +} + +typedef struct +{ + gpointer instance; + gulong handler_id; +} +SignalHandlerData; + +/* when a user menuitem is destroyed, + it should stop listening for its UserAccount's property changes */ +static void +on_user_menuitem_destroyed (SignalHandlerData * data) +{ + g_signal_handler_disconnect (data->instance, data->handler_id); + g_free (data); +} + +static DbusmenuMenuitem* +user_menuitem_new (AccountsUser * user, SessionMenuMgr * mgr) +{ + DbusmenuMenuitem * mi = dbusmenu_menuitem_new (); + mi_set_type (mi, USER_ITEM_TYPE); + + /* set the name & icon and listen for property changes */ + update_user_menuitem_name (mi, user); + update_user_menuitem_icon (mi, user); + SignalHandlerData * hd = g_new0 (SignalHandlerData, 1); + hd->instance = user; + hd->handler_id = g_signal_connect (user, "notify", + G_CALLBACK(on_user_property_changed), mi); + g_object_weak_ref (G_OBJECT(mi), (GWeakNotify)on_user_menuitem_destroyed, hd); + + /* set the logged-in property */ + mi_set_logged_in (mi, + users_service_dbus_is_user_logged_in (mgr->users_dbus_facade, user)); + + /* set the is-current-user property */ + const gboolean is_current_user = + !g_strcmp0 (g_get_user_name(), accounts_user_get_user_name(user)); + dbusmenu_menuitem_property_set_bool (mi, + USER_ITEM_PROP_IS_CURRENT_USER, + is_current_user); + + /* set the switch-to-user action */ + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK (action_func_switch_to_user), user); + + /* give this AccountsUser a hook back to this menuitem */ + user_set_menuitem (user, mi); + user_set_mgr (user, mgr); + + return mi; +} + +/* for sorting AccountsUsers from most to least frequently used */ +static gint +compare_users_by_login_frequency (gconstpointer a, gconstpointer b) +{ + const guint64 a_freq = accounts_user_get_login_frequency (ACCOUNTS_USER(a)); + const guint64 b_freq = accounts_user_get_login_frequency (ACCOUNTS_USER(b)); + if (a_freq > b_freq) return -1; + if (a_freq < b_freq) return 1; + return 0; +} + +/* for sorting AccountsUsers alphabetically */ +static gint +compare_users_by_username (gconstpointer ga, gconstpointer gb) +{ + AccountsUser * a = ACCOUNTS_USER(ga); + AccountsUser * b = ACCOUNTS_USER(gb); + + const int ret = g_strcmp0 (accounts_user_get_real_name (a), + accounts_user_get_real_name (b)); + + if (!ret) /* names are the same, so both have a name collision */ + { + user_set_name_collision (a, TRUE); + user_set_name_collision (b, TRUE); + } + + return ret; +} + +static gboolean +is_user_switching_allowed (SessionMenuMgr * mgr) +{ + /* maybe it's locked down */ + if (g_settings_get_boolean (mgr->lockdown_settings, "disable-user-switching")) + { + return FALSE; + } + + /* maybe the seat doesn't support activation */ + if (!users_service_dbus_can_activate_session (mgr->users_dbus_facade)) + { + return FALSE; + } + + return TRUE; +} + +static void +build_user_menuitems (SessionMenuMgr * mgr) +{ + g_return_if_fail (!mgr->greeter_mode); + + DbusmenuMenuitem * mi; + GSList * items = NULL; + gint pos = mgr->user_menuitem_index; + const char * current_real_name = NULL; + + /** + *** Start Screen Saver + *** Switch Account... + *** Lock + *** Lock / Switch Account... + **/ + + const SwitcherMode mode = get_switcher_mode (mgr); + + mi = mgr->screensaver_mi = mi_new (_("Start Screen Saver")); + mi_set_visible (mi, mode == SWITCHER_MODE_SCREENSAVER); + dbusmenu_menuitem_child_add_position (mgr->top_mi, mi, pos++); + items = g_slist_prepend (items, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK (action_func_lock), mgr); + + mi = mi_new (_("Switch User Account\342\200\246")); + mi_set_visible (mi, mode == SWITCHER_MODE_SWITCH); + dbusmenu_menuitem_child_add_position (mgr->top_mi, mi, pos++); + items = g_slist_prepend (items, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK (action_func_switch_to_greeter), mgr); + + mi = mgr->lock_mi = mi_new (_("Lock")); + mi_set_visible (mi, mode == SWITCHER_MODE_LOCK); + dbusmenu_menuitem_child_add_position (mgr->top_mi, mi, pos++); + items = g_slist_prepend (items, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK (action_func_switch_to_lockscreen), mgr); + + mi = mgr->lock_switch_mi = mi_new (_("Lock/Switch Account\342\200\246")); + mi_set_visible (mi, mode == SWITCHER_MODE_SWITCH_OR_LOCK); + dbusmenu_menuitem_child_add_position (mgr->top_mi, mi, pos++); + items = g_slist_prepend (items, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK (action_func_switch_to_lockscreen), mgr); + + const gboolean is_guest = is_this_guest_session (); + const gboolean guest_allowed = + users_service_dbus_guest_session_enabled (mgr->users_dbus_facade); + mi = mgr->guest_mi = dbusmenu_menuitem_new (); + mi_set_type (mi, USER_ITEM_TYPE); + mi_set_visible (mi, !is_guest && guest_allowed); + dbusmenu_menuitem_property_set (mi, USER_ITEM_PROP_NAME, _("Guest Session")); + dbusmenu_menuitem_child_add_position (mgr->top_mi, mi, pos++); + on_guest_logged_in_changed (mgr->users_dbus_facade, mgr); + items = g_slist_prepend (items, mi); + g_signal_connect_swapped (mi, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK (action_func_switch_to_guest), mgr); + + if (guest_allowed && is_guest) + { + current_real_name = _("Guest"); + } + + /*** + **** Users + ***/ + + /* if we can switch to another user account, show them here */ + const char * const username = g_get_user_name(); + GList * users = users_service_dbus_get_user_list (mgr->users_dbus_facade); + + /* since we're building (or rebuilding) from scratch, + clear the name collision flags */ + GList * u; + for (u=users; u!=NULL; u=u->next) + { + AccountsUser * user = ACCOUNTS_USER(u->data); + + user_set_name_collision (user, FALSE); + + if (!g_strcmp0 (username, accounts_user_get_user_name(user))) + { + current_real_name = accounts_user_get_real_name (user); + } + } + + if (is_user_switching_allowed (mgr)) + { + /* pick the most frequently used accounts */ + const int MAX_USERS = 12; /* this limit comes from the spec */ + if (g_list_length(users) > MAX_USERS) + { + users = g_list_sort (users, compare_users_by_login_frequency); + GList * last = g_list_nth (users, MAX_USERS-1); + GList * remainder = last->next; + last->next = NULL; + remainder->prev = NULL; + g_list_free (remainder); + } + + /* Sort the users by name for display */ + users = g_list_sort (users, compare_users_by_username); + + /* Create menuitems for them */ + int i; + for (i=0, u=users; i<MAX_USERS && u!=NULL; u=u->next, i++) + { + AccountsUser * user = u->data; + DbusmenuMenuitem * mi = user_menuitem_new (user, mgr); + dbusmenu_menuitem_child_add_position (mgr->top_mi, mi, pos++); + items = g_slist_prepend (items, mi); + } + } + + g_list_free (users); + + /* separator */ + mi = mi_new_separator (); + dbusmenu_menuitem_child_add_position (mgr->top_mi, mi, pos++); + items = g_slist_prepend (items, mi); + + if (current_real_name != NULL) + { + session_dbus_set_users_real_name (mgr->session_dbus, + current_real_name); + } + + update_screensaver_shortcut (mgr); + mgr->user_menuitems = items; +} + +static void +update_user_menuitems (SessionMenuMgr * mgr) +{ + /* remove any previous user menuitems */ + GSList * l; + for (l=mgr->user_menuitems; l!=NULL; l=l->next) + { + dbusmenu_menuitem_child_delete (mgr->top_mi, l->data); + } + g_slist_free (mgr->user_menuitems); + mgr->user_menuitems = NULL; + + /* add fresh user menuitems */ + if (!mgr->greeter_mode) + { + build_user_menuitems (mgr); + } +} + +/*** +**** Actions! +***/ + +static void +action_func_spawn_async (const char * cmd) +{ + GError * error = NULL; + + g_debug ("%s calling \"%s\"", G_STRFUNC, cmd); + g_spawn_command_line_async (cmd, &error); + + if (error != NULL) + { + g_warning ("Unable to execute \"%s\": %s", cmd, error->message); + g_clear_error (&error); + } +} + +/* Calling "Lock" locks the screen & goes to black. + Calling "SimulateUserActivity" afterwards shows the Lock Screen. */ +static void +lock_helper (SessionMenuMgr * mgr, gboolean show_lock_screen) +{ + if (!g_settings_get_boolean (mgr->lockdown_settings, "disable-lock-screen")) + { + GError * error = NULL; + GDBusProxy * proxy = g_dbus_proxy_new_for_bus_sync ( + G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.ScreenSaver", + "/org/gnome/ScreenSaver", + "org.gnome.ScreenSaver", + NULL, + &error); + + if (error == NULL) + { + g_dbus_proxy_call_sync (proxy, "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, + &error); + } + + if ((error == NULL) && show_lock_screen) + { + g_dbus_proxy_call_sync (proxy, "SimulateUserActivity", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, + &error); + } + + if (error != NULL) + { + g_warning ("Error locking screen: %s", error->message); + } + + g_clear_object (&proxy); + g_clear_error (&error); + } +} + +static void +action_func_lock (SessionMenuMgr * mgr) +{ + lock_helper (mgr, FALSE); +} + +static void +action_func_switch_to_lockscreen (SessionMenuMgr * mgr) +{ + lock_helper (mgr, TRUE); +} + +static void +action_func_switch_to_greeter (SessionMenuMgr * mgr) +{ + action_func_lock (mgr); + users_service_dbus_show_greeter (mgr->users_dbus_facade); +} + +static void +action_func_switch_to_user (AccountsUser * user) +{ + SessionMenuMgr * mgr = user_get_mgr (user); + g_return_if_fail (mgr != NULL); + action_func_lock (mgr); + users_service_dbus_activate_user_session (mgr->users_dbus_facade, user); +} + +static void +action_func_switch_to_guest (SessionMenuMgr * mgr) +{ + action_func_lock (mgr); + users_service_dbus_activate_guest_session (mgr->users_dbus_facade); +} + +static void +action_func_suspend (SessionMenuMgr * mgr) +{ + GError * error = NULL; + + dbus_upower_call_suspend_sync (mgr->upower_proxy, + mgr->cancellable, + &error); + + if (error != NULL) + { + g_warning ("%s: %s", G_STRFUNC, error->message); + g_clear_error (&error); + } +} + +static void +action_func_hibernate (SessionMenuMgr * mgr) +{ + GError * error = NULL; + + dbus_upower_call_hibernate_sync (mgr->upower_proxy, + mgr->cancellable, + &error); + + if (error != NULL) + { + g_warning ("%s: %s", G_STRFUNC, error->message); + g_clear_error (&error); + } +} + +/*** +**** +***/ + +static gboolean +is_this_guest_session (void) +{ + /* FIXME: this test has been here awhile and seems to work, + but seems brittle to me */ + return geteuid() < 500; +} + +static gboolean +is_this_live_session (void) +{ + const struct passwd * const pw = getpwuid (geteuid()); + return (pw->pw_uid==999) && !g_strcmp0("ubuntu",pw->pw_name); +} + +static SwitcherMode +get_switcher_mode (SessionMenuMgr * mgr) +{ + SwitcherMode mode; + + const gboolean can_lock = !g_settings_get_boolean (mgr->lockdown_settings, + "disable-lock-screen"); + const gboolean can_switch = is_user_switching_allowed (mgr); + + if (!can_lock && !can_switch) /* hmm, quite an extreme lockdown */ + { + mode = SWITCHER_MODE_SCREENSAVER; + } + else if (is_this_live_session()) /* live sessions can't lock or switch */ + { + mode = SWITCHER_MODE_SCREENSAVER; + } + else if (!can_switch) /* switching's locked down */ + { + mode = SWITCHER_MODE_LOCK; + } + else if (is_this_guest_session ()) /* guest sessions can't lock */ + { + mode = SWITCHER_MODE_SWITCH; + } + else /* both locking & switching are allowed */ + { + GList * l = users_service_dbus_get_user_list (mgr->users_dbus_facade); + const size_t user_count = g_list_length (l); + g_list_free (l); + + /* only show switch mode if we have users to switch to */ + mode = user_count > (is_this_guest_session() ? 0 : 1) + ? SWITCHER_MODE_SWITCH_OR_LOCK + : SWITCHER_MODE_LOCK; + } + + return mode; +} + + +/*** +**** +***/ + +SessionMenuMgr* +session_menu_mgr_new (SessionDbus * session_dbus, + gboolean greeter_mode) +{ + SessionMenuMgr* mgr = g_object_new (SESSION_TYPE_MENU_MGR, NULL); + mgr->greeter_mode = greeter_mode; + mgr->session_dbus = g_object_ref (session_dbus); + build_admin_menuitems (mgr); + const guint n = g_list_length (dbusmenu_menuitem_get_children (mgr->top_mi)); + mgr->user_menuitem_index = n; + update_user_menuitems (mgr); + build_session_menuitems (mgr); + return mgr; +} + +/** + * session_menu_mgr_get_menu: + * + * Returns: (transfer none): the manager's menu. + */ +DbusmenuMenuitem * +session_menu_mgr_get_menu (SessionMenuMgr * mgr) +{ + g_return_val_if_fail (IS_SESSION_MENU_MGR(mgr), NULL); + + return mgr->top_mi; +} diff --git a/src/session-menu-mgr.h b/src/session-menu-mgr.h new file mode 100644 index 0000000..5a173e1 --- /dev/null +++ b/src/session-menu-mgr.h @@ -0,0 +1,55 @@ +/* +Copyright 2011 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + + +#ifndef _SESSION_MENU_MGR_H_ +#define _SESSION_MENU_MGR_H_ + +#include <glib-object.h> + +#include "session-dbus.h" + +G_BEGIN_DECLS + +#define SESSION_TYPE_MENU_MGR (session_menu_mgr_get_type ()) +#define SESSION_MENU_MGR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SESSION_TYPE_MENU_MGR, SessionMenuMgr)) +#define SESSION_MENU_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SESSION_TYPE_MENU_MGR, SessionMenuMgrClass)) +#define IS_SESSION_MENU_MGR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SESSION_TYPE_MENU_MGR)) +#define IS_SESSION_MENU_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SESSION_TYPE_MENU_MGR)) +#define SESSION_MENU_MGR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SESSION_TYPE_MENU_MGR, SessionMenuMgrClass)) + +typedef struct _SessionMenuMgrClass SessionMenuMgrClass; +typedef struct _SessionMenuMgr SessionMenuMgr; + +struct _SessionMenuMgrClass +{ + GObjectClass parent_class; +}; + +GType session_menu_mgr_get_type (void) G_GNUC_CONST; + +SessionMenuMgr* session_menu_mgr_new (SessionDbus * session_dbus, + gboolean greeter_mode); + +DbusmenuMenuitem* session_menu_mgr_get_menu (SessionMenuMgr * mgr); + + +G_END_DECLS + +#endif /* _SESSION_MENU_MGR_H_ */ diff --git a/src/session-service.c b/src/session-service.c index 1dd1e14..91bbccd 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -9,21 +9,22 @@ Authors: Christoph Korn <c_korn@gmx.de> Cody Russell <crussell@canonical.com> Conor Curran <conor.curran@canonical.com> + Charles Kerr <charles.kerr@canonical.com> -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along +You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <config.h> +#include "config.h" #include <unistd.h> #include <locale.h> @@ -32,55 +33,37 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <gio/gio.h> #include <gio/gdesktopappinfo.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> - #include <libdbusmenu-glib/server.h> -#include <libdbusmenu-glib/menuitem.h> -#include <libdbusmenu-glib/client.h> #include <gtk/gtk.h> -#include <libdbusmenu-gtk/menuitem.h> #include <libindicator/indicator-service.h> -#include "dbus-shared-names.h" -#include "dbusmenu-shared.h" -#include "users-service-dbus.h" -#include "user-menu-mgr.h" -#include "device-menu-mgr.h" #include "session-dbus.h" +#include "session-menu-mgr.h" +#include "shared-names.h" +#include "users-service-dbus.h" -typedef struct _ActivateData ActivateData; -struct _ActivateData -{ - UsersServiceDbus *service; - UserData *user; -}; - -//static UsersServiceDbus *dbus_interface = NULL; -static SessionDbus *session_dbus = NULL; +static SessionDbus * session_dbus = NULL; static GMainLoop * mainloop = NULL; -/* When the service interface starts to shutdown, we - should follow it. */ +/* When the service interface starts to shutdown, + we should follow it. */ void service_shutdown (IndicatorService * service, gpointer user_data) { - if (mainloop != NULL) { - g_debug("Service shutdown"); - g_main_loop_quit(mainloop); - } - return; + if (mainloop != NULL) + { + g_debug ("Service shutdown"); + g_main_loop_quit (mainloop); + } } -static gboolean -get_greeter_mode (void) +static inline gboolean +is_greeter_mode (void) { - const gchar *var; - var = g_getenv("INDICATOR_GREETER_MODE"); - return (g_strcmp0(var, "1") == 0); + return !g_strcmp0 (g_getenv ("INDICATOR_GREETER_MODE"), "1"); } /* Main, is well, main. It brings everything up and throws @@ -88,41 +71,28 @@ get_greeter_mode (void) int main (int argc, char ** argv) { - gboolean greeter_mode; - g_type_init(); - /* Setting up i18n and gettext. Apparently, we need - all of these. */ - setlocale (LC_ALL, ""); - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - textdomain (GETTEXT_PACKAGE); + /* Setting up i18n and gettext. + Apparently we need all of these. */ + setlocale (LC_ALL, ""); + bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); + textdomain (GETTEXT_PACKAGE); - IndicatorService * service = indicator_service_new_version (INDICATOR_SESSION_DBUS_NAME, - INDICATOR_SESSION_DBUS_VERSION); - g_signal_connect (G_OBJECT(service), - INDICATOR_SERVICE_SIGNAL_SHUTDOWN, + IndicatorService * service = indicator_service_new_version (INDICATOR_SESSION_DBUS_NAME, + INDICATOR_SESSION_DBUS_VERSION); + g_signal_connect (G_OBJECT(service), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, G_CALLBACK(service_shutdown), NULL); - session_dbus = session_dbus_new(); + session_dbus = session_dbus_new(); - greeter_mode = get_greeter_mode(); - - // Devices - DeviceMenuMgr* device_mgr = device_menu_mgr_new (session_dbus, greeter_mode); - DbusmenuServer * server = dbusmenu_server_new(INDICATOR_SESSION_DBUS_OBJECT); - dbusmenu_server_set_root(server, device_mgr_get_root_item (device_mgr)); - - if (!greeter_mode) { - // Users - UserMenuMgr* user_mgr = user_menu_mgr_new (session_dbus, greeter_mode); - DbusmenuServer* users_server = dbusmenu_server_new (INDICATOR_USERS_DBUS_OBJECT); - dbusmenu_server_set_root (users_server, user_mgr_get_root_item (user_mgr)); - } + SessionMenuMgr * menu_mgr = session_menu_mgr_new (session_dbus, is_greeter_mode()); + DbusmenuServer* server = dbusmenu_server_new (INDICATOR_SESSION_DBUS_OBJECT); + dbusmenu_server_set_root (server, session_menu_mgr_get_menu (menu_mgr)); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); - + return 0; } diff --git a/src/settings-helper.c b/src/settings-helper.c deleted file mode 100644 index 007f83f..0000000 --- a/src/settings-helper.c +++ /dev/null @@ -1,167 +0,0 @@ -/* -A small wrapper utility for connecting to GSettings. - -Copyright 2009 Canonical Ltd. - -Authors: - Christoph Korn <c_korn@gmx.de> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <gio/gio.h> -#include <glib/gi18n.h> - -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> - -#include <libdbusmenu-glib/server.h> -#include <libdbusmenu-glib/menuitem.h> - -#include "dbus-shared-names.h" -#include "settings-helper.h" - -static GSettings* settings = NULL; - -static guint confirmation_notify = 0; -static guint logout_notify = 0; -static guint restart_notify = 0; -static guint shutdown_notify = 0; - -static gboolean -build_settings (void) { - if (settings == NULL) { - settings = g_settings_new (SESSION_SCHEMA); - } - if (settings == NULL) { - return FALSE; - } - return TRUE; -} - -gboolean -supress_confirmations (void) { - gboolean settings_built = build_settings(); - g_return_val_if_fail(settings_built, FALSE); - return g_settings_get_boolean (settings, SUPPRESS_KEY) ; -} - -gboolean -should_show_user_menu (void) { - gboolean settings_built = build_settings(); - g_return_val_if_fail(settings_built, TRUE); - return g_settings_get_boolean (settings, SHOW_USER_MENU) ; -} - -gboolean -show_logout (void) { - gboolean settings_built = build_settings(); - g_return_val_if_fail(settings_built, TRUE); - return !g_settings_get_boolean (settings, LOGOUT_KEY) ; -} - -gboolean -show_restart (void) { - gboolean settings_built = build_settings(); - g_return_val_if_fail(settings_built, TRUE); - return !g_settings_get_boolean (settings, RESTART_KEY) ; -} - -gboolean -show_shutdown (void) { - gboolean settings_built = build_settings(); - g_return_val_if_fail(settings_built, TRUE); - return !g_settings_get_boolean (settings, SHUTDOWN_KEY) ; -} - -static void update_menu_entries_callback (GSettings * settings, const gchar * key, gpointer data) { - RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi = (RestartShutdownLogoutMenuItems*) data; - - if(g_strcmp0 (key, SUPPRESS_KEY) == 0) { - if (g_settings_get_boolean (settings, key)) { - dbusmenu_menuitem_property_set(restart_shutdown_logout_mi->logout_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Log Out")); - dbusmenu_menuitem_property_set(restart_shutdown_logout_mi->restart_mi, RESTART_ITEM_LABEL, _("Restart")); - dbusmenu_menuitem_property_set(restart_shutdown_logout_mi->shutdown_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Shut Down")); - } else { - dbusmenu_menuitem_property_set(restart_shutdown_logout_mi->logout_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Log Out…")); - dbusmenu_menuitem_property_set(restart_shutdown_logout_mi->restart_mi, RESTART_ITEM_LABEL, _("Restart…")); - dbusmenu_menuitem_property_set(restart_shutdown_logout_mi->shutdown_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Shut Down…")); - } - } -} - -static void -update_logout_callback (GSettings * settings, const gchar * key, gpointer data) { - DbusmenuMenuitem * mi = (DbusmenuMenuitem*) data; - - if(g_strcmp0 (key, LOGOUT_KEY) == 0) { - dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_VISIBLE, !g_settings_get_boolean(settings, key)); - } -} - -static void -update_restart_callback (GSettings * settings, const gchar * key, gpointer data) { - DbusmenuMenuitem * mi = (DbusmenuMenuitem*) data; - - if(g_strcmp0 (key, RESTART_KEY) == 0) { - dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_VISIBLE, !g_settings_get_boolean(settings, key)); - } -} - -static void -update_shutdown_callback (GSettings * settings, const gchar * key, gpointer data) { - DbusmenuMenuitem * mi = (DbusmenuMenuitem*) data; - - if(g_strcmp0 (key, SHUTDOWN_KEY) == 0) { - dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_VISIBLE, !g_settings_get_boolean(settings, key)); - } -} - -void -update_menu_entries(RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi) { - /* If we don't have a client, build one. */ - gboolean settings_built = build_settings(); - g_return_if_fail(settings_built); - - if (confirmation_notify != 0) { - g_signal_handler_disconnect (settings, confirmation_notify); - confirmation_notify = 0; - } - - if (logout_notify != 0) { - g_signal_handler_disconnect (settings, logout_notify); - logout_notify = 0; - } - - if (restart_notify != 0) { - g_signal_handler_disconnect (settings, restart_notify); - restart_notify = 0; - } - - if (shutdown_notify != 0) { - g_signal_handler_disconnect (settings, shutdown_notify); - shutdown_notify = 0; - } - - confirmation_notify = g_signal_connect (settings, "changed::" SUPPRESS_KEY, - G_CALLBACK(update_menu_entries_callback), restart_shutdown_logout_mi); - logout_notify = g_signal_connect (settings, "changed::" LOGOUT_KEY, - G_CALLBACK(update_logout_callback), restart_shutdown_logout_mi->logout_mi); - restart_notify = g_signal_connect (settings, "changed::" RESTART_KEY, - G_CALLBACK(update_restart_callback), restart_shutdown_logout_mi->restart_mi); - shutdown_notify = g_signal_connect (settings, "changed::" SHUTDOWN_KEY, - G_CALLBACK(update_shutdown_callback), restart_shutdown_logout_mi->shutdown_mi); - - return; -} - diff --git a/src/settings-helper.h b/src/settings-helper.h deleted file mode 100644 index ea0c99f..0000000 --- a/src/settings-helper.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -A small wrapper utility for connecting to GSettings. - -Copyright 2009 Canonical Ltd. - -Authors: - Christoph Korn <c_korn@gmx.de> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - - -#ifndef __GCONF_HELPER_H__ -#define __GCONF_HELPER_H__ - -#include <glib/gi18n.h> - -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> - -#include <libdbusmenu-glib/server.h> -#include <libdbusmenu-glib/menuitem.h> - -#define SESSION_SCHEMA "com.canonical.indicator.session" -#define SUPPRESS_KEY "suppress-logout-restart-shutdown" -#define LOGOUT_KEY "suppress-logout-menuitem" -#define RESTART_KEY "suppress-restart-menuitem" -#define SHUTDOWN_KEY "suppress-shutdown-menuitem" -#define SHOW_USER_MENU "user-show-menu" -#define USER_USERNAME_IN_SWITCH_ITEM "use-username-in-switch-item" - -#define LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown" -#define LOCKDOWN_KEY_USER "disable-user-switching" -#define LOCKDOWN_KEY_SCREENSAVER "disable-lock-screen" -#define KEYBINDING_SCHEMA "org.gnome.settings-daemon.plugins.media-keys" -#define KEY_LOCK_SCREEN "screensaver" - -typedef struct _RestartShutdownLogoutMenuItems -{ - DbusmenuMenuitem * logout_mi; - DbusmenuMenuitem * restart_mi; - DbusmenuMenuitem * shutdown_mi; -} -RestartShutdownLogoutMenuItems; - -void update_menu_entries(RestartShutdownLogoutMenuItems*); -gboolean supress_confirmations (void); -gboolean show_logout (void); -gboolean show_restart (void); -gboolean show_shutdown (void); -gboolean should_show_user_menu (void); - - -#endif /* __GCONF_HELPER__ */ diff --git a/src/dbus-shared-names.h b/src/shared-names.h index 5f35903..dcda182 100644 --- a/src/dbus-shared-names.h +++ b/src/shared-names.h @@ -23,33 +23,12 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef __DBUS_SHARED_NAMES_H__ #define __DBUS_SHARED_NAMES_H__ -typedef enum { - UP_TO_DATE, - CHECKING_FOR_UPDATES, - UPDATES_AVAILABLE, - UPGRADE_IN_PROGRESS, - FINISHED, - RESTART_NEEDED, - DONT_KNOW -}AptState; - -typedef enum { - SIMULATION, - REAL -}TransactionType; - -#define INDICATOR_USERS_DBUS_NAME INDICATOR_SESSION_DBUS_NAME -#define INDICATOR_USERS_DBUS_OBJECT "/com/canonical/indicator/users/menu" -#define INDICATOR_USERS_SERVICE_DBUS_OBJECT "/org/gnome/DisplayManager/UserManager" -#define INDICATOR_USERS_SERVICE_DBUS_INTERFACE "org.gnome.DisplayManager.UserManager" - #define INDICATOR_SESSION_DBUS_NAME "com.canonical.indicator.session" #define INDICATOR_SESSION_DBUS_OBJECT "/com/canonical/indicator/session/menu" #define INDICATOR_SESSION_DBUS_VERSION 0 #define INDICATOR_SESSION_SERVICE_DBUS_OBJECT "/com/canonical/indicator/session/service" #define INDICATOR_SESSION_SERVICE_DBUS_IFACE "com.canonical.indicator.session.service" - #define USER_ITEM_TYPE "x-canonical-user-item" #define USER_ITEM_PROP_NAME "user-item-name" #define USER_ITEM_PROP_LOGGED_IN "user-item-logged-in" @@ -66,4 +45,13 @@ typedef enum { #define GREETER_ICON_DEFAULT "system-shutdown-panel" #define GREETER_ICON_RESTART "system-shutdown-panel-restart" +/* the session indicator's settings */ +#define SESSION_SCHEMA "com.canonical.indicator.session" +#define SUPPRESS_KEY "suppress-logout-restart-shutdown" +#define LOGOUT_KEY "suppress-logout-menuitem" +#define RESTART_KEY "suppress-restart-menuitem" +#define SHUTDOWN_KEY "suppress-shutdown-menuitem" +#define SHOW_USER_MENU "user-show-menu" + + #endif /* __DBUS_SHARED_NAMES_H__ */ diff --git a/src/udev-mgr.c b/src/udev-mgr.c deleted file mode 100644 index 5f197d6..0000000 --- a/src/udev-mgr.c +++ /dev/null @@ -1,546 +0,0 @@ -/* -Copyright 2011 Canonical Ltd. - -Authors: - Conor Curran <conor.curran@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <gudev/gudev.h> - -#include <glib/gi18n.h> - -#include "udev-mgr.h" -#include "sane-rules.h" - -static void udevice_mgr_device_list_iterator (gpointer data, - gpointer userdata); -static void udev_mgr_uevent_cb (GUdevClient *client, - gchar *action, - GUdevDevice *device, - gpointer user_data); -static void udev_mgr_update_menuitems (UdevMgr* self); -static void udev_mgr_check_if_usb_device_is_supported (UdevMgr* self, - GUdevDevice *device, - UdevMgrDeviceAction action); -static void udev_mgr_handle_webcam (UdevMgr* self, - GUdevDevice* device, - UdevMgrDeviceAction action); -static void udev_mgr_handle_scsi_device (UdevMgr* self, - GUdevDevice* device, - UdevMgrDeviceAction action); - -static void udev_mgr_cleanup_lists(gpointer data, gpointer self); -static void udev_mgr_cleanup_entries(gpointer data, gpointer self); - - -static void debug_device (UdevMgr* self, - GUdevDevice* device, - UdevMgrDeviceAction action); - -static gchar* format_device_name (UdevMgr* self, - const gchar* brand, - const gchar* generic, - const gchar* branded) G_GNUC_WARN_UNUSED_RESULT; -struct _UdevMgr -{ - GObject parent_instance; - DbusmenuMenuitem* scanner_item; - DbusmenuMenuitem* webcam_item; - GUdevClient* client; - GHashTable* supported_usb_scanners; - GHashTable* supported_scsi_scanners; - GHashTable* scanners_present; - GHashTable* webcams_present; -}; - -const char *subsystems[3] = {"usb", "scsi", "video4linux"}; -const gchar* usb_subsystem = "usb"; -const gchar* scsi_subsystem = "scsi"; -const gchar* video4linux_subsystem = "video4linux"; - - -G_DEFINE_TYPE (UdevMgr, udev_mgr, G_TYPE_OBJECT); - -static void -udev_mgr_init (UdevMgr* self) -{ - self->client = NULL; - self->supported_usb_scanners = NULL; - self->scanners_present = NULL; - self->webcams_present = NULL; - self->client = g_udev_client_new (subsystems); - self->supported_usb_scanners = g_hash_table_new_full (g_str_hash, - g_str_equal, - g_free, - (GDestroyNotify)udev_mgr_cleanup_lists); - self->supported_scsi_scanners = g_hash_table_new_full (g_str_hash, - g_str_equal, - g_free, - (GDestroyNotify)udev_mgr_cleanup_lists); - self->scanners_present = g_hash_table_new_full (g_str_hash, - g_str_equal, - g_free, - g_free); - self->webcams_present = g_hash_table_new_full (g_str_hash, - g_str_equal, - g_free, - g_free); - - // load into memory all supported scanners ... - populate_usb_scanners (self->supported_usb_scanners); - populate_scsi_scanners (self->supported_scsi_scanners); - g_signal_connect (G_OBJECT (self->client), - "uevent", - G_CALLBACK (udev_mgr_uevent_cb), - self); -} - -static void -udev_mgr_cleanup_lists(gpointer data, gpointer self) -{ - GList* scanners = (GList*)data; - g_list_foreach (scanners, udev_mgr_cleanup_entries, NULL); - g_list_free(scanners); -} - -static void -udev_mgr_cleanup_entries(gpointer data, gpointer self) -{ - gchar* entry = (gchar*)data; - g_free(entry); -} - -static void -udev_mgr_finalize (GObject *object) -{ - UdevMgr* self = UDEV_MGR (object); - g_hash_table_destroy (self->supported_scsi_scanners); - g_hash_table_destroy (self->supported_usb_scanners); - g_hash_table_destroy (self->scanners_present); - g_hash_table_destroy (self->webcams_present); - G_OBJECT_CLASS (udev_mgr_parent_class)->finalize (object); -} - -static void -udev_mgr_class_init (UdevMgrClass *klass) -{ - GObjectClass* object_class = G_OBJECT_CLASS (klass); - object_class->finalize = udev_mgr_finalize; -} - -static void -udevice_mgr_device_list_iterator (gpointer data, gpointer userdata) -{ - g_return_if_fail (G_UDEV_IS_DEVICE (data)); - g_return_if_fail (UDEV_IS_MGR (userdata)); - - UdevMgr* self = UDEV_MGR (userdata); - - GUdevDevice* device = G_UDEV_DEVICE (data); - - const gchar* subsystem = NULL; - subsystem = g_udev_device_get_subsystem (device); - - if (g_strcmp0 (subsystem, "usb") == 0){ - udev_mgr_check_if_usb_device_is_supported (self, device, ADD); - } - else if (g_strcmp0 (subsystem, "video4linux") == 0){ - udev_mgr_handle_webcam (self, device, ADD); - } - else if (g_strcmp0 (subsystem, "scsi") == 0){ - udev_mgr_handle_scsi_device (self, device, ADD); - } - - g_object_unref (device); -} - - -static void udev_mgr_update_menuitems (UdevMgr* self) -{ - dbusmenu_menuitem_property_set_bool (self->scanner_item, - DBUSMENU_MENUITEM_PROP_VISIBLE, - g_hash_table_size (self->scanners_present) > 0); - - dbusmenu_menuitem_property_set_bool (self->webcam_item, - DBUSMENU_MENUITEM_PROP_VISIBLE, - g_hash_table_size (self->webcams_present) > 0); - -} - -static void udev_mgr_uevent_cb (GUdevClient *client, - gchar *action, - GUdevDevice *device, - gpointer user_data) -{ - g_return_if_fail (UDEV_IS_MGR (user_data)); - UdevMgr* self = UDEV_MGR (user_data); - g_return_if_fail (device != NULL); - - g_debug ("just received a UEVENT with an action : %s", action); - - UdevMgrDeviceAction udev_mgr_action = ADD; - - if (g_strcmp0 (action, "remove") == 0){ - udev_mgr_action = REMOVE; - } - - const gchar* subsystem = NULL; - subsystem = g_udev_device_get_subsystem (device); - - if (g_strcmp0 (subsystem, "usb") == 0){ - udev_mgr_check_if_usb_device_is_supported (self, - device, - udev_mgr_action); - } - else if (g_strcmp0 (subsystem, "video4linux") == 0){ - udev_mgr_handle_webcam (self, device, udev_mgr_action); - } - else if (g_strcmp0 (subsystem, "scsi") == 0){ - udev_mgr_handle_scsi_device (self, device, udev_mgr_action); - } -} - - -static void -udev_mgr_handle_webcam (UdevMgr* self, - GUdevDevice* device, - UdevMgrDeviceAction action) -{ - if (FALSE) - debug_device (self, device, action); - - const gchar* vendor; - const gchar* product; - - vendor = g_udev_device_get_property (device, "ID_VENDOR_ID"); - product = g_udev_device_get_property (device, "ID_MODEL_ID"); - - if (!vendor || !product) { - return; - } - - if (action == REMOVE){ - if (g_hash_table_lookup (self->webcams_present, product) == NULL){ - g_warning ("Got a remove event on a webcam device but we don't have that device in our webcam cache"); - return; - } - g_hash_table_remove (self->webcams_present, - product); - dbusmenu_menuitem_property_set (self->webcam_item, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Webcam")); - } - else { - if (g_hash_table_lookup (self->webcams_present, product) != NULL){ - g_warning ("Got an ADD event on a webcam device but we already have that device in our webcam cache"); - return; - } - - const gchar* manufacturer = NULL; - manufacturer = g_udev_device_get_property (device, "ID_VENDOR"); - - if (manufacturer != NULL){ - gchar * label = format_device_name(self, manufacturer, _("Webcam"), _("%s Webcam")); - dbusmenu_menuitem_property_set (self->webcam_item, - DBUSMENU_MENUITEM_PROP_LABEL, - label); - g_free(label); - } - - g_hash_table_insert (self->webcams_present, - g_strdup (product), - g_strdup (vendor)); - } - udev_mgr_update_menuitems (self); -} - -static void -debug_device (UdevMgr* self, - GUdevDevice* device, - UdevMgrDeviceAction action) -{ - const gchar* vendor; - const gchar* product; - const gchar* number; - const gchar* name; - const gchar* manufacturer; - - vendor = g_udev_device_get_property (device, "ID_VENDOR_ID"); - manufacturer = g_udev_device_get_property (device, "ID_VENDOR"); - product = g_udev_device_get_property (device, "ID_MODEL_ID"); - number = g_udev_device_get_number (device); - name = g_udev_device_get_name (device); - - g_debug ("%s device vendor id %s , product id of %s , number of %s and name of %s", - g_strdup(manufacturer), - g_strdup(vendor), - g_strdup(product), - g_strdup(number), - g_strdup(name)); - - /*const gchar *const *list; - const gchar *const *iter; - char propstr[500]; - guint32 namelen = 0, i; - - list = g_udev_device_get_property_keys(device); - - for (iter = list; iter && *iter; iter++) { - if (strlen(*iter) > namelen) - namelen = strlen(*iter); - } - namelen++; - - for (iter = list; iter && *iter; iter++) { - strcpy(propstr, *iter); - strcat(propstr, ":"); - for (i = 0; i < namelen - strlen(*iter); i++) - strcat(propstr, " "); - strcat(propstr, g_udev_device_get_property(device, *iter)); - g_debug("%s", propstr); - }*/ -} -// TODO SCSI is not dynamic right ? -// i.e. just need to handle startup scan. -static void udev_mgr_handle_scsi_device (UdevMgr* self, - GUdevDevice* device, - UdevMgrDeviceAction action) -{ - const gchar* type = NULL; - type = g_udev_device_get_property (device, "TYPE"); - - if (!type) { - return; - } - - // apparently anything thats type 6 and SCSI is a Scanner - if (g_strcmp0 (type, "6") == 0 && action == ADD){ - - const gchar* manufacturer = NULL; - manufacturer = g_udev_device_get_property (device, "ID_VENDOR"); - - if (manufacturer != NULL){ - gchar * label = format_device_name(self, manufacturer, _("Scanner"), _("%s Scanner")); - dbusmenu_menuitem_property_set (self->scanner_item, - DBUSMENU_MENUITEM_PROP_LABEL, - label); - g_free(label); - } - - gchar* random_scanner_name = g_strdup_printf("%p--scanner", self); - g_hash_table_insert (self->scanners_present, - random_scanner_name, - g_strdup("Scanner")); - udev_mgr_update_menuitems (self); - return; - } - - // We only care about type 3 for the special cases below - if (g_strcmp0 (type, "3") != 0){ - return; - } - - const gchar* vendor = NULL; - vendor = g_udev_device_get_property (device, "VENDOR"); - - if (vendor == NULL) - return; - - GList* vendor_list = NULL; - vendor_list = g_hash_table_lookup (self->supported_scsi_scanners, - (gpointer)vendor); - if (vendor_list == NULL) - return; - - const gchar* model_id = NULL; - model_id = g_udev_device_get_property (device, "MODEL"); - - if (model_id == NULL) - return; - - GList* model_entry = NULL; - model_entry = g_list_find_custom (vendor_list, - model_id, - (GCompareFunc)g_strcmp0); - - if (model_entry != NULL){ - if (action == REMOVE){ - if (g_hash_table_lookup (self->scanners_present, g_strdup(vendor)) == NULL){ - g_warning ("Got an REMOVE event on a scanner device but we dont have that device in our scanners cache"); - } - else{ - g_hash_table_remove (self->scanners_present, vendor); - dbusmenu_menuitem_property_set (self->scanner_item, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Scanner")); - - } - } - else{ - if (g_hash_table_lookup (self->scanners_present, g_strdup(vendor)) != NULL){ - g_warning ("Got an ADD event on a scanner device but we already have that device in our scanners cache"); - } - else{ - const gchar* manufacturer = NULL; - manufacturer = g_udev_device_get_property (device, "ID_VENDOR"); - - if (manufacturer != NULL){ - gchar * label = format_device_name(self, manufacturer, _("Scanner"), _("%s Scanner")); - dbusmenu_menuitem_property_set (self->scanner_item, - DBUSMENU_MENUITEM_PROP_LABEL, - label); - g_free(label); - } - g_hash_table_insert (self->scanners_present, - g_strdup(vendor), - g_strdup(model_id)); - } - } - udev_mgr_update_menuitems (self); - } -} - -static void -udev_mgr_check_if_usb_device_is_supported (UdevMgr* self, - GUdevDevice *device, - UdevMgrDeviceAction action) -{ - const gchar* vendor = NULL; - //debug_device (self, device, action); - - vendor = g_udev_device_get_property (device, "ID_VENDOR_ID"); - - if (vendor == NULL) - return; - - //g_debug ("vendor = %s", vendor); - - GList* vendor_list = NULL; - vendor_list = g_hash_table_lookup (self->supported_usb_scanners, - (gpointer)vendor); - if (vendor_list == NULL) - return; - - const gchar* model_id = NULL; - model_id = g_udev_device_get_property (device, "ID_MODEL_ID"); - - if (model_id == NULL) - return; - - GList* model_entry = NULL; - model_entry = g_list_find_custom(vendor_list, model_id, (GCompareFunc)g_strcmp0); - - if (model_entry != NULL){ - if (action == REMOVE){ - if (g_hash_table_lookup (self->scanners_present, g_strdup(vendor)) == NULL){ - g_warning ("Got an REMOVE event on a scanner device but we dont have that device in our scanners cache"); - } - else{ - g_hash_table_remove (self->scanners_present, vendor); - dbusmenu_menuitem_property_set (self->scanner_item, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Scanner")); - } - } - else{ - if (g_hash_table_lookup (self->scanners_present, g_strdup(vendor)) != NULL){ - g_warning ("Got an ADD event on a scanner device but we already have that device in our scanners cache"); - } - else{ - const gchar* manufacturer = NULL; - - manufacturer = g_udev_device_get_property (device, "ID_VENDOR"); - if (manufacturer != NULL){ - gchar * label = format_device_name(self, manufacturer, _("Scanner"), _("%s Scanner")); - dbusmenu_menuitem_property_set (self->scanner_item, - DBUSMENU_MENUITEM_PROP_LABEL, - label); - g_free(label); - } - - g_hash_table_insert (self->scanners_present, - g_strdup(vendor), - g_strdup(model_id)); - } - } - udev_mgr_update_menuitems (self); - } -} - -UdevMgr* udev_mgr_new (DbusmenuMenuitem* scanner, - DbusmenuMenuitem* webcam) -{ - UdevMgr* mgr = g_object_new (UDEV_TYPE_MGR, NULL); - mgr->scanner_item = scanner; - mgr->webcam_item = webcam; - - // Check for USB devices - GList* usb_devices_available = NULL; - usb_devices_available = g_udev_client_query_by_subsystem (mgr->client, - usb_subsystem); - if (usb_devices_available != NULL){ - g_list_foreach (usb_devices_available, - udevice_mgr_device_list_iterator, - mgr); - - g_list_free (usb_devices_available); - } - // Check for webcams - GList* video_devices_available = NULL; - video_devices_available = g_udev_client_query_by_subsystem (mgr->client, - video4linux_subsystem); - if (video_devices_available != NULL){ - g_list_foreach (video_devices_available, - udevice_mgr_device_list_iterator, - mgr); - - g_list_free (video_devices_available); - } - // Check for SCSI devices - GList* scsi_devices_available = NULL; - scsi_devices_available = g_udev_client_query_by_subsystem (mgr->client, - scsi_subsystem); - if (scsi_devices_available != NULL){ - g_list_foreach (scsi_devices_available, - udevice_mgr_device_list_iterator, - mgr); - g_list_free (scsi_devices_available); - } - return mgr; -} - -static gchar* format_device_name (UdevMgr* self, - const gchar* brand, - const gchar* generic, - const gchar* branded) -{ - // We don't want to accommodate long names - if (strlen(brand) > 7) - return g_strdup(generic); - - gint i = 0; - - // If it contains something other than an alphabetic entry ignore it. - for(i = 0; i < sizeof(brand); i++){ - if ( !g_ascii_isalpha (brand[i]) ) - return g_strdup(generic); - } - - gchar* lowered = g_ascii_strdown (brand, -1); - lowered[0] = g_ascii_toupper (lowered[0]); - gchar* label = g_strdup_printf(branded, lowered); - g_free (lowered); - return label; -} diff --git a/src/udev-mgr.h b/src/udev-mgr.h deleted file mode 100644 index 2e57cff..0000000 --- a/src/udev-mgr.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2011 Canonical Ltd. - -Authors: - Conor Curran <conor.curran@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef _UDEV_MGR_H_ -#define _UDEV_MGR_H_ - -#include <glib-object.h> -#include <libdbusmenu-glib/client.h> - -#include <gtk/gtk.h> -#include <libdbusmenu-gtk/menuitem.h> - -G_BEGIN_DECLS - -#define UDEV_TYPE_MGR (udev_mgr_get_type ()) -#define UDEV_MGR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UDEV_TYPE_MGR, UdevMgr)) -#define UDEV_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UDEV_TYPE_MGR, UdevMgrClass)) -#define UDEV_IS_MGR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UDEV_TYPE_MGR)) -#define UDEV_IS_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UDEV_TYPE_MGR)) -#define UDEV_MGR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UDEV_TYPE_MGR, UdevMgrClass)) - -typedef struct _UdevMgrClass UdevMgrClass; -typedef struct _UdevMgr UdevMgr; - -struct _UdevMgrClass -{ - GObjectClass parent_class; -}; - - -GType udev_mgr_get_type (void) G_GNUC_CONST; -UdevMgr* udev_mgr_new (DbusmenuMenuitem* scanner_item, - DbusmenuMenuitem* webcam_item); - -typedef enum { - ADD, - REMOVE -}UdevMgrDeviceAction; - -G_END_DECLS - -#endif /* _UDEV_MGR_H_ */ diff --git a/src/upower.xml b/src/upower.xml index a4066ff..18d5fbd 100644 --- a/src/upower.xml +++ b/src/upower.xml @@ -86,7 +86,7 @@ method return sender=:1.386 -> dest=:1.451 reply_serial=2 <!-- ************************************************************ --> <signal name="DeviceChanged"> - <arg name="device" type="o"> + <arg name="device" type="s"> <doc:doc><doc:summary>Object path of device that was changed.</doc:summary></doc:doc> </arg> diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c deleted file mode 100644 index 3f4bdc4..0000000 --- a/src/user-menu-mgr.c +++ /dev/null @@ -1,428 +0,0 @@ -/* -Copyright 2011 Canonical Ltd. - -Authors: - Conor Curran <conor.curran@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <libdbusmenu-glib/client.h> -#include "user-menu-mgr.h" -#include "settings-helper.h" -#include "dbus-shared-names.h" -#include "dbusmenu-shared.h" -#include "lock-helper.h" -#include "users-service-dbus.h" - -static GSettings* settings = NULL; -static DbusmenuMenuitem *switch_menuitem = NULL; - -struct _UserMenuMgr -{ - GObject parent_instance; - UsersServiceDbus* users_dbus_interface; - DbusmenuMenuitem* root_item; - gint user_count; - SessionDbus* session_dbus_interface; -}; - -static void activate_new_session (DbusmenuMenuitem * mi, - guint timestamp, - gpointer user_data); -static void activate_user_session (DbusmenuMenuitem *mi, - guint timestamp, - gpointer user_data); -static void activate_user_accounts (DbusmenuMenuitem *mi, - guint timestamp, - gpointer user_data); -static gint compare_users_by_username (const gchar *a, - const gchar *b); -static void activate_user_accounts (DbusmenuMenuitem *mi, - guint timestamp, - gpointer user_data); -static void user_menu_mgr_rebuild_items (UserMenuMgr *self, - gboolean greeter_mode); -static gboolean check_new_session (); -static void user_change (UsersServiceDbus *service, - const gchar *user_id, - gpointer user_data); -static void ensure_settings_client (); -static gboolean is_this_guest_session (void); -static void activate_guest_session (DbusmenuMenuitem * mi, - guint timestamp, - gpointer user_data); - - -G_DEFINE_TYPE (UserMenuMgr, user_menu_mgr, G_TYPE_OBJECT); - - -static void -user_menu_mgr_init (UserMenuMgr *self) -{ - self->users_dbus_interface = g_object_new (USERS_SERVICE_DBUS_TYPE, NULL); - self->root_item = dbusmenu_menuitem_new (); - g_signal_connect (G_OBJECT (self->users_dbus_interface), - "user-added", - G_CALLBACK (user_change), - self); - g_signal_connect (G_OBJECT (self->users_dbus_interface), - "user-deleted", - G_CALLBACK (user_change), - self); -} - -static void -user_menu_mgr_finalize (GObject *object) -{ - /* TODO: Add deinitalization code here */ - G_OBJECT_CLASS (user_menu_mgr_parent_class)->finalize (object); -} - -static void -user_menu_mgr_class_init (UserMenuMgrClass *klass) -{ - GObjectClass* object_class = G_OBJECT_CLASS (klass); - object_class->finalize = user_menu_mgr_finalize; -} - -/* Builds up the menu for us */ -static void -user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) -{ - DbusmenuMenuitem *mi = NULL; - DbusmenuMenuitem *guest_mi = NULL; - GList *u; - UserData *user; - gboolean can_activate; - GList *children; - - /* Make sure we have a valid GConf client, and build one - if needed */ - ensure_settings_client (); - - /* Check to see which menu items we're allowed to have */ - can_activate = users_service_dbus_can_activate_session (self->users_dbus_interface) && - !g_settings_get_boolean (settings, LOCKDOWN_KEY_USER); - - /* Remove the old menu items if that makes sense */ - children = dbusmenu_menuitem_take_children (self->root_item); - g_list_foreach (children, (GFunc)g_object_unref, NULL); - g_list_free (children); - - /* Set to NULL just incase we don't end up building one */ - users_service_dbus_set_guest_item(self->users_dbus_interface, NULL); - - /* Build all of the user switching items */ - if (can_activate == TRUE) - { - - gboolean guest_enabled = users_service_dbus_guest_session_enabled (self->users_dbus_interface); - GList * users = NULL; - users = users_service_dbus_get_user_list (self->users_dbus_interface); - self->user_count = g_list_length(users); - - gboolean gsettings_user_menu_is_visible = should_show_user_menu(); - - if (gsettings_user_menu_is_visible == FALSE || greeter_mode == TRUE){ - session_dbus_set_user_menu_visibility (self->session_dbus_interface, - FALSE); - } - else{ - // This needs to be updated once the ability to query guest session support is available - session_dbus_set_user_menu_visibility (self->session_dbus_interface, - guest_enabled || self->user_count > 1); - } - - // TODO we should really return here if the menu is not going to be shown. - - if (check_new_session ()){ - switch_menuitem = dbusmenu_menuitem_new (); - dbusmenu_menuitem_property_set (switch_menuitem, - DBUSMENU_MENUITEM_PROP_TYPE, - MENU_SWITCH_TYPE); - dbusmenu_menuitem_property_set (switch_menuitem, - MENU_SWITCH_USER, - g_get_user_name()); - dbusmenu_menuitem_child_append (self->root_item, switch_menuitem); - g_signal_connect (G_OBJECT (switch_menuitem), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK (activate_new_session), - self->users_dbus_interface); - } - - if ( !is_this_guest_session () && guest_enabled) - { - guest_mi = dbusmenu_menuitem_new (); - dbusmenu_menuitem_property_set (guest_mi, - DBUSMENU_MENUITEM_PROP_TYPE, - USER_ITEM_TYPE); - dbusmenu_menuitem_property_set (guest_mi, - USER_ITEM_PROP_NAME, - _("Guest Session")); - dbusmenu_menuitem_property_set_bool (guest_mi, - USER_ITEM_PROP_LOGGED_IN, - FALSE); - dbusmenu_menuitem_child_append (self->root_item, guest_mi); - g_signal_connect (G_OBJECT (guest_mi), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK (activate_guest_session), - self); - users_service_dbus_set_guest_item (self->users_dbus_interface, - guest_mi); - } - else{ - session_dbus_set_users_real_name (self->session_dbus_interface, - _("Guest")); - } - - - - if (self->user_count > MINIMUM_USERS) { - users = g_list_sort (users, (GCompareFunc)compare_users_by_username); - } - - for (u = users; u != NULL; u = g_list_next (u)) { - user = u->data; - g_debug ("%s: %s", user->user_name, user->real_name); - user->service = self->users_dbus_interface; - gboolean current_user = g_strcmp0 (user->user_name, g_get_user_name()) == 0; - if (current_user == TRUE){ - g_debug ("about to set the users real name to %s for user %s", - user->real_name, user->user_name); - session_dbus_set_users_real_name (self->session_dbus_interface, user->real_name); - } - - if (self->user_count > MINIMUM_USERS) { - mi = dbusmenu_menuitem_new (); - dbusmenu_menuitem_property_set (mi, - DBUSMENU_MENUITEM_PROP_TYPE, - USER_ITEM_TYPE); - if (user->real_name_conflict) { - gchar * conflictedname = g_strdup_printf("%s (%s)", user->real_name, user->user_name); - dbusmenu_menuitem_property_set (mi, USER_ITEM_PROP_NAME, conflictedname); - g_free(conflictedname); - } else { - //g_debug ("%p: %s", user, user->real_name); - dbusmenu_menuitem_property_set (mi, - USER_ITEM_PROP_NAME, - user->real_name); - } - dbusmenu_menuitem_property_set_bool (mi, - USER_ITEM_PROP_LOGGED_IN, - user->sessions != NULL); - if (user->icon_file != NULL && user->icon_file[0] != '\0') { - g_debug ("user %s has this icon : %s", - user->user_name, - user->icon_file); - dbusmenu_menuitem_property_set (mi, - USER_ITEM_PROP_ICON, - user->icon_file); - } else { - dbusmenu_menuitem_property_set (mi, - USER_ITEM_PROP_ICON, - USER_ITEM_ICON_DEFAULT); - } - - - /*g_debug ("user name = %s and g user name = %s", - user->user_name, - g_get_user_name());*/ - - dbusmenu_menuitem_property_set_bool (mi, - USER_ITEM_PROP_IS_CURRENT_USER, - current_user); - dbusmenu_menuitem_child_append (self->root_item, mi); - g_signal_connect (G_OBJECT (mi), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK (activate_user_session), - user); - user->menuitem = mi; - } - } - g_list_free(users); - } - // Add the user accounts and separator - DbusmenuMenuitem * separator1 = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (separator1, - DBUSMENU_MENUITEM_PROP_TYPE, - DBUSMENU_CLIENT_TYPES_SEPARATOR); - dbusmenu_menuitem_child_append (self->root_item, separator1); - - DbusmenuMenuitem * user_accounts_item = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (user_accounts_item, - DBUSMENU_MENUITEM_PROP_TYPE, - DBUSMENU_CLIENT_TYPES_DEFAULT); - dbusmenu_menuitem_property_set (user_accounts_item, - DBUSMENU_MENUITEM_PROP_LABEL, - _("User Accounts…")); - - g_signal_connect (G_OBJECT (user_accounts_item), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK (activate_user_accounts), - NULL); - - dbusmenu_menuitem_child_append (self->root_item, user_accounts_item); - - -} - -/* Checks to see if we can create sessions */ -// TODO what is this ? -static gboolean -check_new_session () -{ - return TRUE; -} - -/* Check to see if the lockdown key is protecting from - locking the screen. If not, lock it. */ -static void -lock_if_possible (void) { - ensure_settings_client (); - - if (!g_settings_get_boolean (settings, LOCKDOWN_KEY_SCREENSAVER)) { - lock_screen(NULL, 0, NULL); - } - - return; -} - - -/* Starts a new generic session */ -static void -activate_new_session (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data) -{ - lock_if_possible(); - - users_service_dbus_show_greeter (USERS_SERVICE_DBUS(user_data)); - - return; -} - -/* Activates a session for a particular user. */ -static void -activate_user_session (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data) -{ - UserData *user = (UserData *)user_data; - UsersServiceDbus *service = user->service; - - lock_if_possible(); - - users_service_dbus_activate_user_session (service, user); -} - -/* Comparison function to look into the UserData struct - to compare by using the username value */ -static gint -compare_users_by_username (const gchar *a, - const gchar *b) -{ - UserData *user1 = (UserData *)a; - UserData *user2 = (UserData *)b; - - gint retval = g_strcmp0 (user1->real_name, user2->real_name); - - /* If they're the same, they're both in conflict. */ - if (retval == 0) { - user1->real_name_conflict = TRUE; - user2->real_name_conflict = TRUE; - } - - return retval; -} - -static void -activate_user_accounts (DbusmenuMenuitem *mi, - guint timestamp, - gpointer user_data) -{ - GError * error = NULL; - if (!g_spawn_command_line_async("gnome-control-center user-accounts", &error)) - { - g_warning("Unable to show control centre: %s", error->message); - g_error_free(error); - } -} - -/* Signal called when a user is added. It updates the count and - rebuilds the menu */ -static void -user_change (UsersServiceDbus *service, - const gchar *user_id, - gpointer user_data) -{ - g_return_if_fail (USER_IS_MENU_MGR (user_data)); - UserMenuMgr* user_mgr = USER_MENU_MGR(user_data); - user_menu_mgr_rebuild_items (user_mgr, FALSE); - return; -} - -/* Ensures that we have a GConf client and if we build one - set up the signal handler. */ -static void -ensure_settings_client () -{ - if(!settings) { - settings = g_settings_new (LOCKDOWN_SCHEMA); - } - return; -} - -DbusmenuMenuitem* -user_mgr_get_root_item (UserMenuMgr* self) -{ - return self->root_item; -} - -/* Checks to see if we should show the guest suession item */ -static gboolean -is_this_guest_session (void) -{ - if (geteuid() < 500) { - /* System users shouldn't have guest account shown. Mostly - this would be the case of the guest user itself. */ - return TRUE; - } - - return FALSE; -} - -/* Called when someone clicks on the guest session item. */ -static void -activate_guest_session (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data) -{ - g_return_if_fail (USER_IS_MENU_MGR (user_data)); - UserMenuMgr* user_mgr = USER_MENU_MGR(user_data); - UsersServiceDbus *service = user_mgr->users_dbus_interface; - - lock_if_possible(); - - if (users_service_dbus_activate_guest_session(service)) { - return; - } -} - - -/* - * Clean Entry Point - */ -UserMenuMgr* user_menu_mgr_new (SessionDbus* session_dbus, gboolean greeter_mode) -{ - UserMenuMgr* user_mgr = g_object_new (USER_TYPE_MENU_MGR, NULL); - user_mgr->session_dbus_interface = session_dbus; - user_menu_mgr_rebuild_items (user_mgr, greeter_mode); - return user_mgr; -} - - diff --git a/src/user-menu-mgr.h b/src/user-menu-mgr.h deleted file mode 100644 index 40f7b18..0000000 --- a/src/user-menu-mgr.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright 2011 Canonical Ltd. - -Authors: - Conor Curran <conor.curran@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - - -#ifndef _USER_MENU_MGR_H_ -#define _USER_MENU_MGR_H_ - - -#include <glib-object.h> -#include <libdbusmenu-gtk/menuitem.h> - -#include "session-dbus.h" - -G_BEGIN_DECLS - -#define USER_TYPE_MENU_MGR (user_menu_mgr_get_type ()) -#define USER_MENU_MGR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), USER_TYPE_MENU_MGR, UserMenuMgr)) -#define USER_MENU_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), USER_TYPE_MENU_MGR, UserMenuMgrClass)) -#define USER_IS_MENU_MGR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), USER_TYPE_MENU_MGR)) -#define USER_IS_MENU_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), USER_TYPE_MENU_MGR)) -#define USER_MENU_MGR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), USER_TYPE_MENU_MGR, UserMenuMgrClass)) - -typedef struct _UserMenuMgrClass UserMenuMgrClass; -typedef struct _UserMenuMgr UserMenuMgr; - -struct _UserMenuMgrClass -{ - GObjectClass parent_class; -}; - -GType user_menu_mgr_get_type (void) G_GNUC_CONST; -UserMenuMgr* user_menu_mgr_new (SessionDbus* session_dbus, - gboolean greeter_mode); - -DbusmenuMenuitem* user_mgr_get_root_item (UserMenuMgr* self); -G_END_DECLS - -#endif /* _USER_MENU_MGR_H_ */ diff --git a/src/user-widget.c b/src/user-widget.c index 33b9e40..b0d2dd4 100644 --- a/src/user-widget.c +++ b/src/user-widget.c @@ -4,31 +4,31 @@ Copyright 2011 Canonical Ltd. Authors: Conor Curran <conor.curran@canonical.com> Mirco Müller <mirco.mueller@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published + Charles Kerr <charles.kerr@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along +You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H -#include "config.h" + #include "config.h" #endif -#include <glib/gi18n.h> #include <gtk/gtk.h> -#include <glib.h> -#include <math.h> + #include <libindicator/indicator-image-helper.h> + +#include "shared-names.h" #include "user-widget.h" -#include "dbus-shared-names.h" typedef struct _UserWidgetPrivate UserWidgetPrivate; @@ -37,7 +37,6 @@ struct _UserWidgetPrivate { DbusmenuMenuitem* twin_item; GtkWidget* user_image; - gboolean using_personal_icon; GtkWidget* user_name; GtkWidget* container; GtkWidget* tick_icon; @@ -47,13 +46,6 @@ struct _UserWidgetPrivate #define USER_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), USER_WIDGET_TYPE, UserWidgetPrivate)) -typedef struct -{ - double r; - double g; - double b; -} CairoColorRGB; - /* Prototypes */ static void user_widget_class_init (UserWidgetClass *klass); static void user_widget_init (UserWidget *self); @@ -62,50 +54,18 @@ static void user_widget_finalize (GObject *object); static void user_widget_set_twin_item (UserWidget* self, DbusmenuMenuitem* twin_item); -// keyevent consumers -static gboolean user_widget_button_release_event (GtkWidget *menuitem, - GdkEventButton *event); -// Dbusmenuitem properties update callback -static void user_widget_property_update (DbusmenuMenuitem* item, - gchar* property, - GVariant* value, - gpointer userdata); - - -static void _color_shade (const CairoColorRGB *a, - float k, - CairoColorRGB *b); - -static void draw_album_border (GtkWidget *widget, gboolean selected); - -#if GTK_CHECK_VERSION(3, 0, 0) + static gboolean user_widget_primitive_draw_cb_gtk_3 (GtkWidget *image, cairo_t* cr, gpointer user_data); -static gboolean user_widget_draw_usericon_gtk_3 (GtkWidget *widget, - cairo_t* cr, - gpointer user_data); - -#else -static gboolean user_widget_primitive_draw_cb (GtkWidget *image, - GdkEventExpose *event, - gpointer user_data); -static gboolean user_widget_draw_usericon_gtk_2 (GtkWidget *widget, - GdkEventExpose *event, - gpointer user_data); - -#endif G_DEFINE_TYPE (UserWidget, user_widget, GTK_TYPE_MENU_ITEM); static void user_widget_class_init (UserWidgetClass *klass) { - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + GObjectClass * gobject_class = G_OBJECT_CLASS (klass); - widget_class->button_release_event = user_widget_button_release_event; - g_type_class_add_private (klass, sizeof (UserWidgetPrivate)); gobject_class->dispose = user_widget_dispose; @@ -115,79 +75,57 @@ user_widget_class_init (UserWidgetClass *klass) static void user_widget_init (UserWidget *self) { - UserWidgetPrivate * priv = USER_WIDGET_GET_PRIVATE(self); - - gint padding = 0; - gtk_widget_style_get (GTK_WIDGET(self), - "horizontal-padding", - &padding, - NULL); - + self->priv = USER_WIDGET_GET_PRIVATE(self); + + UserWidgetPrivate * priv = self->priv; + priv->user_image = NULL; priv->user_name = NULL; priv->logged_in = FALSE; priv->sessions_active = FALSE; priv->container = NULL; priv->tick_icon = NULL; - - // Create the UI elements. + + // Create the UI elements. priv->user_image = gtk_image_new (); - gtk_misc_set_alignment(GTK_MISC(priv->user_image), 0.0, 0.0); + gtk_misc_set_alignment(GTK_MISC(priv->user_image), 0.0, 0.0); gtk_misc_set_padding (GTK_MISC(priv->user_image),0, 4.0); - + priv->user_name = gtk_label_new (""); -#if HAVE_GTK3 - priv->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - priv->container = gtk_hbox_new (FALSE, 0); -#endif + priv->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); - priv->tick_icon = gtk_image_new_from_icon_name ("account-logged-in", + priv->tick_icon = gtk_image_new_from_icon_name ("account-logged-in", GTK_ICON_SIZE_MENU); - gtk_misc_set_alignment(GTK_MISC(priv->tick_icon), 1.0, 0.5); - + gtk_misc_set_alignment(GTK_MISC(priv->tick_icon), 1.0, 0.5); + // Pack it together gtk_box_pack_start (GTK_BOX (priv->container), priv->user_image, FALSE, FALSE, - 0); + 0); gtk_box_pack_start (GTK_BOX (priv->container), priv->user_name, FALSE, FALSE, - 3); - gtk_box_pack_start (GTK_BOX(priv->container), - priv->tick_icon, - FALSE, - FALSE, 5); - - gtk_widget_show_all (priv->container); - gtk_container_add (GTK_CONTAINER (self), priv->container); + 3); + gtk_box_pack_end (GTK_BOX(priv->container), + priv->tick_icon, + FALSE, + FALSE, 5); + + gtk_widget_show_all (priv->container); + gtk_container_add (GTK_CONTAINER (self), priv->container); gtk_widget_show_all (priv->tick_icon); gtk_widget_set_no_show_all (priv->tick_icon, TRUE); gtk_widget_hide (priv->tick_icon); - - + + // Fetch the drawing context. - #if GTK_CHECK_VERSION(3, 0, 0) - g_signal_connect_after (GTK_WIDGET(self), "draw", + g_signal_connect_after (GTK_WIDGET(self), "draw", G_CALLBACK(user_widget_primitive_draw_cb_gtk_3), GTK_WIDGET(self)); - - g_signal_connect_after (GTK_WIDGET(priv->user_image), "draw", - G_CALLBACK(user_widget_draw_usericon_gtk_3), - GTK_WIDGET(self)); - - #else - g_signal_connect_after (GTK_WIDGET(self), "expose-event", - G_CALLBACK(user_widget_primitive_draw_cb), - GTK_WIDGET(self)); - g_signal_connect_after (GTK_WIDGET(priv->user_image), "expose-event", - G_CALLBACK(user_widget_draw_usericon_gtk_2), - GTK_WIDGET(self)); - #endif } static void @@ -206,519 +144,145 @@ user_widget_finalize (GObject *object) /*****************************************************************/ -#if GTK_CHECK_VERSION(3, 0, 0) - // TODO handle drawing of green check mark static gboolean user_widget_primitive_draw_cb_gtk_3 (GtkWidget *widget, cairo_t* cr, gpointer user_data) { - g_return_val_if_fail(IS_USER_WIDGET(user_data), FALSE); UserWidget* meta = USER_WIDGET(user_data); - UserWidgetPrivate * priv = USER_WIDGET_GET_PRIVATE(meta); + UserWidgetPrivate * priv = USER_WIDGET_GET_PRIVATE(meta); // Draw dot only when user is the current user. - if (!dbusmenu_menuitem_property_get_bool (priv->twin_item, - USER_ITEM_PROP_IS_CURRENT_USER)){ - return FALSE; - } - - GtkStyle *style; - gdouble x, y; - style = gtk_widget_get_style (widget); - - GtkAllocation allocation; - gtk_widget_get_allocation (widget, &allocation); - x = allocation.x + 13; - y = allocation.height / 2; - - cairo_arc (cr, x, y, 3.0, 0.0, 2 * G_PI);; - - cairo_set_source_rgb (cr, style->fg[gtk_widget_get_state(widget)].red/65535.0, - style->fg[gtk_widget_get_state(widget)].green/65535.0, - style->fg[gtk_widget_get_state(widget)].blue/65535.0); - cairo_fill (cr); - - return FALSE; -} - -static gboolean -user_widget_draw_usericon_gtk_3 (GtkWidget *widget, - cairo_t* cr, - gpointer user_data) -{ - g_return_val_if_fail(IS_USER_WIDGET(user_data), FALSE); - UserWidget* meta = USER_WIDGET(user_data); - UserWidgetPrivate * priv = USER_WIDGET_GET_PRIVATE(meta); + if (dbusmenu_menuitem_property_get_bool (priv->twin_item, USER_ITEM_PROP_IS_CURRENT_USER)) + { + gdouble x, y; + GtkStyle * style = gtk_widget_get_style (widget); + + GtkAllocation allocation; + gtk_widget_get_allocation (widget, &allocation); + x = allocation.x + 13; + y = allocation.height / 2; + + cairo_arc (cr, x, y, 3.0, 0.0, 2 * G_PI); + + cairo_set_source_rgb (cr, style->fg[gtk_widget_get_state(widget)].red/65535.0, + style->fg[gtk_widget_get_state(widget)].green/65535.0, + style->fg[gtk_widget_get_state(widget)].blue/65535.0); + cairo_fill (cr); + } - if (priv->using_personal_icon == FALSE) - return FALSE; - - draw_album_border (widget, FALSE); return FALSE; } -/** - * TODO: - * Sort out gtk2 - */ -// GTK 2 Expose handler -#else -static gboolean -user_widget_draw_usericon_gtk_2 (GtkWidget *widget, - GdkEventExpose *event, - gpointer user_data) -{ - g_return_val_if_fail(IS_USER_WIDGET(user_data), FALSE); - UserWidget* meta = USER_WIDGET(user_data); - UserWidgetPrivate * priv = USER_WIDGET_GET_PRIVATE(meta); +/*** +**** +***/ - if (priv->using_personal_icon == FALSE) - return FALSE; - - draw_album_border (widget, FALSE); - return FALSE; -} +static const int ICON_SIZE = 24; -static gboolean -user_widget_primitive_draw_cb (GtkWidget *widget, - GdkEventExpose *event, - gpointer user_data) +static void +update_icon (UserWidget * self, DbusmenuMenuitem * mi) { - g_return_val_if_fail(IS_USER_WIDGET(user_data), FALSE); - UserWidget* meta = USER_WIDGET(user_data); - UserWidgetPrivate * priv = USER_WIDGET_GET_PRIVATE(meta); + GdkPixbuf * pixbuf = NULL; + + /* first, try the menuitem's icon property */ + const gchar * icon_name = dbusmenu_menuitem_property_get (mi, USER_ITEM_PROP_ICON); + if (icon_name) + { + GError* error = NULL; + pixbuf = gdk_pixbuf_new_from_file_at_size (icon_name, ICON_SIZE, ICON_SIZE, &error); + if (error != NULL) + { + g_warning ("Couldn't load the image \"%s\": %s", icon_name, error->message); + g_clear_error (&error); + } + } - // Draw dot only when user is the current user. - if (!dbusmenu_menuitem_property_get_bool (priv->twin_item, - USER_ITEM_PROP_IS_CURRENT_USER)){ - return FALSE; - } - - GtkStyle *style; - cairo_t *cr; - cr = (cairo_t*) gdk_cairo_create (gtk_widget_get_window (widget)); - - gdouble x, y; - style = gtk_widget_get_style (widget); - - GtkAllocation allocation; - - gtk_widget_get_allocation (widget, &allocation); - x = allocation.x + 13; - y = allocation.y + allocation.height/2; - - cairo_arc (cr, x, y, 3.0, 0.0, 2 * G_PI);; - - cairo_set_source_rgb (cr, style->fg[gtk_widget_get_state(widget)].red/65535.0, - style->fg[gtk_widget_get_state(widget)].green/65535.0, - style->fg[gtk_widget_get_state(widget)].blue/65535.0); - cairo_fill (cr); - cairo_destroy (cr); - - return FALSE; -} -#endif + /* as a fallback, try to use the default user icon */ + if (pixbuf == NULL) + { + pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), + USER_ITEM_ICON_DEFAULT, + ICON_SIZE, + GTK_ICON_LOOKUP_FORCE_SIZE, + NULL); + } + if (pixbuf != NULL) + { + gtk_image_set_from_pixbuf (GTK_IMAGE(self->priv->user_image), pixbuf); + g_object_unref (pixbuf); + } +} static void -draw_album_border(GtkWidget *widg, gboolean selected) +update_logged_in (UserWidget * self, DbusmenuMenuitem * mi) { - cairo_t *cr; - cr = gdk_cairo_create (gtk_widget_get_window (widg)); - #if GTK_CHECK_VERSION(3, 0, 0) - gtk_style_context_add_class (gtk_widget_get_style_context (widg), - "menu"); - #endif - - GtkStyle *style; - style = gtk_widget_get_style (widg); - - GtkAllocation alloc; - gtk_widget_get_allocation (widg, &alloc); - gint offset = 0; - gint v_offset = 4; - - alloc.width = alloc.width + (offset * 2); - alloc.height = alloc.height - v_offset - 2; - alloc.x = alloc.x - offset; - alloc.y = alloc.y + v_offset/2 +1; - - CairoColorRGB bg_normal, fg_normal; - - bg_normal.r = style->bg[0].red/65535.0; - bg_normal.g = style->bg[0].green/65535.0; - bg_normal.b = style->bg[0].blue/65535.0; - - gint state = selected ? 5 : 0; - - fg_normal.r = style->fg[state].red/65535.0; - fg_normal.g = style->fg[state].green/65535.0; - fg_normal.b = style->fg[state].blue/65535.0; - - CairoColorRGB dark_top_color; - CairoColorRGB light_bottom_color; - CairoColorRGB background_color; - - _color_shade ( &bg_normal, 0.93, &background_color ); - _color_shade ( &bg_normal, 0.23, &dark_top_color ); - _color_shade ( &fg_normal, 0.55, &light_bottom_color ); - - cairo_rectangle (cr, - alloc.x, alloc.y, - alloc.width, alloc.height); - - cairo_set_line_width (cr, 1.0); - - cairo_clip ( cr ); - - cairo_move_to (cr, alloc.x, alloc.y ); - cairo_line_to (cr, alloc.x + alloc.width, - alloc.y ); - cairo_line_to ( cr, alloc.x + alloc.width, - alloc.y + alloc.height ); - cairo_line_to ( cr, alloc.x, alloc.y + alloc.height ); - cairo_line_to ( cr, alloc.x, alloc.y); - cairo_close_path (cr); - - cairo_set_source_rgba ( cr, - background_color.r, - background_color.g, - background_color.b, - 1.0 ); - - cairo_stroke ( cr ); - - cairo_move_to (cr, alloc.x, alloc.y ); - cairo_line_to (cr, alloc.x + alloc.width, - alloc.y ); - - cairo_close_path (cr); - cairo_set_source_rgba ( cr, - dark_top_color.r, - dark_top_color.g, - dark_top_color.b, - 1.0 ); - - cairo_stroke ( cr ); - - cairo_move_to ( cr, alloc.x + alloc.width, - alloc.y + alloc.height ); - cairo_line_to ( cr, alloc.x, alloc.y + alloc.height ); - - cairo_close_path (cr); - cairo_set_source_rgba ( cr, - light_bottom_color.r, - light_bottom_color.g, - light_bottom_color.b, - 1.0); - - cairo_stroke ( cr ); - cairo_destroy (cr); + const gboolean b = dbusmenu_menuitem_property_get_bool (mi, USER_ITEM_PROP_LOGGED_IN); + + g_debug ("User \"%s\" %s active sessions", + dbusmenu_menuitem_property_get (mi, USER_ITEM_PROP_NAME), + b ? "has" : "doesn't have"); + + gtk_widget_set_visible (self->priv->tick_icon, b); } static void -_color_rgb_to_hls (gdouble *r, - gdouble *g, - gdouble *b) +update_name (UserWidget * self, DbusmenuMenuitem * mi) { - gdouble min; - gdouble max; - gdouble red; - gdouble green; - gdouble blue; - gdouble h = 0; - gdouble l; - gdouble s; - gdouble delta; - - red = *r; - green = *g; - blue = *b; - - if (red > green) - { - if (red > blue) - max = red; - else - max = blue; - - if (green < blue) - min = green; - else - min = blue; - } - else - { - if (green > blue) - max = green; - else - max = blue; - - if (red < blue) - min = red; - else - min = blue; - } - l = (max+min)/2; - if (fabs (max-min) < 0.0001) - { - h = 0; - s = 0; - } - else - { - if (l <= 0.5) - s = (max-min)/(max+min); - else - s = (max-min)/(2-max-min); - - delta = (max -min) != 0 ? (max -min) : 1; - - if(delta == 0) - delta = 1; - if (red == max) - h = (green-blue)/delta; - else if (green == max) - h = 2+(blue-red)/delta; - else if (blue == max) - h = 4+(red-green)/delta; - - h *= 60; - if (h < 0.0) - h += 360; - } - - *r = h; - *g = l; - *b = s; + gtk_label_set_label (GTK_LABEL(self->priv->user_name), + dbusmenu_menuitem_property_get (mi, USER_ITEM_PROP_NAME)); } static void -_color_hls_to_rgb (gdouble *h, - gdouble *l, - gdouble *s) +user_widget_property_update (DbusmenuMenuitem * mi, + const gchar * property, + GVariant * value, + UserWidget * self) { - gdouble hue; - gdouble lightness; - gdouble saturation; - gdouble m1, m2; - gdouble r, g, b; + g_return_if_fail (IS_USER_WIDGET (self)); - lightness = *l; - saturation = *s; - - if (lightness <= 0.5) - m2 = lightness*(1+saturation); - else - m2 = lightness+saturation-lightness*saturation; - - m1 = 2*lightness-m2; - - if (saturation == 0) - { - *h = lightness; - *l = lightness; - *s = lightness; - } + if (!g_strcmp0 (property, USER_ITEM_PROP_LOGGED_IN)) + { + update_logged_in (self, mi); + } + else if (!g_strcmp0 (property, USER_ITEM_PROP_ICON)) + { + update_icon (self, mi); + } + else if (!g_strcmp0 (property, USER_ITEM_PROP_NAME)) + { + update_name (self, mi); + } else - { - hue = *h+120; - while (hue > 360) - hue -= 360; - while (hue < 0) - hue += 360; - - if (hue < 60) - r = m1+(m2-m1)*hue/60; - else if (hue < 180) - r = m2; - else if (hue < 240) - r = m1+(m2-m1)*(240-hue)/60; - else - r = m1; - - hue = *h; - while (hue > 360) - hue -= 360; - while (hue < 0) - hue += 360; - - if (hue < 60) - g = m1+(m2-m1)*hue/60; - else if (hue < 180) - g = m2; - else if (hue < 240) - g = m1+(m2-m1)*(240-hue)/60; - else - g = m1; - - hue = *h-120; - while (hue > 360) - hue -= 360; - while (hue < 0) - hue += 360; - - if (hue < 60) - b = m1+(m2-m1)*hue/60; - else if (hue < 180) - b = m2; - else if (hue < 240) - b = m1+(m2-m1)*(240-hue)/60; - else - b = m1; - - *h = r; - *l = g; - *s = b; - } -} - -void -_color_shade (const CairoColorRGB *a, float k, CairoColorRGB *b) -{ - double red; - double green; - double blue; - - red = a->r; - green = a->g; - blue = a->b; - - if (k == 1.0) - { - b->r = red; - b->g = green; - b->b = blue; - return; - } - - _color_rgb_to_hls (&red, &green, &blue); - - green *= k; - if (green > 1.0) - green = 1.0; - else if (green < 0.0) - green = 0.0; - - blue *= k; - if (blue > 1.0) - blue = 1.0; - else if (blue < 0.0) - blue = 0.0; - - _color_hls_to_rgb (&red, &green, &blue); - - b->r = red; - b->g = green; - b->b = blue; -} - - -/*****************************************************************/ - -/* Suppress/consume keyevents */ -static gboolean -user_widget_button_release_event (GtkWidget *menuitem, - GdkEventButton *event) -{ - return FALSE; + { + g_debug ("%s FIXME: unhandled property change %s", G_STRFUNC, property); + } } - -/** - * TODO, be sensitive to UI updates - * */ -static void -user_widget_property_update (DbusmenuMenuitem* item, gchar* property, - GVariant* value, gpointer userdata) +static void +user_widget_set_twin_item (UserWidget * self, DbusmenuMenuitem * mi) { - g_return_if_fail (IS_USER_WIDGET (userdata)); - //gtk_widget_queue_redraw (GTK_WIDGET(userdata)); -} - + self->priv->twin_item = mi; + update_icon (self, mi); + update_name (self, mi); + update_logged_in (self, mi); - -static void -user_widget_set_twin_item (UserWidget* self, - DbusmenuMenuitem* twin_item) -{ - UserWidgetPrivate* priv = USER_WIDGET_GET_PRIVATE(self); - priv->twin_item = twin_item; - g_signal_connect( G_OBJECT(priv->twin_item), "property-changed", + g_signal_connect (G_OBJECT(mi), "property-changed", G_CALLBACK(user_widget_property_update), self); - - const gchar * icon_name = dbusmenu_menuitem_property_get (twin_item, - USER_ITEM_PROP_ICON); - gtk_label_set_label (GTK_LABEL (priv->user_name), - dbusmenu_menuitem_property_get (twin_item, USER_ITEM_PROP_NAME)); - - if (dbusmenu_menuitem_property_get_bool (twin_item, USER_ITEM_PROP_LOGGED_IN)) { - g_debug ("%s USER HAS ACTIVE SESSIONS", - dbusmenu_menuitem_property_get (twin_item, USER_ITEM_PROP_NAME)); - gtk_widget_show(priv->tick_icon); - } - else { - g_debug ("%s USER DOESN'T HAVE ACTIVE SESSIONS", - dbusmenu_menuitem_property_get (twin_item, USER_ITEM_PROP_NAME)); - gtk_widget_hide(priv->tick_icon); - } - - GdkPixbuf* pixbuf = NULL; - GError* error = NULL; - pixbuf = gdk_pixbuf_new_from_file_at_size(icon_name, 32, 32, NULL); - - if (pixbuf == NULL || error != NULL) { - g_warning ("Could not load the user image (%s) for some reason", - icon_name); - if (pixbuf != NULL){ - g_object_unref (pixbuf); - pixbuf = NULL; - } - if (error != NULL){ - g_error_free (error); - error = NULL; - } - - priv->using_personal_icon = FALSE; - - pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), - USER_ITEM_ICON_DEFAULT, - 32, - GTK_ICON_LOOKUP_FORCE_SIZE, - &error); - } - else{ - priv->using_personal_icon = TRUE; - } - - if (pixbuf == NULL || error != NULL) { - g_warning ("Could not load the user image"); - if (error != NULL){ - g_error_free (error); - error = NULL; - } - } - else{ - gtk_image_set_from_pixbuf (GTK_IMAGE(priv->user_image), pixbuf); - } - if (pixbuf != NULL){ - g_object_unref (pixbuf); - pixbuf = NULL; - } } /** - * transport_new: - * @returns: a new #UserWidget. - **/ -GtkWidget* -user_widget_new(DbusmenuMenuitem *item) + * user_widget_new: + * @returns: a new #UserWidget. + **/ +GtkWidget* +user_widget_new (DbusmenuMenuitem *item) { GtkWidget* widget = g_object_new(USER_WIDGET_TYPE, NULL); user_widget_set_twin_item ( USER_WIDGET(widget), item ); - return widget; + return widget; } diff --git a/src/user-widget.h b/src/user-widget.h index 52a5e34..0953e6c 100644 --- a/src/user-widget.h +++ b/src/user-widget.h @@ -31,18 +31,23 @@ G_BEGIN_DECLS #define IS_USER_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), USER_WIDGET_TYPE)) #define USER_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), USER_WIDGET_TYPE, UserWidgetClass)) -typedef struct _UserWidget UserWidget; -typedef struct _UserWidgetClass UserWidgetClass; +typedef struct _UserWidget UserWidget; +typedef struct _UserWidgetClass UserWidgetClass; +typedef struct _UserWidgetPrivate UserWidgetPrivate; -struct _UserWidgetClass { +struct _UserWidgetClass +{ GtkMenuItemClass parent_class; }; -struct _UserWidget { +struct _UserWidget +{ + /*< private >*/ GtkMenuItem parent; + UserWidgetPrivate * priv; }; -GType user_widget_get_type (void); +GType user_widget_get_type (void) G_GNUC_CONST; GtkWidget* user_widget_new(DbusmenuMenuitem *twin_item); G_END_DECLS diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c index 09f916d..fec17dc 100644 --- a/src/users-service-dbus.c +++ b/src/users-service-dbus.c @@ -4,6 +4,7 @@ * * Authors: * Cody Russell <crussell@canonical.com> + * Charles Kerr <charles.kerr@canonical.com> * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -19,101 +20,134 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" + #include "config.h" #endif -#include <string.h> +#include <glib.h> + #include <errno.h> -#include <pwd.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-lowlevel.h> +#include <pwd.h> /* getpwuid() */ -#include "dbus-shared-names.h" -#include "display-manager-client.h" +#include "dbus-accounts.h" +#include "dbus-consolekit-manager.h" +#include "dbus-consolekit-seat.h" +#include "dbus-consolekit-session.h" +#include "dbus-display-manager.h" +#include "dbus-user.h" +#include "shared-names.h" #include "users-service-dbus.h" -#include "accounts-service-client.h" -#include "consolekit-manager-client.h" -#include "consolekit-session-client.h" -#include "consolekit-seat-client.h" #define CK_ADDR "org.freedesktop.ConsoleKit" #define CK_SESSION_IFACE "org.freedesktop.ConsoleKit.Session" +/** +*** +**/ + +static void update_user_list (UsersServiceDbus * self); + +static gchar* get_seat (UsersServiceDbus * service); + +static void on_user_added (Accounts * o, + const gchar * user_object_path, + UsersServiceDbus * service); + +static void on_user_deleted (Accounts * o, + const gchar * user_object_path, + UsersServiceDbus * service); -static void users_service_dbus_class_init (UsersServiceDbusClass *klass); -static void users_service_dbus_init (UsersServiceDbus *self); -static void users_service_dbus_dispose (GObject *object); -static void users_service_dbus_finalize (GObject *object); -static void create_display_manager_proxy (UsersServiceDbus *self); -static void create_accounts_service_proxy (UsersServiceDbus *self); -static void create_seat_proxy (UsersServiceDbus *self); -static void create_ck_proxy (UsersServiceDbus *self); -static void create_cksession_proxy (UsersServiceDbus *self); -static gchar *get_seat (UsersServiceDbus *service); -static void user_added (DBusGProxy *proxy, - const gchar *user_id, - gpointer user_data); -static void user_deleted (DBusGProxy *proxy, - const gchar *user_id, - gpointer user_data); -static void user_changed (DBusGProxy *proxy, - gpointer user_data); -static void seat_proxy_session_added (DBusGProxy *seat_proxy, - const gchar *session_id, - UsersServiceDbus *service); -static void seat_proxy_session_removed (DBusGProxy *seat_proxy, - const gchar *session_id, - UsersServiceDbus *service); -static void sync_users (UsersServiceDbus *self); -static gboolean do_add_session (UsersServiceDbus *service, - UserData *user, - const gchar *ssid); -static gchar * get_seat_internal (DBusGProxy *proxy); - -/* Private */ -typedef struct _UsersServiceDbusPrivate UsersServiceDbusPrivate; +static void on_session_added (ConsoleKitSeat * seat, + const gchar * ssid, + UsersServiceDbus * service); + +static void on_session_removed (ConsoleKitSeat * seat, + const gchar * ssid, + UsersServiceDbus * service); + +static void on_session_list (ConsoleKitSeat * seat, + GAsyncResult * result, + UsersServiceDbus * service); + +/*** +**** Priv Struct +***/ struct _UsersServiceDbusPrivate { - GHashTable *users; - gint count; - gchar *seat; - gchar *ssid; - - DBusGConnection *system_bus; + gchar * seat; + gchar * guest_ssid; - DBusGProxy *accounts_service_proxy; - DBusGProxy *display_manager_proxy; - DBusGProxy *display_manager_props_proxy; - DBusGProxy *ck_proxy; - DBusGProxy *seat_proxy; - DBusGProxy *session_proxy; + /* ssid -> AccountsUser lookup */ + GHashTable * sessions; - GHashTable *exclusions; - GHashTable *sessions; + /* user object path -> AccountsUser lookup */ + GHashTable * users; - DbusmenuMenuitem * guest_item; - gchar * guest_session_id; - gboolean guest_session_enabled; + GCancellable * cancellable; + ConsoleKitSeat * seat_proxy; + ConsoleKitManager * ck_manager_proxy; + Accounts * accounts_proxy; }; -#define USERS_SERVICE_DBUS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), USERS_SERVICE_DBUS_TYPE, UsersServiceDbusPrivate)) +/*** +**** GObject +***/ -/* Signals */ -enum { - USER_ADDED, - USER_DELETED, - LAST_SIGNAL +enum +{ + USER_LIST_CHANGED, + USER_LOGGED_IN_CHANGED, + GUEST_LOGGED_IN_CHANGED, + N_SIGNALS }; -static guint signals[LAST_SIGNAL] = { 0 }; +static guint signals[N_SIGNALS] = { 0 }; -/* GObject Boilerplate */ G_DEFINE_TYPE (UsersServiceDbus, users_service_dbus, G_TYPE_OBJECT); static void +users_service_dbus_dispose (GObject *object) +{ + UsersServiceDbusPrivate * priv = USERS_SERVICE_DBUS(object)->priv; + + g_clear_object (&priv->accounts_proxy); + g_clear_object (&priv->seat_proxy); + g_clear_object (&priv->ck_manager_proxy); + + if (priv->cancellable != NULL) + { + g_cancellable_cancel (priv->cancellable); + g_clear_object (&priv->cancellable); + } + + if (priv->users != NULL) + { + g_hash_table_destroy (priv->users); + priv->users = NULL; + } + + if (priv->sessions != NULL) + { + g_hash_table_destroy (priv->sessions); + priv->sessions = NULL; + } + + G_OBJECT_CLASS (users_service_dbus_parent_class)->dispose (object); +} + +static void +users_service_dbus_finalize (GObject *object) +{ + UsersServiceDbusPrivate * priv = USERS_SERVICE_DBUS(object)->priv; + + g_free (priv->guest_ssid); + g_free (priv->seat); + + G_OBJECT_CLASS (users_service_dbus_parent_class)->finalize (object); +} + +static void users_service_dbus_class_init (UsersServiceDbusClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -123,845 +157,866 @@ users_service_dbus_class_init (UsersServiceDbusClass *klass) object_class->dispose = users_service_dbus_dispose; object_class->finalize = users_service_dbus_finalize; - signals[USER_ADDED] = g_signal_new ("user-added", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (UsersServiceDbusClass, user_added), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, G_TYPE_STRING); - - signals[USER_DELETED] = g_signal_new ("user-deleted", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (UsersServiceDbusClass, user_deleted), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, G_TYPE_STRING); + signals[USER_LIST_CHANGED] = g_signal_new ( + "user-list-changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (UsersServiceDbusClass, user_list_changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[USER_LOGGED_IN_CHANGED] = g_signal_new ( + "user-logged-in-changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (UsersServiceDbusClass, user_logged_in_changed), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, G_TYPE_OBJECT); + + signals[GUEST_LOGGED_IN_CHANGED] = g_signal_new ( + "guest-logged-in-changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (UsersServiceDbusClass, guest_logged_in_changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void users_service_dbus_init (UsersServiceDbus *self) { - GError *error = NULL; - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); + GError * error = NULL; - priv->users = NULL; - priv->count = 0; - priv->guest_item = NULL; - priv->guest_session_id = NULL; - - priv->guest_session_enabled = FALSE; + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, + USERS_SERVICE_DBUS_TYPE, + UsersServiceDbusPrivate); - /* Get the system bus */ - priv->system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); + UsersServiceDbusPrivate * p = self->priv; + + p->cancellable = g_cancellable_new (); + + /* ssid -> AccountsUser */ + p->sessions = g_hash_table_new_full (g_str_hash, + g_str_equal, + g_free, + g_object_unref); + + /* user object path -> AccountsUser */ + p->users = g_hash_table_new_full (g_str_hash, + g_str_equal, + g_free, + g_object_unref); + + /** + *** create the consolekit manager proxy... + **/ + + p->ck_manager_proxy = console_kit_manager_proxy_new_for_bus_sync ( + G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + "org.freedesktop.ConsoleKit", + "/org/freedesktop/ConsoleKit/Manager", + NULL, + &error); if (error != NULL) { - g_error ("Unable to get system bus"); - g_error_free(error); - - return; + g_warning ("%s: %s", G_STRLOC, error->message); + g_clear_error (&error); } - priv->sessions = g_hash_table_new_full (g_str_hash, - g_str_equal, - g_free, - g_free); + p->seat = get_seat (self); - priv->users = g_hash_table_new_full (g_str_hash, - g_str_equal, - g_free, - NULL); + /** + *** create the consolekit seat proxy... + **/ + + if (p->seat != NULL) + { + ConsoleKitSeat * proxy = console_kit_seat_proxy_new_for_bus_sync ( + G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + "org.freedesktop.ConsoleKit", + p->seat, + NULL, + &error); - create_ck_proxy (self); - create_seat_proxy (self); - create_display_manager_proxy (self); - create_accounts_service_proxy (self); + if (error != NULL) + { + g_warning ("Failed to connect to the ConsoleKit seat: %s", error->message); + g_clear_error (&error); + } + else + { + g_signal_connect (proxy, "session-added", + G_CALLBACK (on_session_added), self); + g_signal_connect (proxy, "session-removed", + G_CALLBACK (on_session_removed), self); + console_kit_seat_call_get_sessions (proxy, p->cancellable, + (GAsyncReadyCallback)on_session_list, self); + p->seat_proxy = proxy; + } + } + + /** + *** create the accounts manager proxy... + **/ + + Accounts * proxy = accounts_proxy_new_for_bus_sync ( + G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + "org.freedesktop.Accounts", + "/org/freedesktop/Accounts", + NULL, + &error); + if (error != NULL) + { + g_warning ("%s: %s", G_STRFUNC, error->message); + g_clear_error (&error); + } + else + { + g_signal_connect (proxy, "user-added", G_CALLBACK(on_user_added), self); + g_signal_connect (proxy, "user-deleted", G_CALLBACK(on_user_deleted), self); + p->accounts_proxy = proxy; + update_user_list (self); + } } +/*** +**** +***/ + static void -users_service_dbus_dispose (GObject *object) +emit_user_list_changed (UsersServiceDbus * self) { - G_OBJECT_CLASS (users_service_dbus_parent_class)->dispose (object); + g_signal_emit (self, signals[USER_LIST_CHANGED], 0); } static void -users_service_dbus_finalize (GObject *object) +emit_user_login_changed (UsersServiceDbus * self, AccountsUser * user) { - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (object); - - if (priv->guest_session_id != NULL) { - g_free(priv->guest_session_id); - priv->guest_session_id = NULL; - } - - G_OBJECT_CLASS (users_service_dbus_parent_class)->finalize (object); + g_signal_emit (self, signals[USER_LOGGED_IN_CHANGED], 0, user); } - static void -create_display_manager_proxy (UsersServiceDbus *self) -{ - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); - GError *error = NULL; - const gchar *seat = NULL; - - seat = g_getenv ("XDG_SEAT_PATH"); - g_debug ("CREATING DM PROXIES WITH %s", seat); - priv->display_manager_proxy = dbus_g_proxy_new_for_name (priv->system_bus, - "org.freedesktop.DisplayManager", - seat, - "org.freedesktop.DisplayManager.Seat"); - - priv->display_manager_props_proxy = dbus_g_proxy_new_for_name (priv->system_bus, - "org.freedesktop.DisplayManager", - seat, - "org.freedesktop.DBus.Properties"); - - - if (!priv->display_manager_proxy) - { - g_warning ("Failed to get DisplayManager seat proxy."); - return; - } - if (!priv->display_manager_props_proxy) - { - g_warning ("Failed to get DisplayManager Properties seat proxy."); - return; - } - - GValue has_guest_session = {0}; - g_value_init (&has_guest_session, G_TYPE_BOOLEAN); - if (!dbus_g_proxy_call (priv->display_manager_props_proxy, - "Get", - &error, - G_TYPE_STRING, - "org.freedesktop.DisplayManager.Seat", - G_TYPE_STRING, - "HasGuestAccount", - G_TYPE_INVALID, - G_TYPE_VALUE, - &has_guest_session, - G_TYPE_INVALID)) - { - g_warning ("Failed to get the HasGuestSession property from the DisplayManager Properties seat proxy. error: %s", error->message); - g_error_free (error); - return; - } - g_debug ("Does seat have a guest account = %i", g_value_get_boolean (&has_guest_session)); - priv->guest_session_enabled = g_value_get_boolean (&has_guest_session); +emit_guest_login_changed (UsersServiceDbus * self) +{ + g_signal_emit (self, signals[GUEST_LOGGED_IN_CHANGED], 0); } -static void -create_accounts_service_proxy (UsersServiceDbus *self) -{ - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); - GPtrArray *users = g_ptr_array_new (); - GError *error = NULL; - - priv->accounts_service_proxy = dbus_g_proxy_new_for_name (priv->system_bus, - "org.freedesktop.Accounts", - "/org/freedesktop/Accounts", - "org.freedesktop.Accounts"); - - dbus_g_proxy_add_signal (priv->accounts_service_proxy, - "UserAdded", - DBUS_TYPE_G_OBJECT_PATH, - G_TYPE_INVALID); - - dbus_g_proxy_add_signal (priv->accounts_service_proxy, - "UserChanged", - DBUS_TYPE_G_OBJECT_PATH, - G_TYPE_INVALID); - - dbus_g_proxy_add_signal (priv->accounts_service_proxy, - "UserDeleted", - DBUS_TYPE_G_OBJECT_PATH, - G_TYPE_INVALID); - - dbus_g_proxy_connect_signal (priv->accounts_service_proxy, - "UserAdded", - G_CALLBACK (user_added), - self, - NULL); - - dbus_g_proxy_connect_signal (priv->accounts_service_proxy, - "UserDeleted", - G_CALLBACK (user_deleted), - self, - NULL); - - if (!org_freedesktop_Accounts_list_cached_users (priv->accounts_service_proxy, - &users, - &error)) - { - g_warning ("failed to retrieve user count: %s", error->message); - g_error_free (error); +/*** +**** +***/ - return; +static ConsoleKitSession* +create_consolekit_session_proxy (const char * ssid) +{ + GError * error = NULL; + + ConsoleKitSession * p = console_kit_session_proxy_new_for_bus_sync ( + G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + CK_ADDR, + ssid, + NULL, + &error); + if (error != NULL) + { + g_warning ("%s: %s", G_STRLOC, error->message); + g_error_free (error); } - priv->count = users->len; - g_ptr_array_free (users, TRUE); - sync_users (self); + return p; } -static void -create_ck_proxy (UsersServiceDbus *self) +static gchar * +get_seat_from_session_proxy (ConsoleKitSession * session_proxy) { - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); + gchar * seat = NULL; - priv->ck_proxy = dbus_g_proxy_new_for_name (priv->system_bus, - "org.freedesktop.ConsoleKit", - "/org/freedesktop/ConsoleKit/Manager", - "org.freedesktop.ConsoleKit.Manager"); - - if (!priv->ck_proxy) + GError * error = NULL; + console_kit_session_call_get_seat_id_sync (session_proxy, + &seat, + NULL, + &error); + if (error != NULL) { - g_warning ("Failed to get ConsoleKit proxy."); - return; + g_debug ("%s: %s", G_STRLOC, error->message); + g_error_free (error); } + + return seat; } -/* Get the initial sessions when starting up */ -static void -get_cksessions_cb (DBusGProxy *proxy, GPtrArray * sessions, GError * error, gpointer userdata) +static gchar * +get_seat (UsersServiceDbus *service) { - if (error != NULL) { - g_warning("Unable to get initial sessions: %s", error->message); - return; - } + gchar * seat = NULL; + gchar * ssid = NULL; + GError * error = NULL; + UsersServiceDbusPrivate * priv = service->priv; - /* If there's no error we should at least get an - array of zero entries */ - g_return_if_fail(sessions != NULL); - g_debug("Got %d initial sessions", sessions->len); + console_kit_manager_call_get_current_session_sync (priv->ck_manager_proxy, + &ssid, + NULL, + &error); - int i; - for (i = 0; i < sessions->len; i++) { - seat_proxy_session_added(proxy, g_ptr_array_index(sessions, i), USERS_SERVICE_DBUS(userdata)); - } + if (error != NULL) + { + g_debug ("%s: %s", G_STRLOC, error->message); + g_error_free (error); + } + else + { + ConsoleKitSession * session = create_consolekit_session_proxy (ssid); + + if (session != NULL) + { + seat = get_seat_from_session_proxy (session); + g_object_unref (session); + } + } - return; + return seat; } -static void -create_seat_proxy (UsersServiceDbus *self) +/*** +**** AccountsUser add-ons for tracking sessions +***/ + +static GHashTable* +user_get_sessions_hashset (AccountsUser * user) { - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); - GError *error = NULL; + static GQuark q = 0; - priv->seat = get_seat (self); - if (priv->seat == NULL) + if (G_UNLIKELY(!q)) { - return; + q = g_quark_from_static_string ("sessions"); } - priv->seat_proxy = dbus_g_proxy_new_for_name_owner (priv->system_bus, - "org.freedesktop.ConsoleKit", - priv->seat, - "org.freedesktop.ConsoleKit.Seat", - &error); - - if (!priv->seat_proxy) + GObject * o = G_OBJECT (user); + GHashTable * h = g_object_get_qdata (o, q); + if (h == NULL) { - if (error != NULL) - { - g_warning ("Failed to connect to the ConsoleKit seat: %s", error->message); - g_error_free (error); - } - - return; + h = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + g_object_set_qdata_full (o, q, h, (GDestroyNotify)g_hash_table_destroy); } - dbus_g_proxy_add_signal (priv->seat_proxy, - "SessionAdded", - DBUS_TYPE_G_OBJECT_PATH, - G_TYPE_INVALID); - dbus_g_proxy_add_signal (priv->seat_proxy, - "SessionRemoved", - DBUS_TYPE_G_OBJECT_PATH, - G_TYPE_INVALID); + return h; +} - dbus_g_proxy_connect_signal (priv->seat_proxy, - "SessionAdded", - G_CALLBACK (seat_proxy_session_added), - self, - NULL); - dbus_g_proxy_connect_signal (priv->seat_proxy, - "SessionRemoved", - G_CALLBACK (seat_proxy_session_removed), - self, - NULL); +static void +user_add_session (AccountsUser * user, const char * ssid) +{ + g_hash_table_add (user_get_sessions_hashset(user), g_strdup(ssid)); +} - org_freedesktop_ConsoleKit_Seat_get_sessions_async (priv->seat_proxy, get_cksessions_cb, self); +static void +user_remove_session (AccountsUser * user, const char * ssid) +{ + g_hash_table_remove (user_get_sessions_hashset(user), ssid); +} - return; +static guint +user_count_sessions (AccountsUser * user) +{ + return g_hash_table_size (user_get_sessions_hashset(user)); } +/*** +**** Users +***/ + +/* adds this user session to the user's and service's session tables */ static void -create_cksession_proxy (UsersServiceDbus *service) +add_user_session (UsersServiceDbus * service, + AccountsUser * user, + const gchar * ssid) { - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service); + ConsoleKitSession * session_proxy = create_consolekit_session_proxy (ssid); + if (session_proxy != NULL) + { + UsersServiceDbusPrivate * priv = service->priv; + gchar * seat = get_seat_from_session_proxy (session_proxy); - priv->session_proxy = dbus_g_proxy_new_for_name (priv->system_bus, - CK_ADDR, - priv->ssid, - CK_SESSION_IFACE); + /* is this session in our seat? */ + if (seat && priv->seat && !g_strcmp0 (seat, priv->seat)) + { + /* does this session have a display? */ + gchar * display = NULL; + console_kit_session_call_get_x11_display_sync (session_proxy, + &display, + NULL, NULL); + const gboolean has_display = display && *display; + g_free (display); + + if (has_display) + { + const gchar * username = accounts_user_get_user_name (user); + g_debug ("%s adding %s's session '%s' to our tables", + G_STRLOC, username, ssid); - if (!priv->session_proxy) - { - g_warning ("Failed to get ConsoleKit session proxy"); - return; + g_hash_table_insert (priv->sessions, + g_strdup (ssid), + g_object_ref (user)); + + user_add_session (user, ssid); + } + } + + g_free (seat); + g_object_unref (session_proxy); } } -static gchar * -get_seat (UsersServiceDbus *service) +/* calls add_user_session() for each of this user's sessions */ +static void +add_user_sessions (UsersServiceDbus *self, AccountsUser * user) { - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service); - GError *error = NULL; - gchar *ssid = NULL; - gchar *seat; + const guint64 uid = accounts_user_get_uid (user); + const char * username = accounts_user_get_user_name (user); + g_debug ("%s adding %s (%i)", G_STRLOC, username, (int)uid); + + GError * error = NULL; + gchar ** sessions = NULL; + console_kit_manager_call_get_sessions_for_unix_user_sync ( + self->priv->ck_manager_proxy, + uid, + &sessions, + NULL, + &error); - if (!dbus_g_proxy_call (priv->ck_proxy, - "GetCurrentSession", - &error, - G_TYPE_INVALID, - DBUS_TYPE_G_OBJECT_PATH, - &ssid, - G_TYPE_INVALID)) + if (error != NULL) { - if (error) + g_debug ("%s: %s", G_STRLOC, error->message); + g_error_free (error); + } + else if (sessions != NULL) + { + int i; + + for (i=0; sessions[i]; i++) { - g_debug ("Failed to call GetCurrentSession: %s", error->message); - g_error_free (error); + const char * const ssid = sessions[i]; + g_debug ("%s adding %s's session %s", G_STRLOC, username, ssid); + add_user_session (self, user, ssid); } - if (ssid) - g_free (ssid); - - return NULL; + g_strfreev (sessions); } +} - priv->ssid = ssid; - create_cksession_proxy (service); - - seat = get_seat_internal (priv->session_proxy); - - return seat; +/* returns true if this property is one we use */ +static gboolean +is_interesting_user_property (const char * key) +{ + return !g_strcmp0 (key, "IconFile") + || !g_strcmp0 (key, "LoginFrequency") + || !g_strcmp0 (key, "RealName") + || !g_strcmp0 (key, "Uid") + || !g_strcmp0 (key, "UserName"); } -static gchar * -get_seat_internal (DBusGProxy *proxy) +static void +sync_user_properties (GDBusProxy * source, GDBusProxy * target) { - GError *error = NULL; - gchar *seat = NULL; + gchar ** keys = g_dbus_proxy_get_cached_property_names (source); - if (!org_freedesktop_ConsoleKit_Session_get_seat_id (proxy, &seat, &error)) + if (keys != NULL) { - if (error) + int i; + GVariantBuilder builder; + gboolean changed = FALSE; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + + for (i=0; keys[i]; i++) { - g_debug ("Failed to call GetSeatId: %s", error->message); + const gchar * const key = keys[i]; - return NULL; + if (is_interesting_user_property (key)) + { + GVariant * oldval = g_dbus_proxy_get_cached_property (target, key); + GVariant * newval = g_dbus_proxy_get_cached_property (source, key); + + /* all the properties we're interested in are + basic types safe for g_variant_compare()... */ + g_assert (g_variant_type_is_basic(g_variant_get_type(newval))); + + if (g_variant_compare (oldval, newval)) + { + changed = TRUE; + g_dbus_proxy_set_cached_property (target, key, newval); + g_variant_builder_add (&builder, "{sv}", key, newval); + } + + g_variant_unref (newval); + g_variant_unref (oldval); + } } - } - return seat; -} - -static gboolean -get_unix_user (UsersServiceDbus *service, - const gchar *session_id, - uid_t *uidp) -{ - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service); - GError *error = NULL; - guint uid; - DBusGProxy *session_proxy; - - g_debug("Building session proxy for: %s", session_id); - session_proxy = dbus_g_proxy_new_for_name_owner(priv->system_bus, - CK_ADDR, - session_id, - CK_SESSION_IFACE, - &error); - - if (error != NULL) { - g_warning("Unable to get CK Session proxy: %s", error->message); - g_error_free(error); - return FALSE; - } - - if (!org_freedesktop_ConsoleKit_Session_get_unix_user(session_proxy, &uid, &error)) - { - if (error) + if (changed) { - g_warning ("Failed to call GetUnixUser: %s", error->message); - g_error_free (error); + g_signal_emit_by_name (target, "g-properties-changed", g_variant_builder_end(&builder), keys); } - g_object_unref(session_proxy); - return FALSE; + g_variant_builder_clear (&builder); + g_strfreev (keys); } +} - if (uidp != NULL) +/** + * The AccountsUserProxy's properties aren't being updated automatically + * for some reason... the only update we get is the 'changed' signal. + * This function is a workaround to update our User object's properties. + */ +static void +on_user_changed (AccountsUser * user, UsersServiceDbus * service) +{ + AccountsUser * tmp = accounts_user_proxy_new_for_bus_sync ( + G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + "org.freedesktop.Accounts", + g_dbus_proxy_get_object_path (G_DBUS_PROXY(user)), + NULL, + NULL); + if (tmp != NULL) { - *uidp = (uid_t)uid; + sync_user_properties (G_DBUS_PROXY(tmp), G_DBUS_PROXY(user)); + g_object_unref (tmp); } - - g_object_unref(session_proxy); - return TRUE; } -static gboolean -do_add_session (UsersServiceDbus *service, - UserData *user, - const gchar *ssid) -{ - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service); - GError *error = NULL; - gchar *seat = NULL; - gchar *xdisplay = NULL; - DBusGProxy * session_proxy; - GList *l; - - session_proxy = dbus_g_proxy_new_for_name_owner(priv->system_bus, - CK_ADDR, - ssid, - CK_SESSION_IFACE, - &error); - - if (error != NULL) { - g_warning("Unable to get CK Session proxy: %s", error->message); - g_error_free(error); - return FALSE; - } - - seat = get_seat_internal (session_proxy); - - if (!seat || !priv->seat || strcmp (seat, priv->seat) != 0) { - g_object_unref(session_proxy); - return FALSE; - } - - if (!org_freedesktop_ConsoleKit_Session_get_x11_display (session_proxy, &xdisplay, &error)) - { - if (error) - { - g_debug ("Failed to call GetX11Display: %s", error->message); - g_error_free (error); - } - - g_object_unref(session_proxy); - return FALSE; - } - - g_object_unref(session_proxy); - - if (!xdisplay || xdisplay[0] == '\0') - return FALSE; +static void +add_user_from_object_path (UsersServiceDbus * self, + const char * user_object_path) +{ + GError * error = NULL; - g_hash_table_insert (priv->sessions, - g_strdup (ssid), - g_strdup (user->user_name)); + AccountsUser * user = accounts_user_proxy_new_for_bus_sync ( + G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + "org.freedesktop.Accounts", + user_object_path, + NULL, + &error); - l = g_list_find_custom (user->sessions, ssid, (GCompareFunc)g_strcmp0); - if (l == NULL) + if (error != NULL) { - g_debug ("Adding session %s", ssid); - - user->sessions = g_list_prepend (user->sessions, g_strdup (ssid)); - - if (user->menuitem != NULL) { - dbusmenu_menuitem_property_set_bool(user->menuitem, USER_ITEM_PROP_LOGGED_IN, TRUE); - } + g_warning ("%s: %s", G_STRLOC, error->message); + g_clear_error (&error); } else { - g_debug ("User %s already has session %s", user->user_name, ssid); - } + AccountsUser * prev = g_hash_table_lookup (self->priv->users, user_object_path); + + if (prev != NULL) /* we've already got this user... sync its properties */ + { + sync_user_properties (G_DBUS_PROXY(user), G_DBUS_PROXY(prev)); + g_object_unref (user); + user = prev; + } + else /* ooo, we got a new user */ + { + g_signal_connect (user, "changed", G_CALLBACK(on_user_changed), self); + g_hash_table_insert (self->priv->users, g_strdup(user_object_path), user); + } - return TRUE; + add_user_sessions (self, user); + } } + +/* asks org.freedesktop.Accounts for a list of users and + * calls add_user_from_object_path() on each of those users */ static void -add_sessions_for_user (UsersServiceDbus *self, - UserData *user) +update_user_list (UsersServiceDbus *self) { - g_return_if_fail (IS_USERS_SERVICE_DBUS(self)); + g_return_if_fail(IS_USERS_SERVICE_DBUS(self)); - g_debug ("!!!!!!!!!! - add_sessions_for_user %i %s", - (int)user->uid, user->user_name); + GError * error = NULL; + char ** object_paths = NULL; + UsersServiceDbusPrivate * priv = self->priv; - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); - GError *error; - GPtrArray *sessions; - int i; + accounts_call_list_cached_users_sync (priv->accounts_proxy, + &object_paths, + NULL, + &error); - error = NULL; - if (!org_freedesktop_ConsoleKit_Manager_get_sessions_for_unix_user(priv->ck_proxy, user->uid, &sessions, &error)) + if (error != NULL) { - g_debug ("Failed to call GetSessionsForUnixUser: %s", error->message); - g_error_free (error); - - return; + g_warning ("%s: %s", G_STRFUNC, error->message); + g_clear_error (&error); } - - for (i = 0; i < sessions->len; i++) + else if (object_paths != NULL) { - char *ssid; + gint i; - ssid = g_ptr_array_index (sessions, i); - do_add_session (self, user, ssid); + for (i=0; object_paths[i] != NULL; ++i) + { + add_user_from_object_path (self, object_paths[i]); + } + + emit_user_list_changed (self); + + g_strfreev (object_paths); } - g_ptr_array_foreach (sessions, (GFunc)g_free, NULL); - g_ptr_array_free (sessions, TRUE); + g_debug ("%s finished updating the user list", G_STRLOC); } +static void +on_user_added (Accounts * o G_GNUC_UNUSED, + const gchar * user_path G_GNUC_UNUSED, + UsersServiceDbus * service) +{ + /* We see a new user but we might not want to list it -- + for example, lightdm shows up when we switch to the greeter. + So instead of adding the user directly here, let's ask + org.freedesktop.Accounts for a fresh list of users + because it filters out special cases. */ + update_user_list (service); +} static void -seat_proxy_session_added (DBusGProxy *seat_proxy, - const gchar *session_id, - UsersServiceDbus *service) +on_user_deleted (Accounts * o G_GNUC_UNUSED, + const gchar * user_path, + UsersServiceDbus * service) { - g_return_if_fail(IS_USERS_SERVICE_DBUS(service)); - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service); - uid_t uid; - struct passwd *pwent; - UserData *user; + AccountsUser * user = g_hash_table_lookup (service->priv->users, user_path); - if (!get_unix_user (service, session_id, &uid)) + if (user != NULL) { - g_warning ("Failed to lookup user for session"); - return; + GObject * o = g_object_ref (G_OBJECT(user)); + g_hash_table_remove (service->priv->users, user_path); + emit_user_list_changed (service); + g_object_unref (o); } +} - errno = 0; - pwent = getpwuid (uid); - if (!pwent) - { - g_warning ("Failed to lookup user id %d: %s", (int)uid, g_strerror (errno)); - return; - } +static AccountsUser * +find_user_from_username (UsersServiceDbus * self, + const gchar * username) +{ + AccountsUser * match = NULL; - /* We need to special case guest here because it doesn't - show up in the GDM user tables. */ - if (g_strcmp0("guest", pwent->pw_name) == 0) { - if (priv->guest_item != NULL) { - dbusmenu_menuitem_property_set_bool(priv->guest_item, USER_ITEM_PROP_LOGGED_IN, TRUE); - } - priv->guest_session_id = g_strdup(session_id); - g_debug("Found guest session: %s", priv->guest_session_id); - return; - } + g_return_val_if_fail (IS_USERS_SERVICE_DBUS(self), match); - user = users_service_dbus_get_user_by_username (service, pwent->pw_name); - if (!user) - return; + gpointer user; + GHashTableIter iter; + g_hash_table_iter_init (&iter, self->priv->users); + while (!match && g_hash_table_iter_next (&iter, NULL, &user)) + { + if (!g_strcmp0 (username, accounts_user_get_user_name (user))) + { + match = user; + } + } - do_add_session (service, user, session_id); + return match; } +/*** +**** Sessions +***/ + static void -seat_proxy_session_removed (DBusGProxy *seat_proxy, - const gchar *session_id, - UsersServiceDbus *service) -{ - g_return_if_fail(IS_USERS_SERVICE_DBUS(service)); - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service); - UserData *user; - gchar *username; - GList *l; - - username = g_hash_table_lookup (priv->sessions, session_id); - if (!username) { - if (g_strcmp0(session_id, priv->guest_session_id) == 0) { - g_debug("Removing guest session: %s", priv->guest_session_id); - if (priv->guest_item != NULL) { - dbusmenu_menuitem_property_set_bool(priv->guest_item, USER_ITEM_PROP_LOGGED_IN, FALSE); - } - g_free(priv->guest_session_id); - priv->guest_session_id = NULL; - } - return; - } - - user = users_service_dbus_get_user_by_username (service, username); - if (!user) - return; - - l = g_list_find_custom (user->sessions, - session_id, - (GCompareFunc)g_strcmp0); - if (l) - { - g_debug ("Removing session %s", session_id); - - g_free (l->data); - user->sessions = g_list_delete_link (user->sessions, l); - if (user->menuitem != NULL && user->sessions == NULL) { - dbusmenu_menuitem_property_set_bool(user->menuitem, USER_ITEM_PROP_LOGGED_IN, FALSE); - } +on_session_removed (ConsoleKitSeat * seat_proxy, + const gchar * ssid, + UsersServiceDbus * service) +{ + g_return_if_fail (IS_USERS_SERVICE_DBUS (service)); + + UsersServiceDbusPrivate * priv = service->priv; + g_debug ("%s %s() session removed %s", G_STRLOC, G_STRFUNC, ssid); + + if (!g_strcmp0 (ssid, priv->guest_ssid)) + { + g_debug ("%s removing guest session %s", G_STRLOC, ssid); + g_clear_pointer (&priv->guest_ssid, g_free); + emit_guest_login_changed (service); } else { - g_debug ("Session not found: %s", session_id); + AccountsUser * user = g_hash_table_lookup (priv->sessions, ssid); + if (user == NULL) + { + g_debug ("%s we're not tracking ssid %s", G_STRLOC, ssid); + } + else + { + GObject * o = g_object_ref (G_OBJECT(user)); + g_hash_table_remove (service->priv->users, ssid); + user_remove_session (user, ssid); + emit_user_login_changed (service, user); + g_object_unref (o); + } } } -static void -sync_users (UsersServiceDbus *self) +static gchar* +get_unix_username_from_ssid (UsersServiceDbus * self, + const gchar * ssid) { - g_return_if_fail(IS_USERS_SERVICE_DBUS(self)); - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); + gchar * username = NULL; - if (priv->count > MINIMUM_USERS) + ConsoleKitSession * session_proxy = create_consolekit_session_proxy (ssid); + if (session_proxy != NULL) { - GPtrArray *users = NULL; - GError *error = NULL; - gint i; - - users = g_ptr_array_new (); - - if (!org_freedesktop_Accounts_list_cached_users (priv->accounts_service_proxy, - &users, - &error)) + guint uid = 0; + GError * error = NULL; + console_kit_session_call_get_unix_user_sync (session_proxy, + &uid, + NULL, &error); + if (error != NULL) { - g_warning ("failed to retrieve user list: %s", error->message); - g_error_free (error); - - return; + g_warning ("%s: %s", G_STRLOC, error->message); + g_clear_error (&error); } - - for (i = 0; i < users->len; i++) + else { - gchar *id; - DBusGProxy *proxy; - UserData *user; - GError *error = NULL; - - id = g_ptr_array_index (users, i); - - proxy = dbus_g_proxy_new_for_name (priv->system_bus, - "org.freedesktop.Accounts", - id, - "org.freedesktop.DBus.Properties"); - - GHashTable *properties; - if (!dbus_g_proxy_call (proxy, "GetAll", &error, - G_TYPE_STRING, "org.freedesktop.Accounts.User", G_TYPE_INVALID, - dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &properties, G_TYPE_INVALID)) - { - g_warning ("unable to retrieve user info: %s", error->message); - g_error_free (error); - - continue; - } - - user = g_hash_table_lookup (priv->users, id); - // Double check we havent processed this user already - if (user != NULL) + errno = 0; + const struct passwd * pwent = getpwuid (uid); + if (pwent == NULL) { - g_free(user->user_name); - g_free(user->real_name); - g_free(user->icon_file); - user->real_name_conflict = FALSE; - //continue; + g_warning ("Failed to lookup user id %d: %s", (int)uid, g_strerror(errno)); } else - { - user = g_new0 (UserData, 1); + { + username = g_strdup (pwent->pw_name); } - // Can't subscribe to the Changed signal on each individual user path - // for some reason. - dbus_g_proxy_add_signal (proxy, - "Changed", - G_TYPE_INVALID); - - dbus_g_proxy_connect_signal (proxy, "Changed", - G_CALLBACK(user_changed), - self, - NULL); - user->uid = g_value_get_uint64 (g_hash_table_lookup (properties, "Uid")); - user->user_name = g_strdup (g_value_get_string (g_hash_table_lookup (properties, "UserName"))); - user->real_name = g_strdup (g_value_get_string (g_hash_table_lookup (properties, "RealName"))); - user->icon_file = g_strdup (g_value_get_string (g_hash_table_lookup (properties, "IconFile"))); - user->real_name_conflict = FALSE; - user->menuitem = NULL; - - g_hash_table_unref (properties); - - g_hash_table_insert (priv->users, - g_strdup (id), - user); - - add_sessions_for_user (self, user); } - g_ptr_array_free (users, TRUE); + g_object_unref (session_proxy); } + + return username; } -static void -user_changed (DBusGProxy *proxy, - gpointer user_data) +static gboolean +is_guest_username (const char * username) { - g_debug ("JUST RESYNCED THE USERS FROM A USER CHANGE"); - UsersServiceDbus *service = (UsersServiceDbus *)user_data; - sync_users (service); + if (!g_strcmp0 (username, "guest")) + return TRUE; + + if (username && g_str_has_prefix (username, "guest-")) + return TRUE; + + return FALSE; } +/* If the new session belongs to 'guest', update our guest_ssid. + Otherwise, call add_user_session() to update our session tables */ static void -user_added (DBusGProxy *proxy, - const gchar *user_id, - gpointer user_data) +on_session_added (ConsoleKitSeat * seat_proxy G_GNUC_UNUSED, + const gchar * ssid, + UsersServiceDbus * service) { - UsersServiceDbus *service = (UsersServiceDbus *)user_data; - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service); - priv->count++; - sync_users (service); - g_signal_emit (service, - signals[USER_ADDED], - 0, - user_id); -} + g_return_if_fail (IS_USERS_SERVICE_DBUS(service)); -static void -user_deleted (DBusGProxy *proxy, - const gchar *user_id, - gpointer user_data) -{ - UsersServiceDbus *service = (UsersServiceDbus *)user_data; - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service); + gchar * username = get_unix_username_from_ssid (service, ssid); + g_debug ("%s %s() username %s has new session %s", G_STRLOC, G_STRFUNC, username, ssid); + + if (is_guest_username (username)) + { + /* handle guest as a special case -- it's not in the GDM + user tables and there isn't be an AccountsUser for it */ + g_debug("Found guest session: %s", ssid); + g_free (service->priv->guest_ssid); + service->priv->guest_ssid = g_strdup (ssid); + emit_guest_login_changed (service); + } + else + { + AccountsUser * user = find_user_from_username (service, username); - priv->count--; - g_hash_table_remove (priv->users, user_id); + if (user != NULL) + { + add_user_session (service, user, ssid); + emit_user_login_changed (service, user); + } + } - g_signal_emit (service, - signals[USER_DELETED], - 0, - user_id); - + g_free (username); } -UserData * -users_service_dbus_get_user_by_username (UsersServiceDbus *self, - const gchar *username) +/* Receives a list of sessions and calls on_session_added() for each of them */ +static void +on_session_list (ConsoleKitSeat * seat_proxy, + GAsyncResult * result, + UsersServiceDbus * self) { - GHashTableIter iter; - gpointer value; + GError * error = NULL; + gchar ** sessions = NULL; + g_debug ("%s bootstrapping the session list", G_STRLOC); - g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), NULL); + console_kit_seat_call_get_sessions_finish (seat_proxy, + &sessions, + result, + &error); + + if (error != NULL) + { + g_debug ("%s: %s", G_STRLOC, error->message); + g_error_free (error); + } + else if (sessions != NULL) + { + int i; + + for (i=0; sessions[i]; i++) + { + g_debug ("%s adding initial session '%s'", G_STRLOC, sessions[i]); + on_session_added (seat_proxy, sessions[i], self); + } + + g_strfreev (sessions); + } + + g_debug ("%s done bootstrapping the session list", G_STRLOC); +} - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); +static DisplayManagerSeat * +create_display_proxy (UsersServiceDbus * self) +{ + const gchar * const seat = g_getenv ("XDG_SEAT_PATH"); + g_debug ("%s creating a DisplayManager proxy for seat %s", G_STRLOC, seat); + + GError * error = NULL; + DisplayManagerSeat * p = display_manager_seat_proxy_new_for_bus_sync ( + G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + "org.freedesktop.DisplayManager", + seat, + NULL, + &error); - g_hash_table_iter_init (&iter, priv->users); - while (g_hash_table_iter_next (&iter, NULL, &value)) + if (error != NULL) { - UserData *user = value; - if (strcmp (user->user_name, username) == 0) - return user; + g_warning ("%s: %s", G_STRLOC, error->message); + g_error_free (error); } - return NULL; + return p; } +/*** +**** Public API +***/ + +/** + * users_service_dbus_get_user_list: + * + * Returns: (transfer container): a list of AccountsUser objects + */ GList * -users_service_dbus_get_user_list (UsersServiceDbus *self) +users_service_dbus_get_user_list (UsersServiceDbus * self) { g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), NULL); - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); + return g_hash_table_get_values (self->priv->users); +} + +/** + * users_service_dbus_show_greeter: + * + * Ask the Display Mnaager to switch to the greeter screen. + */ +void +users_service_dbus_show_greeter (UsersServiceDbus * self) +{ + g_return_if_fail (IS_USERS_SERVICE_DBUS(self)); - return g_hash_table_get_values (priv->users); + DisplayManagerSeat * dp = create_display_proxy (self); + display_manager_seat_call_switch_to_greeter_sync (dp, NULL, NULL); + g_clear_object (&dp); } -gboolean -users_service_dbus_show_greeter (UsersServiceDbus *self) +/** + * users_service_dbus_activate_guest_session: + * + * Activates the guest account. + */ +void +users_service_dbus_activate_guest_session (UsersServiceDbus * self) { - g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE); - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); - return org_freedesktop_DisplayManager_Seat_switch_to_greeter(priv->display_manager_proxy, NULL); + g_return_if_fail(IS_USERS_SERVICE_DBUS(self)); + + DisplayManagerSeat * dp = create_display_proxy (self); + display_manager_seat_call_switch_to_guest_sync (dp, "", NULL, NULL); + g_clear_object (&dp); } -/* Activates the guest account if it can. */ -gboolean -users_service_dbus_activate_guest_session (UsersServiceDbus *self) +/** + * users_service_dbus_activate_user_session: + * + * Activates a specific user. + */ +void +users_service_dbus_activate_user_session (UsersServiceDbus * self, + AccountsUser * user) { - g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE); - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); - return org_freedesktop_DisplayManager_Seat_switch_to_guest(priv->display_manager_proxy, "", NULL); + g_return_if_fail (IS_USERS_SERVICE_DBUS(self)); + + const char * const username = accounts_user_get_user_name (user); + DisplayManagerSeat * dp = create_display_proxy (self); + display_manager_seat_call_switch_to_user_sync (dp, username, "", NULL, NULL); + g_clear_object (&dp); } -/* Activates a specific user */ +/** + * users_service_dbus_guest_session_enabled: + * + * Tells whether or not guest sessions are allowed. + */ gboolean -users_service_dbus_activate_user_session (UsersServiceDbus *self, - UserData *user) +users_service_dbus_guest_session_enabled (UsersServiceDbus * self) { - g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE); - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); - return org_freedesktop_DisplayManager_Seat_switch_to_user(priv->display_manager_proxy, user->user_name, "", NULL); + g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE); + + DisplayManagerSeat * dp = create_display_proxy (self); + const gboolean enabled = display_manager_seat_get_has_guest_account (dp); + g_clear_object (&dp); + return enabled; } gboolean -users_service_dbus_can_activate_session (UsersServiceDbus *self) +users_service_dbus_can_activate_session (UsersServiceDbus * self) { - g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE); - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); gboolean can_activate = FALSE; - GError *error = NULL; - if (!priv->seat_proxy) - { - create_seat_proxy (self); - } - - if (!priv->seat || priv->seat[0] == '\0') - { - return FALSE; - } + g_return_val_if_fail (IS_USERS_SERVICE_DBUS(self), can_activate); - if (!dbus_g_proxy_call (priv->seat_proxy, - "CanActivateSessions", - &error, - G_TYPE_INVALID, - G_TYPE_BOOLEAN, &can_activate, - G_TYPE_INVALID)) + GError * error = NULL; + console_kit_seat_call_can_activate_sessions_sync (self->priv->seat_proxy, + &can_activate, + NULL, + &error); + if (error != NULL) { - if (error != NULL){ - g_warning ("Failed to determine if seat can activate sessions: %s", - error->message); - g_error_free (error); - } - return FALSE; + g_warning ("%s: %s", G_STRLOC, error->message); + g_error_free (error); } return can_activate; } -/* Sets the menu item that represents the guest account */ -void -users_service_dbus_set_guest_item (UsersServiceDbus * self, DbusmenuMenuitem * mi) +gboolean +users_service_dbus_is_guest_logged_in (UsersServiceDbus * self) { - g_return_if_fail(IS_USERS_SERVICE_DBUS(self)); - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); - priv->guest_item = mi; + g_return_val_if_fail (IS_USERS_SERVICE_DBUS(self), FALSE); - if (priv->guest_session_id != NULL) { - dbusmenu_menuitem_property_set_bool(priv->guest_item, USER_ITEM_PROP_LOGGED_IN, TRUE); - } - - return; + return self->priv->guest_ssid != NULL; } -gboolean users_service_dbus_guest_session_enabled (UsersServiceDbus * self) +gboolean +users_service_dbus_is_user_logged_in (UsersServiceDbus * self, + AccountsUser * user) { - g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE); - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); - - return priv->guest_session_enabled; -} + g_return_val_if_fail (IS_USERS_SERVICE_DBUS(self), FALSE); + g_return_val_if_fail (IS_ACCOUNTS_USER(user), FALSE); + return user_count_sessions (user) > 0; +} diff --git a/src/users-service-dbus.h b/src/users-service-dbus.h index b7db690..0f082c3 100644 --- a/src/users-service-dbus.h +++ b/src/users-service-dbus.h @@ -3,6 +3,7 @@ * * Authors: * Cody Russell <crussell@canonical.com> + * Charles Kerr <charles.kerr@canonical.com> * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -22,69 +23,74 @@ #include <glib.h> #include <glib-object.h> -#include <libdbusmenu-glib/menuitem.h> -G_BEGIN_DECLS - -#define USERS_SERVICE_DBUS_TYPE (users_service_dbus_get_type ()) -#define USERS_SERVICE_DBUS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), USERS_SERVICE_DBUS_TYPE, UsersServiceDbus)) -#define USERS_SERVICE_DBUS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), USERS_SERVICE_DBUS_TYPE, UsersServiceDbusClass)) -#define IS_USERS_SERVICE_DBUS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), USERS_SERVICE_DBUS_TYPE)) -#define IS_USERS_SERVICE_DBUS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), USERS_SERVICE_DBUS_TYPE)) -#define USERS_SERVICE_DBUS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), USERS_SERVICE_DBUS_TYPE, UsersServiceDbusClass)) - -typedef struct _UsersServiceDbus UsersServiceDbus; -typedef struct _UsersServiceDbusClass UsersServiceDbusClass; -typedef struct _UserData UserData; - -struct _UserData -{ - gint64 uid; - gchar *user_name; - gchar *real_name; - gchar *icon_file; +#include "dbus-user.h" /* for AccountsUser */ - GList *sessions; +G_BEGIN_DECLS - /* Whether the real name here conflicts with another in the system */ - gboolean real_name_conflict; - /* The menuitem representing this user if there is one. */ - DbusmenuMenuitem * menuitem; +#define USERS_SERVICE_DBUS_TYPE (users_service_dbus_get_type ()) +#define USERS_SERVICE_DBUS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), USERS_SERVICE_DBUS_TYPE, UsersServiceDbus)) +#define IS_USERS_SERVICE_DBUS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), USERS_SERVICE_DBUS_TYPE)) - UsersServiceDbus *service; -}; +typedef struct _UsersServiceDbus UsersServiceDbus; +typedef struct _UsersServiceDbusClass UsersServiceDbusClass; +typedef struct _UsersServiceDbusPrivate UsersServiceDbusPrivate; -/* XXX - MAXIMUM_USERS should be set to 7 once we've - * got some gdm issues worked out. +/** + * A facade class which interacts with multiple DBus services to + * track info which is useful to the interactor's user menu: + * + * 1. A list of users to add to the user menu. + * + * Each user is an AccountsUser object, which is a GDBusProxy + * to an org.freedesktop.Accounts.User object. + * + * We initially build this list by calling org.freedesktop.Accounts' + * GetCachedUsers method. We also monitor o.f.Accounts' UserAdded + * and UserDeleted and update the list accordingly. + * + * 2. Track which users currently have X sessions. + * This is used for the menuitems' USER_ITEM_PROP_LOGGED_IN property. + * + * We initially build this list by calling org.freedesktop.ConsoleKit.Seat's + * GetDevices method. We also monitor the seat for SessionAdded and + * SessionRemoved and update the list accordingly. + * + * 3. Provide an API for user switching and guest sessions. + * These are typically pass-through functions to GDBusProxies. + * */ -#define MINIMUM_USERS 0 - -struct _UsersServiceDbus { +struct _UsersServiceDbus +{ + /*< private >*/ GObject parent; + UsersServiceDbusPrivate * priv; }; -struct _UsersServiceDbusClass { +struct _UsersServiceDbusClass +{ GObjectClass parent_class; /* Signals */ - void (* user_added) (UsersServiceDbus *self, const gchar *user_id, gpointer user_data); - void (* user_deleted) (UsersServiceDbus *self, const gchar *user_id, gpointer user_data); + void (* user_list_changed) (UsersServiceDbus*, gpointer); + void (* user_logged_in_changed) (UsersServiceDbus*, AccountsUser*, gpointer); + void (* guest_logged_in_changed) (UsersServiceDbus*, gpointer); }; -GType users_service_dbus_get_type (void) G_GNUC_CONST; +GType users_service_dbus_get_type (void) G_GNUC_CONST; + +GList * users_service_dbus_get_user_list (UsersServiceDbus * self); -UserData *users_service_dbus_get_user_by_username (UsersServiceDbus *self, - const gchar *username); -GList *users_service_dbus_get_user_list (UsersServiceDbus *self); -gboolean users_service_dbus_show_greeter (UsersServiceDbus *self); -gboolean users_service_dbus_can_activate_session (UsersServiceDbus *self); -gboolean users_service_dbus_activate_user_session (UsersServiceDbus *self, - UserData *user); -gboolean users_service_dbus_activate_guest_session (UsersServiceDbus *self); -void users_service_dbus_set_guest_item (UsersServiceDbus * self, - DbusmenuMenuitem * mi); +gboolean users_service_dbus_is_guest_logged_in (UsersServiceDbus * self); +gboolean users_service_dbus_is_user_logged_in (UsersServiceDbus * self, + AccountsUser * user); -gboolean users_service_dbus_guest_session_enabled (UsersServiceDbus * self); +void users_service_dbus_show_greeter (UsersServiceDbus * self); +gboolean users_service_dbus_guest_session_enabled (UsersServiceDbus * self); +gboolean users_service_dbus_can_activate_session (UsersServiceDbus * self); +void users_service_dbus_activate_guest_session (UsersServiceDbus * self); +void users_service_dbus_activate_user_session (UsersServiceDbus * self, + AccountsUser * user); G_END_DECLS |