OBS User unknown 2009-03-08 23:31:39 +00:00 committed by Git OBS Bridge
parent 677116666c
commit 2d582abdc0
10 changed files with 355 additions and 770 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fa23d0e079ea3bf1b7f0e056adc6e28df04581632207face4f851269d92bffdd
size 1276089

View File

@ -0,0 +1,291 @@
--- xfce4-tips/data/Makefile.am
+++ xfce4-tips/data/Makefile.am
@@ -1,10 +1,5 @@
tipsdir = $(datadir)/xfce4/tips
-tips_DATA = \
- tips \
- tips.dat
-
-tips.dat: $(srcdir)/tips
- strfile $(srcdir)/tips tips.dat
+tips_DATA = tips
EXTRA_DIST = $(tips_DATA)
--- xfce4-tips/main.c
+++ xfce4-tips/main.c
@@ -43,7 +43,8 @@
-static const gchar *titles[] = {
+static const gchar *titles[] =
+{
N_("Tips and Tricks"),
N_("Fortunes")
};
@@ -52,8 +53,65 @@
static GtkWidget *dlg = NULL;
static guint option = OPTION_TIPS;
+static gchar *fortune_cmd = NULL;
+static GPtrArray *tips = NULL;
+
+
+static void
+read_tips_from_file (void)
+{
+ gchar *data;
+ gchar *entry;
+ gsize len;
+ guint i, j;
+ GError *error = NULL;
+
+ /* read the whole file */
+ g_file_get_contents (TIPSDIR "/tips", &data, &len, &error);
+
+ tips = g_ptr_array_new ();
+ if (error != NULL)
+ {
+ g_ptr_array_add (tips, g_strdup_printf (_("Could not load tips database (%s)."),
+ error->message));
+ g_free (data);
+ g_error_free (error);
+ return;
+ }
+
+ entry = g_malloc (len + 1);
+ i = j = 0;
+ while (data[i])
+ {
+ if (data[i] == '%')
+ {
+ /* add a new tip */
+ entry[j] = '\0';
+ j = 0;
+ if (entry[0])
+ g_ptr_array_add (tips, g_strdup(entry));
+ /* skip the following line break character(s) */
+ if (data[i] == '\r' && (i + 1) < len && data[i + 1] == '\n')
+ i += 2;
+ else
+ i += 1;
+ }
+ else
+ entry[j++] = data[i];
+
+ i++;
+ }
+ g_free (data);
+ g_free (entry);
+}
+static void
+free_tip (gpointer data, gpointer user_data)
+{
+ g_free (data);
+}
+
static gboolean
autostart_enabled (void)
@@ -95,47 +153,93 @@
item_cb (GtkWidget *btn,
gpointer data)
{
- option = GPOINTER_TO_UINT(data);
+ option = GPOINTER_TO_UINT (data);
gtk_window_set_title (GTK_WINDOW (dlg), _(titles[option]));
}
+static gchar*
+run_fortune (void)
+{
+ GError *error = NULL;
+ gchar *out = NULL;
+ gchar *err = NULL;
+ gchar *buffer = NULL;
+
+ if (fortune_cmd != NULL && g_spawn_command_line_sync (fortune_cmd, &out, &err, NULL, &error))
+ {
+ if (out != NULL && *out != '\0')
+ {
+ /* check output for valid UTF-8 */
+ if (g_utf8_validate (out, -1, NULL))
+ buffer = out;
+ else
+ {
+ /* we got something else than UTF-8, try to convert it from the user's locale */
+ buffer = g_locale_to_utf8 (out, -1, NULL, NULL, NULL);
+ if (buffer == NULL)
+ {
+ /* converting it from the user's locale failed too, we give up */
+ buffer = g_strdup_printf (_("Invalid output of fortune."));
+ }
+ }
+ }
+ else
+ {
+ buffer = g_strdup_printf (_("Executing fortune failed (%s)"), err);
+ }
+ if (buffer != out)
+ g_free (out);
+ g_free(err);
+ }
+ else
+ {
+ buffer = g_strdup_printf (_("Executing fortune failed (%s)"), error->message);
+ g_error_free (error);
+ }
+
+ return buffer;
+}
+
+
+
static void
next_cb(GtkWidget *btn, GtkTextBuffer *textbuf)
{
- gchar buffer[1024];
+ gchar *buffer = NULL;
GtkTextIter start;
GtkTextIter end;
- FILE *fp;
/* clear the text buffer */
- gtk_text_buffer_get_bounds(textbuf, &start, &end);
- gtk_text_buffer_delete(textbuf, &start, &end);
+ gtk_text_buffer_get_bounds (textbuf, &start, &end);
+ gtk_text_buffer_delete (textbuf, &start, &end);
- switch (option) {
- case OPTION_TIPS:
- strcpy(buffer, "fortune " TIPSDIR "/tips");
- break;
-
- case OPTION_FORTUNES:
- strcpy(buffer, "fortune");
- break;
- }
-
- if ((fp = popen(buffer, "r")) == NULL) {
- perror("Unable to execute fortune");
- return;
- }
-
- while (fgets(buffer, sizeof(buffer), fp) != NULL) {
- gtk_text_buffer_get_end_iter(textbuf, &end);
- gtk_text_buffer_insert(textbuf, &end, buffer, -1);
- }
+ switch (option)
+ {
+ case OPTION_TIPS:
+ {
+ if (! tips || tips->len == 0)
+ buffer = _("Error while loading tips.");
+ else
+ /* no need to check or convert the encoding of our own tips file as it is already UTF-8 */
+ buffer = g_ptr_array_index (tips, g_random_int_range(0, tips->len));
+ break;
+ }
+ case OPTION_FORTUNES:
+ {
+ buffer = run_fortune ();
+ break;
+ }
+ }
- pclose (fp);
-}
+ /* add the text to the buffer */
+ gtk_text_buffer_get_end_iter (textbuf, &end);
+ gtk_text_buffer_insert (textbuf, &end, buffer, -1);
+ if (option == OPTION_FORTUNES)
+ g_free (buffer);
+}
int
@@ -152,9 +256,14 @@
GtkWidget *close;
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
-
+
gtk_init (&argc, &argv);
+ /* test for fortune */
+ fortune_cmd = g_find_program_in_path ("fortune");
+
+ read_tips_from_file ();
+
/* fake a SM client id, so the session manager does not restart us */
gdk_set_sm_client_id ("FAKED CLIENTID");
@@ -193,25 +302,28 @@
gtk_box_pack_start (GTK_BOX (vbox2), check, FALSE, FALSE, 0);
gtk_widget_show (check);
- menu = gtk_menu_new ();
- gtk_widget_show (menu);
-
- item = gtk_menu_item_new_with_label (_("Tips and tricks"));
- g_signal_connect (item, "activate", G_CALLBACK (item_cb), GUINT_TO_POINTER (OPTION_TIPS));
- g_signal_connect (item, "activate", G_CALLBACK (next_cb), gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
-
- item = gtk_menu_item_new_with_label (_("Fortunes"));
- g_signal_connect (item, "activate", G_CALLBACK (item_cb), GUINT_TO_POINTER (OPTION_FORTUNES));
- g_signal_connect (item, "activate", G_CALLBACK (next_cb), gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
-
- opt = gtk_option_menu_new();
- gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu);
- gtk_dialog_add_action_widget (GTK_DIALOG (dlg), opt, GTK_RESPONSE_NONE);
- gtk_widget_show(opt);
+ if (fortune_cmd != NULL)
+ {
+ menu = gtk_menu_new ();
+ gtk_widget_show (menu);
+
+ item = gtk_menu_item_new_with_label (titles[OPTION_TIPS]);
+ g_signal_connect (item, "activate", G_CALLBACK (item_cb), GUINT_TO_POINTER (OPTION_TIPS));
+ g_signal_connect (item, "activate", G_CALLBACK (next_cb), gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ gtk_widget_show (item);
+
+ item = gtk_menu_item_new_with_label (titles[OPTION_FORTUNES]);
+ g_signal_connect (item, "activate", G_CALLBACK (item_cb), GUINT_TO_POINTER (OPTION_FORTUNES));
+ g_signal_connect (item, "activate", G_CALLBACK (next_cb), gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ gtk_widget_show (item);
+
+ opt = gtk_option_menu_new();
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu);
+ gtk_dialog_add_action_widget (GTK_DIALOG (dlg), opt, GTK_RESPONSE_NONE);
+ gtk_widget_show(opt);
+ }
next = gtk_button_new_with_label (_("Next"));
gtk_dialog_add_action_widget (GTK_DIALOG (dlg), next, GTK_RESPONSE_NONE);
@@ -232,5 +344,14 @@
gtk_main ();
+
+ /* cleanup */
+ g_free (fortune_cmd);
+ if (tips != NULL)
+ {
+ g_ptr_array_foreach (tips, free_tip, NULL);
+ g_ptr_array_free (tips, TRUE);
+ }
+
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:950ccf85c743f40b88d3431caa3279627153b04ce7b9bf5e4ddd1f9431de4517
size 1362667

View File

@ -1,11 +0,0 @@
--- xfce4-autostart-editor/xfae-model.c
+++ xfce4-autostart-editor/xfae-model.c
@@ -490,7 +490,7 @@
xfce_rc_close (rc);
/* check if we should skip the item */
- if (G_UNLIKELY (skip))
+ if (G_UNLIKELY (skip) && item)
{
xfae_item_free (item);
item = NULL;

View File

@ -1,90 +0,0 @@
--- configure
+++ configure
@@ -26560,7 +26560,7 @@
if test x"$xdt_cv_DBUS_check" = x"yes"; then
- if $PKG_CONFIG --exists "dbus-1 >= 0.34" >/dev/null 2>&1; then
+ if $PKG_CONFIG --exists "dbus-glib-1 >= 0.34" >/dev/null 2>&1; then
# minimum supported version of pkg-config
@@ -26644,22 +26644,22 @@
fi
- { $as_echo "$as_me:$LINENO: checking for dbus-1 >= 0.34" >&5
-$as_echo_n "checking for dbus-1 >= 0.34... " >&6; }
- if $PKG_CONFIG "--atleast-version=0.34" "dbus-1" >/dev/null 2>&1; then
- DBUS_VERSION=`$PKG_CONFIG --modversion "dbus-1"`
+ { $as_echo "$as_me:$LINENO: checking for dbus-glib-1 >= 0.34" >&5
+$as_echo_n "checking for dbus-glib-1 >= 0.34... " >&6; }
+ if $PKG_CONFIG "--atleast-version=0.34" "dbus-glib-1" >/dev/null 2>&1; then
+ DBUS_VERSION=`$PKG_CONFIG --modversion "dbus-glib-1"`
{ $as_echo "$as_me:$LINENO: result: $DBUS_VERSION" >&5
$as_echo "$DBUS_VERSION" >&6; }
{ $as_echo "$as_me:$LINENO: checking DBUS_CFLAGS" >&5
$as_echo_n "checking DBUS_CFLAGS... " >&6; }
- DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-1"`
+ DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-glib-1"`
{ $as_echo "$as_me:$LINENO: result: $DBUS_CFLAGS" >&5
$as_echo "$DBUS_CFLAGS" >&6; }
{ $as_echo "$as_me:$LINENO: checking DBUS_LIBS" >&5
$as_echo_n "checking DBUS_LIBS... " >&6; }
- DBUS_LIBS=`$PKG_CONFIG --libs "dbus-1"`
+ DBUS_LIBS=`$PKG_CONFIG --libs "dbus-glib-1"`
{ $as_echo "$as_me:$LINENO: result: $DBUS_LIBS" >&5
$as_echo "$DBUS_LIBS" >&6; }
@@ -26678,15 +26678,15 @@
DBUS_FOUND="yes"
- elif $PKG_CONFIG --exists "dbus-1" >/dev/null 2>&1; then
- xdt_cv_version=`$PKG_CONFIG --modversion "dbus-1"`
+ elif $PKG_CONFIG --exists "dbus-glib-1" >/dev/null 2>&1; then
+ xdt_cv_version=`$PKG_CONFIG --modversion "dbus-glib-1"`
{ $as_echo "$as_me:$LINENO: result: found, but $xdt_cv_version" >&5
$as_echo "found, but $xdt_cv_version" >&6; }
- echo "*** The required package dbus-1 was found on your system,"
+ echo "*** The required package dbus-glib-1 was found on your system,"
echo "*** but the installed version ($xdt_cv_version) is too old."
- echo "*** Please upgrade dbus-1 to atleast version 0.34, or adjust"
+ echo "*** Please upgrade dbus-glib-1 to atleast version 0.34, or adjust"
echo "*** the PKG_CONFIG_PATH environment variable if you installed"
echo "*** the new version of the package in a nonstandard prefix so"
echo "*** pkg-config is able to find it."
@@ -26697,8 +26697,8 @@
$as_echo "not found" >&6; }
- echo "*** The required package dbus-1 was not found on your system."
- echo "*** Please install dbus-1 (atleast version 0.34) or adjust"
+ echo "*** The required package dbus-glib-1 was not found on your system."
+ echo "*** Please install dbus-glib-1 (atleast version 0.34) or adjust"
echo "*** the PKG_CONFIG_PATH environment variable if you"
echo "*** installed the package in a nonstandard prefix so that"
echo "*** pkg-config is able to find it."
@@ -26707,14 +26707,14 @@
fi
else
- { $as_echo "$as_me:$LINENO: checking for optional package dbus-1 >= 0.34" >&5
-$as_echo_n "checking for optional package dbus-1 >= 0.34... " >&6; }
+ { $as_echo "$as_me:$LINENO: checking for optional package dbus-glib-1 >= 0.34" >&5
+$as_echo_n "checking for optional package dbus-glib-1 >= 0.34... " >&6; }
{ $as_echo "$as_me:$LINENO: result: not found" >&5
$as_echo "not found" >&6; }
fi
else
- { $as_echo "$as_me:$LINENO: checking for optional package dbus-1" >&5
-$as_echo_n "checking for optional package dbus-1... " >&6; }
+ { $as_echo "$as_me:$LINENO: checking for optional package dbus-glib-1" >&5
+$as_echo_n "checking for optional package dbus-glib-1... " >&6; }
{ $as_echo "$as_me:$LINENO: result: disabled" >&5
$as_echo "disabled" >&6; }
fi

View File

@ -1,24 +0,0 @@
--- xfce4-session/xfsm-manager.c
+++ xfce4-session/xfsm-manager.c
@@ -454,7 +454,9 @@
return;
}
- startup_done = xfsm_startup_continue (previous_id);
+ startup_done = FALSE;
+ while (!startup_done)
+ startup_done = xfsm_startup_continue (previous_id);
if (startup_done)
{
--- xfce4-session/xfsm-startup.c
+++ xfce4-session/xfsm-startup.c
@@ -374,7 +374,7 @@
terminal = xfce_rc_read_bool_entry (rc, "Terminal", FALSE);
/* try to launch the command */
- if (!xfce_exec (exec, terminal, startup_notify, &error))
+ if (!xfce_exec (exec, terminal, 0, &error))
{
g_warning ("Unable to launch \"%s\" (specified by %s): %s", exec, files[n], error->message);
g_error_free (error);

View File

@ -1,595 +0,0 @@
--- settings/session/session.c
+++ 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,14 @@ 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);
@@ -181,6 +189,29 @@ general_create (XfceRc *rc)
"depends on whether you enabled the automatic "
"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;
}
--- xfce4-session/main.c
+++ 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 ();
}
--- xfce4-session/shutdown.c
+++ 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;
-
- gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK);
-}
+ gchar * label;
+ gchar * icon;
+ gint cmd;
+ gboolean present;
+ GtkWidget * button;
+};
+
+struct LogoutButton logout_buttons [] = {
+ { N_("Switch user"), "xfsm-switch", XFSM_SWITCH, TRUE },
+ { 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},
+};
-/*
- */
gboolean
-shutdownDialog(gint *shutdownType, gboolean *saveSession)
+shutdownDialog(gboolean *saveSession)
{
gboolean accessibility;
XfsmFadeout *fadeout = NULL;
@@ -145,7 +147,9 @@ shutdownDialog(gint *shutdownType, gbool
GtkWidget *dialog;
GtkWidget *label;
GtkWidget *dbox;
+ GtkWidget *rbox;
GtkWidget *hbox;
+ GtkWidget *hbox2;
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *image;
@@ -154,14 +158,14 @@ shutdownDialog(gint *shutdownType, gbool
GtkWidget *entry;
GtkWidget *hidden;
GtkWidget *logout_button;
- GtkWidget *reboot_button;
- GtkWidget *halt_button;
GtkWidget *cancel_button;
GtkWidget *ok_button;
GdkPixbuf *icon;
gboolean saveonexit;
gboolean autosave;
gboolean prompt;
+ gboolean have_suspend;
+ gboolean have_hibernate;
gint monitor;
gint result;
XfceKiosk *kiosk;
@@ -173,9 +177,8 @@ 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)
@@ -195,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;
@@ -311,76 +316,43 @@ 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);
+ hbox2 = gtk_hbox_new (TRUE, BORDER);
+ gtk_widget_show (hbox2);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
+ logout_buttons[4].present = have_suspend;
+ logout_buttons[5].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);
+ rbox = i > G_N_ELEMENTS (logout_buttons)/2 - 1 ? hbox2 : hbox;
+ gtk_box_pack_start (GTK_BOX (rbox), 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)
{
@@ -406,8 +378,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 = 2; 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 */
@@ -437,7 +410,9 @@ 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
+ && shutdownType != XFSM_SWITCH
&& xfsm_shutdown_helper_need_password (shutdown_helper))
{
gtk_widget_show (ok_button);
@@ -533,6 +508,21 @@ 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;
+ }
+
+ if (result == GTK_RESPONSE_OK && shutdownType == XFSM_SWITCH) {
+ g_spawn_command_line_sync ("gdmflexiserver --startnew", NULL, NULL, NULL, NULL);
+ return FALSE;
+ }
+
/* process all pending events first */
while (gtk_events_pending ())
g_main_context_iteration (NULL, FALSE);
@@ -571,7 +561,7 @@ shutdownDialog(gint *shutdownType, gbool
/*
*/
gint
-xfsm_shutdown(gint type)
+xfsm_shutdown(void)
{
gboolean result;
@@ -589,7 +579,7 @@ xfsm_shutdown(gint type)
sync ();
#endif
- if (type == SHUTDOWN_LOGOUT)
+ if (shutdownType == XFSM_LOGOUT)
return EXIT_SUCCESS;
if (shutdown_helper == NULL)
@@ -598,16 +588,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;
--- xfce4-session/shutdown.h
+++ 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__ */
--- xfce4-session/xfsm-global.c
+++ 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
--- xfce4-session/xfsm-global.h
+++ 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;
--- xfce4-session/xfsm-manager.c
+++ xfce4-session/xfsm-manager.c
@@ -801,7 +801,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)
--- xfce4-session/xfsm-shutdown-helper.c
+++ xfce4-session/xfsm-shutdown-helper.c
@@ -55,6 +55,12 @@
#ifdef HAVE_DBUS
#include <dbus/dbus.h>
+#define HAL_DBUS_SERVICE "org.freedesktop.Hal"
+#define HAL_ROOT_COMPUTER "/org/freedesktop/Hal/devices/computer"
+#define HAL_DBUS_INTERFACE_DEVICE "org.freedesktop.Hal.Device"
+#define HAL_DBUS_INTERFACE_POWER "org.freedesktop.Hal.Device.SystemPowerManagement"
+#define HAL_PM_CAN_SUSPEND "power_management.can_suspend_to_ram"
+#define HAL_PM_CAN_HIBERNATE "power_management.can_suspend_to_disk"
#endif
#include <libxfce4util/libxfce4util.h>
@@ -74,6 +80,17 @@ struct _XfsmShutdownHelper
};
+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_check (XfsmShutdownHelper *helper)
@@ -100,9 +117,9 @@ xfsm_shutdown_helper_hal_check (XfsmShut
* use the org.freedesktop.Hal.Device.SystemPowerManagement
* interface without shutting down/rebooting now.
*/
- message = dbus_message_new_method_call ("org.freedesktop.Hal",
- "/org/freedesktop/Hal/devices/computer",
- "org.freedesktop.Hal.Device.SystemPowerManagement",
+ message = dbus_message_new_method_call (HAL_DBUS_SERVICE,
+ HAL_ROOT_COMPUTER,
+ HAL_DBUS_INTERFACE_POWER,
"ThisMethodMustNotExistInHal");
result = dbus_connection_send_with_reply_and_block (connection, message, 2000, &error);
dbus_message_unref (message);
@@ -145,42 +162,45 @@ xfsm_shutdown_helper_hal_send (XfsmShutd
XfsmShutdownCommand command)
{
#ifdef HAVE_DBUS
- DBusConnection *connection;
- DBusMessage *message;
- DBusMessage *result;
- DBusError error;
-
- /* initialize the error */
- dbus_error_init (&error);
-
- /* connect to the system message bus */
- connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
- if (G_UNLIKELY (connection == NULL))
- {
- g_warning (G_STRLOC ": Failed to connect to the system message bus: %s", error.message);
- dbus_error_free (&error);
- return FALSE;
- }
-
- /* 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");
- result = dbus_connection_send_with_reply_and_block (connection, message, 2000, &error);
- dbus_message_unref (message);
-
- /* check if we received a result */
- if (G_UNLIKELY (result == NULL))
- {
- g_warning (G_STRLOC ": Failed to contact HAL: %s", error.message);
- dbus_error_free (&error);
- return FALSE;
- }
-
- /* pretend that we succeed */
- dbus_message_unref (result);
- return TRUE;
+ DBusConnection *connection;
+ DBusMessage *method;
+ DBusMessage *result;
+ DBusError derror;
+ gint i;
+ gchar *methodname;
+ dbus_int32_t wakeup = 0;
+
+ for (i = 0; i < G_N_ELEMENTS (xfsm2hal); i++) {
+ if ( xfsm2hal[i].command == command ) {
+ methodname = xfsm2hal[i].name;
+ }
+ }
+
+ dbus_error_init(&derror);
+
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, &derror);
+
+ if (connection == NULL)
+ return FALSE;
+
+ method = dbus_message_new_method_call(HAL_DBUS_SERVICE,
+ HAL_ROOT_COMPUTER,
+ HAL_DBUS_INTERFACE_POWER,
+ methodname);
+
+ if (command == XFSM_SUSPEND) {
+ dbus_message_append_args (method, DBUS_TYPE_INT32, &wakeup, DBUS_TYPE_INVALID);
+ }
+
+ result = dbus_connection_send_with_reply_and_block(connection, method, 2000, &derror);
+
+ dbus_message_unref(method);
+
+ if (result == NULL)
+ return FALSE;
+
+ dbus_message_unref(result);
+ return TRUE;
#else
return FALSE;
#endif
--- xfce4-session/xfsm-shutdown-helper.h
+++ xfce4-session/xfsm-shutdown-helper.h
@@ -27,8 +27,12 @@
typedef enum
{
- XFSM_SHUTDOWN_POWEROFF = 0,
- XFSM_SHUTDOWN_REBOOT = 1,
+ XFSM_SWITCH =-2,
+ XFSM_LOGOUT =-1,
+ XFSM_SHUTDOWN = 0,
+ XFSM_REBOOT = 1,
+ XFSM_SUSPEND = 2,
+ XFSM_HIBERNATE = 3,
} XfsmShutdownCommand;

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:44a4512636c18d672332ed9e1b70df5b16d3da15cfb0e9420c3fd84626cc0e61
size 27931

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Mar 2 16:10:39 CET 2009 - prusnak@suse.cz
- xfce4-tips prints tips without calling fortune (tips-no-fortune.patch)
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jan 28 15:02:30 CET 2009 - crrodriguez@suse.de Wed Jan 28 15:02:30 CET 2009 - crrodriguez@suse.de

View File

@ -1,5 +1,5 @@
# #
# spec file for package xfce4-session (Version 4.4.3) # spec file for package xfce4-session (Version 4.6.0)
# #
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
@ -19,25 +19,20 @@
Name: xfce4-session Name: xfce4-session
BuildRequires: dbus-1-devel gtk2-devel libxml2-devel perl-XML-Parser startup-notification update-desktop-files xorg-x11
%if 0%{?suse_version} > 1010
BuildRequires: dbus-1-glib-devel
%endif
BuildRequires: intltool xfce-mcs-manager-devel >= 4.3
Requires: fortune
Summary: Xfce Session manager Summary: Xfce Session manager
Version: 4.4.3 Version: 4.6.0
Release: 3 Release: 2
License: GPL v2 or later License: GPL v2 or later
Url: http://www.xfce.org/ Url: http://www.xfce.org/
Source0: %{name}-%{version}.tar.bz2 Source: %{name}-%{version}.tar.bz2
Source1: %{name}-ubuntu-icons.tar.bz2 Patch0: %{name}-%{version}-tips-no-fortune.patch
Patch0: %{name}-logout-dialog.patch
Patch1: %{name}-faster-start.patch
Patch2: %{name}-autostart-editor-crash.patch
Patch3: %{name}-configure.patch
Group: System/GUI/XFCE Group: System/GUI/XFCE
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libwnck-devel libxfce4util-devel libxfcegui4-devel
BuildRequires: dbus-1-glib-devel hal-devel libxfconf-devel
BuildRequires: intltool perl-XML-Parser update-desktop-files xorg-x11
Requires: %{name}-branding >= %{version}
Recommends: fortune
%description %description
xfce4-session is the session manager for the Xfce desktop environment. xfce4-session is the session manager for the Xfce desktop environment.
@ -57,14 +52,35 @@ License: GPL v2 or later
Summary: Xfce Session manager Summary: Xfce Session manager
Group: System/GUI/XFCE Group: System/GUI/XFCE
Requires: %{name} = %{version} Requires: %{name} = %{version}
Requires: libxfcegui4-devel >= 4.3 Requires: libxfce4util-devel libxfcegui4-devel libwnck-devel
Requires: libxml2-devel Requires: dbus-1-glib-devel hal-devel libxfconf-devel
%description devel %description devel
xfce4-session is the session manager for the Xfce desktop environment. 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 branding-upstream
License: GPL v2 or later
Summary: Xfce Session manager
Group: System/GUI/XFCE
Provides: %{name}-branding = %{version}
Conflicts: otherproviders(%{name}-branding)
Supplements: packageand(%{name}:branding-upstream)
%description branding-upstream
xfce4-session is the session manager for the Xfce desktop environment.
Authors: Authors:
-------- --------
Benedikt Meurer <benny@xfce.org> Benedikt Meurer <benny@xfce.org>
@ -76,28 +92,17 @@ Authors:
%prep %prep
%setup -q %setup -q
%patch0 %patch0
%patch1
%patch2
%build %build
%configure --disable-static --with-pic \ %configure \
--disable-static \
--enable-session-screenshots --enable-session-screenshots
make %{?jobs:-j%jobs} make %{?jobs:-j%jobs}
%suse_update_desktop_file -i xfce-splash-settings X-XFCE Settings DesktopSettings
%suse_update_desktop_file -i xfce-session-settings X-XFCE Settings DesktopSettings
%suse_update_desktop_file -i xfce4-autostart-editor X-XFCE Settings DesktopSettings
%suse_update_desktop_file -i xfce4-tips-autostart X-XFCE Settings DesktopSettings
%install %install
make DESTDIR=$RPM_BUILD_ROOT install make DESTDIR=$RPM_BUILD_ROOT install
%find_lang %{name} %find_lang %{name}
mkdir -p $RPM_BUILD_ROOT/%{_datadir} rm -f $RPM_BUILD_ROOT%{_libdir}/*.la $RPM_BUILD_ROOT%{_libdir}/xfce4/splash/engines/*.la
# 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
%{__rm} -f %{buildroot}%{_libdir}/*.la
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
@ -105,36 +110,43 @@ rm -rf $RPM_BUILD_ROOT
%files -f %name.lang %files -f %name.lang
%defattr(-,root,root) %defattr(-,root,root)
%doc AUTHORS BUGS COPYING ChangeLog ChangeLog.pre-xfce-devel NEWS README TODO %doc AUTHORS BUGS COPYING ChangeLog ChangeLog.pre-xfce-devel NEWS README TODO
%{_sysconfdir}/xdg/xfce4-session/
%{_bindir}/* %{_bindir}/*
%{_libdir}/xfce4/ %{_libdir}/xfce4
%{_libdir}/libxfsm-* %{_libdir}/*.so.*
%{_mandir}/*/* %{_mandir}/*/*
%{_datadir}/themes/* %{_datadir}/themes/*
%{_datadir}/applications/* %{_datadir}/applications/*
%{_datadir}/icons/*/* %{_datadir}/icons/*/*
%dir %{_datadir}/xfce4
%{_datadir}/xfce4/* %{_datadir}/xfce4/*
%{_libexecdir}/balou-export-theme %{_libexecdir}/balou-export-theme
%{_libexecdir}/balou-install-theme %{_libexecdir}/balou-install-theme
%{_libexecdir}/xfsm-shutdown-helper %{_libexecdir}/xfsm-shutdown-helper
%if 0%{?suse_version} && 0%{?suse_version} < 1030
%dir %{_sysconfdir}/xdg/autostart
%endif
%{_sysconfdir}/xdg/autostart/xfce4-tips-autostart.desktop %{_sysconfdir}/xdg/autostart/xfce4-tips-autostart.desktop
%post
/sbin/ldconfig
%run_suseconfig -m gtk2
%postun -p /sbin/ldconfig %postun -p /sbin/ldconfig
%post
%run_suseconfig -m gtk2
/sbin/ldconfig
%files devel %files devel
%defattr(-,root,root) %defattr(-,root,root)
%{_libdir}/pkgconfig/* %dir %{_includedir}/xfce4/*
%dir %{_includedir}/xfce4/xfce4-session-4.2
%{_includedir}/xfce4/*/* %{_includedir}/xfce4/*/*
%{_libdir}/pkgconfig/*
%{_libdir}/*.so
%files branding-upstream
%defattr(-,root,root)
%dir %{_sysconfdir}/xdg/xfce4
%dir %{_sysconfdir}/xdg/xfce4/xfconf
%dir %{_sysconfdir}/xdg/xfce4/xfconf/xfce-perchannel-xml
%{_sysconfdir}/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml
%changelog %changelog
* Mon Mar 02 2009 prusnak@suse.cz
- xfce4-tips prints tips without calling fortune (tips-no-fortune.patch)
* Wed Jan 28 2009 crrodriguez@suse.de * Wed Jan 28 2009 crrodriguez@suse.de
- remove static libraries and "la" files - remove static libraries and "la" files
* Tue Nov 18 2008 pnemec@suse.cz * Tue Nov 18 2008 pnemec@suse.cz