[gnome-shell] Store GjsContext pointer in ShellGlobal



commit baf823c46663228e109a2536de2ecb005cb6697d
Author: Colin Walters <walters verbum org>
Date:   Sat Oct 24 13:40:13 2009 -0400

    Store GjsContext pointer in ShellGlobal
    
    Future functionality in ShellGlobal needs access to the GjsContext.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=599561

 src/gnome-shell-plugin.c   |    4 +++-
 src/shell-global-private.h |   12 ++++++++++++
 src/shell-global.c         |   11 ++++++++++-
 3 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-shell-plugin.c b/src/gnome-shell-plugin.c
index 0485480..bf6c6a0 100644
--- a/src/gnome-shell-plugin.c
+++ b/src/gnome-shell-plugin.c
@@ -40,7 +40,7 @@
 
 #include "display.h"
 
-#include "shell-global.h"
+#include "shell-global-private.h"
 #include "shell-wm.h"
 
 static void gnome_shell_plugin_constructed (GObject *object);
@@ -192,6 +192,8 @@ gnome_shell_plugin_constructed (GObject *object)
   shell_plugin->gjs_context = gjs_context_new_with_search_path(search_path);
   g_strfreev(search_path);
 
+  _shell_global_set_gjs_context (shell_global_get (), shell_plugin->gjs_context);
+
   if (!gjs_context_eval (shell_plugin->gjs_context,
                          "const Main = imports.ui.main; Main.start();",
                          -1,
diff --git a/src/shell-global-private.h b/src/shell-global-private.h
new file mode 100644
index 0000000..234388c
--- /dev/null
+++ b/src/shell-global-private.h
@@ -0,0 +1,12 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+#ifndef __SHELL_GLOBAL_PRIVATE_H__
+#define __SHELL_GLOBAL_PRIVATE_H__
+
+#include "shell-global.h"
+
+#include <gjs/gjs.h>
+
+void _shell_global_set_gjs_context (ShellGlobal *global,
+                                    GjsContext  *context);
+
+#endif /* __SHELL_GLOBAL_PRIVATE_H__ */
diff --git a/src/shell-global.c b/src/shell-global.c
index bad1706..ccb3734 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -18,6 +18,7 @@
 #include <glib/gi18n-lib.h>
 #include <math.h>
 #include <X11/extensions/Xfixes.h>
+#include <gjs/gjs.h>
 
 #define SHELL_DBUS_SERVICE "org.gnome.Shell"
 
@@ -37,7 +38,8 @@ struct _ShellGlobal {
 
   ShellStageInputMode input_mode;
   XserverRegion input_region;
-  
+
+  GjsContext *js_context;
   MutterPlugin *plugin;
   ShellWM *wm;
   const char *datadir;
@@ -445,6 +447,13 @@ _shell_global_set_plugin (ShellGlobal  *global,
   global->wm = shell_wm_new (plugin);
 }
 
+void
+_shell_global_set_gjs_context (ShellGlobal *global,
+                               GjsContext  *context)
+{
+  global->js_context = context;
+}
+
 /**
  * shell_global_begin_modal:
  * @global: a #ShellGlobal



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]