[gnome-panel] libpanel-applet: add process type to private data
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] libpanel-applet: add process type to private data
- Date: Thu, 6 Nov 2014 22:01:27 +0000 (UTC)
commit dafdc5714a6cfc7ebf26fcbd614b48cfc790b954
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Nov 6 18:35:42 2014 +0200
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.
libpanel-applet/panel-applet-factory.c | 4 ++++
libpanel-applet/panel-applet-factory.h | 1 +
libpanel-applet/panel-applet.c | 24 +++++++++++++++++++++++-
3 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/libpanel-applet/panel-applet-factory.c b/libpanel-applet/panel-applet-factory.c
index 21f9014..63ffee2 100644
--- a/libpanel-applet/panel-applet-factory.c
+++ b/libpanel-applet/panel-applet-factory.c
@@ -26,6 +26,7 @@ struct _PanelAppletFactory {
gchar *factory_id;
guint n_applets;
+ gboolean out_of_process;
GType applet_type;
GClosure *closure;
@@ -95,6 +96,7 @@ panel_applet_factory_applet_removed (PanelAppletFactory *factory,
PanelAppletFactory *
panel_applet_factory_new (const gchar *factory_id,
+ gboolean out_of_process,
GType applet_type,
GClosure *closure)
{
@@ -102,6 +104,7 @@ panel_applet_factory_new (const gchar *factory_id,
factory = 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);
@@ -162,6 +165,7 @@ panel_applet_factory_get_applet (PanelAppletFactory *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/libpanel-applet/panel-applet-factory.h b/libpanel-applet/panel-applet-factory.h
index 06f1e74..3c40390 100644
--- a/libpanel-applet/panel-applet-factory.h
+++ b/libpanel-applet/panel-applet-factory.h
@@ -36,6 +36,7 @@ typedef struct _PanelAppletFactoryClass PanelAppletFactoryClass;
GType panel_applet_factory_get_type (void) G_GNUC_CONST;
PanelAppletFactory *panel_applet_factory_new (const gchar *applet_id,
+ gboolean out_of_process,
GType applet_type,
GClosure *closure);
gboolean panel_applet_factory_register_service (PanelAppletFactory *factory);
diff --git a/libpanel-applet/panel-applet.c b/libpanel-applet/panel-applet.c
index cc7b15f..308a44e 100644
--- a/libpanel-applet/panel-applet.c
+++ b/libpanel-applet/panel-applet.c
@@ -81,6 +81,8 @@ struct _PanelAppletPrivate {
GtkWidget *applet;
GDBusConnection *connection;
+ gboolean out_of_process;
+
char *id;
GClosure *closure;
char *object_path;
@@ -118,6 +120,7 @@ static guint panel_applet_signals [LAST_SIGNAL];
enum {
PROP_0,
+ PROP_OUT_OF_PROCESS,
PROP_ID,
PROP_CLOSURE,
PROP_CONNECTION,
@@ -1641,6 +1644,9 @@ panel_applet_get_property (GObject *object,
PanelApplet *applet = 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;
@@ -1693,6 +1699,9 @@ panel_applet_set_property (GObject *object,
PanelApplet *applet = 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;
@@ -1875,6 +1884,19 @@ panel_applet_class_init (PanelAppletClass *klass)
g_type_class_add_private (klass, sizeof (PanelAppletPrivate));
/**
+ * PanelApplet:out-of-process: (skip)
+ *
+ * Implementation detail.
+ **/
+ 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));
+ /**
* PanelApplet:id: (skip)
*
* Implementation detail.
@@ -2294,7 +2316,7 @@ _panel_applet_factory_main_internal (const gchar *factory_id,
_panel_applet_setup_x_error_handler ();
closure = g_cclosure_new (G_CALLBACK (callback), user_data, NULL);
- factory = panel_applet_factory_new (factory_id, applet_type, closure);
+ factory = panel_applet_factory_new (factory_id, out_process, applet_type, closure);
g_closure_unref (closure);
if (panel_applet_factory_register_service (factory)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]