[gnome-shell] global: Add concept of "session type"
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] global: Add concept of "session type"
- Date: Mon, 29 Aug 2011 16:22:44 +0000 (UTC)
commit 5088f2238890436840ebbca30460681a1caaf5d2
Author: Ray Strode <rstrode redhat com>
Date: Tue Jun 21 10:09:09 2011 -0400
global: Add concept of "session type"
This commit introduces a "session type" for
gnome-shell. It essentially defines what
mode of operation the shell runs in
(normal-in-a-users-session mode, or at-the-login-screen mode).
Note this commit only lays the groundwork. Actually
looking at the key and appropriately differentiating
the UI will happen in subsequent commits.
https://bugzilla.gnome.org/show_bug.cgi?id=657082
src/main.c | 17 +++++++++++++++-
src/shell-global-private.h | 3 ++
src/shell-global.c | 47 +++++++++++++++++++++++++++++++++++++++++++-
src/shell-global.h | 7 +++++-
4 files changed, 71 insertions(+), 3 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 1b96a25..116f00f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -23,6 +23,7 @@
#include <telepathy-glib/debug-sender.h>
#include "shell-a11y.h"
+#include "shell-global.h"
#include "shell-global-private.h"
#include "shell-perf-log.h"
#include "st.h"
@@ -32,6 +33,8 @@ extern GType gnome_shell_plugin_get_type (void);
#define SHELL_DBUS_SERVICE "org.gnome.Shell"
#define MAGNIFIER_DBUS_SERVICE "org.gnome.Magnifier"
+static gboolean is_gdm_mode = FALSE;
+
static void
shell_dbus_init (gboolean replace)
{
@@ -466,6 +469,12 @@ GOptionEntry gnome_shell_options[] = {
N_("Print version"),
NULL
},
+ {
+ "gdm-mode", 0, 0, G_OPTION_ARG_NONE,
+ &is_gdm_mode,
+ N_("Mode used by GDM for login screen"),
+ NULL
+ },
{ NULL }
};
@@ -474,6 +483,7 @@ main (int argc, char **argv)
{
GOptionContext *ctx;
GError *error = NULL;
+ ShellSessionType session_type;
int ecode;
TpDebugSender *sender;
@@ -540,7 +550,12 @@ main (int argc, char **argv)
g_log_set_default_handler (default_log_handler, sender);
/* Initialize the global object */
- _shell_global_init (NULL);
+ if (is_gdm_mode)
+ session_type = SHELL_SESSION_GDM;
+ else
+ session_type = SHELL_SESSION_USER;
+
+ _shell_global_init ("session-type", session_type, NULL);
ecode = meta_run ();
diff --git a/src/shell-global-private.h b/src/shell-global-private.h
index f10dfb8..a44b4dc 100644
--- a/src/shell-global-private.h
+++ b/src/shell-global-private.h
@@ -16,6 +16,9 @@ GjsContext *_shell_global_get_gjs_context (ShellGlobal *global);
gboolean _shell_global_check_xdnd_event (ShellGlobal *global,
XEvent *xev);
+void _shell_global_set_session_type (ShellGlobal *global,
+ ShellSessionType session_type);
+
/* Used for async screenshot grabbing */
typedef struct _screenshot_data {
ShellGlobal *global;
diff --git a/src/shell-global.c b/src/shell-global.c
index 7160c2d..3334b52 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -56,6 +56,8 @@ struct _ShellGlobal {
MetaScreen *meta_screen;
GdkScreen *gdk_screen;
+ ShellSessionType session_type;
+
/* We use this window to get a notification from GTK+ when
* a widget in our process does a GTK+ grab. See
* http://bugzilla.gnome.org/show_bug.cgi?id=570641
@@ -90,6 +92,7 @@ struct _ShellGlobal {
enum {
PROP_0,
+ PROP_SESSION_TYPE,
PROP_OVERLAY_GROUP,
PROP_SCREEN,
PROP_GDK_SCREEN,
@@ -135,7 +138,9 @@ shell_global_set_property(GObject *object,
case PROP_STAGE_INPUT_MODE:
shell_global_set_stage_input_mode (global, g_value_get_enum (value));
break;
-
+ case PROP_SESSION_TYPE:
+ global->session_type = g_value_get_enum (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -152,6 +157,9 @@ shell_global_get_property(GObject *object,
switch (prop_id)
{
+ case PROP_SESSION_TYPE:
+ g_value_set_enum (value, shell_global_get_session_type (global));
+ break;
case PROP_OVERLAY_GROUP:
g_value_set_object (value, meta_get_overlay_group_for_screen (global->meta_screen));
break;
@@ -331,6 +339,14 @@ shell_global_class_init (ShellGlobalClass *klass)
G_TYPE_STRING);
g_object_class_install_property (gobject_class,
+ PROP_SESSION_TYPE,
+ g_param_spec_enum ("session-type",
+ "Session Type",
+ "The type of session",
+ SHELL_TYPE_SESSION_TYPE,
+ SHELL_SESSION_USER,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (gobject_class,
PROP_OVERLAY_GROUP,
g_param_spec_object ("overlay-group",
"Overlay Group",
@@ -1886,3 +1902,32 @@ shell_global_screenshot_window (ShellGlobal *global,
return status == CAIRO_STATUS_SUCCESS;
}
+
+/**
+ * shell_global_get_session_type:
+ * @global: The #ShellGlobal.
+ *
+ * Gets the type of session gnome-shell provides.
+ *
+ * The type determines what UI elements are displayed,
+ * what keybindings work, and generally how the shell
+ * behaves.
+ *
+ * A session type of #SHELL_SESSION_USER means gnome-shell
+ * will enable the activities overview, status menu, run dialog,
+ * etc. This is the default.
+ *
+ * A session type of #SHELL_SESSION_GDM means gnome-shell
+ * will enable a login dialog and run in a more confined
+ * way. This type is suitable for the display manager.
+ *
+ * Returns the type of session gnome-shell is providing.
+ */
+ShellSessionType
+shell_global_get_session_type (ShellGlobal *global)
+{
+ g_return_val_if_fail (SHELL_IS_GLOBAL (global),
+ SHELL_SESSION_USER);
+
+ return global->session_type;
+}
diff --git a/src/shell-global.h b/src/shell-global.h
index aa1941a..4018f5f 100644
--- a/src/shell-global.h
+++ b/src/shell-global.h
@@ -142,7 +142,6 @@ void shell_global_reexec_self (ShellGlobal *global);
void shell_global_launch_calendar_server (ShellGlobal *global);
-
typedef void (*ShellGlobalScreenshotCallback) (ShellGlobal *global, gboolean success);
void shell_global_screenshot_area (ShellGlobal *global,
@@ -160,6 +159,12 @@ gboolean shell_global_screenshot_window (ShellGlobal *global,
void shell_global_screenshot (ShellGlobal *global,
const char *filename,
ShellGlobalScreenshotCallback callback);
+typedef enum {
+ SHELL_SESSION_USER,
+ SHELL_SESSION_GDM
+} ShellSessionType;
+
+ShellSessionType shell_global_get_session_type (ShellGlobal *global);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]