[Xfce4-commits] <xfce4-panel:master> Loading external gtk3 panel plugins in gtk2 panel.
Nick Schermer
noreply at xfce.org
Sat Nov 30 17:12:01 CET 2013
Updating branch refs/heads/master
to 69c1239522b65f6fda32924d5d3c933d47494361 (commit)
from 25ccc0d24eba707b0750640c50693b0ab5b1808f (commit)
commit 69c1239522b65f6fda32924d5d3c933d47494361
Author: Andrzej <ndrwrdck at gmail.com>
Date: Sun Apr 7 22:49:33 2013 +0100
Loading external gtk3 panel plugins in gtk2 panel.
Requires a gtk3 version of libxfce4-panel and wrapper to be compiled
from another branch.
This commit is only a quick hack to make the plugins to load.
It should be reworked (starting from better naming) for a release
version.
panel/panel-module.c | 19 +++++++++++++++++--
panel/panel-plugin-external-wrapper.c | 8 +++++++-
panel/panel-plugin-external-wrapper.h | 1 +
panel/panel-plugin-external.c | 18 ++++++++++++++++++
panel/panel-plugin-external.h | 1 +
5 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/panel/panel-module.c b/panel/panel-module.c
index ba39320..6abd362 100644
--- a/panel/panel-module.c
+++ b/panel/panel-module.c
@@ -63,6 +63,7 @@ enum _PanelModuleRunMode
UNKNOWN, /* Unset */
INTERNAL, /* plugin library will be loaded in the panel */
WRAPPER, /* external library with comunication through PanelPluginExternal */
+ WRAPPER3, /* external library with comunication through PanelPluginExternal */
EXTERNAL_46 /* external executable with comunication through PanelPluginExternal46 */
};
@@ -360,7 +361,16 @@ panel_module_new_from_desktop_file (const gchar *filename,
/* run mode of the module, by default everything runs in
* the wrapper, unless defined otherwise */
if (force_external || !xfce_rc_read_bool_entry (rc, "X-XFCE-Internal", FALSE))
- module->mode = WRAPPER;
+ if (!xfce_rc_read_bool_entry (rc, "X-XFCE-Gtk3", TRUE))
+ {
+ printf ("wrapper3 %s\n", path);
+ module->mode = WRAPPER3;
+ }
+ else
+ {
+ printf ("wrapper %s\n", path);
+ module->mode = WRAPPER;
+ }
else
module->mode = INTERNAL;
}
@@ -481,8 +491,13 @@ panel_module_new_plugin (PanelModule *module,
/* fall-through (make wrapper plugin), probably a plugin with
* preinit_func which is not supported for internal plugins */
+ case WRAPPER3:
+ plugin = panel_plugin_external_wrapper_new (module, unique_id, TRUE, arguments);
+ debug_type = "external-wrapper3";
+ break;
+
case WRAPPER:
- plugin = panel_plugin_external_wrapper_new (module, unique_id, arguments);
+ plugin = panel_plugin_external_wrapper_new (module, unique_id, FALSE, arguments);
debug_type = "external-wrapper";
break;
diff --git a/panel/panel-plugin-external-wrapper.c b/panel/panel-plugin-external-wrapper.c
index 06f6e63..89c5674 100644
--- a/panel/panel-plugin-external-wrapper.c
+++ b/panel/panel-plugin-external-wrapper.c
@@ -52,6 +52,7 @@
#define WRAPPER_BIN HELPERDIR G_DIR_SEPARATOR_S "wrapper"
+#define WRAPPER3_BIN HELPERDIR G_DIR_SEPARATOR_S "wrapper3"
@@ -218,7 +219,10 @@ panel_plugin_external_wrapper_get_argv (PanelPluginExternal *external,
/* setup the basic argv */
argv = g_new0 (gchar *, argc + 1);
- argv[PLUGIN_ARGV_0] = g_strdup (WRAPPER_BIN);
+ if (external->is_gtk3)
+ argv[PLUGIN_ARGV_0] = g_strdup (WRAPPER3_BIN);
+ else
+ argv[PLUGIN_ARGV_0] = g_strdup (WRAPPER_BIN);
argv[PLUGIN_ARGV_FILENAME] = g_strdup (panel_module_get_filename (external->module));
argv[PLUGIN_ARGV_UNIQUE_ID] = g_strdup_printf ("%d", external->unique_id);;
argv[PLUGIN_ARGV_SOCKET_ID] = g_strdup_printf ("%u", gtk_socket_get_id (GTK_SOCKET (external)));;
@@ -366,6 +370,7 @@ panel_plugin_external_wrapper_dbus_remote_event_result (PanelPluginExternalWrapp
GtkWidget *
panel_plugin_external_wrapper_new (PanelModule *module,
gint unique_id,
+ gboolean is_gtk3,
gchar **arguments)
{
panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
@@ -374,5 +379,6 @@ panel_plugin_external_wrapper_new (PanelModule *module,
return g_object_new (PANEL_TYPE_PLUGIN_EXTERNAL_WRAPPER,
"module", module,
"unique-id", unique_id,
+ "is-gtk3", is_gtk3,
"arguments", arguments, NULL);
}
diff --git a/panel/panel-plugin-external-wrapper.h b/panel/panel-plugin-external-wrapper.h
index eaa3ee9..e4bb1b2 100644
--- a/panel/panel-plugin-external-wrapper.h
+++ b/panel/panel-plugin-external-wrapper.h
@@ -40,6 +40,7 @@ GType panel_plugin_external_wrapper_get_type (void) G_GNUC_CONST;
GtkWidget *panel_plugin_external_wrapper_new (PanelModule *module,
gint unique_id,
+ gboolean is_gtk3,
gchar **arguments) G_GNUC_MALLOC;
G_END_DECLS
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index b9e8f36..f26adf7 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -133,6 +133,7 @@ enum
PROP_0,
PROP_MODULE,
PROP_UNIQUE_ID,
+ PROP_IS_GTK3,
PROP_ARGUMENTS
};
@@ -174,6 +175,14 @@ panel_plugin_external_class_init (PanelPluginExternalClass *klass)
| G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class,
+ PROP_IS_GTK3,
+ g_param_spec_boolean ("is-gtk3",
+ NULL, NULL,
+ FALSE,
+ EXO_PARAM_READWRITE
+ | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (gobject_class,
PROP_MODULE,
g_param_spec_object ("module",
NULL, NULL,
@@ -201,6 +210,7 @@ panel_plugin_external_init (PanelPluginExternal *external)
external->show_configure = FALSE;
external->show_about = FALSE;
external->unique_id = -1;
+ external->is_gtk3 = FALSE;
external->priv->arguments = NULL;
external->priv->queue = NULL;
@@ -281,6 +291,10 @@ panel_plugin_external_get_property (GObject *object,
g_value_set_int (value, external->unique_id);
break;
+ case PROP_IS_GTK3:
+ g_value_set_boolean (value, external->is_gtk3);
+ break;
+
case PROP_ARGUMENTS:
g_value_set_boxed (value, external->priv->arguments);
break;
@@ -311,6 +325,10 @@ panel_plugin_external_set_property (GObject *object,
external->unique_id = g_value_get_int (value);
break;
+ case PROP_IS_GTK3:
+ external->is_gtk3 = g_value_get_boolean (value);
+ break;
+
case PROP_ARGUMENTS:
external->priv->arguments = g_value_dup_boxed (value);
break;
diff --git a/panel/panel-plugin-external.h b/panel/panel-plugin-external.h
index 5163447..31774fa 100644
--- a/panel/panel-plugin-external.h
+++ b/panel/panel-plugin-external.h
@@ -70,6 +70,7 @@ struct _PanelPluginExternal
* implementations of the abstract object */
guint show_configure : 1;
guint show_about : 1;
+ gboolean is_gtk3;
};
typedef struct
More information about the Xfce4-commits
mailing list