[gnome-shell] shell/global: Expose MetaContext as property



commit e726527604833566cf9435c278f90f9d28ebe436
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jul 16 20:58:27 2021 +0200

    shell/global: Expose MetaContext as property
    
    We'll likely have to interact a bit with the newly added Meta.Context
    object, so add a convenience property that gives us direct access
    instead of getting it from the display every time we need it.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1917>

 src/shell-global.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/src/shell-global.c b/src/shell-global.c
index 99d2ac0ca6..49ff2d7ddf 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -20,6 +20,7 @@
 #include <gio/gio.h>
 #include <girepository.h>
 #include <meta/meta-backend.h>
+#include <meta/meta-context.h>
 #include <meta/display.h>
 #include <meta/util.h>
 #include <meta/meta-shaped-texture.h>
@@ -52,6 +53,7 @@ struct _ShellGlobal {
   ClutterStage *stage;
 
   MetaBackend *backend;
+  MetaContext *meta_context;
   MetaDisplay *meta_display;
   MetaWorkspaceManager *workspace_manager;
   Display *xdisplay;
@@ -91,6 +93,7 @@ enum {
 
   PROP_SESSION_MODE,
   PROP_BACKEND,
+  PROP_CONTEXT,
   PROP_DISPLAY,
   PROP_WORKSPACE_MANAGER,
   PROP_SCREEN_WIDTH,
@@ -234,6 +237,9 @@ shell_global_get_property(GObject         *object,
     case PROP_BACKEND:
       g_value_set_object (value, global->backend);
       break;
+    case PROP_CONTEXT:
+      g_value_set_object (value, global->meta_context);
+      break;
     case PROP_DISPLAY:
       g_value_set_object (value, global->meta_display);
       break;
@@ -513,6 +519,13 @@ shell_global_class_init (ShellGlobalClass *klass)
                                                         "MetaBackend object",
                                                         META_TYPE_BACKEND,
                                                         G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class,
+                                   PROP_CONTEXT,
+                                   g_param_spec_object ("context",
+                                                        "Context",
+                                                        "MetaContext object",
+                                                        META_TYPE_CONTEXT,
+                                                        G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class,
                                    PROP_DISPLAY,
                                    g_param_spec_object ("display",
@@ -995,6 +1008,7 @@ _shell_global_set_plugin (ShellGlobal *global,
 
   display = meta_plugin_get_display (plugin);
   global->meta_display = display;
+  global->meta_context = meta_display_get_context (display);
   global->workspace_manager = meta_display_get_workspace_manager (display);
 
   global->stage = CLUTTER_STAGE (meta_get_stage_for_display (display));


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