[Xfce4-commits] <xfce4-appfinder:andrzejr/plugin> Added support for GtkPlug and OpenWidget DBus method.
Andrzej
noreply at xfce.org
Thu Feb 16 13:00:01 CET 2012
Updating branch refs/heads/andrzejr/plugin
to ac37e6036b2166e0a63341f238fb8703bda5de2b (commit)
from f59b76ccf43ce3c3a72a4e1159b9abfd8232aa46 (commit)
commit ac37e6036b2166e0a63341f238fb8703bda5de2b
Author: Andrzej <ndrwrdck at gmail.com>
Date: Thu Feb 16 20:57:26 2012 +0900
Added support for GtkPlug and OpenWidget DBus method.
src/main.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/src/main.c b/src/main.c
index bd9a379..fbd5109 100644
--- a/src/main.c
+++ b/src/main.c
@@ -39,6 +39,7 @@
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
+#include <src/appfinder-widget.h>
#include <src/appfinder-window.h>
#include <src/appfinder-private.h>
#include <src/appfinder-model.h>
@@ -49,6 +50,7 @@
#define APPFINDER_DBUS_INTERFACE APPFINDER_DBUS_SERVICE
#define APPFINDER_DBUS_PATH "/org/xfce/Appfinder"
#define APPFINDER_DBUS_METHOD_OPEN "OpenWindow"
+#define APPFINDER_DBUS_METHOD_OPEN_WIDGET "OpenWidget"
#define APPFINDER_DBUS_METHOD_QUIT "Quit"
#define APPFINDER_DBUS_ERROR APPFINDER_DBUS_SERVICE ".Error"
@@ -193,6 +195,30 @@ appfinder_window_new (const gchar *startup_id,
+static void
+appfinder_widget_new (GdkNativeWindow id)
+{
+ GtkWidget *plug;
+ GtkWidget *widget;
+
+ plug = gtk_plug_new (id);
+ gtk_widget_show (plug);
+
+ widget = g_object_new (XFCE_TYPE_APPFINDER_WIDGET,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (plug), widget);
+
+ //appfinder_refcount_debug_add (G_OBJECT (widget), startup_id);
+ xfce_appfinder_widget_set_expanded (XFCE_APPFINDER_WIDGET (widget), TRUE);
+ gtk_widget_show (widget);
+
+ windows = g_slist_prepend (windows, widget);
+ g_signal_connect_swapped (G_OBJECT (widget), "destroy",
+ G_CALLBACK (gtk_widget_destroy), plug);
+}
+
+
+
static DBusHandlerResult
appfinder_dbus_message (DBusConnection *dbus_connection,
DBusMessage *message,
@@ -201,6 +227,7 @@ appfinder_dbus_message (DBusConnection *dbus_connection,
DBusMessage *reply;
gboolean expanded;
gchar *startup_id;
+ guint id;
DBusError derror;
if (dbus_message_is_method_call (message, APPFINDER_DBUS_INTERFACE, APPFINDER_DBUS_METHOD_OPEN))
@@ -223,6 +250,25 @@ appfinder_dbus_message (DBusConnection *dbus_connection,
dbus_connection_send (dbus_connection, reply, NULL);
dbus_message_unref (reply);
}
+ else if (dbus_message_is_method_call (message, APPFINDER_DBUS_INTERFACE, APPFINDER_DBUS_METHOD_OPEN_WIDGET))
+ {
+ dbus_error_init (&derror);
+ if (dbus_message_get_args (message, &derror,
+ DBUS_TYPE_UINT32, &id,
+ DBUS_TYPE_INVALID))
+ {
+ appfinder_widget_new ((GdkNativeWindow) id);
+ reply = dbus_message_new_method_return (message);
+ }
+ else
+ {
+ reply = dbus_message_new_error (message, APPFINDER_DBUS_ERROR, derror.message);
+ dbus_error_free (&derror);
+ }
+
+ dbus_connection_send (dbus_connection, reply, NULL);
+ dbus_message_unref (reply);
+ }
else if (dbus_message_is_method_call (message, APPFINDER_DBUS_INTERFACE, APPFINDER_DBUS_METHOD_QUIT))
{
/* close all windows and quit */
More information about the Xfce4-commits
mailing list