forked from pool/xfce4-session
This commit is contained in:
parent
b604f5cecb
commit
e50acc8c9a
540
suspend_hibernate.diff
Normal file
540
suspend_hibernate.diff
Normal file
@ -0,0 +1,540 @@
|
||||
Index: xfce4-session-4.3.99.2/settings/session/session.c
|
||||
===================================================================
|
||||
--- xfce4-session-4.3.99.2.orig/settings/session/session.c
|
||||
+++ xfce4-session-4.3.99.2/settings/session/session.c
|
||||
@@ -51,6 +51,8 @@ static GtkWidget *dialog = NULL;
|
||||
static GtkWidget *general_chooser;
|
||||
static GtkWidget *general_autosave;
|
||||
static GtkWidget *general_prompt;
|
||||
+static GtkWidget *general_hibernate_button;
|
||||
+static GtkWidget *general_suspend_button;
|
||||
static GtkWidget *advanced_kde;
|
||||
static GtkWidget *advanced_gnome;
|
||||
static GtkWidget *advanced_remote;
|
||||
@@ -88,6 +90,8 @@ config_store (void)
|
||||
{
|
||||
xfce_rc_write_bool_entry (rc, "AutoSave", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (general_autosave)));
|
||||
xfce_rc_write_bool_entry (rc, "PromptOnLogout", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (general_prompt)));
|
||||
+ xfce_rc_write_bool_entry (rc, "HibernateButton", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (general_hibernate_button)));
|
||||
+ xfce_rc_write_bool_entry (rc, "SuspendButton", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (general_suspend_button)));
|
||||
}
|
||||
if (G_LIKELY (kiosk_can_security))
|
||||
{
|
||||
@@ -124,10 +128,15 @@ general_create (XfceRc *rc)
|
||||
gboolean autosave;
|
||||
gboolean prompt;
|
||||
gboolean chooser;
|
||||
+ gboolean hibernate;
|
||||
+ gboolean suspend;
|
||||
|
||||
xfce_rc_set_group (rc, "General");
|
||||
autosave = xfce_rc_read_bool_entry (rc, "AutoSave", FALSE);
|
||||
prompt = xfce_rc_read_bool_entry (rc, "PromptOnLogout", TRUE);
|
||||
+ hibernate = xfce_rc_read_bool_entry (rc, "HibernateButton", TRUE);
|
||||
+ suspend = xfce_rc_read_bool_entry (rc, "SuspendButton", TRUE);
|
||||
+
|
||||
xfce_rc_set_group (rc, "Chooser");
|
||||
chooser = xfce_rc_read_bool_entry (rc, "AlwaysDisplay", FALSE);
|
||||
|
||||
@@ -182,6 +191,29 @@ general_create (XfceRc *rc)
|
||||
"saving of sessions on logout or not."),
|
||||
NULL);
|
||||
|
||||
+ general_hibernate_button = gtk_check_button_new_with_label (_("Show hibernate button"));
|
||||
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (general_hibernate_button), hibernate);
|
||||
+ g_signal_connect (G_OBJECT (general_hibernate_button), "toggled",
|
||||
+ G_CALLBACK (config_store), NULL);
|
||||
+ gtk_box_pack_start (GTK_BOX (vbox), general_hibernate_button, FALSE, TRUE, 0);
|
||||
+ gtk_tooltips_set_tip (tooltips, general_hibernate_button,
|
||||
+ _("This option adds a hibernate button to the logout dialog. "
|
||||
+ "Only enable if you known your system suspends to"
|
||||
+ "disk and resumes correctly."),
|
||||
+ NULL);
|
||||
+
|
||||
+ general_suspend_button = gtk_check_button_new_with_label (_("Show suspend button"));
|
||||
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (general_suspend_button), suspend);
|
||||
+ g_signal_connect (G_OBJECT (general_suspend_button), "toggled",
|
||||
+ G_CALLBACK (config_store), NULL);
|
||||
+ gtk_box_pack_start (GTK_BOX (vbox), general_suspend_button, FALSE, TRUE, 0);
|
||||
+ gtk_tooltips_set_tip (tooltips, general_suspend_button,
|
||||
+ _("This option adds a suspend button to the logout dialog. "
|
||||
+ "Only enable if you known your system suspends to"
|
||||
+ "RAM and resumes correctly."),
|
||||
+ NULL);
|
||||
+
|
||||
+
|
||||
return page;
|
||||
}
|
||||
|
||||
Index: xfce4-session-4.3.99.2/xfce4-session/main.c
|
||||
===================================================================
|
||||
--- xfce4-session-4.3.99.2.orig/xfce4-session/main.c
|
||||
+++ xfce4-session-4.3.99.2/xfce4-session/main.c
|
||||
@@ -61,6 +61,11 @@
|
||||
#include <xfce4-session/xfsm-manager.h>
|
||||
#include <xfce4-session/xfsm-startup.h>
|
||||
|
||||
+#include <xfce4-session/xfsm-shutdown-helper.h>
|
||||
+
|
||||
+
|
||||
+#include <dbus/dbus.h>
|
||||
+#include <dbus/dbus-glib.h>
|
||||
|
||||
void
|
||||
setup_environment (void)
|
||||
@@ -225,8 +230,6 @@ initialize (int argc, char **argv)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
- /* imported from xfsm-manager.c */
|
||||
- extern gint shutdown_type;
|
||||
|
||||
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
|
||||
|
||||
@@ -248,5 +251,5 @@ main (int argc, char **argv)
|
||||
|
||||
ice_cleanup ();
|
||||
|
||||
- return xfsm_shutdown (shutdown_type);
|
||||
+ return xfsm_shutdown ();
|
||||
}
|
||||
Index: xfce4-session-4.3.99.2/xfce4-session/shutdown.c
|
||||
===================================================================
|
||||
--- xfce4-session-4.3.99.2.orig/xfce4-session/shutdown.c
|
||||
+++ xfce4-session-4.3.99.2/xfce4-session/shutdown.c
|
||||
@@ -110,34 +110,36 @@ entry_activate_cb (GtkWidget *entry, Gtk
|
||||
gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
}
|
||||
|
||||
-static void
|
||||
-logout_button_clicked (GtkWidget *b, gint *shutdownType)
|
||||
-{
|
||||
- *shutdownType = SHUTDOWN_LOGOUT;
|
||||
-
|
||||
- gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK);
|
||||
-}
|
||||
+static gint shutdownType = XFSM_LOGOUT;
|
||||
|
||||
static void
|
||||
-reboot_button_clicked (GtkWidget *b, gint *shutdownType)
|
||||
+logout_dialog_button_clicked (GtkWidget *b, gint *cmd)
|
||||
{
|
||||
- *shutdownType = SHUTDOWN_REBOOT;
|
||||
+ shutdownType = *cmd;
|
||||
|
||||
gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK);
|
||||
}
|
||||
|
||||
-static void
|
||||
-halt_button_clicked (GtkWidget *b, gint *shutdownType)
|
||||
+struct LogoutButton
|
||||
{
|
||||
- *shutdownType = SHUTDOWN_HALT;
|
||||
+ gchar * label;
|
||||
+ gchar * icon;
|
||||
+ gint cmd;
|
||||
+ gboolean present;
|
||||
+ GtkWidget * button;
|
||||
+};
|
||||
+
|
||||
+struct LogoutButton logout_buttons [] = {
|
||||
+ { N_("Log out"), "xfsm-logout", XFSM_LOGOUT, TRUE },
|
||||
+ { N_("Restart"), "xfsm-reboot", XFSM_REBOOT, TRUE },
|
||||
+ { N_("Shut down"), "xfsm-shutdown", XFSM_SHUTDOWN, TRUE },
|
||||
+ { N_("Suspend"), "xfsm-suspend", XFSM_SUSPEND, FALSE},
|
||||
+ { N_("Hibernate"), "xfsm-hibernate", XFSM_HIBERNATE, FALSE},
|
||||
+};
|
||||
|
||||
- gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK);
|
||||
-}
|
||||
|
||||
-/*
|
||||
- */
|
||||
gboolean
|
||||
-shutdownDialog(gint *shutdownType, gboolean *saveSession)
|
||||
+shutdownDialog(gboolean *saveSession)
|
||||
{
|
||||
gboolean accessibility;
|
||||
XfsmFadeout *fadeout = NULL;
|
||||
@@ -154,8 +156,6 @@ shutdownDialog(gint *shutdownType, gbool
|
||||
GtkWidget *entry;
|
||||
GtkWidget *hidden;
|
||||
GtkWidget *logout_button;
|
||||
- GtkWidget *reboot_button;
|
||||
- GtkWidget *halt_button;
|
||||
GtkWidget *cancel_button;
|
||||
GtkWidget *ok_button;
|
||||
GtkWidget *header;
|
||||
@@ -163,6 +163,8 @@ shutdownDialog(gint *shutdownType, gbool
|
||||
gboolean saveonexit;
|
||||
gboolean autosave;
|
||||
gboolean prompt;
|
||||
+ gboolean have_suspend;
|
||||
+ gboolean have_hibernate;
|
||||
gint monitor;
|
||||
gint result;
|
||||
XfceKiosk *kiosk;
|
||||
@@ -174,9 +176,9 @@ shutdownDialog(gint *shutdownType, gbool
|
||||
GdkPixmap *screenshot_pm = NULL;
|
||||
GdkGC *screenshot_gc;
|
||||
#endif
|
||||
+ gint i;
|
||||
|
||||
g_return_val_if_fail(saveSession != NULL, FALSE);
|
||||
- g_return_val_if_fail(shutdownType != NULL, FALSE);
|
||||
|
||||
/* destroy any previously running shutdown helper first */
|
||||
if (shutdown_helper != NULL)
|
||||
@@ -196,13 +198,15 @@ shutdownDialog(gint *shutdownType, gbool
|
||||
saveonexit = xfce_rc_read_bool_entry (rc, "SaveOnExit", TRUE);
|
||||
autosave = xfce_rc_read_bool_entry (rc, "AutoSave", FALSE);
|
||||
prompt = xfce_rc_read_bool_entry (rc, "PromptOnLogout", TRUE);
|
||||
+ have_suspend = xfce_rc_read_bool_entry (rc, "SuspendButton", TRUE);
|
||||
+ have_hibernate = xfce_rc_read_bool_entry (rc, "HibernateButton", TRUE);
|
||||
|
||||
/* if PromptOnLogout is off, saving depends on AutoSave */
|
||||
if (!prompt)
|
||||
{
|
||||
xfce_rc_close (rc);
|
||||
|
||||
- *shutdownType = SHUTDOWN_LOGOUT;
|
||||
+ shutdownType = XFSM_LOGOUT;
|
||||
*saveSession = autosave;
|
||||
|
||||
return TRUE;
|
||||
@@ -318,76 +322,39 @@ shutdownDialog(gint *shutdownType, gbool
|
||||
hbox = gtk_hbox_new (TRUE, BORDER);
|
||||
gtk_widget_show (hbox);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
+ logout_buttons[3].present = have_suspend;
|
||||
+ logout_buttons[4].present = have_hibernate;
|
||||
|
||||
- /* logout */
|
||||
- logout_button = gtk_button_new ();
|
||||
- gtk_widget_show (logout_button);
|
||||
- gtk_box_pack_start (GTK_BOX (hbox), logout_button, TRUE, TRUE, 0);
|
||||
-
|
||||
- g_signal_connect (logout_button, "clicked",
|
||||
- G_CALLBACK (logout_button_clicked), shutdownType);
|
||||
-
|
||||
- vbox2 = gtk_vbox_new (FALSE, BORDER);
|
||||
- gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
|
||||
- gtk_widget_show (vbox2);
|
||||
- gtk_container_add (GTK_CONTAINER (logout_button), vbox2);
|
||||
-
|
||||
- icon = xfce_themed_icon_load ("xfsm-logout", 32);
|
||||
- image = gtk_image_new_from_pixbuf (icon);
|
||||
- gtk_widget_show (image);
|
||||
- gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
|
||||
- g_object_unref (icon);
|
||||
-
|
||||
- label = gtk_label_new (_("Log Out"));
|
||||
- gtk_widget_show (label);
|
||||
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
-
|
||||
- /* reboot */
|
||||
- reboot_button = gtk_button_new ();
|
||||
- gtk_widget_show (reboot_button);
|
||||
- gtk_box_pack_start (GTK_BOX (hbox), reboot_button, TRUE, TRUE, 0);
|
||||
-
|
||||
- g_signal_connect (reboot_button, "clicked",
|
||||
- G_CALLBACK (reboot_button_clicked), shutdownType);
|
||||
-
|
||||
- vbox2 = gtk_vbox_new (FALSE, BORDER);
|
||||
- gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
|
||||
- gtk_widget_show (vbox2);
|
||||
- gtk_container_add (GTK_CONTAINER (reboot_button), vbox2);
|
||||
-
|
||||
- icon = xfce_themed_icon_load ("xfsm-reboot", 32);
|
||||
- image = gtk_image_new_from_pixbuf (icon);
|
||||
- gtk_widget_show (image);
|
||||
- gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
|
||||
- g_object_unref (icon);
|
||||
-
|
||||
- label = gtk_label_new (_("Restart"));
|
||||
- gtk_widget_show (label);
|
||||
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
-
|
||||
- /* halt */
|
||||
- halt_button = gtk_button_new ();
|
||||
- gtk_widget_show (halt_button);
|
||||
- gtk_box_pack_start (GTK_BOX (hbox), halt_button, TRUE, TRUE, 0);
|
||||
-
|
||||
- g_signal_connect (halt_button, "clicked",
|
||||
- G_CALLBACK (halt_button_clicked), shutdownType);
|
||||
-
|
||||
- vbox2 = gtk_vbox_new (FALSE, BORDER);
|
||||
- gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
|
||||
- gtk_widget_show (vbox2);
|
||||
- gtk_container_add (GTK_CONTAINER (halt_button), vbox2);
|
||||
-
|
||||
- icon = xfce_themed_icon_load ("xfsm-shutdown", 32);
|
||||
- image = gtk_image_new_from_pixbuf (icon);
|
||||
- gtk_widget_show (image);
|
||||
- gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
|
||||
- g_object_unref (icon);
|
||||
-
|
||||
- label = gtk_label_new (_("Shut Down"));
|
||||
- gtk_widget_show (label);
|
||||
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
-
|
||||
+ for (i = 0; i < G_N_ELEMENTS (logout_buttons); i++) {
|
||||
+
|
||||
+ if (logout_buttons[i].present == FALSE)
|
||||
+ continue;
|
||||
+
|
||||
+ logout_button = gtk_button_new ();
|
||||
+ gtk_widget_show (logout_button);
|
||||
+ gtk_box_pack_start (GTK_BOX (hbox), logout_button, TRUE, TRUE, 0);
|
||||
+
|
||||
+ g_signal_connect (logout_button, "clicked",
|
||||
+ G_CALLBACK (logout_dialog_button_clicked), &logout_buttons[i].cmd);
|
||||
+
|
||||
+ vbox2 = gtk_vbox_new (FALSE, BORDER);
|
||||
+ gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
|
||||
+ gtk_widget_show (vbox2);
|
||||
+ gtk_container_add (GTK_CONTAINER (logout_button), vbox2);
|
||||
+
|
||||
+ icon = xfce_themed_icon_load (logout_buttons[i].icon, 32);
|
||||
+ image = gtk_image_new_from_pixbuf (icon);
|
||||
+ gtk_widget_show (image);
|
||||
+ gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
|
||||
+ g_object_unref (icon);
|
||||
+
|
||||
+ label = gtk_label_new (logout_buttons[i].label);
|
||||
+ gtk_widget_show (label);
|
||||
+ gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
+
|
||||
+ logout_buttons[i].button = logout_button;
|
||||
+ }
|
||||
+
|
||||
/* save session */
|
||||
if (!autosave)
|
||||
{
|
||||
@@ -413,8 +380,9 @@ shutdownDialog(gint *shutdownType, gbool
|
||||
if (!kiosk_can_shutdown ||
|
||||
(shutdown_helper = xfsm_shutdown_helper_spawn ()) == NULL)
|
||||
{
|
||||
- gtk_widget_set_sensitive (reboot_button, FALSE);
|
||||
- gtk_widget_set_sensitive (halt_button, FALSE);
|
||||
+ for (i = 1; i < G_N_ELEMENTS (logout_buttons); i++) {
|
||||
+ gtk_widget_set_sensitive (logout_buttons[i].button, FALSE);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* save portion of the root window covered by the dialog */
|
||||
@@ -444,7 +412,7 @@ shutdownDialog(gint *shutdownType, gbool
|
||||
gtk_widget_hide (dialog);
|
||||
|
||||
/* ask password */
|
||||
- if (result == GTK_RESPONSE_OK && *shutdownType != SHUTDOWN_LOGOUT
|
||||
+ if (result == GTK_RESPONSE_OK && shutdownType != XFSM_LOGOUT
|
||||
&& xfsm_shutdown_helper_need_password (shutdown_helper))
|
||||
{
|
||||
gtk_widget_show (ok_button);
|
||||
@@ -540,6 +508,16 @@ shutdownDialog(gint *shutdownType, gbool
|
||||
gdk_flush ();
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * For suspend/hibernate perform the action but do not
|
||||
+ * close the session so it is still there on resume
|
||||
+ */
|
||||
+ if (result == GTK_RESPONSE_OK
|
||||
+ && (shutdownType == XFSM_SUSPEND || shutdownType == XFSM_HIBERNATE)) {
|
||||
+ xfsm_shutdown_helper_send_command (shutdown_helper, shutdownType);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
/* process all pending events first */
|
||||
while (gtk_events_pending ())
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
@@ -578,7 +556,7 @@ shutdownDialog(gint *shutdownType, gbool
|
||||
/*
|
||||
*/
|
||||
gint
|
||||
-xfsm_shutdown(gint type)
|
||||
+xfsm_shutdown(void)
|
||||
{
|
||||
gboolean result;
|
||||
|
||||
@@ -596,7 +574,7 @@ xfsm_shutdown(gint type)
|
||||
sync ();
|
||||
#endif
|
||||
|
||||
- if (type == SHUTDOWN_LOGOUT)
|
||||
+ if (shutdownType == XFSM_LOGOUT)
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
if (shutdown_helper == NULL)
|
||||
@@ -605,16 +583,7 @@ xfsm_shutdown(gint type)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
- if (type == SHUTDOWN_HALT)
|
||||
- {
|
||||
- result = xfsm_shutdown_helper_send_command (shutdown_helper,
|
||||
- XFSM_SHUTDOWN_POWEROFF);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- result = xfsm_shutdown_helper_send_command (shutdown_helper,
|
||||
- XFSM_SHUTDOWN_REBOOT);
|
||||
- }
|
||||
+ result = xfsm_shutdown_helper_send_command (shutdown_helper, shutdownType);
|
||||
|
||||
xfsm_shutdown_helper_destroy (shutdown_helper);
|
||||
shutdown_helper = NULL;
|
||||
Index: xfce4-session-4.3.99.2/xfce4-session/shutdown.h
|
||||
===================================================================
|
||||
--- xfce4-session-4.3.99.2.orig/xfce4-session/shutdown.h
|
||||
+++ xfce4-session-4.3.99.2/xfce4-session/shutdown.h
|
||||
@@ -24,13 +24,8 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
-/* */
|
||||
-#define SHUTDOWN_LOGOUT 0
|
||||
-#define SHUTDOWN_REBOOT 1
|
||||
-#define SHUTDOWN_HALT 2
|
||||
-
|
||||
/* prototypes */
|
||||
-extern gboolean shutdownDialog(gint *, gboolean *);
|
||||
-extern gint xfsm_shutdown(gint);
|
||||
+extern gboolean shutdownDialog(gboolean *);
|
||||
+extern gint xfsm_shutdown(void);
|
||||
|
||||
#endif /* !__XFSM_SHUTDOWN_H__ */
|
||||
Index: xfce4-session-4.3.99.2/xfce4-session/xfsm-global.c
|
||||
===================================================================
|
||||
--- xfce4-session-4.3.99.2.orig/xfce4-session/xfsm-global.c
|
||||
+++ xfce4-session-4.3.99.2/xfce4-session/xfsm-global.c
|
||||
@@ -46,7 +46,6 @@ gchar *session_name = NULL;
|
||||
gchar *session_file = NULL;
|
||||
GList *failsafe_clients = NULL;
|
||||
gboolean failsafe_mode = TRUE;
|
||||
-gint shutdown_type = SHUTDOWN_LOGOUT;
|
||||
XfsmSplashScreen *splash_screen = NULL;
|
||||
|
||||
void
|
||||
Index: xfce4-session-4.3.99.2/xfce4-session/xfsm-global.h
|
||||
===================================================================
|
||||
--- xfce4-session-4.3.99.2.orig/xfce4-session/xfsm-global.h
|
||||
+++ xfce4-session-4.3.99.2/xfce4-session/xfsm-global.h
|
||||
@@ -47,7 +47,6 @@ extern gchar *session_name;
|
||||
extern gchar *session_file;
|
||||
extern GList *failsafe_clients;
|
||||
extern gboolean failsafe_mode;
|
||||
-extern gint shutdown_type;
|
||||
extern XfsmSplashScreen *splash_screen;
|
||||
|
||||
|
||||
Index: xfce4-session-4.3.99.2/xfce4-session/xfsm-manager.c
|
||||
===================================================================
|
||||
--- xfce4-session-4.3.99.2.orig/xfce4-session/xfsm-manager.c
|
||||
+++ xfce4-session-4.3.99.2/xfce4-session/xfsm-manager.c
|
||||
@@ -799,7 +799,7 @@ xfsm_manager_save_yourself (XfsmClient *
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (!fast && shutdown && !shutdownDialog (&shutdown_type, &shutdown_save))
|
||||
+ if (!fast && shutdown && !shutdownDialog (&shutdown_save))
|
||||
return;
|
||||
|
||||
if (!shutdown || shutdown_save)
|
||||
Index: xfce4-session-4.3.99.2/xfce4-session/xfsm-shutdown-helper.c
|
||||
===================================================================
|
||||
--- xfce4-session-4.3.99.2.orig/xfce4-session/xfsm-shutdown-helper.c
|
||||
+++ xfce4-session-4.3.99.2/xfce4-session/xfsm-shutdown-helper.c
|
||||
@@ -138,7 +138,17 @@ xfsm_shutdown_helper_hal_check (XfsmShut
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
-
|
||||
+static struct
|
||||
+{
|
||||
+ XfsmShutdownCommand command;
|
||||
+ gchar * name;
|
||||
+} xfsm2hal[] =
|
||||
+{
|
||||
+ { XFSM_REBOOT, "Reboot"},
|
||||
+ { XFSM_SHUTDOWN, "Shutdown"},
|
||||
+ { XFSM_SUSPEND, "Suspend"},
|
||||
+ { XFSM_HIBERNATE, "Hibernate"}
|
||||
+};
|
||||
|
||||
static gboolean
|
||||
xfsm_shutdown_helper_hal_send (XfsmShutdownHelper *helper,
|
||||
@@ -149,6 +159,8 @@ xfsm_shutdown_helper_hal_send (XfsmShutd
|
||||
DBusMessage *message;
|
||||
DBusMessage *result;
|
||||
DBusError error;
|
||||
+ gchar *methodname;
|
||||
+ int i;
|
||||
|
||||
/* initialize the error */
|
||||
dbus_error_init (&error);
|
||||
@@ -163,10 +175,41 @@ xfsm_shutdown_helper_hal_send (XfsmShutd
|
||||
}
|
||||
|
||||
/* send the appropriate message to HAL, telling it to shutdown or reboot the system */
|
||||
- message = dbus_message_new_method_call ("org.freedesktop.Hal",
|
||||
- "/org/freedesktop/Hal/devices/computer",
|
||||
- "org.freedesktop.Hal.Device.SystemPowerManagement",
|
||||
- (command == XFSM_SHUTDOWN_REBOOT) ? "Reboot" : "Shutdown");
|
||||
+ switch (command)
|
||||
+ {
|
||||
+ case XFSM_REBOOT:
|
||||
+ message = dbus_message_new_method_call ("org.freedesktop.Hal",
|
||||
+ "/org/freedesktop/Hal/devices/computer",
|
||||
+ "org.freedesktop.Hal.Device.SystemPowerManagement",
|
||||
+ "Reboot");
|
||||
+ break;
|
||||
+
|
||||
+ case XFSM_SHUTDOWN:
|
||||
+ message = dbus_message_new_method_call ("org.freedesktop.Hal",
|
||||
+ "/org/freedesktop/Hal/devices/computer",
|
||||
+ "org.freedesktop.Hal.Device.SystemPowerManagement",
|
||||
+ "Shutdown");
|
||||
+ break;
|
||||
+
|
||||
+ case XFSM_SUSPEND:
|
||||
+ {
|
||||
+ dbus_int32_t wakeup = 0;
|
||||
+ message = dbus_message_new_method_call ("org.freedesktop.Hal",
|
||||
+ "/org/freedesktop/Hal/devices/computer",
|
||||
+ "org.freedesktop.Hal.Device.SystemPowerManagement",
|
||||
+ "Suspend");
|
||||
+ dbus_message_append_args (message, DBUS_TYPE_INT32, &wakeup, DBUS_TYPE_INVALID);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ case XFSM_HIBERNATE:
|
||||
+ message = dbus_message_new_method_call ("org.freedesktop.Hal",
|
||||
+ "/org/freedesktop/Hal/devices/computer",
|
||||
+ "org.freedesktop.Hal.Device.SystemPowerManagement",
|
||||
+ "Hibernate");
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
result = dbus_connection_send_with_reply_and_block (connection, message, 2000, &error);
|
||||
dbus_message_unref (message);
|
||||
|
||||
Index: xfce4-session-4.3.99.2/xfce4-session/xfsm-shutdown-helper.h
|
||||
===================================================================
|
||||
--- xfce4-session-4.3.99.2.orig/xfce4-session/xfsm-shutdown-helper.h
|
||||
+++ xfce4-session-4.3.99.2/xfce4-session/xfsm-shutdown-helper.h
|
||||
@@ -27,8 +27,11 @@
|
||||
|
||||
typedef enum
|
||||
{
|
||||
- XFSM_SHUTDOWN_POWEROFF = 0,
|
||||
- XFSM_SHUTDOWN_REBOOT = 1,
|
||||
+ XFSM_LOGOUT =-1,
|
||||
+ XFSM_SHUTDOWN = 0,
|
||||
+ XFSM_REBOOT = 1,
|
||||
+ XFSM_SUSPEND = 2,
|
||||
+ XFSM_HIBERNATE = 3,
|
||||
} XfsmShutdownCommand;
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6c142405ffe8920220f1e00ea89ed5ab5f8158ba4586ac2a39d267149a03ddec
|
||||
size 1390272
|
3
xfce4-session-4.4.0.tar.bz2
Normal file
3
xfce4-session-4.4.0.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ebaa5c338a2264dbb3fc3c2f51c4f870c660df0141368c47178771d0c0c53be2
|
||||
size 1328917
|
3
xfce4-session-ubuntu-icons.tar.bz2
Normal file
3
xfce4-session-ubuntu-icons.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:30abc35ce2ffdb6b4b8f14ac36ab73ac3f374e3970788396b29bf7ea018c29bf
|
||||
size 18914
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Jan 21 22:31:06 CET 2007 - bwalle@suse.de
|
||||
|
||||
- upgraded to 4.4.0
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 8 14:47:25 CET 2006 - pnemec@suse.cz
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package xfce4-session (Version 4.2.3)
|
||||
# spec file for package xfce4-session (Version 4.4.0)
|
||||
#
|
||||
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# This file and all modifications and additions to the pristine
|
||||
# package are under the same license as the package itself.
|
||||
#
|
||||
@ -11,26 +11,49 @@
|
||||
# norootforbuild
|
||||
|
||||
Name: xfce4-session
|
||||
BuildRequires: gtk2-devel libxml2-devel startup-notification update-desktop-files xfce-mcs-manager xorg-x11
|
||||
BuildRequires: dbus-1-devel gtk2-devel libxml2-devel perl-XML-Parser startup-notification update-desktop-files xorg-x11
|
||||
%if %suse_version > 1010
|
||||
BuildRequires: dbus-1-glib-devel
|
||||
%endif
|
||||
BuildRequires: xfce-mcs-manager-devel >= 4.3
|
||||
Requires: fortune
|
||||
Summary: Xfce Session manager
|
||||
Version: 4.2.3
|
||||
Release: 2
|
||||
License: GPL
|
||||
Version: 4.4.0
|
||||
Release: 1
|
||||
License: GNU General Public License (GPL)
|
||||
URL: http://www.xfce.org/
|
||||
Source0: %{name}-%{version}.tar.bz2
|
||||
Source1: xfce4-session-ubuntu-icons.tar.bz2
|
||||
Patch0: suspend_hibernate.diff
|
||||
Group: System/GUI/Other
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Requires: libxfcegui4 >= 4.2.3
|
||||
Requires: libxfce4mcs >= 4.2.3
|
||||
Requires: xfce-mcs-manager >= 4.2.3
|
||||
Requires: xfwm4 >= 4.2.3
|
||||
Requires: xfce4-desktop >= 4.2.3
|
||||
Requires: xfce4-desktop >= 4.3
|
||||
|
||||
%description
|
||||
xfce4-session is the session manager for the Xfce desktop environment.
|
||||
|
||||
|
||||
|
||||
Authors:
|
||||
--------
|
||||
Benedikt Meurer <benny@xfce.org>
|
||||
Oliver M. Bolzer <oliver@debian.org>
|
||||
Francois Le Clainche <fleclainche@wanadoo.fr>
|
||||
Maarten Boekhold <boekhold@emirates.net.ae>
|
||||
Brian Tarricone <kelnos@xfce.org>
|
||||
|
||||
%package devel
|
||||
Summary: Xfce Session manager
|
||||
Group: System/GUI/Other
|
||||
Requires: %{name} = %{version}
|
||||
Requires: libxfcegui4-devel >= 4.3
|
||||
Requires: libxml2-devel
|
||||
|
||||
%description devel
|
||||
xfce4-session is the session manager for the Xfce desktop environment.
|
||||
|
||||
|
||||
|
||||
Authors:
|
||||
--------
|
||||
Benedikt Meurer <benny@xfce.org>
|
||||
@ -41,6 +64,7 @@ Authors:
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
export CFLAGS="$RPM_OPT_FLAGS"
|
||||
@ -52,10 +76,16 @@ export CFLAGS="$RPM_OPT_FLAGS"
|
||||
--mandir=%{_mandir} \
|
||||
--sysconfdir=%{_sysconfdir} \
|
||||
--enable-session-screenshots
|
||||
make
|
||||
%{__make} %{?jobs:-j%jobs}
|
||||
|
||||
%install
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
mkdir -p $RPM_BUILD_ROOT/%{_datadir}
|
||||
# the icons for the hibernate and standby buttons
|
||||
cd $RPM_BUILD_ROOT/%{_datadir}
|
||||
tar xvfj $RPM_SOURCE_DIR/xfce4-session-ubuntu-icons.tar.bz2
|
||||
cd -
|
||||
rm -f $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/scalable/apps/xfsm-shutdown.svg
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
@ -67,16 +97,28 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_bindir}/*
|
||||
%{_libdir}/xfce4/
|
||||
%{_libdir}/libxfsm-*
|
||||
%{_libdir}/pkgconfig/*
|
||||
%{_datadir}/locale/*/*/*
|
||||
%{_datadir}/man/*/*
|
||||
%{_mandir}/*/*
|
||||
%{_datadir}/themes/*
|
||||
%{_datadir}/applications/*
|
||||
%{_datadir}/icons/*/*
|
||||
%{_datadir}/xfce4/*
|
||||
%{_includedir}/xfce4/*
|
||||
%dir /etc/xdg/autostart
|
||||
/etc/xdg/autostart/xfce4-tips-autostart.desktop
|
||||
|
||||
%post
|
||||
%run_suseconfig -m gtk2
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/pkgconfig/*
|
||||
%dir %{_includedir}/xfce4/xfce4-session-4.2
|
||||
%{_includedir}/xfce4/*/*
|
||||
%{_datadir}/icons/*/*/*
|
||||
|
||||
%changelog -n xfce4-session
|
||||
* Sun Jan 21 2007 - bwalle@suse.de
|
||||
- upgraded to 4.4.0
|
||||
* Wed Feb 08 2006 - pnemec@suse.cz
|
||||
- added xfce4-desktop and xfwm to requires
|
||||
* Wed Jan 25 2006 - mls@suse.de
|
||||
|
Loading…
Reference in New Issue
Block a user