From 109dc78304c309c368b95df17ee9a057fbb72402 Mon Sep 17 00:00:00 2001 From: lukefromdc Date: Fri, 14 Jul 2017 03:21:51 -0400 Subject: libpanel-applet: add process type to private data We will need to know this as soon we will create GtkPlug and GtkSocket only for out of process applets. based on https://github.com/GNOME/gnome-panel/commit/dafdc5714a6cfc7ebf26fcbd614b48cfc790b954 --- libmate-panel-applet/mate-panel-applet-factory.c | 4 ++++ libmate-panel-applet/mate-panel-applet-factory.h | 1 + libmate-panel-applet/mate-panel-applet.c | 19 ++++++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/libmate-panel-applet/mate-panel-applet-factory.c b/libmate-panel-applet/mate-panel-applet-factory.c index 82d256ac..63f41950 100644 --- a/libmate-panel-applet/mate-panel-applet-factory.c +++ b/libmate-panel-applet/mate-panel-applet-factory.c @@ -28,6 +28,7 @@ struct _MatePanelAppletFactory { gchar *factory_id; guint n_applets; + gboolean out_of_process; GType applet_type; GClosure *closure; }; @@ -83,6 +84,7 @@ mate_panel_applet_factory_applet_removed (MatePanelAppletFactory *factory, MatePanelAppletFactory * mate_panel_applet_factory_new (const gchar *factory_id, + gboolean out_of_process, GType applet_type, GClosure *closure) { @@ -90,6 +92,7 @@ mate_panel_applet_factory_new (const gchar *factory_id, factory = MATE_PANEL_APPLET_FACTORY (g_object_new (PANEL_TYPE_APPLET_FACTORY, NULL)); factory->factory_id = g_strdup (factory_id); + factory->out_of_process = out_of_process; factory->applet_type = applet_type; factory->closure = g_closure_ref (closure); @@ -150,6 +153,7 @@ mate_panel_applet_factory_get_applet (MatePanelAppletFactory *factory, g_variant_get (parameters, "(&si@a{sv})", &applet_id, &screen_num, &props); applet = g_object_new (factory->applet_type, + "out-of-process", factory->out_of_process, "id", applet_id, "connection", connection, "closure", factory->closure, diff --git a/libmate-panel-applet/mate-panel-applet-factory.h b/libmate-panel-applet/mate-panel-applet-factory.h index 52fb23b4..4bffc444 100644 --- a/libmate-panel-applet/mate-panel-applet-factory.h +++ b/libmate-panel-applet/mate-panel-applet-factory.h @@ -40,6 +40,7 @@ typedef struct _MatePanelAppletFactoryClass MatePanelAppletFactoryClass; GType mate_panel_applet_factory_get_type (void) G_GNUC_CONST; MatePanelAppletFactory *mate_panel_applet_factory_new (const gchar *applet_id, + gboolean out_of_process, GType applet_type, GClosure *closure); gboolean mate_panel_applet_factory_register_service (MatePanelAppletFactory *factory); diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c index c83e5671..4f7f430f 100644 --- a/libmate-panel-applet/mate-panel-applet.c +++ b/libmate-panel-applet/mate-panel-applet.c @@ -55,6 +55,8 @@ struct _MatePanelAppletPrivate { GtkWidget *applet; GDBusConnection *connection; + gboolean out_of_process; + char *id; GClosure *closure; char *object_path; @@ -97,6 +99,7 @@ static guint mate_panel_applet_signals[LAST_SIGNAL] = { 0 }; enum { PROP_0, + PROP_OUT_OF_PROCESS, PROP_ID, PROP_CLOSURE, PROP_CONNECTION, @@ -1619,6 +1622,9 @@ mate_panel_applet_get_property (GObject *object, MatePanelApplet *applet = MATE_PANEL_APPLET (object); switch (prop_id) { + case PROP_OUT_OF_PROCESS: + g_value_set_boolean (value, applet->priv->out_of_process); + break; case PROP_ID: g_value_set_string (value, applet->priv->id); break; @@ -1677,6 +1683,9 @@ mate_panel_applet_set_property (GObject *object, MatePanelApplet *applet = MATE_PANEL_APPLET (object); switch (prop_id) { + case PROP_OUT_OF_PROCESS: + applet->priv->out_of_process = g_value_get_boolean (value); + break; case PROP_ID: applet->priv->id = g_value_dup_string (value); break; @@ -1922,6 +1931,14 @@ mate_panel_applet_class_init (MatePanelAppletClass *klass) g_type_class_add_private (klass, sizeof (MatePanelAppletPrivate)); + g_object_class_install_property (gobject_class, + PROP_OUT_OF_PROCESS, + g_param_spec_boolean ("out-of-process", + "out-of-process", + "out-of-process", + TRUE, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_ID, g_param_spec_string ("id", @@ -2311,7 +2328,7 @@ _mate_panel_applet_factory_main_internal (const gchar *factory_id, } closure = g_cclosure_new(G_CALLBACK(callback), user_data, NULL); - factory = mate_panel_applet_factory_new(factory_id, applet_type, closure); + factory = mate_panel_applet_factory_new(factory_id, out_process, applet_type, closure); g_closure_unref(closure); if (mate_panel_applet_factory_register_service(factory)) -- cgit v1.2.1