[gnome-shell-extensions/wip/apps-menu: 2/2] Add a helper to set DCONF_PROFILE
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/wip/apps-menu: 2/2] Add a helper to set DCONF_PROFILE
- Date: Thu, 24 Jan 2013 19:55:39 +0000 (UTC)
commit 39c000239a1613ef70deab3e40e3c18f1c64f74f
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Jan 24 18:40:57 2013 +0100
Add a helper to set DCONF_PROFILE
Makefile.am | 4 +-
configure.ac | 4 ++
data/Makefile.am | 7 ++++
data/gnome-classic-session-helper.desktop.in.in | 9 +++++
data/gnome-classic.session.desktop.in.in | 2 +-
helper/Makefile.am | 20 +++++++++++
helper/gnome-classic-session-helper.in | 20 +++++++++++
helper/main.js | 42 +++++++++++++++++++++++
8 files changed, 105 insertions(+), 3 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index f34d0b0..c560d66 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,11 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-DIST_SUBDIRS = data extensions po
+DIST_SUBDIRS = data extensions helper po
SUBDIRS = extensions po
if CLASSIC_MODE
-SUBDIRS += data
+SUBDIRS += data helper
endif
EXTRA_DIST = lib/convenience.js
diff --git a/configure.ac b/configure.ac
index 536ba3d..2acf319 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,6 +18,9 @@ PKG_PROG_PKG_CONFIG([0.22])
GLIB_GSETTINGS
+GJS_CONSOLE=`$PKG_CONFIG --variable=gjs_console gjs-1.0`
+AC_SUBST(GJS_CONSOLE)
+
SHELL_VERSION="$PACKAGE_VERSION"
shell_major=`echo "$PACKAGE_VERSION" | cut -d'.' -f1`
shell_minor=`echo "$PACKAGE_VERSION" | cut -d'.' -f2`
@@ -101,6 +104,7 @@ AC_CONFIG_FILES([
extensions/workspace-indicator/Makefile
extensions/xrandr-indicator/Makefile
extensions/Makefile
+ helper/Makefile
Makefile
po/Makefile.in
])
diff --git a/data/Makefile.am b/data/Makefile.am
index 4744566..f09f20d 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,5 +1,10 @@
include $(top_srcdir)/include.mk
+autostartdir = $(sysconfdir)/xdg/autostart
+autostart_in_in_files = gnome-classic-session-helper.desktop.in.in
+autostart_in_files = $(autostart_in_in_files:.desktop.in.in=.desktop.in)
+autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
+
desktopdir = $(datadir)/applications
desktop_in_in_files = gnome-shell-classic.desktop.in.in
desktop_in_files = $(desktop_in_in_files:.desktop.in.in=.desktop.in)
@@ -40,6 +45,7 @@ extension_list:=$(subst $(space),$(comma),$(extensions))
@INTLTOOL_DESKTOP_RULE@
EXTRA_DIST = \
+ $(autostart_in_in_files) \
$(desktop_in_in_files) \
$(session_in_in_files) \
$(xsession_in_files) \
@@ -47,6 +53,7 @@ EXTRA_DIST = \
$(NULL)
CLEANFILES = \
+ $(autostart_DATA) \
$(desktop_DATA) \
$(session_DATA) \
$(xsession_DATA) \
diff --git a/data/gnome-classic-session-helper.desktop.in.in b/data/gnome-classic-session-helper.desktop.in.in
new file mode 100644
index 0000000..8c75f75
--- /dev/null
+++ b/data/gnome-classic-session-helper.desktop.in.in
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Application
+_Name=GNOME Classic Session Helper
+Exec= libexecdir@/gnome-classic-session-helper
+OnlyShowIn=GNOME;
+NoDisplay=true
+X-GNOME-Autostart-Phase=Initialization
+X-GNOME-Autostart-Notify=true
+X-GNOME-AutoRestart=true
diff --git a/data/gnome-classic.session.desktop.in.in b/data/gnome-classic.session.desktop.in.in
index f728aae..17abaed 100644
--- a/data/gnome-classic.session.desktop.in.in
+++ b/data/gnome-classic.session.desktop.in.in
@@ -1,5 +1,5 @@
[GNOME Session]
_Name=GNOME Classic
-RequiredComponents=gnome-shell-classic;gnome-settings-daemon;
+RequiredComponents=gnome-shell-classic;gnome-settings-daemon;gnome-classic-session-helper
IsRunnableHelper= libexecdir@/gnome-session-check-accelerated
FallbackSession=gnome-fallback
diff --git a/helper/Makefile.am b/helper/Makefile.am
new file mode 100644
index 0000000..7077c63
--- /dev/null
+++ b/helper/Makefile.am
@@ -0,0 +1,20 @@
+# convenience command for doing Makefile variable substitutions in non-Makefile
+# files (scripts, service files, etc.)
+do_subst = sed -e 's|@pkglibdir[ ]|$(pkglibdir)|g' \
+ -e 's|@pkgdatadir[ ]|$(pkgdatadir)|g' \
+ -e 's|@GJS_CONSOLE[ ]|$(GJS_CONSOLE)|g'
+
+helperdir = $(libexecdir)
+helper_SCRIPTS = gnome-classic-session-helper
+
+jsdir = $(pkgdatadir)/js
+dist_js_DATA = main.js
+
+gnome-classic-session-helper: gnome-classic-session-helper.in
+ $(AM_V_GEN) $(do_subst) $< > $@
+ chmod +x $@
+
+CLEANFILES = \
+ gnome-classic-session-helper
+EXTRA_DIST = \
+ gnome-classic-session-helper.in
diff --git a/helper/gnome-classic-session-helper.in b/helper/gnome-classic-session-helper.in
new file mode 100644
index 0000000..f91a82f
--- /dev/null
+++ b/helper/gnome-classic-session-helper.in
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+export GJS_PATH="@pkgdatadir@/js${GJS_PATH:+:$GJS_PATH}"
+export GI_TYPELIB_PATH="@pkglibdir@/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
+export LD_LIBRARY_PATH="@pkglibdir ${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+
+if test x"$GJS_DEBUG_OUTPUT" = x ; then
+ export GJS_DEBUG_OUTPUT=stderr
+fi
+
+if test x"$GJS_DEBUG_TOPICS" = x ; then
+ export GJS_DEBUG_TOPICS="JS ERROR;JS LOG"
+fi
+
+DEBUG_COMMAND=""
+if test x"$CLASSIC_SESSION_HELPER_RUN_DEBUG" != x; then
+ DEBUG_COMMAND="gdb --args"
+fi
+
+exec $DEBUG_COMMAND @GJS_CONSOLE@ -I @pkgdatadir@/js -c "const Main = imports.main; Main.start();" "$@"
diff --git a/helper/main.js b/helper/main.js
new file mode 100644
index 0000000..3cf2caa
--- /dev/null
+++ b/helper/main.js
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2013 Red Hat, Inc.
+ *
+ * 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/>.
+ */
+
+const GLib = imports.gi.GLib;
+const Gio = imports.gi.Gio;
+
+const SessionManagerIface = <interface name='org.gnome.SessionManager'>
+ <method name='IsSessionRunning'>
+ <arg name='running' type='b' direction='out' />
+ </method>
+ <method name='Setenv'>
+ <arg name='variable' type='s' direction='in' />
+ <arg name='value' type='s' direction='in' />
+ </method>
+</interface>;
+
+const SessionManagerProxy = Gio.DBusProxy.makeProxyWrapper(SessionManagerIface);
+
+function SessionManagerService() {
+ return new SessionManagerProxy(Gio.DBus.session, 'org.gnome.SessionManager', '/org/gnome/SessionManager');
+}
+
+function start() {
+ var sessionManagerService = new SessionManagerService();
+ log(sessionManagerService.IsSessionRunningSync());
+ log(sessionManagerService.SetenvSync('DCONF_PROFILE', 'gnome-classic'));
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]