summaryrefslogtreecommitdiff
path: root/libxfsm
diff options
context:
space:
mode:
Diffstat (limited to 'libxfsm')
-rw-r--r--libxfsm/Makefile.am26
-rw-r--r--libxfsm/Makefile.in707
-rw-r--r--libxfsm/xfsm-shutdown-common.h73
-rw-r--r--libxfsm/xfsm-util.c450
-rw-r--r--libxfsm/xfsm-util.h91
5 files changed, 1347 insertions, 0 deletions
diff --git a/libxfsm/Makefile.am b/libxfsm/Makefile.am
new file mode 100644
index 0000000..0de0261
--- /dev/null
+++ b/libxfsm/Makefile.am
@@ -0,0 +1,26 @@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)
+
+noinst_LTLIBRARIES = libxfsm.la
+
+libxfsm_la_SOURCES = \
+ xfsm-util.h \
+ xfsm-util.c \
+ xfsm-shutdown-common.h
+
+libxfsm_la_CFLAGS = \
+ $(LIBX11_CFLAGS) \
+ $(LIBXFCE4UI_CFLAGS) \
+ $(LIBXFCE4UTIL_CFLAGS) \
+ $(XFCONF_CFLAGS)
+
+if HAVE_OS_CYGWIN
+libxfsm_la_LDFLAGS = \
+ -no-undefined
+endif
+
+libxfsm_la_LIBADD = \
+ $(LIBX11_LIBS) \
+ $(LIBXFCE4UI_LIBS) \
+ $(LIBXFCE4UTIL_LIBS) \
+ $(XFCONF_LIBS)
diff --git a/libxfsm/Makefile.in b/libxfsm/Makefile.in
new file mode 100644
index 0000000..92af85d
--- /dev/null
+++ b/libxfsm/Makefile.in
@@ -0,0 +1,707 @@
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = libxfsm
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libxfsm_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_libxfsm_la_OBJECTS = libxfsm_la-xfsm-util.lo
+libxfsm_la_OBJECTS = $(am_libxfsm_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+libxfsm_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libxfsm_la_CFLAGS) \
+ $(CFLAGS) $(libxfsm_la_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/libxfsm_la-xfsm-util.Plo
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libxfsm_la_SOURCES)
+DIST_SOURCES = $(libxfsm_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LINGUAS = @ALL_LINGUAS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BACKEND = @BACKEND@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GIO_CFLAGS = @GIO_CFLAGS@
+GIO_LIBS = @GIO_LIBS@
+GIO_REQUIRED_VERSION = @GIO_REQUIRED_VERSION@
+GIO_VERSION = @GIO_VERSION@
+GMODULE_CFLAGS = @GMODULE_CFLAGS@
+GMODULE_LIBS = @GMODULE_LIBS@
+GMODULE_REQUIRED_VERSION = @GMODULE_REQUIRED_VERSION@
+GMODULE_VERSION = @GMODULE_VERSION@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GTK_REQUIRED_VERSION = @GTK_REQUIRED_VERSION@
+GTK_VERSION = @GTK_VERSION@
+HELPER_PATH_PREFIX = @HELPER_PATH_PREFIX@
+ICEAUTH = @ICEAUTH@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@
+INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@
+INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@
+INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBM = @LIBM@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSM_CFLAGS = @LIBSM_CFLAGS@
+LIBSM_LDFLAGS = @LIBSM_LDFLAGS@
+LIBSM_LIBS = @LIBSM_LIBS@
+LIBTOOL = @LIBTOOL@
+LIBWNCK_CFLAGS = @LIBWNCK_CFLAGS@
+LIBWNCK_LIBS = @LIBWNCK_LIBS@
+LIBWNCK_REQUIRED_VERSION = @LIBWNCK_REQUIRED_VERSION@
+LIBWNCK_VERSION = @LIBWNCK_VERSION@
+LIBX11_CFLAGS = @LIBX11_CFLAGS@
+LIBX11_LDFLAGS = @LIBX11_LDFLAGS@
+LIBX11_LIBS = @LIBX11_LIBS@
+LIBXFCE4UI_CFLAGS = @LIBXFCE4UI_CFLAGS@
+LIBXFCE4UI_LIBS = @LIBXFCE4UI_LIBS@
+LIBXFCE4UI_REQUIRED_VERSION = @LIBXFCE4UI_REQUIRED_VERSION@
+LIBXFCE4UI_VERSION = @LIBXFCE4UI_VERSION@
+LIBXFCE4UTIL_CFLAGS = @LIBXFCE4UTIL_CFLAGS@
+LIBXFCE4UTIL_LIBS = @LIBXFCE4UTIL_LIBS@
+LIBXFCE4UTIL_REQUIRED_VERSION = @LIBXFCE4UTIL_REQUIRED_VERSION@
+LIBXFCE4UTIL_VERSION = @LIBXFCE4UTIL_VERSION@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGFMT_OPTS = @MSGFMT_OPTS@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POFILES = @POFILES@
+POLKIT_CFLAGS = @POLKIT_CFLAGS@
+POLKIT_LIBS = @POLKIT_LIBS@
+POLKIT_REQUIRED_VERSION = @POLKIT_REQUIRED_VERSION@
+POLKIT_VERSION = @POLKIT_VERSION@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XFCONF_CFLAGS = @XFCONF_CFLAGS@
+XFCONF_LIBS = @XFCONF_LIBS@
+XFCONF_REQUIRED_VERSION = @XFCONF_REQUIRED_VERSION@
+XFCONF_VERSION = @XFCONF_VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_ARGS = @XGETTEXT_ARGS@
+XMKMF = @XMKMF@
+XSESSION_PREFIX = @XSESSION_PREFIX@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+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_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+intltool__v_merge_options_ = @intltool__v_merge_options_@
+intltool__v_merge_options_0 = @intltool__v_merge_options_0@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)
+
+noinst_LTLIBRARIES = libxfsm.la
+libxfsm_la_SOURCES = \
+ xfsm-util.h \
+ xfsm-util.c \
+ xfsm-shutdown-common.h
+
+libxfsm_la_CFLAGS = \
+ $(LIBX11_CFLAGS) \
+ $(LIBXFCE4UI_CFLAGS) \
+ $(LIBXFCE4UTIL_CFLAGS) \
+ $(XFCONF_CFLAGS)
+
+@HAVE_OS_CYGWIN_TRUE@libxfsm_la_LDFLAGS = \
+@HAVE_OS_CYGWIN_TRUE@ -no-undefined
+
+libxfsm_la_LIBADD = \
+ $(LIBX11_LIBS) \
+ $(LIBXFCE4UI_LIBS) \
+ $(LIBXFCE4UTIL_LIBS) \
+ $(XFCONF_LIBS)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libxfsm/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign libxfsm/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+libxfsm.la: $(libxfsm_la_OBJECTS) $(libxfsm_la_DEPENDENCIES) $(EXTRA_libxfsm_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libxfsm_la_LINK) $(libxfsm_la_OBJECTS) $(libxfsm_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxfsm_la-xfsm-util.Plo@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+libxfsm_la-xfsm-util.lo: xfsm-util.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxfsm_la_CFLAGS) $(CFLAGS) -MT libxfsm_la-xfsm-util.lo -MD -MP -MF $(DEPDIR)/libxfsm_la-xfsm-util.Tpo -c -o libxfsm_la-xfsm-util.lo `test -f 'xfsm-util.c' || echo '$(srcdir)/'`xfsm-util.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libxfsm_la-xfsm-util.Tpo $(DEPDIR)/libxfsm_la-xfsm-util.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xfsm-util.c' object='libxfsm_la-xfsm-util.lo' libtool=yes @AMDEPBACKSLASH@
+@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) $(libxfsm_la_CFLAGS) $(CFLAGS) -c -o libxfsm_la-xfsm-util.lo `test -f 'xfsm-util.c' || echo '$(srcdir)/'`xfsm-util.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f ./$(DEPDIR)/libxfsm_la-xfsm-util.Plo
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f ./$(DEPDIR)/libxfsm_la-xfsm-util.Plo
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+ clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libxfsm/xfsm-shutdown-common.h b/libxfsm/xfsm-shutdown-common.h
new file mode 100644
index 0000000..3b9fbd0
--- /dev/null
+++ b/libxfsm/xfsm-shutdown-common.h
@@ -0,0 +1,73 @@
+/*-
+ * Copyright (c) 2018 Ali Abdallah <ali@xfce.org>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA.
+ */
+#ifndef __XFSM_SHUTDOWN_COMMON_H_
+#define __XFSM_SHUTDOWN_COMMON_H_
+
+#ifdef POWEROFF_CMD
+#undef POWEROFF_CMD
+#endif
+#ifdef REBOOT_CMD
+#undef REBOOT_CMD
+#endif
+#ifdef UP_BACKEND_SUSPEND_COMMAND
+#undef UP_BACKEND_SUSPEND_COMMAND
+#endif
+#ifdef UP_BACKEND_HIBERNATE_COMMAND
+#undef UP_BACKEND_HIBERNATE_COMMAND
+#endif
+
+/* On FreeBSD, NetBSD and DragonFly BSD users with write access to
+ * /dev/acpi can suspend/hibernate the system */
+#define BSD_SLEEP_ACCESS_NODE "/dev/acpi"
+
+/* On OpenBSD this is done via apmd, so we check /var/run/apmdev to see
+ * zzz and ZZZ commands can write to it*/
+#ifdef BACKEND_TYPE_OPENBSD
+#undef BSD_SLEEP_ACCESS_NODE
+#define BSD_SLEEP_ACCESS_NODE "/var/run/apmdev"
+#endif
+
+#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#define POWEROFF_CMD "/sbin/shutdown -p now"
+#define REBOOT_CMD "/sbin/shutdown -r now"
+#elif defined(sun) || defined(__sun)
+#define POWEROFF_CMD "/usr/sbin/shutdown -i 5 -g 0 -y"
+#define REBOOT_CMD "/usr/sbin/shutdown -i 6 -g 0 -y"
+#else
+#define POWEROFF_CMD "/sbin/shutdown -h now"
+#define REBOOT_CMD "/sbin/shutdown -r now"
+#endif
+
+#ifdef BACKEND_TYPE_FREEBSD
+#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/acpiconf -s 3"
+#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/acpiconf -s 4"
+#endif
+
+#ifdef BACKEND_TYPE_LINUX
+#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/pm-suspend"
+#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/pm-hibernate"
+#endif
+
+#ifdef BACKEND_TYPE_OPENBSD
+#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/zzz"
+#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/ZZZ"
+#endif
+
+#endif /* __XFSM_SHUTDOWN_COMMON_H_ */
diff --git a/libxfsm/xfsm-util.c b/libxfsm/xfsm-util.c
new file mode 100644
index 0000000..61d91b1
--- /dev/null
+++ b/libxfsm/xfsm-util.c
@@ -0,0 +1,450 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org>
+ * Copyright (c) 2004 Jasper Huijsmans <jasper@xfce.org>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA.
+ *
+ * Parts of this file where taken from gnome-session/gsm-multiscreen.c,
+ * which was written by Mark McLoughlin <mark@skynet.ie>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <X11/Xlib.h>
+
+#include <gdk/gdkx.h>
+
+#include <libxfce4ui/libxfce4ui.h>
+
+#include <libxfsm/xfsm-util.h>
+
+
+gboolean
+xfsm_start_application (gchar **command,
+ gchar **environment,
+ GdkScreen *screen,
+ const gchar *current_directory,
+ const gchar *client_machine,
+ const gchar *user_id)
+{
+ gboolean result;
+ gchar *screen_name;
+ gchar **argv;
+ gint argc;
+ gint size;
+
+ g_return_val_if_fail (command != NULL && *command != NULL, FALSE);
+
+ argv = g_new (gchar *, 21);
+ size = 20;
+ argc = 0;
+
+ if (client_machine != NULL)
+ {
+ /* setting current directory on a remote machine is not supported */
+ current_directory = NULL;
+
+ argv[argc++] = g_strdup ("xon");
+ argv[argc++] = g_strdup (client_machine);
+ }
+
+ if (screen != NULL)
+ {
+ if (client_machine != NULL)
+ {
+ gchar *display_name =
+ xfsm_gdk_display_get_fullname (gdk_screen_get_display (screen));
+
+ screen_name = g_strdup_printf ("%s.%d", display_name,
+ gdk_screen_get_number (screen));
+ }
+ else
+ screen_name = gdk_screen_make_display_name (screen);
+ argv[argc++] = g_strdup ("env");
+ argv[argc++] = g_strdup_printf ("DISPLAY=%s", screen_name);
+ g_free (screen_name);
+ }
+
+ for (; *command != NULL; ++command)
+ {
+ if (argc == size)
+ {
+ size *= 2;
+ argv = g_realloc (argv, (size + 1) * sizeof (*argv));
+ }
+
+ argv[argc++] = xfce_expand_variables (*command, environment);
+ }
+
+ argv[argc] = NULL;
+
+ result = g_spawn_async (current_directory,
+ argv,
+ environment,
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN | G_SPAWN_SEARCH_PATH,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+
+ g_strfreev (argv);
+
+ return result;
+}
+
+
+void
+xfsm_place_trash_window (GtkWindow *window,
+ GdkScreen *screen,
+ gint monitor)
+{
+ GtkRequisition requisition;
+ GdkRectangle geometry;
+
+ gdk_screen_get_monitor_geometry (screen, monitor, &geometry);
+ gtk_widget_get_preferred_size (GTK_WIDGET (window), &requisition, NULL);
+
+ gtk_window_move (window, 0, geometry.height - requisition.height);
+}
+
+
+gboolean
+xfsm_strv_equal (gchar **a, gchar **b)
+{
+ if ((a == NULL && b != NULL) || (a != NULL && b == NULL))
+ return FALSE;
+ else if (a == NULL || b == NULL)
+ return TRUE;
+
+ while (*a != NULL && *b != NULL)
+ {
+ if (strcmp (*a, *b) != 0)
+ return FALSE;
+
+ ++a;
+ ++b;
+ }
+
+ return (*a == NULL && *b == NULL);
+}
+
+
+XfconfChannel*
+xfsm_open_config (void)
+{
+ static XfconfChannel *channel = NULL;
+
+ if (G_UNLIKELY (channel == NULL))
+ channel = xfconf_channel_get ("xfce4-session");
+ return channel;
+}
+
+gchar*
+xfsm_gdk_display_get_fullname (GdkDisplay *display)
+{
+ const gchar *name;
+ const gchar *np;
+ gchar *hostname;
+ gchar buffer[256];
+ gchar *bp;
+
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+
+ name = gdk_display_get_name (display);
+ if (*name == ':')
+ {
+ hostname = xfce_gethostname ();
+ g_strlcpy (buffer, hostname, 256);
+ g_free (hostname);
+
+ bp = buffer + strlen (buffer);
+
+ for (np = name; *np != '\0' && *np != '.' && bp < buffer + 255; )
+ *bp++ = *np++;
+ *bp = '\0';
+ }
+ else
+ {
+ g_strlcpy (buffer, name, 256);
+
+ for (bp = buffer + strlen (buffer) - 1; *bp != ':'; --bp)
+ if (*bp == '.')
+ {
+ *bp = '\0';
+ break;
+ }
+ }
+
+ return g_strdup (buffer);
+}
+
+GdkPixbuf *
+xfsm_load_session_preview (const gchar *name)
+{
+ GdkDisplay *display;
+ GdkPixbuf *pb = NULL;
+ gchar *display_name;
+ gchar *filename;
+ gchar *path;
+
+ /* determine thumb file */
+ display = gdk_display_get_default ();
+ display_name = xfsm_gdk_display_get_fullname (display);
+ path = g_strconcat ("sessions/thumbs-", display_name, "/", name, ".png", NULL);
+ filename = xfce_resource_lookup (XFCE_RESOURCE_CACHE, path);
+ g_free (display_name);
+ g_free (path);
+
+ if (filename != NULL)
+ pb = gdk_pixbuf_new_from_file (filename, NULL);
+ g_free (filename);
+
+ return pb;
+}
+
+XfceRc *
+settings_list_sessions_open_rc (void)
+{
+ XfceRc *rc;
+ gchar *display_name;
+ gchar *resource_name;
+ gchar *session_file;
+
+ display_name = xfsm_gdk_display_get_fullname (gdk_display_get_default ());
+ resource_name = g_strconcat ("sessions/xfce4-session-", display_name, NULL);
+ session_file = xfce_resource_save_location (XFCE_RESOURCE_CACHE, resource_name, TRUE);
+ g_free (resource_name);
+ g_free (display_name);
+
+ if (!g_file_test (session_file, G_FILE_TEST_IS_REGULAR))
+ {
+ g_debug ("xfsm_manager_load_session: Something wrong with %s, Does it exist? Permissions issue?", session_file);
+ return FALSE;
+ }
+
+ rc = xfce_rc_simple_open (session_file, FALSE);
+ if (G_UNLIKELY (rc == NULL))
+ {
+ g_warning ("xfsm_manager_load_session: unable to open %s", session_file);
+ return FALSE;
+ }
+ return rc;
+}
+
+GList *
+settings_list_sessions (XfceRc *rc)
+{
+ XfsmSessionInfo *session;
+ GdkPixbuf *preview_default = NULL;
+ GList *sessions = NULL;
+ gchar **groups;
+ gint n;
+
+ groups = xfce_rc_get_groups (rc);
+ for (n = 0; groups[n] != NULL; ++n)
+ {
+ if (strncmp (groups[n], "Session: ", 9) == 0)
+ {
+ xfce_rc_set_group (rc, groups[n]);
+ session = g_new0 (XfsmSessionInfo, 1);
+ session->name = g_strdup (groups[n] + 9);
+ session->atime = xfce_rc_read_int_entry (rc, "LastAccess", 0);
+ session->preview = xfsm_load_session_preview (session->name);
+
+ if (session->preview == NULL)
+ {
+ if (G_UNLIKELY (preview_default == NULL))
+ {
+ preview_default = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+ "xfce4-logo", 64,
+ GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL);
+ }
+
+ session->preview = GDK_PIXBUF (g_object_ref (preview_default));
+ }
+
+ sessions = g_list_append (sessions, session);
+ }
+ }
+
+ if (preview_default != NULL)
+ g_object_unref (preview_default);
+
+ g_strfreev (groups);
+
+ return sessions;
+}
+
+void
+settings_list_sessions_treeview_init (GtkTreeView *treeview)
+{
+ GtkTreeSelection *selection;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ GtkListStore *model;
+
+ model = gtk_list_store_new (N_COLUMNS,
+ GDK_TYPE_PIXBUF,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_INT);
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (model));
+ g_object_unref (G_OBJECT (model));
+
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), TRUE);
+ column = gtk_tree_view_column_new ();
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_tree_view_column_pack_start (column, renderer, FALSE);
+ gtk_tree_view_column_set_attributes (column, renderer,
+ "pixbuf", PREVIEW_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+
+ column = gtk_tree_view_column_new ();
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_set_title (column, _("Session"));
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_tree_view_column_set_expand (column, TRUE);
+ gtk_tree_view_column_set_attributes (column, renderer,
+ "markup", TITLE_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+
+ column = gtk_tree_view_column_new ();
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_set_alignment (column, 1.0);
+ gtk_tree_view_column_set_title (column, _("Last accessed"));
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_tree_view_column_set_attributes (column, renderer,
+ "text", ACCESSED_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+}
+
+static gint
+compare_session_atime (XfsmSessionInfo *session1,
+ XfsmSessionInfo *session2)
+{
+ if (session1->atime < session2->atime)
+ return 1;
+ if (session1->atime > session2->atime)
+ return -1;
+ return 0;
+}
+
+static GList *
+sort_sessions_on_atime (GList *sessions)
+{
+ return g_list_sort (sessions, (GCompareFunc) compare_session_atime);
+}
+
+void
+settings_list_sessions_populate (GtkTreeModel *model,
+ GList *sessions)
+{
+ XfsmSessionInfo *session;
+ GtkTreeIter iter;
+ gchar *accessed;
+ gchar *title;
+ GList *lp;
+
+ sessions = sort_sessions_on_atime (sessions);
+
+ gtk_list_store_clear (GTK_LIST_STORE (model));
+
+ for (lp = sessions; lp != NULL; lp = lp->next)
+ {
+ session = (XfsmSessionInfo *) lp->data;
+
+ title = g_strdup_printf ("<b>%s</b>", session->name);
+ accessed = g_strstrip (g_strdup (ctime (&session->atime)));
+
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ PREVIEW_COLUMN, session->preview,
+ NAME_COLUMN, session->name,
+ TITLE_COLUMN, title,
+ ACCESSED_COLUMN, accessed,
+ ATIME_COLUMN, session->atime,
+ -1);
+
+ g_free (accessed);
+ g_free (title);
+ }
+}
+
+void
+settings_list_sessions_delete_session (GtkButton *button,
+ GtkTreeView *treeview)
+{
+ XfceRc *rc;
+ gchar *session_file;
+ gchar *display_name;
+ gchar *resource_name;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
+ GValue value;
+ gchar *session;
+
+ display_name = xfsm_gdk_display_get_fullname (gdk_display_get_default ());
+ resource_name = g_strconcat ("sessions/xfce4-session-", display_name, NULL);
+ session_file = xfce_resource_save_location (XFCE_RESOURCE_CACHE, resource_name, TRUE);
+
+ if (!g_file_test (session_file, G_FILE_TEST_IS_REGULAR))
+ {
+ g_debug ("xfsm_manager_load_session: Something wrong with %s, Does it exist? Permissions issue?", session_file);
+ return;
+ }
+
+ /* Remove the session from session file */
+ bzero (&value, sizeof (value));
+ selection = gtk_tree_view_get_selection (treeview);
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ {
+ g_warning ("xfsm_chooser_get_session: !gtk_tree_selection_get_selected");
+ return;
+ }
+ gtk_tree_model_get_value (model, &iter, NAME_COLUMN, &value);
+ session = g_strdup_printf ("Session: %s", g_value_get_string (&value));
+ g_value_unset (&value);
+ rc = xfce_rc_simple_open (session_file, FALSE);
+ xfce_rc_delete_group (rc, session, FALSE);
+ xfce_rc_close (rc);
+ g_free (session);
+
+ /* Remove the session from the treeview */
+ model = gtk_tree_view_get_model (treeview);
+ selection = gtk_tree_view_get_selection (treeview);
+ gtk_tree_selection_get_selected (selection, &model, &iter);
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+}
diff --git a/libxfsm/xfsm-util.h b/libxfsm/xfsm-util.h
new file mode 100644
index 0000000..0d3eb03
--- /dev/null
+++ b/libxfsm/xfsm-util.h
@@ -0,0 +1,91 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA.
+ */
+
+#ifndef __XFSM_UTIL_H__
+#define __XFSM_UTIL_H__
+
+#include <xfconf/xfconf.h>
+
+#include <gtk/gtk.h>
+
+#include <libxfce4util/libxfce4util.h>
+#include <libxfce4ui/libxfce4ui.h>
+
+G_BEGIN_DECLS;
+
+#define DEFAULT_SESSION_NAME "Default"
+
+typedef struct _XfsmSessionInfo XfsmSessionInfo;
+
+struct _XfsmSessionInfo
+{
+ gchar *name; /* name of the session */
+ time_t atime; /* last access time */
+ GdkPixbuf *preview; /* preview icon (52x42) */
+};
+
+enum
+{
+ PREVIEW_COLUMN,
+ NAME_COLUMN,
+ TITLE_COLUMN,
+ ACCESSED_COLUMN,
+ ATIME_COLUMN,
+ N_COLUMNS,
+};
+
+
+gboolean xfsm_start_application (gchar **command,
+ gchar **environment,
+ GdkScreen *screen,
+ const gchar *current_directory,
+ const gchar *client_machine,
+ const gchar *user_id);
+
+void xfsm_place_trash_window (GtkWindow *window,
+ GdkScreen *screen,
+ gint monitor);
+
+/* XXX - move to libxfce4util? */
+gboolean xfsm_strv_equal (gchar **a,
+ gchar **b);
+
+XfconfChannel *xfsm_open_config (void);
+
+gchar *xfsm_gdk_display_get_fullname (GdkDisplay *display);
+
+GdkPixbuf *xfsm_load_session_preview (const gchar *name);
+
+XfceRc *settings_list_sessions_open_rc (void);
+
+GList *settings_list_sessions (XfceRc *rc);
+
+void settings_list_sessions_treeview_init (GtkTreeView *treeview);
+
+void settings_list_sessions_populate (GtkTreeModel *model,
+ GList *sessions);
+
+void settings_list_sessions_delete_session (GtkButton *button,
+ GtkTreeView *treeview);
+
+G_END_DECLS;
+
+#endif /* !__XFSM_UTIL_H__ */