Browse Source

gnome-session package update

Signed-off-by: guibuilder_pel7x64builder0 <guibuilder@powerel.org>
master
guibuilder_pel7x64builder0 6 years ago
parent
commit
e0bb63662d
  1. 2851
      SOURCES/0001-Revert-Remove-all-references-to-gnome-session-proper.patch
  2. 119
      SOURCES/0001-main-don-t-call-into-gdbus-before-setting-all-enviro.patch
  3. 1186
      SOURCES/0001-save-make-sure-app-state-is-written-into-desktop-fil.patch
  4. 4147
      SOURCES/0002-Revert-Remove-gnome-session-properties.patch
  5. 96
      SOURCES/0002-autostart-ensure-gnome-shell-and-mutter-get-right-au.patch
  6. 195
      SOURCES/0003-Revert-Rename-the-desktop-file-to-gnome-session-prop.patch
  7. 441
      SOURCES/0004-stop-using-gsm_util_get_current_desktop.patch
  8. 34
      SOURCES/0005-session-properties-get-out-of-Other.patch
  9. 377
      SOURCES/0006-session-properties-refresh-from-recent-glade.patch
  10. 81
      SOURCES/0007-manager-Don-t-clear-saved-session-if-autosaving-is-d.patch
  11. 1724
      SOURCES/0008-Add-Remember-Currently-Running-Applications-button.patch
  12. 272
      SOURCES/0009-Revert-Allow-saved-session-to-be-a-symlink.patch
  13. 191
      SOURCES/0010-Allow-saved-session-directory-to-be-a-symlink.patch
  14. 1162
      SOURCES/0011-Tie-session-selector-to-properties-dialog.patch
  15. 429
      SOURCES/0012-make-save-session-stall-until-it-finishes.patch
  16. 662
      SOURCES/0013-manager-save-session-type-in-session-dir.patch
  17. 42
      SOURCES/0014-session-selector-restore-saved-session-mode.patch
  18. 269
      SOURCES/0015-session-selector-refresh-from-recent-glade.patch
  19. 604
      SOURCES/0016-session-selector-add-toggle-for-classic-normal-selec.patch
  20. 79
      SOURCES/0017-session-selector-use-classic-mode-by-default.patch
  21. 756
      SOURCES/0018-manager-port-away-from-dbus-glib-to-GDBus.patch
  22. 91
      SOURCES/0019-capplet-fix-disable-check-items.patch
  23. 52
      SOURCES/gnome-session-3.3.92-nv30.patch
  24. 56
      SOURCES/gnome-session-3.6.2-swrast.patch
  25. 1397
      SPECS/gnome-session.spec

2851
SOURCES/0001-Revert-Remove-all-references-to-gnome-session-proper.patch

File diff suppressed because it is too large Load Diff

119
SOURCES/0001-main-don-t-call-into-gdbus-before-setting-all-enviro.patch

@ -0,0 +1,119 @@ @@ -0,0 +1,119 @@
From 2c0087930a188684e61e71d5b5459e4363471196 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 14 Feb 2018 09:50:56 -0500
Subject: [PATCH] main: don't call into gdbus before setting all environment
variables

setenv () is not multi-thread safe so we need to avoid gsm_util_setenv
calls (which fire off the glib worker thread) before we finish
doing all our setenv() work.
---
gnome-session/main.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gnome-session/main.c b/gnome-session/main.c
index e2c3efe..e7a1614 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -244,91 +244,96 @@ initialize_gio (void)
disable_fuse = g_strdup (g_getenv ("GVFS_DISABLE_FUSE"));
use_vfs = g_strdup (g_getenv ("GIO_USE_VFS"));
g_setenv ("GVFS_DISABLE_FUSE", "1", TRUE);
g_setenv ("GIO_USE_VFS", "local", TRUE);
g_vfs_get_default ();
if (use_vfs) {
g_setenv ("GIO_USE_VFS", use_vfs, TRUE);
g_free (use_vfs);
} else {
g_unsetenv ("GIO_USE_VFS");
}
if (disable_fuse) {
g_setenv ("GVFS_DISABLE_FUSE", disable_fuse, TRUE);
g_free (disable_fuse);
} else {
g_unsetenv ("GVFS_DISABLE_FUSE");
}
}
int
main (int argc, char **argv)
{
GError *error = NULL;
static char **override_autostart_dirs = NULL;
static char *opt_session_name = NULL;
const char *debug_string = NULL;
gboolean gl_failed = FALSE;
+ gboolean needs_current_desktop_setenv = FALSE;
guint name_owner_id;
GOptionContext *options;
static GOptionEntry entries[] = {
{ "autostart", 'a', 0, G_OPTION_ARG_STRING_ARRAY, &override_autostart_dirs, N_("Override standard autostart directories"), N_("AUTOSTART_DIR") },
{ "session", 0, 0, G_OPTION_ARG_STRING, &opt_session_name, N_("Session to use"), N_("SESSION_NAME") },
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
{ "failsafe", 'f', 0, G_OPTION_ARG_NONE, &failsafe, N_("Do not load user-specified applications"), NULL },
{ "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL },
/* Translators: the 'fail whale' is the black dialog we show when something goes seriously wrong */
{ "whale", 0, 0, G_OPTION_ARG_NONE, &please_fail, N_("Show the fail whale dialog for testing"), NULL },
{ "disable-acceleration-check", 0, 0, G_OPTION_ARG_NONE, &disable_acceleration_check, N_("Disable hardware acceleration check"), NULL },
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
/* Make sure that we have a session bus */
if (!require_dbus_session (argc, argv, &error)) {
gsm_util_init_error (TRUE, "%s", error->message);
}
/* From 3.14 GDM sets XDG_CURRENT_DESKTOP. For compatibility with
* older versions of GDM, other display managers, and startx,
* set a fallback value if we don't find it set.
*/
if (g_getenv ("XDG_CURRENT_DESKTOP") == NULL) {
- g_setenv("XDG_CURRENT_DESKTOP", "GNOME", TRUE);
- gsm_util_setenv ("XDG_CURRENT_DESKTOP", "GNOME");
+ g_setenv ("XDG_CURRENT_DESKTOP", "GNOME", TRUE);
+ needs_current_desktop_setenv = TRUE;
}
/* Make sure we initialize gio in a way that does not autostart any daemon */
initialize_gio ();
+ if (needs_current_desktop_setenv) {
+ gsm_util_setenv ("XDG_CURRENT_DESKTOP", "GNOME");
+ }
+
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
debug_string = g_getenv ("GNOME_SESSION_DEBUG");
if (debug_string != NULL) {
debug = rpmatch (debug_string) == TRUE || atoi (debug_string) == 1;
}
error = NULL;
options = g_option_context_new (_(" — the GNOME session manager"));
g_option_context_add_main_entries (options, entries, GETTEXT_PACKAGE);
g_option_context_parse (options, &argc, &argv, &error);
if (error != NULL) {
g_warning ("%s", error->message);
exit (1);
}
g_option_context_free (options);
/* Rebind stdout/stderr to the journal explicitly, so that
* journald picks ups the nicer "gnome-session" as the program
* name instead of whatever shell script GDM happened to use.
*/
#ifdef HAVE_SYSTEMD
if (!debug) {
int journalfd;
journalfd = sd_journal_stream_fd (PACKAGE, LOG_INFO, 0);
--
2.14.3

1186
SOURCES/0001-save-make-sure-app-state-is-written-into-desktop-fil.patch

File diff suppressed because it is too large Load Diff

4147
SOURCES/0002-Revert-Remove-gnome-session-properties.patch

File diff suppressed because it is too large Load Diff

96
SOURCES/0002-autostart-ensure-gnome-shell-and-mutter-get-right-au.patch

@ -0,0 +1,96 @@ @@ -0,0 +1,96 @@
From 622e54d54c65eba7c5d8e4172f8aae8a970126f9 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 18 Jan 2018 10:09:36 -0500
Subject: [PATCH 2/2] autostart: ensure gnome-shell and mutter get right
autostart phase

Previous versions of gnome-shell neglected to save the autostart phases
for required components in the session state. While that is now fixed,
users may still have old saved state that lack the autostart phase.

In order to ease upgrades, this commit manually adds in the phases that
are important for a functioning GNOME desktop.
---
gnome-session/gsm-autostart-app.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gnome-session/gsm-autostart-app.c b/gnome-session/gsm-autostart-app.c
index 9eb1db5b..5617e549 100644
--- a/gnome-session/gsm-autostart-app.c
+++ b/gnome-session/gsm-autostart-app.c
@@ -621,61 +621,71 @@ load_desktop_file (GsmAutostartApp *app)
char *startup_id;
char *phase_str;
int phase;
gboolean res;
g_assert (app->priv->app_info != NULL);
phase_str = g_desktop_app_info_get_string (app->priv->app_info,
GSM_AUTOSTART_APP_PHASE_KEY);
if (phase_str != NULL) {
if (strcmp (phase_str, "EarlyInitialization") == 0) {
phase = GSM_MANAGER_PHASE_EARLY_INITIALIZATION;
} else if (strcmp (phase_str, "PreDisplayServer") == 0) {
phase = GSM_MANAGER_PHASE_PRE_DISPLAY_SERVER;
} else if (strcmp (phase_str, "DisplayServer") == 0) {
phase = GSM_MANAGER_PHASE_DISPLAY_SERVER;
} else if (strcmp (phase_str, "Initialization") == 0) {
phase = GSM_MANAGER_PHASE_INITIALIZATION;
} else if (strcmp (phase_str, "WindowManager") == 0) {
phase = GSM_MANAGER_PHASE_WINDOW_MANAGER;
} else if (strcmp (phase_str, "Panel") == 0) {
phase = GSM_MANAGER_PHASE_PANEL;
} else if (strcmp (phase_str, "Desktop") == 0) {
phase = GSM_MANAGER_PHASE_DESKTOP;
} else {
phase = GSM_MANAGER_PHASE_APPLICATION;
}
g_free (phase_str);
} else {
- phase = GSM_MANAGER_PHASE_APPLICATION;
+ const char *app_id;
+
+ app_id = g_app_info_get_id (G_APP_INFO (app->priv->app_info));
+
+ /* These hardcoded checks are to keep upgrades working */
+ if (app_id != NULL && g_str_has_prefix (app_id, "org.gnome.Shell"))
+ phase = GSM_MANAGER_PHASE_DISPLAY_SERVER;
+ else if (app_id != NULL && g_str_has_prefix (app_id, "org.gnome.SettingsDaemon"))
+ phase = GSM_MANAGER_PHASE_INITIALIZATION;
+ else
+ phase = GSM_MANAGER_PHASE_APPLICATION;
}
dbus_name = g_desktop_app_info_get_string (app->priv->app_info,
GSM_AUTOSTART_APP_DBUS_NAME_KEY);
if (dbus_name != NULL) {
app->priv->launch_type = AUTOSTART_LAUNCH_ACTIVATE;
} else {
app->priv->launch_type = AUTOSTART_LAUNCH_SPAWN;
}
/* this must only be done on first load */
switch (app->priv->launch_type) {
case AUTOSTART_LAUNCH_SPAWN:
startup_id =
g_desktop_app_info_get_string (app->priv->app_info,
GSM_AUTOSTART_APP_STARTUP_ID_KEY);
if (startup_id == NULL) {
startup_id = gsm_util_generate_startup_id ();
}
break;
case AUTOSTART_LAUNCH_ACTIVATE:
startup_id = g_strdup (dbus_name);
break;
default:
g_assert_not_reached ();
}
res = g_desktop_app_info_has_key (app->priv->app_info,
GSM_AUTOSTART_APP_AUTORESTART_KEY);
--
2.14.3

195
SOURCES/0003-Revert-Rename-the-desktop-file-to-gnome-session-prop.patch

@ -0,0 +1,195 @@ @@ -0,0 +1,195 @@
From 808e1598dc50484f62998b4a9e94e956f028d362 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 8 May 2015 16:27:15 -0400
Subject: [PATCH 03/19] Revert "Rename the desktop file to
gnome-session-properties.desktop"

This reverts commit ac9fd0dc97a17674cb082f80df0b1fcc45bc92bf.
---
configure.ac | 2 +-
data/Makefile.am | 2 +-
...ession-properties.desktop.in.in => session-properties.desktop.in.in} | 0
po/POTFILES.in | 1 +
po/POTFILES.skip | 1 +
5 files changed, 4 insertions(+), 2 deletions(-)
rename data/{gnome-session-properties.desktop.in.in => session-properties.desktop.in.in} (100%)

diff --git a/configure.ac b/configure.ac
index b3f285ed..5182c09e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -343,61 +343,61 @@ if test $enable_ipv6 = yes; then
dnl =================================================================
dnl Now we would check for specific function like getaddrinfo.
dnl =================================================================
have_getaddrinfo=no
if test $have_ipv6=yes; then
AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
if test $have_getaddrinfo != yes; then
# getaddrinfo is not in the default libraries. See if it's in some other.
for lib in bsd socket inet; do
AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes; break])
done
fi
if test $have_getaddrinfo=yes; then
AC_DEFINE(ENABLE_IPV6, 1, [Define if IPV6 is supported])
have_full_ipv6=yes
fi
fi
fi
dnl ==============================================================================
dnl End of IPv6 checks
dnl ==============================================================================
AC_CONFIG_FILES([
Makefile
capplet/Makefile
doc/Makefile
doc/dbus/Makefile
doc/dbus/gnome-session.xml
doc/man/Makefile
data/Makefile
-data/gnome-session-properties.desktop.in
+data/session-properties.desktop.in
data/org.gnome.SessionManager.gschema.xml
data/icons/Makefile
data/icons/16x16/Makefile
data/icons/22x22/Makefile
data/icons/24x24/Makefile
data/icons/32x32/Makefile
data/icons/48x48/Makefile
data/icons/scalable/Makefile
data/icons/symbolic/Makefile
gnome-session/Makefile
tools/Makefile
po/Makefile.in
])
AC_OUTPUT
dnl ---------------------------------------------------------------------------
dnl - Show summary
dnl ---------------------------------------------------------------------------
echo "
gnome-session $VERSION
`echo gnome-session $VERSION | sed "s/./=/g"`
prefix: ${prefix}
exec_prefix: ${exec_prefix}
libdir: ${libdir}
bindir: ${bindir}
sbindir: ${sbindir}
sysconfdir: ${sysconfdir}
localstatedir: ${localstatedir}
diff --git a/data/Makefile.am b/data/Makefile.am
index b5c3f5ec..0bb25c06 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,58 +1,58 @@
SUBDIRS = icons
uidir = $(pkgdatadir)
ui_DATA = \
session-properties.ui
if BUILD_SESSION_SELECTOR
ui_DATA += session-selector.ui
endif
hwcompatdir = $(pkgdatadir)
hwcompat_DATA = hardware-compatibility
xsessiondir = $(datadir)/xsessions
xsession_in_files = gnome.desktop.in gnome-xorg.desktop.in
if BUILD_SESSION_SELECTOR
xsession_in_files += gnome-custom-session.desktop.in
endif
xsession_DATA = $(xsession_in_files:.desktop.in=.desktop)
wayland_sessiondir = $(datadir)/wayland-sessions
wayland_session_in_files = gnome.desktop.in
wayland_session_DATA = $(wayland_session_in_files:.desktop.in=.desktop)
desktopdir = $(datadir)/applications
-desktop_in_files = gnome-session-properties.desktop.in
+desktop_in_files = session-properties.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
sessiondir = $(datadir)/gnome-session/sessions
session_in_in_files = gnome.session.desktop.in.in gnome-dummy.session.desktop.in.in
session_in_files = $(session_in_in_files:.session.desktop.in.in=.session.desktop.in)
session_DATA = $(session_in_files:.session.desktop.in=.session)
%.session.desktop.in: %.session.desktop.in.in Makefile
$(AM_V_GEN)sed \
-e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
$< > $@
%.session: %.session.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
@INTLTOOL_DESKTOP_RULE@
@INTLTOOL_XML_NOMERGE_RULE@
gsettings_SCHEMAS = org.gnome.SessionManager.gschema.xml
@GSETTINGS_RULES@
migrationdir = $(datadir)/GConf/gsettings
dist_migration_DATA = gnome-session.convert
EXTRA_DIST = \
$(xsession_in_files) \
$(session_in_in_files) \
$(wayland_session_in_files) \
$(gsettings_SCHEMAS:.xml=.xml.in) \
session-selector.ui \
gnome-custom-session.desktop.in \
diff --git a/data/gnome-session-properties.desktop.in.in b/data/session-properties.desktop.in.in
similarity index 100%
rename from data/gnome-session-properties.desktop.in.in
rename to data/session-properties.desktop.in.in
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5cb5123d..08d2eb06 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,24 +1,25 @@
# List of source files containing translatable strings.
# Please keep this file sorted alphabetically.
capplet/gsm-app-dialog.c
capplet/gsm-properties-dialog.c
capplet/gsp-app.c
capplet/main.c
data/gnome-custom-session.desktop.in
data/gnome.desktop.in
data/gnome-xorg.desktop.in
data/gnome-dummy.session.desktop.in.in
data/gnome.session.desktop.in.in
data/gnome-session-properties.desktop.in.in
[type: gettext/glade]data/session-selector.ui
+data/session-properties.desktop.in.in
[type: gettext/glade]data/session-properties.ui
gnome-session/gsm-fail-whale-dialog.c
gnome-session/gsm-manager.c
gnome-session/gsm-process-helper.c
gnome-session/gsm-util.c
gnome-session/gsm-xsmp-client.c
gnome-session/gsm-xsmp-server.c
gnome-session/main.c
tools/gnome-session-inhibit.c
tools/gnome-session-selector.c
tools/gnome-session-quit.c
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 91b41569..e6470914 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,5 +1,6 @@
# List of source files containing translatable strings that should not be
# translated.
# Please keep this file sorted alphabetically.
data/gnome-dummy.session.desktop.in
data/gnome.session.desktop.in
+data/session-properties.desktop.in
--
2.14.2

441
SOURCES/0004-stop-using-gsm_util_get_current_desktop.patch

@ -0,0 +1,441 @@ @@ -0,0 +1,441 @@
From 2a087ede1b20e8dcac1c37c0b280f9bf6be7c93b Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 13 May 2015 10:56:09 -0400
Subject: [PATCH 04/19] stop using gsm_util_get_current_desktop

It no longer exists.
---
capplet/gsp-app.c | 111 +++++++++++++++++++++++++++++-------------------------
1 file changed, 60 insertions(+), 51 deletions(-)

diff --git a/capplet/gsp-app.c b/capplet/gsp-app.c
index c92b8dad..123ab217 100644
--- a/capplet/gsp-app.c
+++ b/capplet/gsp-app.c
@@ -3,60 +3,61 @@
* Copyright (C) 1999 Free Software Foundation, Inc.
* Copyright (C) 2007, 2009 Vincent Untz.
* Copyright (C) 2008 Lucas Rocha.
* Copyright (C) 2008 William Jon McCann <jmccann@redhat.com>
*
* 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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <sys/stat.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
+#include <gio/gdesktopappinfo.h>
#include "gsm-app-dialog.h"
#include "gsm-properties-dialog.h"
#include "gsm-util.h"
#include "gsp-app-manager.h"
#include "gsp-keyfile.h"
#include "gsp-app.h"
#define GSP_APP_SAVE_DELAY 2
#define GSP_ASP_SAVE_MASK_HIDDEN 0x0001
#define GSP_ASP_SAVE_MASK_ENABLED 0x0002
#define GSP_ASP_SAVE_MASK_NAME 0x0004
#define GSP_ASP_SAVE_MASK_EXEC 0x0008
#define GSP_ASP_SAVE_MASK_COMMENT 0x0010
#define GSP_ASP_SAVE_MASK_NO_DISPLAY 0x0020
#define GSP_ASP_SAVE_MASK_ALL 0xffff
struct _GspAppPrivate {
char *basename;
char *path;
gboolean hidden;
gboolean no_display;
gboolean enabled;
gboolean shown;
char *name;
char *exec;
@@ -281,148 +282,145 @@ _gsp_app_update_description (GspApp *app)
} else {
secondary = _("No description");
}
g_free (app->priv->description);
app->priv->description = g_markup_printf_escaped ("<b>%s</b>\n%s",
primary,
secondary);
}
/*
* Saving
*/
static void
_gsp_ensure_user_autostart_dir (void)
{
char *dir;
dir = g_build_filename (g_get_user_config_dir (), "autostart", NULL);
g_mkdir_with_parents (dir, S_IRWXU);
g_free (dir);
}
static gboolean
_gsp_app_user_equal_system (GspApp *app,
char **system_path)
{
GspAppManager *manager;
- const char *system_dir;
- char *path;
- char *str;
- GKeyFile *keyfile;
+ gboolean return_value = FALSE;
+ const char *system_dir = NULL;
+ char *path = NULL;
+ char *str = NULL;
+ GKeyFile *keyfile = NULL;
+ GDesktopAppInfo *app_info = NULL;
manager = gsp_app_manager_get ();
system_dir = gsp_app_manager_get_dir (manager,
app->priv->xdg_system_position);
g_object_unref (manager);
if (!system_dir) {
- return FALSE;
+ goto out;
}
path = g_build_filename (system_dir, app->priv->basename, NULL);
keyfile = g_key_file_new ();
if (!g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, NULL)) {
- g_free (path);
- g_key_file_free (keyfile);
- return FALSE;
+ goto out;
}
- if (gsp_key_file_get_boolean (keyfile,
- G_KEY_FILE_DESKTOP_KEY_HIDDEN,
- FALSE) != app->priv->hidden ||
- gsp_key_file_get_boolean (keyfile,
- GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED,
- TRUE) != app->priv->enabled ||
- gsp_key_file_get_shown (keyfile,
- gsm_util_get_current_desktop ()) != app->priv->shown) {
- g_free (path);
- g_key_file_free (keyfile);
- return FALSE;
+ app_info = g_desktop_app_info_new_from_keyfile (keyfile);
+
+ if (!app_info) {
+ goto out;
}
- if (gsp_key_file_get_boolean (keyfile,
- G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY,
- FALSE) != app->priv->no_display) {
- g_free (path);
- g_key_file_free (keyfile);
- return FALSE;
+ if (g_desktop_app_info_get_is_hidden (app_info)) {
+ goto out;
+ }
+
+ if (g_desktop_app_info_has_key (app_info,
+ GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED) &&
+ !g_desktop_app_info_get_boolean (app_info,
+ GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED)) {
+ goto out;
+ }
+
+ if (!g_desktop_app_info_get_show_in (app_info, NULL)) {
+ goto out;
+ }
+
+ if (g_desktop_app_info_get_nodisplay (app_info)) {
+ goto out;
}
str = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_NAME);
if (!_gsp_str_equal (str, app->priv->name)) {
- g_free (str);
- g_free (path);
- g_key_file_free (keyfile);
- return FALSE;
+ goto out;
}
- g_free (str);
+ g_clear_pointer (&str, g_free);
str = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_COMMENT);
if (!_gsp_str_equal (str, app->priv->comment)) {
- g_free (str);
- g_free (path);
- g_key_file_free (keyfile);
- return FALSE;
+ goto out;
}
- g_free (str);
+ g_clear_pointer (&str, g_free);
str = gsp_key_file_get_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_EXEC);
if (!_gsp_str_equal (str, app->priv->exec)) {
- g_free (str);
- g_free (path);
- g_key_file_free (keyfile);
- return FALSE;
+ goto out;
}
- g_free (str);
+ g_clear_pointer (&str, g_free);
str = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_ICON);
if (!_gsp_str_equal (str, app->priv->icon)) {
- g_free (str);
- g_free (path);
- g_key_file_free (keyfile);
- return FALSE;
+ goto out;
}
- g_free (str);
-
- g_key_file_free (keyfile);
+ g_clear_pointer (&str, g_free);
*system_path = path;
-
- return TRUE;
+ path = NULL;
+ return_value = TRUE;
+out:
+ g_clear_pointer (&path, g_free);
+ g_clear_pointer (&str, g_free);
+ g_clear_object (&app_info);
+ g_clear_pointer (&keyfile, g_key_file_free);
+
+ return return_value;
}
static inline void
_gsp_app_save_done_success (GspApp *app)
{
app->priv->save_mask = 0;
if (app->priv->old_system_path) {
g_free (app->priv->old_system_path);
app->priv->old_system_path = NULL;
}
}
static gboolean
_gsp_app_save (gpointer data)
{
GspApp *app;
char *use_path;
GKeyFile *keyfile;
GError *error;
app = GSP_APP (data);
/* first check if removing the data from the user dir and using the
* data from the system dir is enough -- this helps us keep clean the
* user config dir by removing unneeded files */
if (_gsp_app_user_equal_system (app, &use_path)) {
if (g_file_test (app->priv->path, G_FILE_TEST_EXISTS)) {
g_remove (app->priv->path);
}
@@ -748,153 +746,164 @@ gsp_app_delete (GspApp *app)
app->priv->hidden = TRUE;
app->priv->save_mask |= GSP_ASP_SAVE_MASK_HIDDEN;
_gsp_app_queue_save (app);
_gsp_app_emit_changed (app);
}
}
/*
* New autostart app
*/
void
gsp_app_reload_at (GspApp *app,
const char *path,
unsigned int xdg_position)
{
g_return_if_fail (GSP_IS_APP (app));
app->priv->xdg_position = G_MAXUINT;
gsp_app_new (path, xdg_position);
}
GspApp *
gsp_app_new (const char *path,
unsigned int xdg_position)
{
GspAppManager *manager;
GspApp *app;
GKeyFile *keyfile;
+ GDesktopAppInfo *app_info;
char *basename;
gboolean new;
basename = g_path_get_basename (path);
manager = gsp_app_manager_get ();
app = gsp_app_manager_find_app_with_basename (manager, basename);
g_object_unref (manager);
new = (app == NULL);
if (!new) {
if (app->priv->xdg_position == xdg_position) {
if (app->priv->skip_next_monitor_event) {
app->priv->skip_next_monitor_event = FALSE;
return NULL;
}
/* else: the file got changed but not by us, we'll
* update our data from disk */
}
if (app->priv->xdg_position < xdg_position ||
app->priv->save_timeout != 0) {
/* we don't really care about this file, since we
* already have something with a higher priority, or
* we're going to write something in the user config
* anyway.
* Note: xdg_position >= 1 so it's a system dir */
app->priv->xdg_system_position = MIN (xdg_position,
app->priv->xdg_system_position);
return NULL;
}
}
keyfile = g_key_file_new ();
if (!g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, NULL)) {
g_key_file_free (keyfile);
g_free (basename);
return NULL;
}
+ app_info = g_desktop_app_info_new_from_keyfile (keyfile);
+
+ if (!app_info) {
+ g_object_unref (app_info);
+ g_key_file_free (keyfile);
+ g_free (basename);
+ return NULL;
+ }
+
if (new) {
app = g_object_new (GSP_TYPE_APP, NULL);
app->priv->basename = basename;
} else {
g_free (basename);
_gsp_app_free_reusable_data (app);
}
+
app->priv->path = g_strdup (path);
app->priv->hidden = gsp_key_file_get_boolean (keyfile,
G_KEY_FILE_DESKTOP_KEY_HIDDEN,
FALSE);
app->priv->no_display = gsp_key_file_get_boolean (keyfile,
G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY,
FALSE);
app->priv->enabled = gsp_key_file_get_boolean (keyfile,
GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED,
TRUE);
- app->priv->shown = gsp_key_file_get_shown (keyfile,
- gsm_util_get_current_desktop ());
+ app->priv->shown = g_desktop_app_info_get_show_in (app_info, NULL);
app->priv->name = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_NAME);
app->priv->exec = gsp_key_file_get_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_EXEC);
app->priv->comment = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_COMMENT);
if (gsm_util_text_is_blank (app->priv->name)) {
g_free (app->priv->name);
app->priv->name = g_strdup (app->priv->exec);
}
app->priv->icon = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_ICON);
if (app->priv->icon) {
/* look at icon and see if it's a themed icon or not */
if (g_path_is_absolute (app->priv->icon)) {
GFile *iconfile;
iconfile = g_file_new_for_path (app->priv->icon);
app->priv->gicon = g_file_icon_new (iconfile);
g_object_unref (iconfile);
} else {
app->priv->gicon = g_themed_icon_new (app->priv->icon);
}
} else {
app->priv->gicon = NULL;
}
+ g_object_unref (app_info);
g_key_file_free (keyfile);
_gsp_app_update_description (app);
if (xdg_position > 0) {
g_assert (xdg_position <= app->priv->xdg_system_position);
app->priv->xdg_system_position = xdg_position;
}
/* else we keep the old value (which is G_MAXUINT if it wasn't set) */
app->priv->xdg_position = xdg_position;
g_assert (!new || app->priv->save_timeout == 0);
app->priv->save_timeout = 0;
app->priv->old_system_path = NULL;
app->priv->skip_next_monitor_event = FALSE;
if (!new) {
_gsp_app_emit_changed (app);
}
return app;
}
static char *
_gsp_find_free_basename (const char *suggested_basename)
{
GspAppManager *manager;
char *base_path;
char *filename;
char *basename;
--
2.14.2

34
SOURCES/0005-session-properties-get-out-of-Other.patch

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
From 119ac97cea3b362e53aaa236f643f9bb916a03cb Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 20 Dec 2013 15:07:35 -0500
Subject: [PATCH 05/19] session-properties: get out of Other

Put it in the menus next to Settings and Software
---
data/session-properties.desktop.in.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/session-properties.desktop.in.in b/data/session-properties.desktop.in.in
index 3dc7b033..dcfe2f84 100644
--- a/data/session-properties.desktop.in.in
+++ b/data/session-properties.desktop.in.in
@@ -1,15 +1,15 @@
[Desktop Entry]
_Name=Startup Applications
_Comment=Choose what applications to start when you log in
Exec=gnome-session-properties
Icon=session-properties
Terminal=false
Type=Application
StartupNotify=true
-Categories=GTK;GNOME;Settings;X-GNOME-PersonalSettings;
+Categories=GNOME;GTK;System;
OnlyShowIn=GNOME;Unity;
NoDisplay=true
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-session
X-GNOME-Bugzilla-Component=gnome-session-properties
X-GNOME-Bugzilla-Version=@VERSION@
--
2.14.2

377
SOURCES/0006-session-properties-refresh-from-recent-glade.patch

@ -0,0 +1,377 @@ @@ -0,0 +1,377 @@
From 805c9f995da83c173f9323f55a3f26b627410553 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 20 Dec 2013 10:53:33 -0500
Subject: [PATCH 06/19] session-properties: refresh from recent glade

The ui file is rather old. This commit just opens it up in a recent
glade and resaves it, so we have a fresh starting point to make
changes.
---
data/session-properties.ui | 43 ++++++++++++++++++++++++++++++++++---------
1 file changed, 34 insertions(+), 9 deletions(-)

diff --git a/data/session-properties.ui b/data/session-properties.ui
index 1f0cb9a5..47a30f78 100644
--- a/data/session-properties.ui
+++ b/data/session-properties.ui
@@ -1,323 +1,348 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy toplevel-contextual -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkNotebook" id="main-notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="border_width">6</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">12</property>
- <property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xpad">3</property>
<property name="ypad">3</property>
<property name="label" translatable="yes">Additional startup _programs:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">session_properties_treeview</property>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
- <property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">etched-in</property>
<child>
<object class="GtkTreeView" id="session_properties_treeview">
<property name="height_request">210</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
+ </child>
</object>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVButtonBox" id="vbuttonbox1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="session_properties_add_button">
<property name="label">gtk-add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="session_properties_delete_button">
<property name="label">gtk-remove</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="session_properties_edit_button">
<property name="label">gtk-edit</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">Startup Programs</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">12</property>
- <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="session_properties_remember_toggle">
<property name="label" translatable="yes">_Automatically remember running applications when logging out</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkButton" id="session_properties_save_button">
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">4</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="stock">gtk-save</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">_Remember Currently Running Applications</property>
<property name="use_underline">True</property>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">Options</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<object class="GtkTable" id="main-table">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkEntry" id="session_properties_command_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">&#x25CF;</property>
+ <property name="invisible_char">●</property>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="session_properties_browse_button">
<property name="label" translatable="yes">Browse…</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="session_properties_comment_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">&#x25CF;</property>
+ <property name="invisible_char">●</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="session_properties_name_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">&#x25CF;</property>
+ <property name="invisible_char">●</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Comm_ent:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">label2</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Co_mmand:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">session_properties_command_entry</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">session_properties_name_entry</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</object>
</interface>
--
2.14.2

81
SOURCES/0007-manager-Don-t-clear-saved-session-if-autosaving-is-d.patch

@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
From eb9b29eeb55c47d691b65b046e31ede815e3d22c Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 20 Dec 2013 16:14:16 -0500
Subject: [PATCH 07/19] manager: Don't clear saved session if autosaving is
disabled

Now that we support on-demand saving again, we need to make sure
we don't wipe that away at log out.
---
gnome-session/gsm-manager.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index bdba38e8..e2fad3b1 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -1828,61 +1828,60 @@ on_xsmp_client_register_confirmed (GsmXSMPClient *client,
app = find_app_for_startup_id (manager, id);
if (app != NULL) {
gsm_app_set_registered (app, TRUE);
}
}
static gboolean
auto_save_is_enabled (GsmManager *manager)
{
return g_settings_get_boolean (manager->priv->settings, KEY_AUTOSAVE_ONE_SHOT)
|| g_settings_get_boolean (manager->priv->settings, KEY_AUTOSAVE);
}
static void
maybe_save_session (GsmManager *manager)
{
GError *error;
if (gsm_system_is_login_session (manager->priv->system))
return;
/* We only allow session saving when session is running or when
* logging out */
if (manager->priv->phase != GSM_MANAGER_PHASE_RUNNING &&
manager->priv->phase != GSM_MANAGER_PHASE_END_SESSION) {
return;
}
if (!auto_save_is_enabled (manager)) {
- gsm_session_save_clear ();
return;
}
error = NULL;
gsm_session_save (manager->priv->clients, &error);
if (error) {
g_warning ("Error saving session: %s", error->message);
g_error_free (error);
}
}
static void
_handle_client_end_session_response (GsmManager *manager,
GsmClient *client,
gboolean is_ok,
gboolean do_last,
gboolean cancel,
const char *reason)
{
/* just ignore if received outside of shutdown */
if (manager->priv->phase < GSM_MANAGER_PHASE_QUERY_END_SESSION) {
return;
}
g_debug ("GsmManager: Response from end session request: is-ok=%d do-last=%d cancel=%d reason=%s", is_ok, do_last, cancel, reason ? reason :"");
if (cancel) {
cancel_end_session (manager);
return;
--
2.14.2

1724
SOURCES/0008-Add-Remember-Currently-Running-Applications-button.patch

File diff suppressed because it is too large Load Diff

272
SOURCES/0009-Revert-Allow-saved-session-to-be-a-symlink.patch

@ -0,0 +1,272 @@ @@ -0,0 +1,272 @@
From abf8b3509a0debaf124669d9626a6d9883a1a0d3 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 20 Dec 2013 11:22:07 -0500
Subject: [PATCH 09/19] Revert "Allow saved-session to be a symlink"

This reverts commit b733c2ee519b65c3c4eab0d0e93056412f995f3f.
---
gnome-session/gsm-session-save.c | 32 ++++++++++++++++++++++++++++----
gnome-session/gsm-util.c | 6 ++++++
2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/gnome-session/gsm-session-save.c b/gnome-session/gsm-session-save.c
index d6000e09..eebc5ff1 100644
--- a/gnome-session/gsm-session-save.c
+++ b/gnome-session/gsm-session-save.c
@@ -9,61 +9,61 @@
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <gio/gio.h>
#include "gsm-util.h"
#include "gsm-autostart-app.h"
#include "gsm-client.h"
#include "gsm-session-save.h"
#define GSM_MANAGER_SCHEMA "org.gnome.SessionManager"
#define KEY_AUTOSAVE_ONE_SHOT "auto-save-session-one-shot"
static gboolean gsm_session_clear_saved_session (const char *directory,
GHashTable *discard_hash);
typedef struct {
- const char *dir;
+ char *dir;
GHashTable *discard_hash;
GError **error;
} SessionSaveData;
static gboolean
save_one_client (char *id,
GObject *object,
SessionSaveData *data)
{
GsmClient *client;
GKeyFile *keyfile;
const char *app_id;
char *path = NULL;
char *filename = NULL;
char *contents = NULL;
gsize length = 0;
char *discard_exec;
GError *local_error;
client = GSM_CLIENT (object);
local_error = NULL;
keyfile = gsm_client_save (client, &local_error);
if (keyfile == NULL || local_error) {
goto out;
}
contents = g_key_file_to_data (keyfile, &length, &local_error);
@@ -112,89 +112,113 @@ save_one_client (char *id,
}
g_debug ("GsmSessionSave: saved client %s to %s", id, filename);
out:
if (keyfile != NULL) {
g_key_file_free (keyfile);
}
g_free (contents);
g_free (filename);
g_free (path);
/* in case of any error, stop saving session */
if (local_error) {
g_propagate_error (data->error, local_error);
g_error_free (local_error);
return TRUE;
}
return FALSE;
}
void
gsm_session_save (GsmStore *client_store,
GError **error)
{
GSettings *settings;
const char *save_dir;
+ char *tmp_dir;
SessionSaveData data;
g_debug ("GsmSessionSave: Saving session");
/* Clear one shot key autosave in the event its set (so that it's actually
* one shot only)
*/
settings = g_settings_new (GSM_MANAGER_SCHEMA);
g_settings_set_boolean (settings, KEY_AUTOSAVE_ONE_SHOT, FALSE);
g_object_unref (settings);
save_dir = gsm_util_get_saved_session_dir ();
if (save_dir == NULL) {
g_warning ("GsmSessionSave: cannot create saved session directory");
return;
}
- data.dir = save_dir;
+ tmp_dir = gsm_util_get_empty_tmp_session_dir ();
+ if (tmp_dir == NULL) {
+ g_warning ("GsmSessionSave: cannot create new saved session directory");
+ return;
+ }
+
+ /* save the session in a temp directory, and remember the discard
+ * commands */
+ data.dir = tmp_dir;
data.discard_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
- /* remove old saved session */
- gsm_session_clear_saved_session (save_dir, data.discard_hash);
data.error = error;
gsm_store_foreach (client_store,
(GsmStoreFunc) save_one_client,
&data);
+ if (!*error) {
+ /* remove the old saved session */
+ gsm_session_clear_saved_session (save_dir, data.discard_hash);
+
+ /* rename the temp session dir */
+ if (g_file_test (save_dir, G_FILE_TEST_IS_DIR))
+ g_rmdir (save_dir);
+ g_rename (tmp_dir, save_dir);
+ } else {
+ g_warning ("GsmSessionSave: error saving session: %s", (*error)->message);
+ /* FIXME: we should create a hash table filled with the discard
+ * commands that are in desktop files from save_dir. */
+ gsm_session_clear_saved_session (tmp_dir, NULL);
+ g_rmdir (tmp_dir);
+ }
+
g_hash_table_destroy (data.discard_hash);
+ g_free (tmp_dir);
}
static gboolean
gsm_session_clear_one_client (const char *filename,
GHashTable *discard_hash)
{
gboolean result = TRUE;
GKeyFile *key_file;
char *discard_exec = NULL;
char **envp;
g_debug ("GsmSessionSave: removing '%s' from saved session", filename);
envp = (char **) gsm_util_listenv ();
key_file = g_key_file_new ();
if (g_key_file_load_from_file (key_file, filename,
G_KEY_FILE_NONE, NULL)) {
char **argv;
int argc;
discard_exec = g_key_file_get_string (key_file,
G_KEY_FILE_DESKTOP_GROUP,
GSM_AUTOSTART_APP_DISCARD_KEY,
NULL);
if (!discard_exec)
goto out;
if (discard_hash && g_hash_table_lookup (discard_hash, discard_exec))
goto out;
diff --git a/gnome-session/gsm-util.c b/gnome-session/gsm-util.c
index 4772c6e6..30edb577 100644
--- a/gnome-session/gsm-util.c
+++ b/gnome-session/gsm-util.c
@@ -71,63 +71,69 @@ gsm_util_find_desktop_file_for_app_name (const char *name,
g_debug ("GsmUtil: found in XDG dirs: '%s'", app_path);
}
/* look for gnome vendor prefix */
if (app_path == NULL) {
g_free (desktop_file);
desktop_file = g_strdup_printf ("gnome-%s.desktop", name);
g_key_file_load_from_dirs (key_file,
desktop_file,
(const char **) app_dirs,
&app_path,
G_KEY_FILE_NONE,
NULL);
if (app_path != NULL) {
g_debug ("GsmUtil: found in XDG dirs: '%s'", app_path);
}
}
g_free (desktop_file);
g_key_file_free (key_file);
g_strfreev (app_dirs);
return app_path;
}
static gboolean
ensure_dir_exists (const char *dir)
{
+ if (g_file_test (dir, G_FILE_TEST_IS_DIR))
+ return TRUE;
+
if (g_mkdir_with_parents (dir, 0755) == 0)
return TRUE;
+ if (errno == EEXIST)
+ return g_file_test (dir, G_FILE_TEST_IS_DIR);
+
g_warning ("GsmSessionSave: Failed to create directory %s: %s", dir, strerror (errno));
return FALSE;
}
gchar *
gsm_util_get_empty_tmp_session_dir (void)
{
char *tmp;
gboolean exists;
tmp = g_build_filename (g_get_user_config_dir (),
"gnome-session",
"saved-session.new",
NULL);
exists = ensure_dir_exists (tmp);
if (G_UNLIKELY (!exists)) {
g_warning ("GsmSessionSave: could not create directory for saved session: %s", tmp);
g_free (tmp);
return NULL;
} else {
/* make sure it's empty */
GDir *dir;
const char *filename;
dir = g_dir_open (tmp, 0, NULL);
if (dir) {
while ((filename = g_dir_read_name (dir))) {
--
2.14.2

191
SOURCES/0010-Allow-saved-session-directory-to-be-a-symlink.patch

@ -0,0 +1,191 @@ @@ -0,0 +1,191 @@
From 7c05176e0db2b4d00971a5baf940ad075a088c70 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 20 Dec 2013 11:22:53 -0500
Subject: [PATCH 10/19] Allow saved-session directory to be a symlink

This gives us the option of adding a rudimentary session
chooser later.
---
gnome-session/gsm-session-save.c | 36 ++++++++++++++++++++++++++++++------
gnome-session/gsm-util.c | 6 ------
2 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/gnome-session/gsm-session-save.c b/gnome-session/gsm-session-save.c
index eebc5ff1..66914b57 100644
--- a/gnome-session/gsm-session-save.c
+++ b/gnome-session/gsm-session-save.c
@@ -148,67 +148,91 @@ gsm_session_save (GsmStore *client_store,
* one shot only)
*/
settings = g_settings_new (GSM_MANAGER_SCHEMA);
g_settings_set_boolean (settings, KEY_AUTOSAVE_ONE_SHOT, FALSE);
g_object_unref (settings);
save_dir = gsm_util_get_saved_session_dir ();
if (save_dir == NULL) {
g_warning ("GsmSessionSave: cannot create saved session directory");
return;
}
tmp_dir = gsm_util_get_empty_tmp_session_dir ();
if (tmp_dir == NULL) {
g_warning ("GsmSessionSave: cannot create new saved session directory");
return;
}
/* save the session in a temp directory, and remember the discard
* commands */
data.dir = tmp_dir;
data.discard_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
data.error = error;
gsm_store_foreach (client_store,
(GsmStoreFunc) save_one_client,
&data);
if (!*error) {
- /* remove the old saved session */
- gsm_session_clear_saved_session (save_dir, data.discard_hash);
+ char *session_dir;
- /* rename the temp session dir */
- if (g_file_test (save_dir, G_FILE_TEST_IS_DIR))
- g_rmdir (save_dir);
- g_rename (tmp_dir, save_dir);
+ if (g_file_test (save_dir, G_FILE_TEST_IS_SYMLINK))
+ session_dir = g_file_read_link (save_dir, error);
+ else
+ session_dir = g_strdup (save_dir);
+
+ if (session_dir != NULL) {
+
+ char *absolute_session_dir;
+
+ if (g_path_is_absolute (session_dir)) {
+ absolute_session_dir = g_strdup (session_dir);
+ } else {
+ char *parent_dir;
+
+ parent_dir = g_path_get_dirname (save_dir);
+ absolute_session_dir = g_build_filename (parent_dir, session_dir, NULL);
+ g_free (parent_dir);
+ }
+ g_free (session_dir);
+
+ /* remove the old saved session */
+ gsm_session_clear_saved_session (absolute_session_dir, data.discard_hash);
+
+ if (g_file_test (absolute_session_dir, G_FILE_TEST_IS_DIR))
+ g_rmdir (absolute_session_dir);
+ g_rename (tmp_dir, absolute_session_dir);
+
+ g_free (absolute_session_dir);
+ }
} else {
g_warning ("GsmSessionSave: error saving session: %s", (*error)->message);
/* FIXME: we should create a hash table filled with the discard
* commands that are in desktop files from save_dir. */
gsm_session_clear_saved_session (tmp_dir, NULL);
g_rmdir (tmp_dir);
}
g_hash_table_destroy (data.discard_hash);
g_free (tmp_dir);
}
static gboolean
gsm_session_clear_one_client (const char *filename,
GHashTable *discard_hash)
{
gboolean result = TRUE;
GKeyFile *key_file;
char *discard_exec = NULL;
char **envp;
g_debug ("GsmSessionSave: removing '%s' from saved session", filename);
envp = (char **) gsm_util_listenv ();
key_file = g_key_file_new ();
if (g_key_file_load_from_file (key_file, filename,
G_KEY_FILE_NONE, NULL)) {
char **argv;
int argc;
diff --git a/gnome-session/gsm-util.c b/gnome-session/gsm-util.c
index 30edb577..4772c6e6 100644
--- a/gnome-session/gsm-util.c
+++ b/gnome-session/gsm-util.c
@@ -71,69 +71,63 @@ gsm_util_find_desktop_file_for_app_name (const char *name,
g_debug ("GsmUtil: found in XDG dirs: '%s'", app_path);
}
/* look for gnome vendor prefix */
if (app_path == NULL) {
g_free (desktop_file);
desktop_file = g_strdup_printf ("gnome-%s.desktop", name);
g_key_file_load_from_dirs (key_file,
desktop_file,
(const char **) app_dirs,
&app_path,
G_KEY_FILE_NONE,
NULL);
if (app_path != NULL) {
g_debug ("GsmUtil: found in XDG dirs: '%s'", app_path);
}
}
g_free (desktop_file);
g_key_file_free (key_file);
g_strfreev (app_dirs);
return app_path;
}
static gboolean
ensure_dir_exists (const char *dir)
{
- if (g_file_test (dir, G_FILE_TEST_IS_DIR))
- return TRUE;
-
if (g_mkdir_with_parents (dir, 0755) == 0)
return TRUE;
- if (errno == EEXIST)
- return g_file_test (dir, G_FILE_TEST_IS_DIR);
-
g_warning ("GsmSessionSave: Failed to create directory %s: %s", dir, strerror (errno));
return FALSE;
}
gchar *
gsm_util_get_empty_tmp_session_dir (void)
{
char *tmp;
gboolean exists;
tmp = g_build_filename (g_get_user_config_dir (),
"gnome-session",
"saved-session.new",
NULL);
exists = ensure_dir_exists (tmp);
if (G_UNLIKELY (!exists)) {
g_warning ("GsmSessionSave: could not create directory for saved session: %s", tmp);
g_free (tmp);
return NULL;
} else {
/* make sure it's empty */
GDir *dir;
const char *filename;
dir = g_dir_open (tmp, 0, NULL);
if (dir) {
while ((filename = g_dir_read_name (dir))) {
--
2.14.2

1162
SOURCES/0011-Tie-session-selector-to-properties-dialog.patch

File diff suppressed because it is too large Load Diff

429
SOURCES/0012-make-save-session-stall-until-it-finishes.patch

@ -0,0 +1,429 @@ @@ -0,0 +1,429 @@
From 7553acfe86151ed6bc6649f3e16e2a42c6435930 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 20 Dec 2013 11:32:52 -0500
Subject: [PATCH 12/19] make save-session stall until it finishes

---
gnome-session/gsm-manager.c | 58 ++++++++++++++++++++++++++----
gnome-session/gsm-manager.h | 2 +-
gnome-session/org.gnome.SessionManager.xml | 1 +
3 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index 825a6846..6630aab8 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -113,60 +113,61 @@ typedef enum
GSM_MANAGER_LOGOUT_REBOOT_INTERACT,
GSM_MANAGER_LOGOUT_SHUTDOWN,
GSM_MANAGER_LOGOUT_SHUTDOWN_INTERACT,
} GsmManagerLogoutType;
struct GsmManagerPrivate
{
gboolean failsafe;
GsmStore *clients;
GsmStore *inhibitors;
GsmInhibitorFlag inhibited_actions;
GsmStore *apps;
GsmPresence *presence;
GsmXsmpServer *xsmp_server;
char *session_name;
gboolean is_fallback_session : 1;
/* Current status */
GsmManagerPhase phase;
guint phase_timeout_id;
GSList *required_apps;
GSList *pending_apps;
GsmManagerLogoutMode logout_mode;
GSList *query_clients;
guint query_timeout_id;
/* This is used for GSM_MANAGER_PHASE_END_SESSION only at the moment,
* since it uses a sublist of all running client that replied in a
* specific way */
GSList *next_query_clients;
+ GSList *pending_save_invocations;
/* This is the action that will be done just before we exit */
GsmManagerLogoutType logout_type;
/* List of clients which were disconnected due to disabled condition
* and shouldn't be automatically restarted */
GSList *condition_clients;
GSList *pending_end_session_tasks;
GCancellable *end_session_cancellable;
GSettings *settings;
GSettings *session_settings;
GSettings *screensaver_settings;
GSettings *lockdown_settings;
GsmSystem *system;
GDBusConnection *connection;
GsmExportedManager *skeleton;
gboolean dbus_disconnected : 1;
GsmShell *shell;
guint shell_end_session_dialog_canceled_id;
guint shell_end_session_dialog_open_failed_id;
guint shell_end_session_dialog_confirmed_logout_id;
guint shell_end_session_dialog_confirmed_shutdown_id;
guint shell_end_session_dialog_confirmed_reboot_id;
};
enum {
PROP_0,
@@ -1202,91 +1203,125 @@ query_end_session_complete (GsmManager *manager)
static gboolean
_client_request_save (GsmClient *client,
ClientEndSessionData *data)
{
gboolean ret;
GError *error;
error = NULL;
ret = gsm_client_request_save (client, data->flags, &error);
if (ret) {
g_debug ("GsmManager: adding client to query clients: %s", gsm_client_peek_id (client));
data->manager->priv->query_clients = g_slist_prepend (data->manager->priv->query_clients,
client);
} else if (error) {
g_debug ("GsmManager: unable to query client: %s", error->message);
g_error_free (error);
}
return FALSE;
}
static gboolean
_client_request_save_helper (const char *id,
GsmClient *client,
ClientEndSessionData *data)
{
return _client_request_save (client, data);
}
+static void
+fail_pending_save_invocations (GsmManager *manager,
+ GError *error)
+{
+ GSList *l;
+
+ for (l = manager->priv->pending_save_invocations; l != NULL; l = l->next) {
+ DBusGMethodInvocation *context = l->data;
+
+ dbus_g_method_return_error (context, error);
+ }
+
+ g_slist_free (manager->priv->pending_save_invocations);
+ manager->priv->pending_save_invocations = NULL;
+}
+
+static void
+finish_pending_save_invocations (GsmManager *manager)
+{
+ GSList *l;
+
+ for (l = manager->priv->pending_save_invocations; l != NULL; l = l->next) {
+ DBusGMethodInvocation *context = l->data;
+
+ dbus_g_method_return (context);
+ }
+
+ g_slist_free (manager->priv->pending_save_invocations);
+ manager->priv->pending_save_invocations = NULL;
+}
+
static void
query_save_session_complete (GsmManager *manager)
{
GError *error = NULL;
if (g_slist_length (manager->priv->next_query_clients) > 0) {
ClientEndSessionData data;
data.manager = manager;
data.flags = GSM_CLIENT_END_SESSION_FLAG_LAST;
g_slist_foreach (manager->priv->next_query_clients,
(GFunc)_client_request_save,
&data);
g_slist_free (manager->priv->next_query_clients);
manager->priv->next_query_clients = NULL;
return;
}
if (manager->priv->query_timeout_id > 0) {
g_source_remove (manager->priv->query_timeout_id);
manager->priv->query_timeout_id = 0;
}
gsm_session_save (manager->priv->clients, &error);
if (error) {
g_warning ("Error saving session: %s", error->message);
+ fail_pending_save_invocations (manager, error);
g_error_free (error);
+ } else {
+ finish_pending_save_invocations (manager);
}
}
static guint32
generate_cookie (void)
{
guint32 cookie;
cookie = (guint32)g_random_int_range (1, G_MAXINT32);
return cookie;
}
static guint32
_generate_unique_cookie (GsmManager *manager)
{
guint32 cookie;
do {
cookie = generate_cookie ();
} while (gsm_store_find (manager->priv->inhibitors, (GsmStoreFunc)_find_by_cookie, &cookie) != NULL);
return cookie;
}
static gboolean
_on_query_end_session_timeout (GsmManager *manager)
{
GSList *l;
@@ -2737,92 +2772,101 @@ gsm_manager_initialization_error (GsmExportedManager *skeleton,
GsmManager *manager)
{
if (manager->priv->phase != GSM_MANAGER_PHASE_INITIALIZATION) {
g_dbus_method_invocation_return_error (invocation,
GSM_MANAGER_ERROR,
GSM_MANAGER_ERROR_NOT_IN_INITIALIZATION,
"InitializationError interface is only available during the Initialization phase");
return TRUE;
}
gsm_util_init_error (fatal, "%s", message);
gsm_exported_manager_complete_initialization_error (skeleton, invocation);
return TRUE;
}
static void
user_logout (GsmManager *manager,
GsmManagerLogoutMode mode)
{
if (manager->priv->phase >= GSM_MANAGER_PHASE_QUERY_END_SESSION) {
manager->priv->logout_mode = mode;
end_session_or_show_shell_dialog (manager);
return;
}
request_logout (manager, mode);
}
gboolean
-gsm_manager_save_session (GsmManager *manager,
- GError **error)
+gsm_manager_save_session (GsmManager *manager,
+ DBusGMethodInvocation *context)
{
ClientEndSessionData data;
+ GError *error;
g_debug ("GsmManager: SaveSession called");
g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE);
if (manager->priv->phase != GSM_MANAGER_PHASE_RUNNING) {
- g_set_error (error,
- GSM_MANAGER_ERROR,
- GSM_MANAGER_ERROR_NOT_IN_RUNNING,
- "SaveSession interface is only available during the Running phase");
+ error = g_error_new (GSM_MANAGER_ERROR,
+ GSM_MANAGER_ERROR_NOT_IN_RUNNING,
+ "SaveSession interface is only available during the Running phase");
+ dbus_g_method_return_error (context, error);
+ g_error_free (error);
return FALSE;
}
data.manager = manager;
data.flags = 0;
gsm_store_foreach (manager->priv->clients,
(GsmStoreFunc)_client_request_save_helper,
&data);
if (manager->priv->query_clients) {
manager->priv->query_timeout_id = g_timeout_add_seconds (GSM_MANAGER_SAVE_SESSION_TIMEOUT,
(GSourceFunc)_on_query_save_session_timeout,
manager);
+
+ manager->priv->pending_save_invocations = g_slist_prepend (manager->priv->pending_save_invocations,
+ context);
+
return TRUE;
} else {
g_debug ("GsmManager: Nothing to save");
- return FALSE;
+ dbus_g_method_return (context);
+ return TRUE;
}
+
+ return TRUE;
}
gboolean
gsm_manager_logout (GsmManager *manager,
guint logout_mode,
GError **error)
{
if (manager->priv->phase < GSM_MANAGER_PHASE_RUNNING) {
g_set_error (error,
GSM_MANAGER_ERROR,
GSM_MANAGER_ERROR_NOT_IN_RUNNING,
"Logout interface is only available after the Running phase starts");
return FALSE;
}
if (_log_out_is_locked_down (manager)) {
g_set_error (error,
GSM_MANAGER_ERROR,
GSM_MANAGER_ERROR_LOCKED_DOWN,
"Logout has been locked down");
return FALSE;
}
switch (logout_mode) {
case GSM_MANAGER_LOGOUT_MODE_NORMAL:
case GSM_MANAGER_LOGOUT_MODE_NO_CONFIRMATION:
case GSM_MANAGER_LOGOUT_MODE_FORCE:
user_logout (manager, logout_mode);
break;
diff --git a/gnome-session/gsm-manager.h b/gnome-session/gsm-manager.h
index 4d14aa34..a8de58de 100644
--- a/gnome-session/gsm-manager.h
+++ b/gnome-session/gsm-manager.h
@@ -97,42 +97,42 @@ GType gsm_manager_get_type (void);
GsmManager * gsm_manager_new (GsmStore *client_store,
gboolean failsafe);
GsmManager * gsm_manager_get (void);
gboolean gsm_manager_get_failsafe (GsmManager *manager);
gboolean gsm_manager_add_autostart_app (GsmManager *manager,
const char *path,
const char *provides);
gboolean gsm_manager_add_required_app (GsmManager *manager,
const char *path,
const char *provides);
gboolean gsm_manager_add_autostart_apps_from_dir (GsmManager *manager,
const char *path);
gboolean gsm_manager_add_legacy_session_apps (GsmManager *manager,
const char *path);
void gsm_manager_start (GsmManager *manager);
const char * _gsm_manager_get_default_session (GsmManager *manager);
void _gsm_manager_set_active_session (GsmManager *manager,
const char *session_name,
gboolean is_fallback);
void _gsm_manager_set_renderer (GsmManager *manager,
const char *renderer);
gboolean gsm_manager_save_session (GsmManager *manager,
- GError **error);
+ DBusGMethodInvocation *context);
gboolean gsm_manager_logout (GsmManager *manager,
guint logout_mode,
GError **error);
gboolean gsm_manager_set_phase (GsmManager *manager,
GsmManagerPhase phase);
G_END_DECLS
#endif /* __GSM_MANAGER_H */
diff --git a/gnome-session/org.gnome.SessionManager.xml b/gnome-session/org.gnome.SessionManager.xml
index 29eb0990..ac73adc9 100644
--- a/gnome-session/org.gnome.SessionManager.xml
+++ b/gnome-session/org.gnome.SessionManager.xml
@@ -256,60 +256,61 @@
<arg name="handled" direction="out" type="b">
<doc:doc>
<doc:summary>True if condition is handled, false otherwise</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>Allows the caller to determine whether the session manager is
handling changes to the specified autostart condition.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="Shutdown">
<doc:doc>
<doc:description>
<doc:para>Request a shutdown dialog.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="Reboot">
<doc:doc>
<doc:description>
<doc:para>Request a reboot dialog.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="SaveSession">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<doc:doc>
<doc:description>
<doc:para>Request to save session</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="CanShutdown">
<arg name="is_available" direction="out" type="b">
<doc:doc>
<doc:summary>True if shutdown is available to the user, false otherwise</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>Allows the caller to determine whether or not it's okay to show
a shutdown option in the UI</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="Logout">
<arg name="mode" type="u" direction="in">
<doc:doc>
<doc:summary>The type of logout that is being requested</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>Request a logout dialog</doc:para>
--
2.14.2

662
SOURCES/0013-manager-save-session-type-in-session-dir.patch

@ -0,0 +1,662 @@ @@ -0,0 +1,662 @@
From b92add119aa5b9813556db26477170dd39eca5b6 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 20 Dec 2013 15:32:04 -0500
Subject: [PATCH 13/19] manager: save session type in session dir

If a user saved their session when in classic mode, make sure we
record that information so subsequent calls to gnome-session will
restore classic mode.
---
gnome-session/gsm-manager.c | 21 ++++++++++++++++++--
gnome-session/gsm-manager.h | 1 +
gnome-session/gsm-session-save.c | 41 +++++++++++++++++++++++++++++++++++++---
gnome-session/gsm-session-save.h | 5 +++--
gnome-session/main.c | 11 ++++++++++-
5 files changed, 71 insertions(+), 8 deletions(-)

diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index 6630aab8..135392fd 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -1260,61 +1260,61 @@ finish_pending_save_invocations (GsmManager *manager)
g_slist_free (manager->priv->pending_save_invocations);
manager->priv->pending_save_invocations = NULL;
}
static void
query_save_session_complete (GsmManager *manager)
{
GError *error = NULL;
if (g_slist_length (manager->priv->next_query_clients) > 0) {
ClientEndSessionData data;
data.manager = manager;
data.flags = GSM_CLIENT_END_SESSION_FLAG_LAST;
g_slist_foreach (manager->priv->next_query_clients,
(GFunc)_client_request_save,
&data);
g_slist_free (manager->priv->next_query_clients);
manager->priv->next_query_clients = NULL;
return;
}
if (manager->priv->query_timeout_id > 0) {
g_source_remove (manager->priv->query_timeout_id);
manager->priv->query_timeout_id = 0;
}
- gsm_session_save (manager->priv->clients, &error);
+ gsm_session_save (manager->priv->clients, manager->priv->session_name, &error);
if (error) {
g_warning ("Error saving session: %s", error->message);
fail_pending_save_invocations (manager, error);
g_error_free (error);
} else {
finish_pending_save_invocations (manager);
}
}
static guint32
generate_cookie (void)
{
guint32 cookie;
cookie = (guint32)g_random_int_range (1, G_MAXINT32);
return cookie;
}
static guint32
_generate_unique_cookie (GsmManager *manager)
{
guint32 cookie;
do {
cookie = generate_cookie ();
} while (gsm_store_find (manager->priv->inhibitors, (GsmStoreFunc)_find_by_cookie, &cookie) != NULL);
return cookie;
@@ -1528,60 +1528,77 @@ debug_app_summary (GsmManager *manager)
g_debug ("GsmManager: App startup summary");
for (phase = GSM_MANAGER_PHASE_EARLY_INITIALIZATION; phase < GSM_MANAGER_PHASE_RUNNING; phase++) {
g_debug ("GsmManager: Phase %s", phase_num_to_name (phase));
gsm_store_foreach (manager->priv->apps,
(GsmStoreFunc)_debug_app_for_phase,
GUINT_TO_POINTER (phase));
}
}
void
gsm_manager_start (GsmManager *manager)
{
g_debug ("GsmManager: GSM starting to manage");
g_return_if_fail (GSM_IS_MANAGER (manager));
gsm_xsmp_server_start (manager->priv->xsmp_server);
gsm_manager_set_phase (manager, GSM_MANAGER_PHASE_EARLY_INITIALIZATION);
debug_app_summary (manager);
start_phase (manager);
}
const char *
_gsm_manager_get_default_session (GsmManager *manager)
{
return g_settings_get_string (manager->priv->session_settings,
KEY_SESSION_NAME);
}
+char *
+_gsm_manager_get_saved_session (GsmManager *manager)
+{
+ char *file;
+ char *type;
+ gboolean loaded;
+
+ file = g_build_filename (gsm_util_get_saved_session_dir (), "type", NULL);
+ loaded = g_file_get_contents (file, &type, NULL, NULL);
+ g_free (file);
+
+ if (!loaded)
+ return NULL;
+
+ return type;
+}
+
void
_gsm_manager_set_active_session (GsmManager *manager,
const char *session_name,
gboolean is_fallback)
{
g_free (manager->priv->session_name);
manager->priv->session_name = g_strdup (session_name);
manager->priv->is_fallback_session = is_fallback;
gsm_exported_manager_set_session_name (manager->priv->skeleton, session_name);
}
void
_gsm_manager_set_renderer (GsmManager *manager,
const char *renderer)
{
gsm_exported_manager_set_renderer (manager->priv->skeleton, renderer);
}
static gboolean
_app_has_app_id (const char *id,
GsmApp *app,
const char *app_id_a)
{
const char *app_id_b;
app_id_b = gsm_app_peek_app_id (app);
return (app_id_b != NULL && strcmp (app_id_a, app_id_b) == 0);
}
@@ -1946,61 +1963,61 @@ on_xsmp_client_register_confirmed (GsmXSMPClient *client,
}
}
static gboolean
auto_save_is_enabled (GsmManager *manager)
{
return g_settings_get_boolean (manager->priv->settings, KEY_AUTOSAVE_ONE_SHOT)
|| g_settings_get_boolean (manager->priv->settings, KEY_AUTOSAVE);
}
static void
maybe_save_session (GsmManager *manager)
{
GError *error;
if (gsm_system_is_login_session (manager->priv->system))
return;
/* We only allow session saving when session is running or when
* logging out */
if (manager->priv->phase != GSM_MANAGER_PHASE_RUNNING &&
manager->priv->phase != GSM_MANAGER_PHASE_END_SESSION) {
return;
}
if (!auto_save_is_enabled (manager)) {
return;
}
error = NULL;
- gsm_session_save (manager->priv->clients, &error);
+ gsm_session_save (manager->priv->clients, manager->priv->session_name, &error);
if (error) {
g_warning ("Error saving session: %s", error->message);
g_error_free (error);
}
}
static void
_handle_client_end_session_response (GsmManager *manager,
GsmClient *client,
gboolean is_ok,
gboolean do_last,
gboolean cancel,
const char *reason)
{
/* just ignore if we are not yet running */
if (manager->priv->phase < GSM_MANAGER_PHASE_RUNNING) {
return;
}
g_debug ("GsmManager: Response from end session request: is-ok=%d do-last=%d cancel=%d reason=%s", is_ok, do_last, cancel, reason ? reason :"");
if (manager->priv->phase == GSM_MANAGER_PHASE_RUNNING) {
/* Ignore responses when no requests were sent */
if (manager->priv->query_clients == NULL) {
return;
}
manager->priv->query_clients = g_slist_remove (manager->priv->query_clients, client);
diff --git a/gnome-session/gsm-manager.h b/gnome-session/gsm-manager.h
index a8de58de..fcf36019 100644
--- a/gnome-session/gsm-manager.h
+++ b/gnome-session/gsm-manager.h
@@ -88,51 +88,52 @@ typedef enum
GSM_MANAGER_ERROR_INVALID_OPTION,
GSM_MANAGER_ERROR_LOCKED_DOWN,
GSM_MANAGER_NUM_ERRORS
} GsmManagerError;
#define GSM_MANAGER_ERROR gsm_manager_error_quark ()
GQuark gsm_manager_error_quark (void);
GType gsm_manager_get_type (void);
GsmManager * gsm_manager_new (GsmStore *client_store,
gboolean failsafe);
GsmManager * gsm_manager_get (void);
gboolean gsm_manager_get_failsafe (GsmManager *manager);
gboolean gsm_manager_add_autostart_app (GsmManager *manager,
const char *path,
const char *provides);
gboolean gsm_manager_add_required_app (GsmManager *manager,
const char *path,
const char *provides);
gboolean gsm_manager_add_autostart_apps_from_dir (GsmManager *manager,
const char *path);
gboolean gsm_manager_add_legacy_session_apps (GsmManager *manager,
const char *path);
void gsm_manager_start (GsmManager *manager);
const char * _gsm_manager_get_default_session (GsmManager *manager);
+char * _gsm_manager_get_saved_session (GsmManager *manager);
void _gsm_manager_set_active_session (GsmManager *manager,
const char *session_name,
gboolean is_fallback);
void _gsm_manager_set_renderer (GsmManager *manager,
const char *renderer);
gboolean gsm_manager_save_session (GsmManager *manager,
DBusGMethodInvocation *context);
gboolean gsm_manager_logout (GsmManager *manager,
guint logout_mode,
GError **error);
gboolean gsm_manager_set_phase (GsmManager *manager,
GsmManagerPhase phase);
G_END_DECLS
#endif /* __GSM_MANAGER_H */
diff --git a/gnome-session/gsm-session-save.c b/gnome-session/gsm-session-save.c
index 66914b57..78b64197 100644
--- a/gnome-session/gsm-session-save.c
+++ b/gnome-session/gsm-session-save.c
@@ -1,73 +1,105 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
* gsm-session-save.c
* Copyright (C) 2008 Lucas Rocha.
*
* 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 of the
* License, 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
+#include <string.h>
+
#include <glib.h>
#include <glib/gstdio.h>
#include <gio/gio.h>
#include "gsm-util.h"
#include "gsm-autostart-app.h"
#include "gsm-client.h"
#include "gsm-session-save.h"
#define GSM_MANAGER_SCHEMA "org.gnome.SessionManager"
#define KEY_AUTOSAVE_ONE_SHOT "auto-save-session-one-shot"
static gboolean gsm_session_clear_saved_session (const char *directory,
GHashTable *discard_hash);
typedef struct {
char *dir;
GHashTable *discard_hash;
GError **error;
} SessionSaveData;
+static void
+clear_session_type (const char *save_dir)
+{
+ char *file;
+
+ file = g_build_filename (save_dir, "type", NULL);
+
+ g_unlink (file);
+
+ g_free (file);
+}
+
+static void
+set_session_type (const char *save_dir,
+ const char *type)
+{
+ char *file;
+ GError *error;
+
+ file = g_build_filename (save_dir, "type", NULL);
+
+ error = NULL;
+ g_file_set_contents (file, type, strlen (type), &error);
+ if (error != NULL)
+ g_warning ("couldn't save session type to %s: %s",
+ type, error->message);
+
+ g_free (file);
+}
+
static gboolean
save_one_client (char *id,
GObject *object,
SessionSaveData *data)
{
GsmClient *client;
GKeyFile *keyfile;
const char *app_id;
char *path = NULL;
char *filename = NULL;
char *contents = NULL;
gsize length = 0;
char *discard_exec;
GError *local_error;
client = GSM_CLIENT (object);
local_error = NULL;
keyfile = gsm_client_save (client, &local_error);
if (keyfile == NULL || local_error) {
goto out;
}
contents = g_key_file_to_data (keyfile, &length, &local_error);
if (local_error) {
goto out;
}
@@ -107,112 +139,114 @@ save_one_client (char *id,
GSM_AUTOSTART_APP_DISCARD_KEY,
NULL);
if (discard_exec) {
g_hash_table_insert (data->discard_hash,
discard_exec, discard_exec);
}
g_debug ("GsmSessionSave: saved client %s to %s", id, filename);
out:
if (keyfile != NULL) {
g_key_file_free (keyfile);
}
g_free (contents);
g_free (filename);
g_free (path);
/* in case of any error, stop saving session */
if (local_error) {
g_propagate_error (data->error, local_error);
g_error_free (local_error);
return TRUE;
}
return FALSE;
}
void
-gsm_session_save (GsmStore *client_store,
- GError **error)
+gsm_session_save (GsmStore *client_store,
+ const char *type,
+ GError **error)
{
GSettings *settings;
const char *save_dir;
char *tmp_dir;
SessionSaveData data;
g_debug ("GsmSessionSave: Saving session");
/* Clear one shot key autosave in the event its set (so that it's actually
* one shot only)
*/
settings = g_settings_new (GSM_MANAGER_SCHEMA);
g_settings_set_boolean (settings, KEY_AUTOSAVE_ONE_SHOT, FALSE);
g_object_unref (settings);
save_dir = gsm_util_get_saved_session_dir ();
if (save_dir == NULL) {
g_warning ("GsmSessionSave: cannot create saved session directory");
return;
}
tmp_dir = gsm_util_get_empty_tmp_session_dir ();
if (tmp_dir == NULL) {
g_warning ("GsmSessionSave: cannot create new saved session directory");
return;
}
/* save the session in a temp directory, and remember the discard
* commands */
data.dir = tmp_dir;
data.discard_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
data.error = error;
gsm_store_foreach (client_store,
(GsmStoreFunc) save_one_client,
&data);
if (!*error) {
char *session_dir;
if (g_file_test (save_dir, G_FILE_TEST_IS_SYMLINK))
session_dir = g_file_read_link (save_dir, error);
else
session_dir = g_strdup (save_dir);
if (session_dir != NULL) {
-
char *absolute_session_dir;
+ set_session_type (tmp_dir, type);
+
if (g_path_is_absolute (session_dir)) {
absolute_session_dir = g_strdup (session_dir);
} else {
char *parent_dir;
parent_dir = g_path_get_dirname (save_dir);
absolute_session_dir = g_build_filename (parent_dir, session_dir, NULL);
g_free (parent_dir);
}
g_free (session_dir);
/* remove the old saved session */
gsm_session_clear_saved_session (absolute_session_dir, data.discard_hash);
if (g_file_test (absolute_session_dir, G_FILE_TEST_IS_DIR))
g_rmdir (absolute_session_dir);
g_rename (tmp_dir, absolute_session_dir);
g_free (absolute_session_dir);
}
} else {
g_warning ("GsmSessionSave: error saving session: %s", (*error)->message);
/* FIXME: we should create a hash table filled with the discard
* commands that are in desktop files from save_dir. */
gsm_session_clear_saved_session (tmp_dir, NULL);
g_rmdir (tmp_dir);
}
g_hash_table_destroy (data.discard_hash);
g_free (tmp_dir);
@@ -294,31 +328,32 @@ gsm_session_clear_saved_session (const char *directory,
while ((filename = g_dir_read_name (dir))) {
char *path = g_build_filename (directory,
filename, NULL);
result = gsm_session_clear_one_client (path, discard_hash)
&& result;
g_free (path);
}
g_dir_close (dir);
return result;
}
void
gsm_session_save_clear (void)
{
const char *save_dir;
g_debug ("GsmSessionSave: Clearing saved session");
save_dir = gsm_util_get_saved_session_dir ();
if (save_dir == NULL) {
g_warning ("GsmSessionSave: cannot create saved session directory");
return;
}
gsm_session_clear_saved_session (save_dir, NULL);
+ clear_session_type (save_dir);
}
diff --git a/gnome-session/gsm-session-save.h b/gnome-session/gsm-session-save.h
index e623260f..c91b5615 100644
--- a/gnome-session/gsm-session-save.h
+++ b/gnome-session/gsm-session-save.h
@@ -1,33 +1,34 @@
/* gsm-session-save.h
* Copyright (C) 2008 Lucas Rocha.
*
* 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 of the
* License, 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GSM_SESSION_SAVE_H__
#define __GSM_SESSION_SAVE_H__
#include <glib.h>
#include "gsm-store.h"
G_BEGIN_DECLS
-void gsm_session_save (GsmStore *client_store,
- GError **error);
+void gsm_session_save (GsmStore *client_store,
+ const char *type,
+ GError **error);
void gsm_session_save_clear (void);
G_END_DECLS
#endif /* __GSM_SESSION_SAVE_H__ */
diff --git a/gnome-session/main.c b/gnome-session/main.c
index e2c3efef..6e697678 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -119,61 +119,70 @@ sigusr2_cb (gpointer data)
static gboolean
sigusr1_cb (gpointer data)
{
gdm_log_toggle_debug ();
return TRUE;
}
static void
on_name_acquired (GDBusConnection *connection,
const char *name,
gpointer data)
{
gsm_manager_start (manager);
}
static void
create_manager (void)
{
GsmStore *client_store;
client_store = gsm_store_new ();
manager = gsm_manager_new (client_store, failsafe);
g_object_unref (client_store);
g_unix_signal_add (SIGTERM, term_or_int_signal_cb, manager);
g_unix_signal_add (SIGINT, term_or_int_signal_cb, manager);
g_unix_signal_add (SIGUSR1, sigusr1_cb, manager);
g_unix_signal_add (SIGUSR2, sigusr2_cb, manager);
if (IS_STRING_EMPTY (session_name)) {
- session_name = _gsm_manager_get_default_session (manager);
+ char *saved_session_name;
+
+ saved_session_name = _gsm_manager_get_saved_session (manager);
+
+ if (IS_STRING_EMPTY (saved_session_name))
+ session_name = _gsm_manager_get_default_session (manager);
+ else
+ session_name = g_steal_pointer (&saved_session_name);
+
+ g_free (saved_session_name);
}
if (!gsm_session_fill (manager, session_name)) {
gsm_fail_whale_dialog_we_failed (FALSE, TRUE, NULL);
}
_gsm_manager_set_renderer (manager, gl_renderer);
}
static void
on_bus_acquired (GDBusConnection *connection,
const char *name,
gpointer data)
{
create_manager ();
}
static guint
acquire_name (void)
{
return g_bus_own_name (G_BUS_TYPE_SESSION,
GSM_DBUS_NAME,
G_BUS_NAME_OWNER_FLAGS_NONE,
on_bus_acquired,
on_name_acquired,
on_name_lost,
NULL, NULL);
}
static gboolean
--
2.14.2

42
SOURCES/0014-session-selector-restore-saved-session-mode.patch

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
From 2a15240b8653b8fe0f0c1e2804d7c2fe8452a604 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 7 Jan 2014 21:16:23 -0500
Subject: [PATCH 14/19] session-selector: restore saved session mode

When using the custom session selector, we need to know
whether to use classic mode or not.

This commit makes us use whatever mode was saved with the
session.
---
tools/gnome-session-custom-session | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tools/gnome-session-custom-session b/tools/gnome-session-custom-session
index 07fdb0cc..358aee01 100644
--- a/tools/gnome-session-custom-session
+++ b/tools/gnome-session-custom-session
@@ -1,4 +1,19 @@
#! /bin/sh
gnome-session-selector
-exec gnome-session
+
+type_file="${XDG_CONFIG_HOME:-$HOME/.config}/gnome-session/saved-session/type"
+
+session_type=""
+if [ -e "$type_file" ]; then
+ read session_type < "$type_file"
+fi
+
+session_type_argument=""
+[ -n "$session_type" ] && session_type_argument="--session=$session_type"
+
+if [ "$session_type" = "gnome-classic" ]; then
+ export GNOME_SHELL_SESSION_MODE="classic"
+fi
+
+exec gnome-session "$session_type_argument"
--
2.14.2

269
SOURCES/0015-session-selector-refresh-from-recent-glade.patch

@ -0,0 +1,269 @@ @@ -0,0 +1,269 @@
From 3e35abd4c7d0aae97d868db6e66706c2ccdeeb11 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 20 Dec 2013 10:53:33 -0500
Subject: [PATCH 15/19] session-selector: refresh from recent glade

The ui file is rather old. This commit just opens it up in a recent
glade and resaves it, so we have a fresh starting point to make
changes.
---
data/session-selector.ui | 80 ++++++++++++++++++++++++++++++++----------------
1 file changed, 54 insertions(+), 26 deletions(-)

diff --git a/data/session-selector.ui b/data/session-selector.ui
index 1534a746..4d1e3009 100644
--- a/data/session-selector.ui
+++ b/data/session-selector.ui
@@ -1,195 +1,223 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy project-wide -->
- <object class="GtkListStore" id="session-store">
- <columns>
- <!-- column-name name -->
- <column type="gchararray"/>
- </columns>
- </object>
- <object class="GtkTreeModelSort" id="sort-model">
- <property name="model">session-store</property>
- </object>
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="main-window">
+ <property name="can_focus">False</property>
<property name="title" translatable="yes">Custom Session</property>
<property name="window_position">center</property>
<property name="default_width">500</property>
<property name="default_height">310</property>
<property name="decorated">False</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label_xalign">0.5</property>
<property name="shadow_type">out</property>
<child>
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">12</property>
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
-
<child>
<object class="GtkInfoBar" id="info-bar">
<property name="visible">True</property>
- <property name="message-type">other</property>
-
+ <property name="can_focus">False</property>
+ <property name="message_type">other</property>
<child internal-child="content_area">
- <object class="GtkHBox" id="info-bar-content_area">
+ <object class="GtkBox" id="info-bar-content_area">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="spacing">0</property>
<child>
<object class="GtkLabel" id="info-label">
<property name="visible">True</property>
- <property name="xalign">0.0</property>
- <property name="yalign">0.5</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
<property name="label" translatable="yes">Please select a custom session to use</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="infobar-action_area1">
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
- <property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="session-list">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="model">sort-model</property>
<property name="headers_visible">False</property>
<property name="search_column">0</property>
- <property name="model">sort-model</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
+ </child>
</object>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVButtonBox" id="vbuttonbox2">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="new-session">
<property name="label" translatable="yes">_New Session</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="remove-session">
<property name="label" translatable="yes">_Remove Session</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="rename-session">
<property name="label" translatable="yes">Rena_me Session</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="hbuttonbox2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="continue-button">
<property name="label" translatable="yes">_Continue</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
+ <object class="GtkListStore" id="session-store">
+ <columns>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkTreeModelSort" id="sort-model">
+ <property name="model">session-store</property>
+ </object>
</interface>
--
2.14.2

604
SOURCES/0016-session-selector-add-toggle-for-classic-normal-selec.patch

@ -0,0 +1,604 @@ @@ -0,0 +1,604 @@
From f0f0898da1c1e28d4ad6d6c17ba559e59780bd21 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 7 Jan 2014 21:02:02 -0500
Subject: [PATCH 16/19] session-selector: add toggle for classic/normal
selection

Since we offer both classic mode and regular mode when
not using the session selector, we should also offer it
when using the session selector.
---
data/session-selector.ui | 39 ++++++++++++++-
tools/gnome-session-selector.c | 106 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 143 insertions(+), 2 deletions(-)

diff --git a/data/session-selector.ui b/data/session-selector.ui
index 4d1e3009..beab73a1 100644
--- a/data/session-selector.ui
+++ b/data/session-selector.ui
@@ -153,71 +153,106 @@
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="hbuttonbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
- <property name="layout_style">end</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="classic-mode-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Classic Experience</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="classic-mode-switch">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<object class="GtkButton" id="continue-button">
<property name="label" translatable="yes">_Continue</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">0</property>
+ <property name="position">1</property>
+ <property name="non_homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
<object class="GtkListStore" id="session-store">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkTreeModelSort" id="sort-model">
<property name="model">session-store</property>
</object>
</interface>
diff --git a/tools/gnome-session-selector.c b/tools/gnome-session-selector.c
index 53822f6c..a7361a5b 100644
--- a/tools/gnome-session-selector.c
+++ b/tools/gnome-session-selector.c
@@ -16,60 +16,61 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Written by: Matthias Clasen <mclasen@redhat.com>
*/
#include "config.h"
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#define GSM_SERVICE_DBUS "org.gnome.SessionManager"
#define GSM_PATH_DBUS "/org/gnome/SessionManager"
#define GSM_INTERFACE_DBUS "org.gnome.SessionManager"
#define GSM_MANAGER_SCHEMA "org.gnome.SessionManager"
#define KEY_AUTOSAVE_ONE_SHOT "auto-save-session-one-shot"
+#define DEFAULT_SESSION_NAME "gnome"
static GtkBuilder *builder;
static GtkWidget *session_list;
static GtkListStore *store;
static GtkTreeModelSort *sort_model;
static char *info_text;
static void select_session (const char *name);
static gboolean make_session_current (const char *name);
static char *
get_session_path (const char *name)
{
return g_build_filename (g_get_user_config_dir (), "gnome-session", name, NULL);
}
static char *
find_new_session_name (void)
{
char *name;
char *path;
int i;
for (i = 1; i < 20; i++) {
name = g_strdup_printf (_("Session %d"), i);
path = get_session_path (name);
if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
g_free (path);
return name;
}
@@ -125,104 +126,126 @@ is_valid_session_name (const char *name)
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
do {
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 0, &n, -1);
if (strcmp (n, name) == 0) {
char *message;
message = g_strdup_printf (_("A session named “%s” already exists"), name);
warning_text = g_strdup_printf ("%s\n<small><b>Note:</b> <i>%s</i></small>", info_text, message);
g_free (message);
g_free (n);
break;
}
g_free (n);
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter));
info_bar = (GtkWidget *) gtk_builder_get_object (builder, "info-bar");
label = (GtkWidget*) gtk_builder_get_object (builder, "info-label");
if (warning_text != NULL) {
gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING);
gtk_label_set_markup (GTK_LABEL (label), warning_text);
g_free (warning_text);
return FALSE;
}
gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_OTHER);
gtk_label_set_markup (GTK_LABEL (label), info_text);
return TRUE;
}
+static char *
+get_session_type_from_file (const char *name)
+{
+ char *file;
+ char *type;
+ gboolean loaded;
+
+ file = g_build_filename (g_get_user_config_dir (), "gnome-session", name, "type", NULL);
+ loaded = g_file_get_contents (file, &type, NULL, NULL);
+ g_free (file);
+
+ if (!loaded)
+ return g_strdup (DEFAULT_SESSION_NAME);
+
+ return type;
+}
+
static void
populate_session_list (GtkWidget *session_list)
{
GtkTreeIter iter;
char *path;
const char *name;
GDir *dir;
GError *error;
char *saved_session;
char *default_session;
char *default_name;
char last_session[PATH_MAX] = "";
saved_session = get_session_path ("saved-session");
if (!g_file_test (saved_session, G_FILE_TEST_IS_SYMLINK)) {
default_name = find_new_session_name ();
default_session = get_session_path (default_name);
rename (saved_session, default_session);
if (symlink (default_name, saved_session) < 0)
g_warning ("Failed to convert saved-session to symlink");
g_free (default_name);
g_free (default_session);
}
path = g_build_filename (g_get_user_config_dir (), "gnome-session", NULL);
error = NULL;
dir = g_dir_open (path, 0, &error);
if (dir == NULL) {
g_warning ("Failed to open %s: %s", path, error->message);
g_error_free (error);
goto out;
}
default_name = NULL;
if (readlink (saved_session, last_session, PATH_MAX - 1) > 0) {
default_name = g_path_get_basename (last_session);
}
while ((name = g_dir_read_name (dir)) != NULL) {
+ char *session_type;
+
if (strcmp (name, "saved-session") == 0)
continue;
+ session_type = get_session_type_from_file (name);
+
gtk_list_store_insert_with_values (store, &iter, 100, 0, name, -1);
+ g_free (session_type);
if (g_strcmp0 (default_name, name) == 0) {
GtkTreeSelection *selection;
GtkTreeIter child_iter;
gtk_tree_model_sort_convert_child_iter_to_iter (GTK_TREE_MODEL_SORT (sort_model), &child_iter, &iter);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (session_list));
gtk_tree_selection_select_iter (selection, &child_iter);
}
}
g_free (default_name);
g_dir_close (dir);
out:
g_free (saved_session);
g_free (path);
}
static char *
get_last_session (void)
{
char *saved_session;
char last_session[PATH_MAX] = "";
char *name = NULL;
saved_session = get_session_path ("saved-session");
if (readlink (saved_session, last_session, PATH_MAX - 1) > 0) {
name = g_path_get_basename (last_session);
@@ -260,60 +283,136 @@ remove_session (const char *name)
GError *error;
path1 = get_session_path ("saved-session");
path2 = get_session_path (name);
error = NULL;
n = g_file_read_link (path1, &error);
if (n == NULL) {
g_warning ("Failed to read link: %s", error->message);
g_error_free (error);
}
else if (strcmp (n, name) == 0) {
unlink (path1);
}
g_free (n);
dir = g_dir_open (path2, 0, NULL);
while ((d = g_dir_read_name (dir)) != NULL) {
path = g_build_filename (path2, d, NULL);
unlink (path);
g_free (path);
}
g_dir_close (dir);
remove (path2);
g_free (path1);
g_free (path2);
}
+static const char *
+get_session_type_from_switch (void)
+{
+ GtkWidget *mode_switch;
+ gboolean is_classic_mode;
+
+ mode_switch = (GtkWidget *)gtk_builder_get_object (builder, "classic-mode-switch");
+
+ is_classic_mode = gtk_switch_get_active (GTK_SWITCH (mode_switch));
+
+ if (is_classic_mode) {
+ return "gnome-classic";
+ } else {
+ return "gnome";
+ }
+}
+
+static void
+set_mode_switch_from_session_type_file (const char *name)
+{
+ GtkWidget *mode_switch;
+ gboolean is_classic_mode = FALSE;
+ char *type;
+
+ mode_switch = (GtkWidget *)gtk_builder_get_object (builder, "classic-mode-switch");
+
+ type = get_session_type_from_file (name);
+ is_classic_mode = strcmp (type, "gnome-classic") == 0;
+ g_free (type);
+
+ gtk_switch_set_active (GTK_SWITCH (mode_switch), is_classic_mode);
+}
+
+static void
+save_session_type (const char *save_dir,
+ const char *type)
+{
+ char *file;
+ GError *error;
+
+ file = g_build_filename (save_dir, "type", NULL);
+
+ error = NULL;
+ g_file_set_contents (file, type, strlen (type), &error);
+ if (error != NULL)
+ g_warning ("couldn't save session type to %s: %s",
+ type, error->message);
+
+ g_free (file);
+}
+
+static void
+save_session_type_from_switch (void)
+{
+ char *name, *path;
+ const char *session_type;
+
+ name = get_selected_session ();
+
+ if (name == NULL) {
+ return;
+ }
+
+ path = get_session_path (name);
+ g_free (name);
+
+ session_type = get_session_type_from_switch ();
+ save_session_type (path, session_type);
+}
+
+static void
+on_mode_switched (GtkSwitch *mode_switch)
+{
+ save_session_type_from_switch ();
+}
+
static gboolean
make_session_current (const char *name)
{
char *path1;
gboolean ret = TRUE;
path1 = g_build_filename (g_get_user_config_dir (), "gnome-session", "saved-session", NULL);
unlink (path1);
if (symlink (name, path1) < 0) {
g_warning ("Failed to make session '%s' current", name);
ret = FALSE;
}
g_free (path1);
return ret;
}
static void
on_remove_session_clicked (GtkButton *button,
gpointer data)
{
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
char *name;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (session_list));
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
@@ -492,60 +591,62 @@ static void
create_session_and_begin_rename (void)
{
gchar *name;
name = find_new_session_name ();
create_session (name);
select_session (name);
begin_rename ();
}
static void
on_new_session_clicked (GtkButton *button,
gpointer data)
{
create_session_and_begin_rename ();
}
static void
on_selection_changed (GtkTreeSelection *selection,
gpointer data)
{
char *name;
name = get_selected_session ();
if (name == NULL) {
return;
}
+ set_mode_switch_from_session_type_file (name);
+
g_free (name);
}
static void
update_remove_button (void)
{
GtkWidget *button;
button = (GtkWidget *)gtk_builder_get_object (builder, "remove-session");
if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) > 1) {
gtk_widget_set_sensitive (button, TRUE);
} else {
gtk_widget_set_sensitive (button, FALSE);
}
}
static void
on_row_edited (GtkCellRendererText *cell,
const char *path_string,
const char *new_name,
gpointer data)
{
GtkTreePath *path;
GtkTreeIter sort_iter, items_iter;
char *old_name;
gboolean was_renamed;
path = gtk_tree_path_new_from_string (path_string);
gtk_tree_model_get_iter (GTK_TREE_MODEL (sort_model), &sort_iter, path);
@@ -751,75 +852,80 @@ main (int argc, char *argv[])
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model),
0, GTK_SORT_ASCENDING);
g_signal_connect (store, "row-deleted", G_CALLBACK (on_row_deleted), NULL);
g_signal_connect (store, "row-inserted", G_CALLBACK (on_row_inserted), NULL);
session_list = (GtkWidget *) gtk_builder_get_object (builder, "session-list");
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (session_list));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
populate_session_list (session_list);
cell = gtk_cell_renderer_text_new ();
g_signal_connect (cell, "edited", G_CALLBACK (on_row_edited), NULL);
column = gtk_tree_view_column_new_with_attributes ("", cell, "text", 0, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (session_list), GTK_TREE_VIEW_COLUMN (column));
g_signal_connect (session_list, "row-activated", G_CALLBACK (on_row_activated), NULL);
g_signal_connect (selection, "changed",
G_CALLBACK (on_selection_changed), NULL);
widget = (GtkWidget *) gtk_builder_get_object (builder, "new-session");
g_signal_connect (widget, "clicked", G_CALLBACK (on_new_session_clicked), NULL);
widget = (GtkWidget *) gtk_builder_get_object (builder, "remove-session");
g_signal_connect (widget, "clicked", G_CALLBACK (on_remove_session_clicked), NULL);
widget = (GtkWidget *) gtk_builder_get_object (builder, "rename-session");
g_signal_connect (widget, "clicked", G_CALLBACK (on_rename_session_clicked), NULL);
widget = (GtkWidget *) gtk_builder_get_object (builder, "continue-button");
g_signal_connect (widget, "clicked", G_CALLBACK (on_continue_clicked), NULL);
+ widget = (GtkWidget *) gtk_builder_get_object (builder, "classic-mode-switch");
+ g_signal_connect (widget, "notify::active", G_CALLBACK (on_mode_switched), NULL);
g_signal_connect (window, "map", G_CALLBACK (on_map), NULL);
gtk_widget_show (window);
if (g_strcmp0 (action, "load") == 0) {
info_text = _("Please select a custom session to run");
} else if (g_strcmp0 (action, "print") == 0) {
info_text = _("Please select a session to use");
} else if (g_strcmp0 (action, "save") == 0) {
info_text = _("Please select a session to save to");
}
label = (GtkWidget*) gtk_builder_get_object (builder, "info-label");
gtk_label_set_markup (GTK_LABEL (label), info_text);
selected_session = get_selected_session ();
if (selected_session == NULL) {
create_session_and_begin_rename ();
} else {
+ set_mode_switch_from_session_type_file (selected_session);
g_free (selected_session);
}
gtk_main ();
selected_session = get_selected_session ();
if (g_strcmp0 (action, "load") == 0) {
make_session_current (selected_session);
+ save_session_type_from_switch ();
auto_save_next_session_if_needed ();
} else if (g_strcmp0 (action, "save") == 0) {
char *last_session;
last_session = get_last_session ();
make_session_current (selected_session);
save_session ();
+ save_session_type_from_switch ();
if (last_session != NULL)
make_session_current (last_session);
} else if (g_strcmp0 (action, "print") == 0) {
g_print ("%s\n", selected_session);
}
g_free (selected_session);
return 0;
}
--
2.14.2

79
SOURCES/0017-session-selector-use-classic-mode-by-default.patch

@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
From 12df4f92bff325fbffcaa4eb0ee0392511f6ebb6 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 8 Jan 2014 10:15:29 -0500
Subject: [PATCH 17/19] session-selector: use classic mode by default

---
tools/gnome-session-selector.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/gnome-session-selector.c b/tools/gnome-session-selector.c
index a7361a5b..a41cd260 100644
--- a/tools/gnome-session-selector.c
+++ b/tools/gnome-session-selector.c
@@ -16,61 +16,61 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Written by: Matthias Clasen <mclasen@redhat.com>
*/
#include "config.h"
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#define GSM_SERVICE_DBUS "org.gnome.SessionManager"
#define GSM_PATH_DBUS "/org/gnome/SessionManager"
#define GSM_INTERFACE_DBUS "org.gnome.SessionManager"
#define GSM_MANAGER_SCHEMA "org.gnome.SessionManager"
#define KEY_AUTOSAVE_ONE_SHOT "auto-save-session-one-shot"
-#define DEFAULT_SESSION_NAME "gnome"
+#define DEFAULT_SESSION_NAME "gnome-classic"
static GtkBuilder *builder;
static GtkWidget *session_list;
static GtkListStore *store;
static GtkTreeModelSort *sort_model;
static char *info_text;
static void select_session (const char *name);
static gboolean make_session_current (const char *name);
static char *
get_session_path (const char *name)
{
return g_build_filename (g_get_user_config_dir (), "gnome-session", name, NULL);
}
static char *
find_new_session_name (void)
{
char *name;
char *path;
int i;
for (i = 1; i < 20; i++) {
name = g_strdup_printf (_("Session %d"), i);
path = get_session_path (name);
if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
g_free (path);
return name;
}
--
2.14.2

756
SOURCES/0018-manager-port-away-from-dbus-glib-to-GDBus.patch

@ -0,0 +1,756 @@ @@ -0,0 +1,756 @@
From 916d9ba86cf2020ffedff331397ed02b5e53f030 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 8 Mar 2017 16:36:44 -0500
Subject: [PATCH 18/19] manager: port away from dbus-glib to GDBus

---
capplet/gsm-properties-dialog.c | 52 +++++++++++++++++++++--------------------
configure.ac | 2 +-
gnome-session/gsm-manager.c | 16 ++++++-------
gnome-session/gsm-manager.h | 3 ++-
tools/gnome-session-selector.c | 48 ++++++++++++++++++++-----------------
5 files changed, 64 insertions(+), 57 deletions(-)

diff --git a/capplet/gsm-properties-dialog.c b/capplet/gsm-properties-dialog.c
index 51fa5106..04452c1a 100644
--- a/capplet/gsm-properties-dialog.c
+++ b/capplet/gsm-properties-dialog.c
@@ -1,66 +1,66 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 1999 Free Software Foundation, Inc.
* Copyright (C) 2007 Vincent Untz.
* Copyright (C) 2008 Lucas Rocha.
* Copyright (C) 2008 William Jon McCann <jmccann@redhat.com>
*
* 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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include "config.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
+
#include "gsm-properties-dialog.h"
#include "gsm-app-dialog.h"
#include "gsm-util.h"
#include "gsp-app.h"
#include "gsp-app-manager.h"
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
#define GSM_SERVICE_DBUS "org.gnome.SessionManager"
#define GSM_PATH_DBUS "/org/gnome/SessionManager"
#define GSM_INTERFACE_DBUS "org.gnome.SessionManager"
#define GSM_PROPERTIES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_PROPERTIES_DIALOG, GsmPropertiesDialogPrivate))
#define GTKBUILDER_FILE "session-properties.ui"
#define CAPPLET_TREEVIEW_WIDGET_NAME "session_properties_treeview"
#define CAPPLET_ADD_WIDGET_NAME "session_properties_add_button"
#define CAPPLET_DELETE_WIDGET_NAME "session_properties_delete_button"
#define CAPPLET_EDIT_WIDGET_NAME "session_properties_edit_button"
#define CAPPLET_SAVE_WIDGET_NAME "session_properties_save_button"
#define CAPPLET_SESSION_SAVED_WIDGET_NAME "session_properties_session_saved_label"
#define CAPPLET_REMEMBER_WIDGET_NAME "session_properties_remember_toggle"
#define STARTUP_APP_ICON "system-run"
#define SPC_SETTINGS_SCHEMA "org.gnome.SessionManager"
#define SPC_SETTINGS_AUTOSAVE_KEY "auto-save-session"
struct GsmPropertiesDialogPrivate
{
GtkBuilder *xml;
GtkListStore *list_store;
GtkTreeModel *tree_filter;
GtkTreeView *treeview;
GtkWidget *add_button;
@@ -454,101 +454,103 @@ on_edit_app_clicked (GtkWidget *widget,
g_object_unref (app);
}
}
static void
on_row_activated (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
GsmPropertiesDialog *dialog)
{
on_edit_app_clicked (NULL, dialog);
}
static void
session_saved_message (GsmPropertiesDialog *dialog,
const char *msg,
gboolean is_error)
{
GtkLabel *label;
gchar *markup;
label = GTK_LABEL (gtk_builder_get_object (dialog->priv->xml, CAPPLET_SESSION_SAVED_WIDGET_NAME));
if (is_error)
markup = g_markup_printf_escaped ("<span foreground=\"red\">%s</span>", msg);
else
markup = g_markup_escape_text (msg, -1);
gtk_label_set_markup (label, markup);
g_free (markup);
}
static void
-session_saved_cb (DBusGProxy *proxy,
- DBusGProxyCall *call_id,
- void *user_data)
+session_saved_cb (GDBusConnection *conn,
+ GAsyncResult *result,
+ gpointer user_data)
{
- gboolean res;
+ GVariant *reply;
GsmPropertiesDialog *dialog = user_data;
+ GError *error = NULL;
- res = dbus_g_proxy_end_call (proxy, call_id, NULL, G_TYPE_INVALID);
- if (res)
+ reply = g_dbus_connection_call_finish (conn, result, &error);
+ if (error == NULL)
session_saved_message (dialog, _("Your session has been saved."), FALSE);
else
session_saved_message (dialog, _("Failed to save session"), TRUE);
- g_object_unref (proxy);
+ g_clear_error (&error);
+
+ g_variant_unref (reply);
}
static void
save_session_directly (GsmPropertiesDialog *dialog)
{
- DBusGConnection *conn;
- DBusGProxy *proxy;
- DBusGProxyCall *call;
+ GDBusConnection *conn;
- conn = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
+ conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
if (conn == NULL) {
session_saved_message (dialog, _("Could not connect to the session bus"), TRUE);
return;
}
- proxy = dbus_g_proxy_new_for_name (conn, GSM_SERVICE_DBUS, GSM_PATH_DBUS, GSM_INTERFACE_DBUS);
- if (proxy == NULL) {
- session_saved_message (dialog, _("Could not connect to the session manager"), TRUE);
- return;
- }
-
- call = dbus_g_proxy_begin_call (proxy, "SaveSession", session_saved_cb, dialog, NULL, G_TYPE_INVALID);
- if (call == NULL) {
- session_saved_message (dialog, _("Failed to save session"), TRUE);
- g_object_unref (proxy);
- return;
- }
+ g_dbus_connection_call (conn,
+ GSM_SERVICE_DBUS,
+ GSM_PATH_DBUS,
+ GSM_INTERFACE_DBUS,
+ "SaveSession",
+ NULL,
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ (GAsyncReadyCallback)
+ session_saved_cb,
+ dialog);
}
static void
save_session_from_selector (GsmPropertiesDialog *dialog,
const char *program_path)
{
char *command_line = g_strdup_printf ("%s --action save", program_path);
g_spawn_command_line_sync (command_line, NULL, NULL, NULL, NULL);
g_free (command_line);
}
static void
on_save_session_clicked (GtkWidget *widget,
GsmPropertiesDialog *dialog)
{
char *program_path;
program_path = g_find_program_in_path ("gnome-session-selector");
if (program_path != NULL) {
save_session_from_selector (dialog, program_path);
g_free (program_path);
} else {
save_session_directly (dialog);
}
}
static void
diff --git a/configure.ac b/configure.ac
index d0eeab8a..5182c09e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,61 +21,61 @@ LT_PREREQ([2.2.6])
LT_INIT([dlopen disable-static])
GNOME_MAINTAINER_MODE_DEFINES
GNOME_COMPILE_WARNINGS([maximum])
AC_ARG_ENABLE(deprecation_flags,
[AS_HELP_STRING([--enable-deprecation-flags],
[use *_DISABLE_DEPRECATED flags @<:@default=no@:>@])],,
[enable_deprecation_flags=no])
if test "x$enable_deprecation_flags" = "xyes"; then
DISABLE_DEPRECATED_CFLAGS=$DISABLE_DEPRECATED
AC_SUBST([DISABLE_DEPRECATED_CFLAGS])
fi
GLIB_REQUIRED=2.46.0
GTK3_REQUIRED=3.18.0
DBUS_GLIB_REQUIRED=0.76
UPOWER_REQUIRED=0.9.0
JSON_GLIB_REQUIRED=0.10
GNOME_DESKTOP_REQUIRED=3.18.0
AC_ARG_ENABLE(session-selector, AS_HELP_STRING([--enable-session-selector],
[enable building a custom session selector dialog]),
enable_session_selector=$enableval,enable_session_selector=no)
AM_CONDITIONAL(BUILD_SESSION_SELECTOR,
[test "$enable_session_selector" = yes])
if test "$enable_session_selector" = yes; then
- PKG_CHECK_MODULES(SESSION_SELECTOR, gtk+-3.0 gio-2.0 dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
+ PKG_CHECK_MODULES(SESSION_SELECTOR, gtk+-3.0 gio-2.0)
fi
dnl ====================================================================
dnl Dependency Checks
dnl ====================================================================
dnl Standard vertical stacks
PKG_CHECK_MODULES(GIO, gio-2.0)
PKG_CHECK_MODULES(GIOUNIX, gio-unix-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= $GTK3_REQUIRED)
PKG_CHECK_MODULES(GNOME_SESSION,
glib-2.0 >= $GLIB_REQUIRED
gio-2.0 >= $GLIB_REQUIRED
json-glib-1.0 >= $JSON_GLIB_REQUIRED
gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
)
dnl We can only support old upower
dnl https://bugzilla.gnome.org/show_bug.cgi?id=710383
PKG_CHECK_MODULES(UPOWER, upower-glib < 0.99.0, have_old_upower=yes, have_old_upower=no)
AS_IF([test x$have_old_upower = xyes], [
AC_DEFINE([HAVE_OLD_UPOWER], [1], [Define if we have an older upower])
])
AM_CONDITIONAL(HAVE_OLD_UPOWER, test x$have_old_upower = xyes)
PKG_CHECK_MODULES(SESSION_PROPERTIES,
glib-2.0 >= $GLIB_REQUIRED
gtk+-3.0 >= $GTK3_REQUIRED
)
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index 135392fd..29c3054d 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -1210,78 +1210,78 @@ _client_request_save (GsmClient *client,
error = NULL;
ret = gsm_client_request_save (client, data->flags, &error);
if (ret) {
g_debug ("GsmManager: adding client to query clients: %s", gsm_client_peek_id (client));
data->manager->priv->query_clients = g_slist_prepend (data->manager->priv->query_clients,
client);
} else if (error) {
g_debug ("GsmManager: unable to query client: %s", error->message);
g_error_free (error);
}
return FALSE;
}
static gboolean
_client_request_save_helper (const char *id,
GsmClient *client,
ClientEndSessionData *data)
{
return _client_request_save (client, data);
}
static void
fail_pending_save_invocations (GsmManager *manager,
GError *error)
{
GSList *l;
for (l = manager->priv->pending_save_invocations; l != NULL; l = l->next) {
- DBusGMethodInvocation *context = l->data;
+ GDBusMethodInvocation *invocation = l->data;
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (invocation, error);
}
g_slist_free (manager->priv->pending_save_invocations);
manager->priv->pending_save_invocations = NULL;
}
static void
finish_pending_save_invocations (GsmManager *manager)
{
GSList *l;
for (l = manager->priv->pending_save_invocations; l != NULL; l = l->next) {
- DBusGMethodInvocation *context = l->data;
+ GDBusMethodInvocation *invocation = l->data;
- dbus_g_method_return (context);
+ g_dbus_method_invocation_return_value (invocation, NULL);
}
g_slist_free (manager->priv->pending_save_invocations);
manager->priv->pending_save_invocations = NULL;
}
static void
query_save_session_complete (GsmManager *manager)
{
GError *error = NULL;
if (g_slist_length (manager->priv->next_query_clients) > 0) {
ClientEndSessionData data;
data.manager = manager;
data.flags = GSM_CLIENT_END_SESSION_FLAG_LAST;
g_slist_foreach (manager->priv->next_query_clients,
(GFunc)_client_request_save,
&data);
g_slist_free (manager->priv->next_query_clients);
manager->priv->next_query_clients = NULL;
return;
}
if (manager->priv->query_timeout_id > 0) {
g_source_remove (manager->priv->query_timeout_id);
manager->priv->query_timeout_id = 0;
@@ -2790,96 +2790,96 @@ gsm_manager_initialization_error (GsmExportedManager *skeleton,
{
if (manager->priv->phase != GSM_MANAGER_PHASE_INITIALIZATION) {
g_dbus_method_invocation_return_error (invocation,
GSM_MANAGER_ERROR,
GSM_MANAGER_ERROR_NOT_IN_INITIALIZATION,
"InitializationError interface is only available during the Initialization phase");
return TRUE;
}
gsm_util_init_error (fatal, "%s", message);
gsm_exported_manager_complete_initialization_error (skeleton, invocation);
return TRUE;
}
static void
user_logout (GsmManager *manager,
GsmManagerLogoutMode mode)
{
if (manager->priv->phase >= GSM_MANAGER_PHASE_QUERY_END_SESSION) {
manager->priv->logout_mode = mode;
end_session_or_show_shell_dialog (manager);
return;
}
request_logout (manager, mode);
}
gboolean
gsm_manager_save_session (GsmManager *manager,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *invocation)
{
ClientEndSessionData data;
GError *error;
g_debug ("GsmManager: SaveSession called");
g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE);
if (manager->priv->phase != GSM_MANAGER_PHASE_RUNNING) {
error = g_error_new (GSM_MANAGER_ERROR,
GSM_MANAGER_ERROR_NOT_IN_RUNNING,
"SaveSession interface is only available during the Running phase");
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (invocation, error);
g_error_free (error);
return FALSE;
}
data.manager = manager;
data.flags = 0;
gsm_store_foreach (manager->priv->clients,
(GsmStoreFunc)_client_request_save_helper,
&data);
if (manager->priv->query_clients) {
manager->priv->query_timeout_id = g_timeout_add_seconds (GSM_MANAGER_SAVE_SESSION_TIMEOUT,
(GSourceFunc)_on_query_save_session_timeout,
manager);
manager->priv->pending_save_invocations = g_slist_prepend (manager->priv->pending_save_invocations,
- context);
+ invocation);
return TRUE;
} else {
g_debug ("GsmManager: Nothing to save");
- dbus_g_method_return (context);
+ g_dbus_method_invocation_return_value (invocation, NULL);
return TRUE;
}
return TRUE;
}
gboolean
gsm_manager_logout (GsmManager *manager,
guint logout_mode,
GError **error)
{
if (manager->priv->phase < GSM_MANAGER_PHASE_RUNNING) {
g_set_error (error,
GSM_MANAGER_ERROR,
GSM_MANAGER_ERROR_NOT_IN_RUNNING,
"Logout interface is only available after the Running phase starts");
return FALSE;
}
if (_log_out_is_locked_down (manager)) {
g_set_error (error,
GSM_MANAGER_ERROR,
GSM_MANAGER_ERROR_LOCKED_DOWN,
"Logout has been locked down");
return FALSE;
}
switch (logout_mode) {
case GSM_MANAGER_LOGOUT_MODE_NORMAL:
case GSM_MANAGER_LOGOUT_MODE_NO_CONFIRMATION:
diff --git a/gnome-session/gsm-manager.h b/gnome-session/gsm-manager.h
index fcf36019..88a88ccc 100644
--- a/gnome-session/gsm-manager.h
+++ b/gnome-session/gsm-manager.h
@@ -1,54 +1,55 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2008 William Jon McCann <jmccann@redhat.com>
*
* 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 of the License, 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __GSM_MANAGER_H
#define __GSM_MANAGER_H
#include <glib-object.h>
+#include <gio/gio.h>
#include "gsm-store.h"
#include "gsm-manager-logout-mode.h"
G_BEGIN_DECLS
#define GSM_TYPE_MANAGER (gsm_manager_get_type ())
#define GSM_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSM_TYPE_MANAGER, GsmManager))
#define GSM_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSM_TYPE_MANAGER, GsmManagerClass))
#define GSM_IS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSM_TYPE_MANAGER))
#define GSM_IS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSM_TYPE_MANAGER))
#define GSM_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSM_TYPE_MANAGER, GsmManagerClass))
typedef struct GsmManagerPrivate GsmManagerPrivate;
typedef struct
{
GObject parent;
GsmManagerPrivate *priv;
} GsmManager;
typedef struct
{
GObjectClass parent_class;
void (* phase_changed) (GsmManager *manager,
const char *phase);
} GsmManagerClass;
typedef enum {
@@ -98,42 +99,42 @@ GType gsm_manager_get_type (void);
GsmManager * gsm_manager_new (GsmStore *client_store,
gboolean failsafe);
GsmManager * gsm_manager_get (void);
gboolean gsm_manager_get_failsafe (GsmManager *manager);
gboolean gsm_manager_add_autostart_app (GsmManager *manager,
const char *path,
const char *provides);
gboolean gsm_manager_add_required_app (GsmManager *manager,
const char *path,
const char *provides);
gboolean gsm_manager_add_autostart_apps_from_dir (GsmManager *manager,
const char *path);
gboolean gsm_manager_add_legacy_session_apps (GsmManager *manager,
const char *path);
void gsm_manager_start (GsmManager *manager);
const char * _gsm_manager_get_default_session (GsmManager *manager);
char * _gsm_manager_get_saved_session (GsmManager *manager);
void _gsm_manager_set_active_session (GsmManager *manager,
const char *session_name,
gboolean is_fallback);
void _gsm_manager_set_renderer (GsmManager *manager,
const char *renderer);
gboolean gsm_manager_save_session (GsmManager *manager,
- DBusGMethodInvocation *context);
+ GDBusMethodInvocation *context);
gboolean gsm_manager_logout (GsmManager *manager,
guint logout_mode,
GError **error);
gboolean gsm_manager_set_phase (GsmManager *manager,
GsmManagerPhase phase);
G_END_DECLS
#endif /* __GSM_MANAGER_H */
diff --git a/tools/gnome-session-selector.c b/tools/gnome-session-selector.c
index a41cd260..6ad307b0 100644
--- a/tools/gnome-session-selector.c
+++ b/tools/gnome-session-selector.c
@@ -7,63 +7,60 @@
* the Free Software Foundation; either version 2 of the License, 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, see <http://www.gnu.org/licenses/>.
*
* Written by: Matthias Clasen <mclasen@redhat.com>
*/
#include "config.h"
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-
#define GSM_SERVICE_DBUS "org.gnome.SessionManager"
#define GSM_PATH_DBUS "/org/gnome/SessionManager"
#define GSM_INTERFACE_DBUS "org.gnome.SessionManager"
#define GSM_MANAGER_SCHEMA "org.gnome.SessionManager"
#define KEY_AUTOSAVE_ONE_SHOT "auto-save-session-one-shot"
#define DEFAULT_SESSION_NAME "gnome-classic"
static GtkBuilder *builder;
static GtkWidget *session_list;
static GtkListStore *store;
static GtkTreeModelSort *sort_model;
static char *info_text;
static void select_session (const char *name);
static gboolean make_session_current (const char *name);
static char *
get_session_path (const char *name)
{
return g_build_filename (g_get_user_config_dir (), "gnome-session", name, NULL);
}
static char *
find_new_session_name (void)
{
char *name;
char *path;
int i;
@@ -694,86 +691,93 @@ on_row_activated (GtkTreeView *tree_view,
gtk_main_quit ();
}
static void
auto_save_next_session (void)
{
GSettings *settings;
settings = g_settings_new (GSM_MANAGER_SCHEMA);
g_settings_set_boolean (settings, KEY_AUTOSAVE_ONE_SHOT, TRUE);
g_object_unref (settings);
}
static void
auto_save_next_session_if_needed (void)
{
char *marker;
marker = g_build_filename (g_get_user_config_dir (),
"gnome-session", "saved-session",
".new-session", NULL);
if (g_file_test (marker, G_FILE_TEST_EXISTS)) {
auto_save_next_session ();
unlink (marker);
}
g_free (marker);
}
static void
-save_session (void)
+session_saved_cb (GDBusConnection *conn,
+ GAsyncResult *result)
{
- DBusGConnection *conn;
- DBusGProxy *proxy;
- GError *error;
+ GVariant *reply;
- conn = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
- if (conn == NULL) {
- g_warning ("Could not connect to the session bus");
- return;
- }
+ reply = g_dbus_connection_call_finish (conn, result, NULL);
- proxy = dbus_g_proxy_new_for_name (conn, GSM_SERVICE_DBUS, GSM_PATH_DBUS, GSM_INTERFACE_DBUS);
- if (proxy == NULL) {
- g_warning ("Could not connect to the session manager");
- return;
- }
+ g_variant_unref (reply);
+}
- error = NULL;
- if (!dbus_g_proxy_call (proxy, "SaveSession", &error, G_TYPE_INVALID, G_TYPE_INVALID)) {
- g_warning ("Failed to save session: %s", error->message);
- g_error_free (error);
+static void
+save_session (void)
+{
+ GDBusConnection *conn;
+
+ conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+ if (conn == NULL) {
return;
}
- g_object_unref (proxy);
+ g_dbus_connection_call (conn,
+ GSM_SERVICE_DBUS,
+ GSM_PATH_DBUS,
+ GSM_INTERFACE_DBUS,
+ "SaveSession",
+ NULL,
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ (GAsyncReadyCallback)
+ session_saved_cb,
+ NULL);
}
static int
compare_sessions (GtkTreeModel *model,
GtkTreeIter *a,
GtkTreeIter *b,
gpointer data)
{
char *name_a, *name_b;
int result;
gtk_tree_model_get (model, a, 0, &name_a, -1);
gtk_tree_model_get (model, b, 0, &name_b, -1);
result = g_utf8_collate (name_a, name_b);
g_free (name_a);
g_free (name_b);
return result;
}
static void
on_map (GtkWidget *widget,
gpointer data)
{
gdk_window_focus (gtk_widget_get_window (widget), GDK_CURRENT_TIME);
}
int
--
2.14.2

91
SOURCES/0019-capplet-fix-disable-check-items.patch

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
From 0dfb463e126353b17d0c6ec63b99f10bae3fd919 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 27 Mar 2017 15:34:51 -0400
Subject: [PATCH 19/19] capplet: fix disable check items

An optimzation that tries to prevent transient desktop files from
accumulating in the user's homedirectory inadvertently broke the
ability for a user to disable startup applications.

This commit restores the broken functionality.
---
capplet/gsp-app.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/capplet/gsp-app.c b/capplet/gsp-app.c
index 123ab217..1a0580e6 100644
--- a/capplet/gsp-app.c
+++ b/capplet/gsp-app.c
@@ -315,64 +315,65 @@ _gsp_app_user_equal_system (GspApp *app,
char *str = NULL;
GKeyFile *keyfile = NULL;
GDesktopAppInfo *app_info = NULL;
manager = gsp_app_manager_get ();
system_dir = gsp_app_manager_get_dir (manager,
app->priv->xdg_system_position);
g_object_unref (manager);
if (!system_dir) {
goto out;
}
path = g_build_filename (system_dir, app->priv->basename, NULL);
keyfile = g_key_file_new ();
if (!g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, NULL)) {
goto out;
}
app_info = g_desktop_app_info_new_from_keyfile (keyfile);
if (!app_info) {
goto out;
}
if (g_desktop_app_info_get_is_hidden (app_info)) {
goto out;
}
if (g_desktop_app_info_has_key (app_info,
- GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED) &&
- !g_desktop_app_info_get_boolean (app_info,
- GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED)) {
- goto out;
+ GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED)) {
+ if (app->priv->enabled != g_desktop_app_info_get_boolean (app_info, GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED))
+ goto out;
+ } else if (!app->priv->enabled) {
+ goto out;
}
if (!g_desktop_app_info_get_show_in (app_info, NULL)) {
goto out;
}
if (g_desktop_app_info_get_nodisplay (app_info)) {
goto out;
}
str = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_NAME);
if (!_gsp_str_equal (str, app->priv->name)) {
goto out;
}
g_clear_pointer (&str, g_free);
str = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_COMMENT);
if (!_gsp_str_equal (str, app->priv->comment)) {
goto out;
}
g_clear_pointer (&str, g_free);
str = gsp_key_file_get_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_EXEC);
if (!_gsp_str_equal (str, app->priv->exec)) {
goto out;
}
g_clear_pointer (&str, g_free);
--
2.14.2

52
SOURCES/gnome-session-3.3.92-nv30.patch

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
From b524466482c9c64c11a55fb5d0174080471a1d5a Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Fri, 8 May 2015 16:41:38 -0400
Subject: [PATCH] blacklist NV30 adapter on nouveau until #745202 is fixed

---
data/hardware-compatibility | 3 +++
1 file changed, 3 insertions(+)

diff --git a/data/hardware-compatibility b/data/hardware-compatibility
index 48b7946..3daef68 100644
--- a/data/hardware-compatibility
+++ b/data/hardware-compatibility
@@ -1,32 +1,35 @@
##
## This file contains a list of blacklist/whitelist regular expressions for
## renderer strings.
##
## The regular expressions are case-insensitive POSIX Extended Regular
## Expressions. See regex(7) for details.
##
## Syntax:
## - Comment lines start with '#'
## - Lines starting with '+' are whitelisting.
## - Lines starting with '-' are blacklisting.
## - Lines not starting with '#', '+', '-' are ignored.
##
# Intel 830-865
-Intel\(R\) 8[[:digit:]]{2,2}[^[:digit:]]
# Intel IGD
-Intel IGD
# Pre-R300 radeon
-Mesa DRI R[12]00[^[:digit:]]
-Mesa DRI R[12]00$
+# NV30 family on Nouveau: https://bugzilla.redhat.com/show_bug.cgi?id=745202
+-Gallium .* on NV3[0-9A-F]$
+
# Old Mesa software GL renderer
-software rasterizer
# Gallium has softpipe; we explicitly enable llvmpipe
-softpipe
# nouveau vieux NV25 doesn't work too well
-Mesa DRI nv25
--
2.3.7

56
SOURCES/gnome-session-3.6.2-swrast.patch

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
From 69c18aa6324e7d3fd6f93ea7a79ce99bed1a452d Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Fri, 8 May 2015 16:46:47 -0400
Subject: [PATCH] Allow running on the classic software renderer

No effect on arches where we build llvmpipe,
but on ppc/s390 classic swrast is marginally
less painful than softpipe.
---
data/hardware-compatibility | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/hardware-compatibility b/data/hardware-compatibility
index 3daef68..fd06230 100644
--- a/data/hardware-compatibility
+++ b/data/hardware-compatibility
@@ -1,35 +1,35 @@
##
## This file contains a list of blacklist/whitelist regular expressions for
## renderer strings.
##
## The regular expressions are case-insensitive POSIX Extended Regular
## Expressions. See regex(7) for details.
##
## Syntax:
## - Comment lines start with '#'
## - Lines starting with '+' are whitelisting.
## - Lines starting with '-' are blacklisting.
## - Lines not starting with '#', '+', '-' are ignored.
##
# Intel 830-865
-Intel\(R\) 8[[:digit:]]{2,2}[^[:digit:]]
# Intel IGD
-Intel IGD
# Pre-R300 radeon
-Mesa DRI R[12]00[^[:digit:]]
-Mesa DRI R[12]00$
# NV30 family on Nouveau: https://bugzilla.redhat.com/show_bug.cgi?id=745202
-Gallium .* on NV3[0-9A-F]$
# Old Mesa software GL renderer
--software rasterizer
+#software rasterizer
# Gallium has softpipe; we explicitly enable llvmpipe
-softpipe
# nouveau vieux NV25 doesn't work too well
-Mesa DRI nv25
--
2.3.7

1397
SPECS/gnome-session.spec

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save