X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Factions%2Fsession.c;h=775deab154b0bda897aa616da28d4b6f41bd1be9;hb=4b5373f609e6462995a38cc4f0f50b17cbc8f835;hp=cfc5e377d5e68e2a9dea884c2fa6c445007ec859;hpb=9676757a08b3e2e508c47f7795326bda8e54dc53;p=chaz%2Fopenbox diff --git a/openbox/actions/session.c b/openbox/actions/session.c index cfc5e377..775deab1 100644 --- a/openbox/actions/session.c +++ b/openbox/actions/session.c @@ -3,10 +3,6 @@ #include "openbox/session.h" #include "gettext.h" -#ifndef USE_SM -void action_logout_startup(void) {} -#else - typedef struct { gboolean prompt; gboolean silent; @@ -35,12 +31,22 @@ static gpointer setup_func(xmlNodePtr node) return o; } -static void prompt_cb(ObPrompt *p, gint result, gpointer data) +static gboolean prompt_cb(ObPrompt *p, gint result, gpointer data) { Options *o = data; - if (result) + if (result) { +#ifdef USE_SM session_request_logout(o->silent); - g_free(o); +#else + g_message(_("The SessionLogout actions is not available since Openbox was built without session management support")); +#endif + } + return TRUE; /* call cleanup func */ +} + +static void prompt_cleanup(ObPrompt *p, gpointer data) +{ + g_free(data); prompt_unref(p); } @@ -54,12 +60,13 @@ static gboolean logout_func(ObActionsData *data, gpointer options) ObPrompt *p; ObPromptAnswer answers[] = { { _("Cancel"), 0 }, - { _("Log out"), 1 } + { _("Log Out"), 1 } }; o2 = g_memdup(o, sizeof(Options)); p = prompt_new(_("Are you sure you want to log out?"), - answers, 2, 0, 0, prompt_cb, o2); + _("Log Out"), + answers, 2, 0, 0, prompt_cb, prompt_cleanup, o2); prompt_show(p, NULL, FALSE); } else @@ -67,5 +74,3 @@ static gboolean logout_func(ObActionsData *data, gpointer options) return FALSE; } - -#endif