Updating branch refs/heads/nick/shutdown-cleanup to 44ba3822a68cfd1fac28235ee57ad33284c1f460 (commit) from 48ceeac682c132464446240da7f1c6af300736bb (commit)
commit 44ba3822a68cfd1fac28235ee57ad33284c1f460 Author: Nick Schermer <n...@xfce.org> Date: Sun Nov 6 13:20:48 2011 +0100 Move things around a bit to cleanup. Separate the logout dialog from the shutdown function and give everything xfsm_* functionnames. Cleanup Makefile.am a bit too and drop the generated dbus file. configure.in.in | 4 +- xfce4-session/Makefile.am | 78 +++--- xfce4-session/ice-layer.h | 2 +- xfce4-session/main.c | 4 +- xfce4-session/sm-layer.h | 2 +- .../{chooser-icon.png => xfsm-chooser-icon.png} | Bin 8957 -> 8957 bytes xfce4-session/xfsm-client-dbus.h | 266 -------------------- xfce4-session/xfsm-client.c | 12 +- xfce4-session/xfsm-dns.c | 2 +- xfce4-session/xfsm-error.c | 2 +- xfce4-session/xfsm-global.c | 1 - xfce4-session/xfsm-legacy.c | 2 +- xfce4-session/{shutdown.c => xfsm-logout-dialog.c} | 139 ++++------- xfce4-session/{sm-layer.h => xfsm-logout-dialog.h} | 19 +- xfce4-session/xfsm-manager.c | 27 +- xfce4-session/xfsm-manager.h | 4 +- xfce4-session/xfsm-shutdown-helper.c | 4 +- xfce4-session/xfsm-shutdown-helper.h | 3 +- xfce4-session/xfsm-shutdown.c | 107 ++++++++ xfce4-session/{shutdown.h => xfsm-shutdown.h} | 10 +- xfce4-session/xfsm-startup.c | 2 +- 21 files changed, 245 insertions(+), 445 deletions(-) diff --git a/configure.in.in b/configure.in.in index 1d10454..91fac66 100644 --- a/configure.in.in +++ b/configure.in.in @@ -52,7 +52,9 @@ AC_PROG_CC() AM_PROG_CC_C_O() AC_PROG_INSTALL() AC_PROG_INTLTOOL() -AC_PROG_LIBTOOL() + +LT_PREREQ([2.2.6]) +LT_INIT([disable-static]) dnl check for standard header files AC_HEADER_STDC diff --git a/xfce4-session/Makefile.am b/xfce4-session/Makefile.am index b486cbb..b7c5e21 100644 --- a/xfce4-session/Makefile.am +++ b/xfce4-session/Makefile.am @@ -1,20 +1,31 @@ -# $Id$ INCLUDES = \ -I$(top_builddir) \ - -I$(top_srcdir) + -DG_LOG_DOMAIN=\"xfce4-session\" \ + -DLIBDIR=\"$(libdir)\" \ + -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DXFSM_SHUTDOWN_HELPER_CMD=\"$(HELPER_PATH_PREFIX)/xfce4/session/xfsm-shutdown-helper\" \ + -DDBUS_API_SUBJECT_TO_CHANGE \ + -DWNCK_I_KNOW_THIS_IS_UNSTABLE \ + $(PLATFORM_CPPFLAGS) man_MANS = xfce4-session.1 bin_PROGRAMS = xfce4-session +xfce4_session_built_sources = \ + xfsm-chooser-icon.h \ + xfsm-client-dbus.h \ + xfsm-manager-dbus.h \ + xfsm-marshal.c \ + xfsm-marshal.h + xfce4_session_SOURCES = \ - chooser-icon.h \ + $(xfce4_session_built_sources) \ ice-layer.c \ ice-layer.h \ main.c \ - shutdown.c \ - shutdown.h \ sm-layer.c \ sm-layer.h \ xfsm-chooser.c \ @@ -36,13 +47,14 @@ xfce4_session_SOURCES = \ xfsm-global.h \ xfsm-legacy.c \ xfsm-legacy.h \ + xfsm-logout-dialog.c \ + xfsm-logout-dialog.h \ xfsm-manager.c \ xfsm-manager.h \ - xfsm-manager-dbus.h \ - xfsm-marshal.c \ - xfsm-marshal.h \ xfsm-properties.c \ xfsm-properties.h \ + xfsm-shutdown.c \ + xfsm-shutdown.h \ xfsm-shutdown-helper.c \ xfsm-shutdown-helper.h \ xfsm-splash-screen.c \ @@ -58,13 +70,11 @@ xfce4_session_CFLAGS = \ $(DBUS_CFLAGS) \ $(DBUS_GLIB_CFLAGS) \ $(LIBWNCK_CFLAGS) \ - $(XFCONF_CFLAGS) \ - -DDBUS_API_SUBJECT_TO_CHANGE \ - -DWNCK_I_KNOW_THIS_IS_UNSTABLE \ - -DLIBDIR=\"$(libdir)\" \ - -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DXFSM_SHUTDOWN_HELPER_CMD=\"$(HELPER_PATH_PREFIX)/xfce4/session/xfsm-shutdown-helper\" + $(XFCONF_CFLAGS) + +xfce4_session_LDFLAGS = \ + -no-undefined \ + $(PLATFORM_LDFLAGS) xfce4_session_LDADD = \ $(top_builddir)/libxfsm/libxfsm-4.6.la \ @@ -82,27 +92,17 @@ xfce4_session_LDADD = \ xfce4_session_DEPENDENCIES = \ $(top_builddir)/libxfsm/libxfsm-4.6.la - if MAINTAINER_MODE -BUILT_SOURCES = \ - xfsm-client-dbus.h \ - xfsm-manager-dbus.h \ - xfsm-marshal.c \ - xfsm-marshal.h \ - chooser-icon.h +xfsm-chooser-icon.h: $(srcdir)/xfsm-chooser-icon.png + $(AM_V_GEN) gdk-pixbuf-csource --static --raw --stream --name=xfsm_chooser_icon_data $< > $@ -chooser-icon.h: $(srcdir)/chooser-icon.png - $(AM_V_GEN) gdk-pixbuf-csource --static --raw --stream --name=chooser_icon_data $< > $@ +xfsm-marshal.h: xfsm-marshal.list Makefile + $(AM_V_GEN) glib-genmarshal --prefix=xfsm_marshal --internal --header $< > $@ -xfsm-marshal.h: stamp-xfsm-marshal.h - @true -stamp-xfsm-marshal.h: xfsm-marshal.list Makefile - $(AM_V_GEN) glib-genmarshal --prefix=xfsm_marshal xfsm-marshal.list --header > xfsm-marshal.h - echo timestamp > $(@F) xfsm-marshal.c: xfsm-marshal.list Makefile - $(AM_V_GEN) echo '#include "xfsm-marshal.h"' > $@ - glib-genmarshal --prefix=xfsm_marshal xfsm-marshal.list --body >> xfsm-marshal.c + $(AM_V_GEN) echo "#include <xfce4-session/xfsm-marshal.h>" > $@ \ + && glib-genmarshal --prefix=xfsm_marshal --body $< >> $@ xfsm-manager-dbus.h: $(srcdir)/xfsm-manager-dbus.xml $(AM_V_GEN) dbus-binding-tool --mode=glib-server --prefix=xfsm_manager $< > $@ @@ -110,13 +110,19 @@ xfsm-manager-dbus.h: $(srcdir)/xfsm-manager-dbus.xml xfsm-client-dbus.h: $(srcdir)/xfsm-client-dbus.xml $(AM_V_GEN) dbus-binding-tool --mode=glib-server --prefix=xfsm_client $< > $@ -DISTCLEANFILES = \ - $(BUILT_SOURCES) +DISTCLEANFILES = \ + $(xfce4_session_built_sources) -endif +BUILT_SOURCES = \ + $(xfce4_session_built_sources) +endif EXTRA_DIST = \ $(man_MANS) \ - chooser-icon.png \ - xfsm-marshal.list + xfsm-chooser-icon.png \ + xfsm-marshal.list \ + xfsm-client-dbus.xml \ + xfsm-manager-dbus.xml + +# vi:set ts=8 sw=8 noet ai nocindent syntax=automake: diff --git a/xfce4-session/ice-layer.h b/xfce4-session/ice-layer.h index 5d6b3d6..7e8d81b 100644 --- a/xfce4-session/ice-layer.h +++ b/xfce4-session/ice-layer.h @@ -26,7 +26,7 @@ #include <glib.h> -#include "xfsm-manager.h" +#include <xfce4-session/xfsm-manager.h> Bool ice_auth_proc (char *hostname); gboolean ice_setup_listeners (int num_listeners, diff --git a/xfce4-session/main.c b/xfce4-session/main.c index 8f7c003..e88b895 100644 --- a/xfce4-session/main.c +++ b/xfce4-session/main.c @@ -60,13 +60,13 @@ #include <libxfsm/xfsm-util.h> #include <xfce4-session/ice-layer.h> -#include <xfce4-session/shutdown.h> #include <xfce4-session/sm-layer.h> #include <xfce4-session/xfsm-dns.h> #include <xfce4-session/xfsm-global.h> #include <xfce4-session/xfsm-manager.h> +#include <xfce4-session/xfsm-shutdown.h> #include <xfce4-session/xfsm-startup.h> -#include "xfsm-error.h" +#include <xfce4-session/xfsm-error.h> static gboolean opt_disable_tcp = FALSE; static gboolean opt_version = FALSE; diff --git a/xfce4-session/sm-layer.h b/xfce4-session/sm-layer.h index 90cf96a..fc50487 100644 --- a/xfce4-session/sm-layer.h +++ b/xfce4-session/sm-layer.h @@ -25,7 +25,7 @@ #include <xfconf/xfconf.h> #include <libxfce4util/libxfce4util.h> -#include "xfsm-manager.h" +#include <xfce4-session/xfsm-manager.h> void sm_init (XfconfChannel *channel, gboolean disable_tcp, diff --git a/xfce4-session/chooser-icon.png b/xfce4-session/xfsm-chooser-icon.png similarity index 100% rename from xfce4-session/chooser-icon.png rename to xfce4-session/xfsm-chooser-icon.png diff --git a/xfce4-session/xfsm-client-dbus.h b/xfce4-session/xfsm-client-dbus.h deleted file mode 100644 index 06545e6..0000000 --- a/xfce4-session/xfsm-client-dbus.h +++ /dev/null @@ -1,266 +0,0 @@ -/* Generated by dbus-binding-tool; do not edit! */ - - -#ifndef __dbus_glib_marshal_xfsm_client_MARSHAL_H__ -#define __dbus_glib_marshal_xfsm_client_MARSHAL_H__ - -#include <glib-object.h> - -G_BEGIN_DECLS - -#ifdef G_ENABLE_DEBUG -#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) -#define g_marshal_value_peek_char(v) g_value_get_char (v) -#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) -#define g_marshal_value_peek_int(v) g_value_get_int (v) -#define g_marshal_value_peek_uint(v) g_value_get_uint (v) -#define g_marshal_value_peek_long(v) g_value_get_long (v) -#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) -#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) -#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) -#define g_marshal_value_peek_enum(v) g_value_get_enum (v) -#define g_marshal_value_peek_flags(v) g_value_get_flags (v) -#define g_marshal_value_peek_float(v) g_value_get_float (v) -#define g_marshal_value_peek_double(v) g_value_get_double (v) -#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) -#define g_marshal_value_peek_param(v) g_value_get_param (v) -#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) -#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) -#define g_marshal_value_peek_object(v) g_value_get_object (v) -#else /* !G_ENABLE_DEBUG */ -/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. - * Do not access GValues directly in your code. Instead, use the - * g_value_get_*() functions - */ -#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int -#define g_marshal_value_peek_char(v) (v)->data[0].v_int -#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint -#define g_marshal_value_peek_int(v) (v)->data[0].v_int -#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint -#define g_marshal_value_peek_long(v) (v)->data[0].v_long -#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 -#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 -#define g_marshal_value_peek_enum(v) (v)->data[0].v_long -#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_float(v) (v)->data[0].v_float -#define g_marshal_value_peek_double(v) (v)->data[0].v_double -#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer -#endif /* !G_ENABLE_DEBUG */ - - -/* BOOLEAN:BOXED,POINTER */ -extern void dbus_glib_marshal_xfsm_client_BOOLEAN__BOXED_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -void -dbus_glib_marshal_xfsm_client_BOOLEAN__BOXED_POINTER (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__BOXED_POINTER) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gpointer data2); - register GMarshalFunc_BOOLEAN__BOXED_POINTER callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_BOOLEAN__BOXED_POINTER) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_boxed (param_values + 1), - g_marshal_value_peek_pointer (param_values + 2), - data2); - - g_value_set_boolean (return_value, v_return); -} - -/* BOOLEAN:POINTER */ -extern void dbus_glib_marshal_xfsm_client_BOOLEAN__POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -void -dbus_glib_marshal_xfsm_client_BOOLEAN__POINTER (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER) (gpointer data1, - gpointer arg_1, - gpointer data2); - register GMarshalFunc_BOOLEAN__POINTER callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 2); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_BOOLEAN__POINTER) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_pointer (param_values + 1), - data2); - - g_value_set_boolean (return_value, v_return); -} - -/* BOOLEAN:BOXED,POINTER,POINTER */ -extern void dbus_glib_marshal_xfsm_client_BOOLEAN__BOXED_POINTER_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -void -dbus_glib_marshal_xfsm_client_BOOLEAN__BOXED_POINTER_POINTER (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__BOXED_POINTER_POINTER) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gpointer arg_3, - gpointer data2); - register GMarshalFunc_BOOLEAN__BOXED_POINTER_POINTER callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 4); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_BOOLEAN__BOXED_POINTER_POINTER) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_boxed (param_values + 1), - g_marshal_value_peek_pointer (param_values + 2), - g_marshal_value_peek_pointer (param_values + 3), - data2); - - g_value_set_boolean (return_value, v_return); -} - -/* BOOLEAN:POINTER,POINTER */ -extern void dbus_glib_marshal_xfsm_client_BOOLEAN__POINTER_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -void -dbus_glib_marshal_xfsm_client_BOOLEAN__POINTER_POINTER (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER_POINTER) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gpointer data2); - register GMarshalFunc_BOOLEAN__POINTER_POINTER callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_BOOLEAN__POINTER_POINTER) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_pointer (param_values + 1), - g_marshal_value_peek_pointer (param_values + 2), - data2); - - g_value_set_boolean (return_value, v_return); -} - -G_END_DECLS - -#endif /* __dbus_glib_marshal_xfsm_client_MARSHAL_H__ */ - -#include <dbus/dbus-glib.h> -static const DBusGMethodInfo dbus_glib_xfsm_client_methods[] = { - { (GCallback) xfsm_client_dbus_get_id, dbus_glib_marshal_xfsm_client_BOOLEAN__POINTER_POINTER, 0 }, - { (GCallback) xfsm_client_dbus_get_state, dbus_glib_marshal_xfsm_client_BOOLEAN__POINTER_POINTER, 44 }, - { (GCallback) xfsm_client_dbus_get_all_sm_properties, dbus_glib_marshal_xfsm_client_BOOLEAN__POINTER_POINTER, 94 }, - { (GCallback) xfsm_client_dbus_get_sm_properties, dbus_glib_marshal_xfsm_client_BOOLEAN__BOXED_POINTER_POINTER, 163 }, - { (GCallback) xfsm_client_dbus_set_sm_properties, dbus_glib_marshal_xfsm_client_BOOLEAN__BOXED_POINTER, 236 }, - { (GCallback) xfsm_client_dbus_delete_sm_properties, dbus_glib_marshal_xfsm_client_BOOLEAN__BOXED_POINTER, 298 }, - { (GCallback) xfsm_client_dbus_terminate, dbus_glib_marshal_xfsm_client_BOOLEAN__POINTER, 355 }, -}; - -const DBusGObjectInfo dbus_glib_xfsm_client_object_info = { 1, - dbus_glib_xfsm_client_methods, - 7, -"org.xfce.Session.Client\0GetID\0S\0id\0O\0F\0N\0s\0\0org.xfce.Session.Client\0GetState\0S\0state\0O\0F\0N\0u\0\0org.xfce.Session.Client\0GetAllSmProperties\0S\0properties\0O\0F\0N\0a{sv}\0\0org.xfce.Session.Client\0GetSmProperties\0S\0names\0I\0as\0values\0O\0F\0N\0a{sv}\0\0org.xfce.Session.Client\0SetSmProperties\0S\0properties\0I\0a{sv}\0\0org.xfce.Session.Client\0DeleteSmProperties\0S\0names\0I\0as\0\0org.xfce.Session.Client\0Terminate\0S\0\0\0", -"org.xfce.Session.Client\0StateChanged\0org.xfce.Session.Client\0SmPropertyChanged\0org.xfce.Session.Client\0SmPropertyDeleted\0\0", -"\0" -}; - diff --git a/xfce4-session/xfsm-client.c b/xfce4-session/xfsm-client.c index 9f879d6..0455c6c 100644 --- a/xfce4-session/xfsm-client.c +++ b/xfce4-session/xfsm-client.c @@ -32,11 +32,11 @@ #include <libxfsm/xfsm-util.h> -#include "xfsm-client.h" -#include "xfsm-manager.h" -#include "xfsm-global.h" -#include "xfsm-marshal.h" -#include "xfsm-error.h" +#include <xfce4-session/xfsm-client.h> +#include <xfce4-session/xfsm-manager.h> +#include <xfce4-session/xfsm-global.h> +#include <xfce4-session/xfsm-marshal.h> +#include <xfce4-session/xfsm-error.h> #define XFSM_CLIENT_OBJECT_PATH_PREFIX "/org/xfce/SessionClients/" @@ -417,7 +417,7 @@ static gboolean xfsm_client_dbus_terminate (XfsmClient *client, /* header needs the above fwd decls */ -#include "xfsm-client-dbus.h" +#include <xfce4-session/xfsm-client-dbus.h> static void diff --git a/xfce4-session/xfsm-dns.c b/xfce4-session/xfsm-dns.c index 0275426..abb9cef 100644 --- a/xfce4-session/xfsm-dns.c +++ b/xfce4-session/xfsm-dns.c @@ -55,7 +55,7 @@ #include <libxfsm/xfsm-util.h> -#include "xfsm-dns.h" +#include <xfce4-session/xfsm-dns.h> #include <xfce4-session/xfsm-global.h> diff --git a/xfce4-session/xfsm-error.c b/xfce4-session/xfsm-error.c index 399230a..f4d9c69 100644 --- a/xfce4-session/xfsm-error.c +++ b/xfce4-session/xfsm-error.c @@ -22,7 +22,7 @@ #include <dbus/dbus-glib.h> -#include "xfsm-error.h" +#include <xfce4-session/xfsm-error.h> GQuark diff --git a/xfce4-session/xfsm-global.c b/xfce4-session/xfsm-global.c index fa5bbaf..1d5ed37 100644 --- a/xfce4-session/xfsm-global.c +++ b/xfce4-session/xfsm-global.c @@ -45,7 +45,6 @@ #include <libxfce4util/libxfce4util.h> #include <libxfce4ui/libxfce4ui.h> -#include <xfce4-session/shutdown.h> #include <xfce4-session/xfsm-global.h> #include <libxfsm/xfsm-util.h> diff --git a/xfce4-session/xfsm-legacy.c b/xfce4-session/xfsm-legacy.c index c730b30..7f29ea3 100644 --- a/xfce4-session/xfsm-legacy.c +++ b/xfce4-session/xfsm-legacy.c @@ -74,7 +74,7 @@ #include <libwnck/libwnck.h> -#include "xfsm-legacy.h" +#include <xfce4-session/xfsm-legacy.h> #include <libxfsm/xfsm-util.h> diff --git a/xfce4-session/shutdown.c b/xfce4-session/xfsm-logout-dialog.c similarity index 90% rename from xfce4-session/shutdown.c rename to xfce4-session/xfsm-logout-dialog.c index 45031ba..8b2fc15 100644 --- a/xfce4-session/shutdown.c +++ b/xfce4-session/xfsm-logout-dialog.c @@ -1,3 +1,26 @@ +/*- + * Copyright (c) 2003-2004 Benedikt Meurer <be...@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/logout.c, which + * was written by Owen Taylor <otay...@redhat.com>. + */ + /* $Id$ */ /*- * Copyright (c) 2003-2004 Benedikt Meurer <be...@xfce.org> @@ -58,7 +81,7 @@ #include <libxfsm/xfsm-util.h> -#include <xfce4-session/shutdown.h> +#include <xfce4-session/xfsm-logout-dialog.h> #include <xfce4-session/xfsm-compat-gnome.h> #include <xfce4-session/xfsm-compat-kde.h> #include <xfce4-session/xfsm-fadeout.h> @@ -123,41 +146,41 @@ entry_activate_cb (GtkWidget *entry, GtkDialog *dialog) } static void -logout_button_clicked (GtkWidget *b, gint *shutdownType) +logout_button_clicked (GtkWidget *b, gint *shutdown_type) { - *shutdownType = XFSM_SHUTDOWN_LOGOUT; + *shutdown_type = XFSM_SHUTDOWN_LOGOUT; gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK); } static void -reboot_button_clicked (GtkWidget *b, gint *shutdownType) +reboot_button_clicked (GtkWidget *b, gint *shutdown_type) { - *shutdownType = XFSM_SHUTDOWN_REBOOT; + *shutdown_type = XFSM_SHUTDOWN_REBOOT; gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK); } static void -halt_button_clicked (GtkWidget *b, gint *shutdownType) +halt_button_clicked (GtkWidget *b, gint *shutdown_type) { - *shutdownType = XFSM_SHUTDOWN_HALT; + *shutdown_type = XFSM_SHUTDOWN_HALT; gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK); } static void -suspend_button_clicked (GtkWidget *b, gint *shutdownType) +suspend_button_clicked (GtkWidget *b, gint *shutdown_type) { - *shutdownType = XFSM_SHUTDOWN_SUSPEND; + *shutdown_type = XFSM_SHUTDOWN_SUSPEND; gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK); } static void -hibernate_button_clicked (GtkWidget *b, gint *shutdownType) +hibernate_button_clicked (GtkWidget *b, gint *shutdown_type) { - *shutdownType = XFSM_SHUTDOWN_HIBERNATE; + *shutdown_type = XFSM_SHUTDOWN_HIBERNATE; gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK); } @@ -165,7 +188,9 @@ hibernate_button_clicked (GtkWidget *b, gint *shutdownType) /* */ gboolean -shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolean *saveSession) +xfsm_logout_dialog (const gchar *session_name, + XfsmShutdownType *shutdown_type, + gboolean *save_session) { gboolean accessibility; GtkIconTheme *icon_theme; @@ -217,8 +242,8 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea struct passwd *pw; #endif - g_return_val_if_fail(saveSession != NULL, FALSE); - g_return_val_if_fail(shutdownType != NULL, FALSE); + g_return_val_if_fail(save_session != NULL, FALSE); + g_return_val_if_fail(shutdown_type != NULL, FALSE); icon_theme = gtk_icon_theme_get_default (); @@ -254,8 +279,8 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea /* if PromptOnLogout is off, saving depends on AutoSave */ if (!prompt) { - *shutdownType = XFSM_SHUTDOWN_LOGOUT; - *saveSession = autosave; + *shutdown_type = XFSM_SHUTDOWN_LOGOUT; + *save_session = autosave; return TRUE; } @@ -395,7 +420,7 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea gtk_box_pack_start (GTK_BOX (hbox), logout_button, TRUE, TRUE, 0); g_signal_connect (logout_button, "clicked", - G_CALLBACK (logout_button_clicked), shutdownType); + G_CALLBACK (logout_button_clicked), shutdown_type); vbox2 = gtk_vbox_new (FALSE, BORDER); gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER); @@ -429,7 +454,7 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea gtk_box_pack_start (GTK_BOX (hbox), reboot_button, TRUE, TRUE, 0); g_signal_connect (reboot_button, "clicked", - G_CALLBACK (reboot_button_clicked), shutdownType); + G_CALLBACK (reboot_button_clicked), shutdown_type); vbox2 = gtk_vbox_new (FALSE, BORDER); gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER); @@ -471,7 +496,7 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea gtk_box_pack_start (GTK_BOX (hbox), halt_button, TRUE, TRUE, 0); g_signal_connect (halt_button, "clicked", - G_CALLBACK (halt_button_clicked), shutdownType); + G_CALLBACK (halt_button_clicked), shutdown_type); vbox2 = gtk_vbox_new (FALSE, BORDER); gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER); @@ -533,7 +558,7 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea gtk_box_pack_start (GTK_BOX (hbox), suspend_button, TRUE, TRUE, 0); g_signal_connect (suspend_button, "clicked", - G_CALLBACK (suspend_button_clicked), shutdownType); + G_CALLBACK (suspend_button_clicked), shutdown_type); vbox2 = gtk_vbox_new (FALSE, BORDER); gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER); @@ -571,7 +596,7 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea gtk_box_pack_start (GTK_BOX (hbox), hibernate_button, TRUE, TRUE, 0); g_signal_connect (hibernate_button, "clicked", - G_CALLBACK (hibernate_button_clicked), shutdownType); + G_CALLBACK (hibernate_button_clicked), shutdown_type); vbox2 = gtk_vbox_new (FALSE, BORDER); gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER); @@ -643,7 +668,7 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea result = gtk_dialog_run (GTK_DIALOG(dialog)); if (result == GTK_RESPONSE_OK) { - *saveSession = autosave ? autosave : + *save_session = autosave ? autosave : gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox)); } @@ -654,7 +679,7 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea NULL); /* ask password */ - if (result == GTK_RESPONSE_OK && *shutdownType != XFSM_SHUTDOWN_LOGOUT + if (result == GTK_RESPONSE_OK && *shutdown_type != XFSM_SHUTDOWN_LOGOUT && require_password ) { gtk_widget_show (ok_button); @@ -760,8 +785,8 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea */ if (result == GTK_RESPONSE_OK) { - xfconf_channel_set_string (channel, "/general/SessionName", sessionName); - xfconf_channel_set_bool (channel, "/general/SaveOnExit", *saveSession); + xfconf_channel_set_string (channel, "/general/SessionName", session_name); + xfconf_channel_set_bool (channel, "/general/SaveOnExit", *save_session); } else { @@ -773,7 +798,7 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea if (screenshot_pm != NULL) { if (result == GTK_RESPONSE_OK) - screenshot_save (sessionName, screenshot_pm, &screenshot_area); + screenshot_save (session_name, screenshot_pm, &screenshot_area); g_object_unref (G_OBJECT (screenshot_pm)); } @@ -781,65 +806,3 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea return (result == GTK_RESPONSE_OK); } - - -/* - */ -gint -xfsm_shutdown(XfsmShutdownType type) -{ - gboolean result; - GError *error = NULL; - - /* kludge */ - if (type == XFSM_SHUTDOWN_ASK) - { - g_warning ("xfsm_shutdown () passed XFSM_SHUTDOWN_ASK. This is a bug."); - type = XFSM_SHUTDOWN_LOGOUT; - } - - /* these two remember if they were started or not */ - xfsm_compat_gnome_shutdown (); - xfsm_compat_kde_shutdown (); - - /* kill legacy clients */ - xfsm_legacy_shutdown (); - -#if !defined(__NR_ioprio_set) && defined(HAVE_SYNC) - /* sync disk block in-core status with that on disk. if - * we have ioprio_set (), then we've already synced. */ - if (fork () == 0) - { -# ifdef HAVE_SETSID - setsid (); -# endif - sync (); - _exit (EXIT_SUCCESS); - } -#endif /* HAVE_SYNC */ - - if (type == XFSM_SHUTDOWN_LOGOUT) - return EXIT_SUCCESS; - - if (shutdown_helper == NULL) - shutdown_helper = xfsm_shutdown_helper_new (); - - result = xfsm_shutdown_helper_send_command (shutdown_helper, type, &error); - g_object_unref (shutdown_helper); - shutdown_helper = NULL; - - if (!result) - { - xfce_message_dialog (NULL, _("Shutdown Failed"), - GTK_STOCK_DIALOG_ERROR, - _("Unable to perform shutdown"), - error->message, - GTK_STOCK_QUIT, GTK_RESPONSE_ACCEPT, - NULL); - g_error_free (error); - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} - diff --git a/xfce4-session/sm-layer.h b/xfce4-session/xfsm-logout-dialog.h similarity index 69% copy from xfce4-session/sm-layer.h copy to xfce4-session/xfsm-logout-dialog.h index 90cf96a..ed348b7 100644 --- a/xfce4-session/sm-layer.h +++ b/xfce4-session/xfsm-logout-dialog.h @@ -1,6 +1,6 @@ -/* $Id$ */ /*- * Copyright (c) 2003-2004 Benedikt Meurer <be...@xfce.org> + * Copyright (c) 2011 Nick Schermer <n...@xfce.org> * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -19,16 +19,13 @@ * MA 02110-1301 USA. */ -#ifndef __SM_LAYER_H__ -#define __SM_LAYER_H__ +#ifndef __XFSM_LOGOUT_DIALOG_H__ +#define __XFSM_LOGOUT_DIALOG_H__ -#include <xfconf/xfconf.h> -#include <libxfce4util/libxfce4util.h> +#include <xfce4-session/xfsm-global.h> -#include "xfsm-manager.h" +gboolean xfsm_logout_dialog (const gchar *session_name, + XfsmShutdownType *shutdown_type, + gboolean *save_session); -void sm_init (XfconfChannel *channel, - gboolean disable_tcp, - XfsmManager *manager); - -#endif /* !__SM_LAYER_H__ */ +#endif diff --git a/xfce4-session/xfsm-manager.c b/xfce4-session/xfsm-manager.c index e1d05f0..9f87c48 100644 --- a/xfce4-session/xfsm-manager.c +++ b/xfce4-session/xfsm-manager.c @@ -71,20 +71,21 @@ #include <libwnck/libwnck.h> -#include "xfsm-shutdown-helper.h" +#include <xfce4-session/xfsm-shutdown-helper.h> #include <libxfce4ui/libxfce4ui.h> #include <libxfsm/xfsm-splash-engine.h> #include <libxfsm/xfsm-util.h> -#include "xfsm-manager.h" -#include "chooser-icon.h" -#include "xfsm-chooser.h" -#include "xfsm-global.h" -#include "xfsm-legacy.h" -#include "xfsm-startup.h" -#include "xfsm-marshal.h" -#include "xfsm-error.h" +#include <xfce4-session/xfsm-manager.h> +#include <xfce4-session/xfsm-chooser-icon.h> +#include <xfce4-session/xfsm-chooser.h> +#include <xfce4-session/xfsm-global.h> +#include <xfce4-session/xfsm-legacy.h> +#include <xfce4-session/xfsm-startup.h> +#include <xfce4-session/xfsm-marshal.h> +#include <xfce4-session/xfsm-error.h> +#include <xfce4-session/xfsm-logout-dialog.h> #define DEFAULT_SESSION_NAME "Default" @@ -480,7 +481,7 @@ xfsm_manager_choose_session (XfsmManager *manager, { if (G_UNLIKELY (preview_default == NULL)) { - preview_default = gdk_pixbuf_new_from_inline (-1, chooser_icon_data, + preview_default = gdk_pixbuf_new_from_inline (-1, xfsm_chooser_icon_data, FALSE, NULL); } @@ -766,7 +767,7 @@ xfsm_manager_restart (XfsmManager *manager) /* tell splash screen that the session is starting now */ preview = xfsm_load_session_preview (manager->session_name); if (preview == NULL) - preview = gdk_pixbuf_new_from_inline (-1, chooser_icon_data, FALSE, NULL); + preview = gdk_pixbuf_new_from_inline (-1, xfsm_chooser_icon_data, FALSE, NULL); steps = g_queue_get_length (manager->failsafe_mode ? manager->failsafe_clients : manager->pending_properties); xfsm_splash_screen_start (splash_screen, manager->session_name, preview, steps); g_object_unref (preview); @@ -1093,7 +1094,7 @@ xfsm_manager_save_yourself_global (XfsmManager *manager, { /* if we're not specifying fast shutdown, and we're ok with * prompting then ask the user what to do */ - if (!shutdownDialog (manager->session_name, &manager->shutdown_type, &shutdown_save)) + if (!xfsm_logout_dialog (manager->session_name, &manager->shutdown_type, &shutdown_save)) return; /* |allow_shutdown_save| is ignored if we prompt the user. i think @@ -1813,7 +1814,7 @@ static gboolean xfsm_manager_dbus_shutdown (XfsmManager *manager, /* eader needs the above fwd decls */ -#include "xfsm-manager-dbus.h" +#include <xfce4-session/xfsm-manager-dbus.h> static void diff --git a/xfce4-session/xfsm-manager.h b/xfce4-session/xfsm-manager.h index ba980d3..b12b143 100644 --- a/xfce4-session/xfsm-manager.h +++ b/xfce4-session/xfsm-manager.h @@ -28,8 +28,8 @@ #include <xfconf/xfconf.h> #include <libxfce4util/libxfce4util.h> -#include "xfsm-client.h" -#include "shutdown.h" +#include <xfce4-session/xfsm-client.h> +#include <xfce4-session/xfsm-global.h> G_BEGIN_DECLS diff --git a/xfce4-session/xfsm-shutdown-helper.c b/xfce4-session/xfsm-shutdown-helper.c index 3debeb2..ef29f4f 100644 --- a/xfce4-session/xfsm-shutdown-helper.c +++ b/xfce4-session/xfsm-shutdown-helper.c @@ -71,8 +71,8 @@ #include <libxfce4util/libxfce4util.h> -#include "xfsm-shutdown-helper.h" -#include "xfsm-global.h" +#include <xfce4-session/xfsm-shutdown-helper.h> +#include <xfce4-session/xfsm-global.h> static void xfsm_shutdown_helper_finalize (GObject *object); diff --git a/xfce4-session/xfsm-shutdown-helper.h b/xfce4-session/xfsm-shutdown-helper.h index 20e1076..4bacbe8 100644 --- a/xfce4-session/xfsm-shutdown-helper.h +++ b/xfce4-session/xfsm-shutdown-helper.h @@ -24,8 +24,7 @@ #define __XFSM_SHUTDOWN_HELPER_H #include <glib-object.h> - -#include "shutdown.h" +#include <xfce4-session/xfsm-global.h> G_BEGIN_DECLS diff --git a/xfce4-session/xfsm-shutdown.c b/xfce4-session/xfsm-shutdown.c new file mode 100644 index 0000000..9246c01 --- /dev/null +++ b/xfce4-session/xfsm-shutdown.c @@ -0,0 +1,107 @@ +/* $Id$ */ +/*- + * Copyright (c) 2003-2004 Benedikt Meurer <be...@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/logout.c, which + * was written by Owen Taylor <otay...@redhat.com>. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef HAVE_SYS_WAIT_H +#include <sys/wait.h> +#endif + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#include <libxfce4util/libxfce4util.h> +#include <gtk/gtk.h> + +#include <libxfsm/xfsm-util.h> + +#include <xfce4-session/xfsm-shutdown.h> +#include <xfce4-session/xfsm-compat-gnome.h> +#include <xfce4-session/xfsm-compat-kde.h> +#include <xfce4-session/xfsm-fadeout.h> +#include <xfce4-session/xfsm-global.h> +#include <xfce4-session/xfsm-legacy.h> +#include <xfce4-session/xfsm-shutdown-helper.h> + +gint +xfsm_shutdown(XfsmShutdownType type) +{ + gboolean result; + GError *error = NULL; + XfsmShutdownHelper *shutdown_helper; + + /* kludge */ + if (type == XFSM_SHUTDOWN_ASK) + { + g_warning ("xfsm_shutdown () passed XFSM_SHUTDOWN_ASK. This is a bug."); + type = XFSM_SHUTDOWN_LOGOUT; + } + + /* these two remember if they were started or not */ + xfsm_compat_gnome_shutdown (); + xfsm_compat_kde_shutdown (); + + /* kill legacy clients */ + xfsm_legacy_shutdown (); + +#if !defined(__NR_ioprio_set) && defined(HAVE_SYNC) + /* sync disk block in-core status with that on disk. if + * we have ioprio_set (), then we've already synced. */ + if (fork () == 0) + { +# ifdef HAVE_SETSID + setsid (); +# endif + sync (); + _exit (EXIT_SUCCESS); + } +#endif /* HAVE_SYNC */ + + if (type == XFSM_SHUTDOWN_LOGOUT) + return EXIT_SUCCESS; + + shutdown_helper = xfsm_shutdown_helper_new (); + result = xfsm_shutdown_helper_send_command (shutdown_helper, type, &error); + g_object_unref (shutdown_helper); + + if (!result) + { + xfce_message_dialog (NULL, _("Shutdown Failed"), + GTK_STOCK_DIALOG_ERROR, + _("Unable to perform shutdown"), + error->message, + GTK_STOCK_QUIT, GTK_RESPONSE_ACCEPT, + NULL); + g_error_free (error); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/xfce4-session/shutdown.h b/xfce4-session/xfsm-shutdown.h similarity index 79% rename from xfce4-session/shutdown.h rename to xfce4-session/xfsm-shutdown.h index 65ac453..76d7145 100644 --- a/xfce4-session/shutdown.h +++ b/xfce4-session/xfsm-shutdown.h @@ -1,4 +1,3 @@ -/* $Id$ */ /*- * Copyright (c) 2003-2004 Benedikt Meurer <be...@xfce.org> * All rights reserved. @@ -22,14 +21,7 @@ #ifndef __XFSM_SHUTDOWN_H__ #define __XFSM_SHUTDOWN_H__ -#include <glib.h> - -#include "xfsm-global.h" - -/* prototypes */ -gboolean shutdownDialog (const gchar *sessionName, - XfsmShutdownType *shutdownType, - gboolean *saveSession); +#include <xfce4-session/xfsm-global.h> gint xfsm_shutdown (XfsmShutdownType type); diff --git a/xfce4-session/xfsm-startup.c b/xfce4-session/xfsm-startup.c index c41fd39..3c08a78 100644 --- a/xfce4-session/xfsm-startup.c +++ b/xfce4-session/xfsm-startup.c @@ -56,7 +56,7 @@ #include <xfce4-session/xfsm-manager.h> #include <xfce4-session/xfsm-splash-screen.h> -#include "xfsm-startup.h" +#include <xfce4-session/xfsm-startup.h> typedef struct _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits