aboutsummaryrefslogtreecommitdiff
path: root/tests/test-libappindicator-dbus-client.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-22 15:25:13 -0600
committerTed Gould <ted@gould.cx>2010-02-22 15:25:13 -0600
commitdd2a9a5096d01f6f0f37408ce39fba087cc84dd8 (patch)
tree1cf17fb7f177fcbe2575f7fb2fc0e5ce61b719bc /tests/test-libappindicator-dbus-client.c
parent386128abb4ef32983efd13b1e757459aa34d473b (diff)
parent75ccac53fc05f24633c76ac5d956b91a9a6640fb (diff)
downloadlibayatana-appindicator-dd2a9a5096d01f6f0f37408ce39fba087cc84dd8.tar.gz
libayatana-appindicator-dd2a9a5096d01f6f0f37408ce39fba087cc84dd8.tar.bz2
libayatana-appindicator-dd2a9a5096d01f6f0f37408ce39fba087cc84dd8.zip
* Upstream merge
* Menu updates connections
Diffstat (limited to 'tests/test-libappindicator-dbus-client.c')
-rw-r--r--tests/test-libappindicator-dbus-client.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test-libappindicator-dbus-client.c b/tests/test-libappindicator-dbus-client.c
index 6125d36..f5482aa 100644
--- a/tests/test-libappindicator-dbus-client.c
+++ b/tests/test-libappindicator-dbus-client.c
@@ -23,9 +23,13 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib.h>
#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-bindings.h>
+#include <dbus/dbus-glib-lowlevel.h>
#include <libappindicator/app-indicator.h>
#include "test-defines.h"
+#include "../src/dbus-shared.h"
+
static GMainLoop * mainloop = NULL;
static gboolean passed = TRUE;
static int propcount = 0;
@@ -184,6 +188,19 @@ kill_func (gpointer userdata)
return FALSE;
}
+static DBusHandlerResult
+dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_data)
+{
+ if (dbus_message_is_method_call(message, NOTIFICATION_WATCHER_DBUS_ADDR, "RegisterStatusNotifierItem")) {
+ DBusMessage * reply = dbus_message_new_method_return(message);
+ dbus_connection_send(connection, reply, NULL);
+ dbus_message_unref(reply);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
gint
main (gint argc, gchar * argv[])
{
@@ -198,6 +215,21 @@ main (gint argc, gchar * argv[])
return 1;
}
+ DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
+ guint nameret = 0;
+
+ if (!org_freedesktop_DBus_request_name(bus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, 0, &nameret, &error)) {
+ g_error("Unable to call to request name");
+ return 1;
+ }
+
+ if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+ g_error("Unable to get name");
+ return 1;
+ }
+
+ dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_filter, NULL, NULL);
+
DBusGProxy * props = dbus_g_proxy_new_for_name_owner(session_bus,
":1.0",
"/org/ayatana/NotificationItem/my_id",