summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libmate-panel-applet/mate-panel-applet.c29
-rw-r--r--mate-panel/libmate-panel-applet-private/panel-applet-container.c39
2 files changed, 57 insertions, 11 deletions
diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c
index bf7a1f35..e881667e 100644
--- a/libmate-panel-applet/mate-panel-applet.c
+++ b/libmate-panel-applet/mate-panel-applet.c
@@ -908,13 +908,19 @@ mate_panel_applet_can_focus (GtkWidget *widget)
/* Taken from libmatecomponentui/matecomponent/matecomponent-plug.c */
static gboolean
-mate_panel_applet_button_event (GtkWidget *widget,
+mate_panel_applet_button_event (MatePanelApplet *applet,
GdkEventButton *event)
{
+ GtkWidget *widget;
GdkWindow *window;
GdkWindow *socket_window;
XEvent xevent;
+ if (!applet->priv->out_of_process)
+ return FALSE;
+
+ widget = applet->priv->plug;
+
if (!gtk_widget_is_toplevel (widget))
return FALSE;
@@ -998,7 +1004,7 @@ mate_panel_applet_button_press (GtkWidget *widget,
return TRUE;
}
- return mate_panel_applet_button_event (applet->priv->plug, event);
+ return mate_panel_applet_button_event (applet, event);
}
static gboolean
@@ -1007,7 +1013,7 @@ mate_panel_applet_button_release (GtkWidget *widget,
{
MatePanelApplet *applet = MATE_PANEL_APPLET (widget);
- return mate_panel_applet_button_event (applet->priv->plug, event);
+ return mate_panel_applet_button_event (applet, event);
}
static gboolean
@@ -1882,6 +1888,9 @@ mate_panel_applet_constructor (GType type,
construct_properties);
applet = MATE_PANEL_APPLET (object);
+ if (!applet->priv->out_of_process)
+ return object;
+
applet->priv->plug = gtk_plug_new (0);
GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(applet->priv->plug));
@@ -2443,6 +2452,9 @@ guint32
mate_panel_applet_get_xid (MatePanelApplet *applet,
GdkScreen *screen)
{
+ if (applet->priv->out_of_process == FALSE)
+ return 0;
+
gtk_window_set_screen (GTK_WINDOW (applet->priv->plug), screen);
gtk_widget_show (applet->priv->plug);
@@ -2459,5 +2471,14 @@ G_MODULE_EXPORT GtkWidget *
mate_panel_applet_get_applet_widget (const gchar *factory_id,
guint uid)
{
- return mate_panel_applet_factory_get_applet_widget (factory_id, uid);
+ GtkWidget *widget;
+
+ widget = mate_panel_applet_factory_get_applet_widget (factory_id, uid);
+ if (!widget) {
+ return NULL;
+ }
+
+ mate_panel_applet_setup (MATE_PANEL_APPLET (widget));
+
+ return widget;
}
diff --git a/mate-panel/libmate-panel-applet-private/panel-applet-container.c b/mate-panel/libmate-panel-applet-private/panel-applet-container.c
index 4b4ffd2b..f1ed62f2 100644
--- a/mate-panel/libmate-panel-applet-private/panel-applet-container.c
+++ b/mate-panel/libmate-panel-applet-private/panel-applet-container.c
@@ -23,6 +23,7 @@
#include <string.h>
#include <gtk/gtk.h>
#include <gtk/gtkx.h>
+#include <panel-applets-manager.h>
#include "panel-applet-container.h"
#include "panel-marshal.h"
@@ -32,6 +33,7 @@ struct _MatePanelAppletContainerPrivate {
guint name_watcher_id;
gchar *bus_name;
+ gchar *iid;
gboolean out_of_process;
guint32 xid;
guint32 uid;
@@ -88,20 +90,35 @@ static void mate_panel_applet_container_init(MatePanelAppletContainer* container
{
container->priv = MATE_PANEL_APPLET_CONTAINER_GET_PRIVATE (container);
- container->priv->socket = gtk_socket_new ();
- g_signal_connect_swapped (container->priv->socket, "plug-removed", G_CALLBACK (mate_panel_applet_container_plug_removed), container);
-
container->priv->pending_ops = g_hash_table_new_full (g_direct_hash,
g_direct_equal,
NULL,
(GDestroyNotify) g_object_unref);
-
- gtk_container_add (GTK_CONTAINER (container),
- container->priv->socket);
- gtk_widget_show (container->priv->socket);
}
static void
+panel_applet_container_setup (MatePanelAppletContainer *container)
+{
+ if (container->priv->out_of_process) {
+ container->priv->socket = gtk_socket_new ();
+
+ g_signal_connect_swapped (container->priv->socket,
+ "plug-removed",
+ G_CALLBACK (mate_panel_applet_container_plug_removed),
+ container);
+
+ gtk_container_add (GTK_CONTAINER (container), container->priv->socket);
+ gtk_widget_show (container->priv->socket);
+ } else {
+ GtkWidget *applet;
+
+ applet = mate_panel_applets_manager_get_applet_widget (container->priv->iid, container->priv->uid);
+
+ gtk_container_add (GTK_CONTAINER (container), applet);
+ }
+ }
+
+static void
mate_panel_applet_container_cancel_pending_operations (MatePanelAppletContainer *container)
{
GList *keys, *l;
@@ -135,6 +152,11 @@ mate_panel_applet_container_dispose (GObject *object)
container->priv->bus_name = NULL;
}
+ if (container->priv->iid) {
+ g_free (container->priv->iid);
+ container->priv->iid = NULL;
+ }
+
if (container->priv->name_watcher_id > 0) {
g_bus_unwatch_name (container->priv->name_watcher_id);
container->priv->name_watcher_id = 0;
@@ -349,6 +371,8 @@ on_proxy_appeared (GObject *source_object,
g_simple_async_result_complete (result);
g_object_unref (result);
+ panel_applet_container_setup (container);
+
if (container->priv->xid > 0) {
gtk_socket_add_id (GTK_SOCKET (container->priv->socket),
container->priv->xid);
@@ -496,6 +520,7 @@ mate_panel_applet_container_get_applet (MatePanelAppletContainer *container,
bus_name = g_strdup_printf (MATE_PANEL_APPLET_BUS_NAME, factory_id);
+ container->priv->iid = g_strdup (iid);
container->priv->name_watcher_id =
g_bus_watch_name (G_BUS_TYPE_SESSION,
bus_name,