aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-08-10 08:32:35 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-08-10 08:32:35 +0200
commit3b69c237d620907701c4bef2c0296fd78ba04d77 (patch)
treed9a3fbbb1c526ec717b2e45f261b5a165ee3e585
parent92010355e93cbf844c7828297615ca57a1f84e31 (diff)
parentd6cdc24f310ce43f6f900cd929dfc57a4d7267bd (diff)
downloadlibayatana-appindicator-3b69c237d620907701c4bef2c0296fd78ba04d77.tar.gz
libayatana-appindicator-3b69c237d620907701c4bef2c0296fd78ba04d77.tar.bz2
libayatana-appindicator-3b69c237d620907701c4bef2c0296fd78ba04d77.zip
Merge branch 'tari01-pr/drop-dbus-glib'
Attributes GH PR #67: https://github.com/AyatanaIndicators/libayatana-appindicator/pull/67
-rw-r--r--.build.yml5
-rw-r--r--CMakeLists.txt4
-rw-r--r--debian/control2
-rw-r--r--src/dbus-shared.h19
-rw-r--r--tests/test-libappindicator-dbus-client.c501
-rw-r--r--tests/test-libappindicator-fallback-item.c172
-rw-r--r--tests/test-libappindicator-fallback-watcher.c135
-rw-r--r--tests/test-libappindicator-status-client.c213
-rw-r--r--tests/test-libappindicator.c3
9 files changed, 567 insertions, 487 deletions
diff --git a/.build.yml b/.build.yml
index d6a6b06..0158c64 100644
--- a/.build.yml
+++ b/.build.yml
@@ -16,7 +16,6 @@ requires:
- gtk3
- glib2
- libdbusmenu-gtk3
- - dbus-glib
- gobject-introspection
- gtk3-docs
@@ -48,8 +47,6 @@ requires:
- libgtk3.0-cil-dev
- gtk-sharp2-gapi
- libgtk2.0-cil-dev
- - libdbus-1-dev
- - libdbus-glib-1-dev
- libdbusmenu-glib-dev
- libdbusmenu-gtk3-dev
- libdbusmenu-gtk-dev
@@ -84,8 +81,6 @@ requires:
- libgtk3.0-cil-dev
- gtk-sharp2-gapi
- libgtk2.0-cil-dev
- - libdbus-1-dev
- - libdbus-glib-1-dev
- libdbusmenu-glib-dev
- libdbusmenu-gtk3-dev
- libdbusmenu-gtk-dev
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6fd080d..cd30268 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,10 +66,6 @@ elseif (FLAVOUR_GTK2)
)
endif()
-if(ENABLE_TESTS)
- set(DEPS ${DEPS} dbus-1>=1.12 dbus-glib-1>=0.82)
-endif()
-
include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PROJECT_DEPS REQUIRED ${DEPS})
diff --git a/debian/control b/debian/control
index cd59fad..8f9cd58 100644
--- a/debian/control
+++ b/debian/control
@@ -27,8 +27,6 @@ Build-Depends: debhelper (>= 9),
libgtk3.0-cil-dev [amd64 arm64 armel armhf i386 mipsel ppc64el s390x kfreebsd-amd64 kfreebsd-i386 powerpc ppc64],
gtk-sharp2-gapi [amd64 arm64 armel armhf i386 mipsel ppc64el s390x kfreebsd-amd64 kfreebsd-i386 powerpc ppc64],
libgtk2.0-cil-dev [amd64 arm64 armel armhf i386 mipsel ppc64el s390x kfreebsd-amd64 kfreebsd-i386 powerpc ppc64],
- libdbus-1-dev,
- libdbus-glib-1-dev (>= 0.82),
libayatana-indicator-dev (>= 0.6.0-0~),
libayatana-indicator3-dev (>= 0.6.0-0~),
libdbusmenu-glib-dev (>= 0.5.90),
diff --git a/src/dbus-shared.h b/src/dbus-shared.h
index 23f44f0..1ec15b8 100644
--- a/src/dbus-shared.h
+++ b/src/dbus-shared.h
@@ -2,23 +2,30 @@
DBus defaults for everyone to share in the project.
Copyright 2009 Canonical Ltd.
+Copyright 2023 Robert Tari
Authors:
Ted Gould <ted@canonical.com>
+ Robert Tari <robert@tari.in>
-This program is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 3, as published
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
by the Free Software Foundation.
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranties of
-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
-You should have received a copy of the GNU General Public License along
+You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
+#define DBUS_PATH_DBUS "/org/freedesktop/DBus"
+#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
+#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties"
+#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1
#define INDICATOR_APPLICATION_DBUS_ADDR "org.ayatana.indicator.application"
#define INDICATOR_APPLICATION_DBUS_OBJ "/org/ayatana/indicator/application/service"
diff --git a/tests/test-libappindicator-dbus-client.c b/tests/test-libappindicator-dbus-client.c
index 18c6946..bc7626a 100644
--- a/tests/test-libappindicator-dbus-client.c
+++ b/tests/test-libappindicator-dbus-client.c
@@ -3,9 +3,11 @@ Tests for the libappindicator library that are over DBus. This is
the client side of those tests.
Copyright 2009 Canonical Ltd.
+Copyright 2023 Robert Tari
Authors:
Ted Gould <ted@canonical.com>
+ Robert Tari <robert@tari.in>
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License version 3, as published
@@ -22,12 +24,8 @@ 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 <app-indicator.h>
#include "test-defines.h"
-
#include "../src/dbus-shared.h"
static GMainLoop * mainloop = NULL;
@@ -37,254 +35,305 @@ static int propcount = 0;
static void
check_propcount (void)
{
- if (propcount >= 5) {
- g_main_loop_quit(mainloop);
- }
- return;
+ if (propcount >= 5) {
+ g_main_loop_quit(mainloop);
+ }
+ return;
}
-
-static void
-prop_id_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data)
+static void prop_id_cb (GObject *pObject, GAsyncResult *pResult, void *pUserata)
{
- propcount++;
-
- GError * error = NULL;
- GValue value = {0};
-
- if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) {
- g_warning("Getting ID failed: %s", error->message);
- g_error_free(error);
- passed = FALSE;
- check_propcount();
- return;
- }
-
- if (g_strcmp0(TEST_ID, g_value_get_string(&value))) {
- g_debug("Property ID Returned: FAILED");
- passed = FALSE;
- } else {
- g_debug("Property ID Returned: PASSED");
- }
-
- check_propcount();
- return;
+ propcount++;
+ GError *pError = NULL;
+ GVariant *pParams = g_dbus_proxy_call_finish (G_DBUS_PROXY (pObject), pResult, &pError);
+
+ if (pParams)
+ {
+ gchar *sInterface = NULL;
+ gchar *sId = NULL;
+ g_variant_get (pParams, "(ss)", &sInterface, &sId);
+ gint nComp = g_strcmp0 (TEST_ID, sId);
+
+ if (nComp)
+ {
+ g_debug ("Property ID Returned: FAILED");
+ passed = FALSE;
+ }
+ else
+ {
+ g_debug ("Property ID Returned: PASSED");
+ }
+
+ g_variant_unref (pParams);
+ }
+
+ if (pError)
+ {
+ g_warning ("Getting ID failed: %s", pError->message);
+ g_error_free (pError);
+ passed = FALSE;
+ check_propcount();
+
+ return;
+ }
+
+ check_propcount();
+
+ return;
}
-static void
-prop_category_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data)
+static void prop_category_cb (GObject *pObject, GAsyncResult *pResult, void *pUserata)
{
- propcount++;
-
- GError * error = NULL;
- GValue value = {0};
-
- if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) {
- g_warning("Getting category failed: %s", error->message);
- g_error_free(error);
- passed = FALSE;
- check_propcount();
- return;
- }
-
- if (g_strcmp0(TEST_CATEGORY_S, g_value_get_string(&value))) {
- g_debug("Property category Returned: FAILED");
- passed = FALSE;
- } else {
- g_debug("Property category Returned: PASSED");
- }
-
- check_propcount();
- return;
+ propcount++;
+ GError *pError = NULL;
+ GVariant *pParams = g_dbus_proxy_call_finish (G_DBUS_PROXY (pObject), pResult, &pError);
+
+ if (pParams)
+ {
+ gchar *sInterface = NULL;
+ gchar *sCategory = NULL;
+ g_variant_get (pParams, "(ss)", &sInterface, &sCategory);
+ gint nComp = g_strcmp0 (TEST_CATEGORY_S, sCategory);
+
+ if (nComp)
+ {
+ g_debug ("Property category Returned: FAILED");
+ passed = FALSE;
+ }
+ else
+ {
+ g_debug ("Property category Returned: PASSED");
+ }
+
+ g_variant_unref (pParams);
+ }
+
+ if (pError)
+ {
+ g_warning ("Getting category failed: %s", pError->message);
+ g_error_free (pError);
+ passed = FALSE;
+ check_propcount();
+
+ return;
+ }
+
+ check_propcount();
+
+ return;
}
-static void
-prop_status_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data)
+static void prop_status_cb (GObject *pObject, GAsyncResult *pResult, void *pUserata)
{
- propcount++;
-
- GError * error = NULL;
- GValue value = {0};
-
- if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) {
- g_warning("Getting status failed: %s", error->message);
- g_error_free(error);
- passed = FALSE;
- check_propcount();
- return;
- }
-
- if (g_strcmp0(TEST_STATE_S, g_value_get_string(&value))) {
- g_debug("Property status Returned: FAILED");
- passed = FALSE;
- } else {
- g_debug("Property status Returned: PASSED");
- }
-
- check_propcount();
- return;
+ propcount++;
+ GError *pError = NULL;
+ GVariant *pParams = g_dbus_proxy_call_finish (G_DBUS_PROXY (pObject), pResult, &pError);
+
+ if (pParams)
+ {
+ gchar *sInterface = NULL;
+ gchar *sStatus = NULL;
+ g_variant_get (pParams, "(ss)", &sInterface, &sStatus);
+ gint nComp = g_strcmp0 (TEST_STATE_S, sStatus);
+
+ if (nComp)
+ {
+ g_debug ("Property status Returned: FAILED");
+ passed = FALSE;
+ }
+ else
+ {
+ g_debug ("Property status Returned: PASSED");
+ }
+
+ g_variant_unref (pParams);
+ }
+
+ if (pError)
+ {
+ g_warning ("Getting status failed: %s", pError->message);
+ g_error_free (pError);
+ passed = FALSE;
+ check_propcount();
+
+ return;
+ }
+
+ check_propcount();
+
+ return;
}
-static void
-prop_icon_name_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data)
+static void prop_icon_name_cb (GObject *pObject, GAsyncResult *pResult, void *pUserata)
{
- propcount++;
-
- GError * error = NULL;
- GValue value = {0};
-
- if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) {
- g_warning("Getting icon name failed: %s", error->message);
- g_error_free(error);
- passed = FALSE;
- check_propcount();
- return;
- }
-
- if (g_strcmp0(TEST_ICON_NAME, g_value_get_string(&value))) {
- g_debug("Property icon name Returned: FAILED");
- passed = FALSE;
- } else {
- g_debug("Property icon name Returned: PASSED");
- }
-
- check_propcount();
- return;
+ propcount++;
+ GError *pError = NULL;
+ GVariant *pParams = g_dbus_proxy_call_finish (G_DBUS_PROXY (pObject), pResult, &pError);
+
+ if (pParams)
+ {
+ gchar *sInterface = NULL;
+ gchar *sIcon = NULL;
+ g_variant_get (pParams, "(ss)", &sInterface, &sIcon);
+ gint nComp = g_strcmp0 (TEST_ICON_NAME, sIcon);
+
+ if (nComp)
+ {
+ g_debug ("Property icon name Returned: FAILED");
+ passed = FALSE;
+ }
+ else
+ {
+ g_debug ("Property icon name Returned: PASSED");
+ }
+
+ g_variant_unref (pParams);
+ }
+
+ if (pError)
+ {
+ g_warning ("Getting icon name failed: %s", pError->message);
+ g_error_free (pError);
+ passed = FALSE;
+ check_propcount();
+
+ return;
+ }
+
+ check_propcount();
+
+ return;
}
-static void
-prop_attention_icon_name_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data)
+static void prop_attention_icon_name_cb (GObject *pObject, GAsyncResult *pResult, void *pUserata)
{
- propcount++;
-
- GError * error = NULL;
- GValue value = {0};
-
- if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) {
- g_warning("Getting attention icon name failed: %s", error->message);
- g_error_free(error);
- passed = FALSE;
- check_propcount();
- return;
- }
-
- if (g_strcmp0(TEST_ATTENTION_ICON_NAME, g_value_get_string(&value))) {
- g_debug("Property attention icon name Returned: FAILED");
- passed = FALSE;
- } else {
- g_debug("Property attention icon name Returned: PASSED");
- }
-
- check_propcount();
- return;
+ propcount++;
+ GError *pError = NULL;
+ GVariant *pParams = g_dbus_proxy_call_finish (G_DBUS_PROXY (pObject), pResult, &pError);
+
+ if (pParams)
+ {
+ gchar *sInterface = NULL;
+ gchar *sAttentionIcon = NULL;
+ g_variant_get (pParams, "(ss)", &sInterface, &sAttentionIcon);
+ gint nComp = g_strcmp0 (TEST_ATTENTION_ICON_NAME, sAttentionIcon);
+
+ if (nComp)
+ {
+ g_debug ("Property attention icon name Returned: FAILED");
+ passed = FALSE;
+ }
+ else
+ {
+ g_debug ("Property attention icon name Returned: PASSED");
+ }
+
+ g_variant_unref (pParams);
+ }
+
+ if (pError)
+ {
+ g_warning ("Getting attention icon name failed: %s", pError->message);
+ g_error_free (pError);
+ passed = FALSE;
+ check_propcount();
+
+ return;
+ }
+
+ check_propcount();
+
+ return;
}
gboolean
kill_func (gpointer userdata)
{
- g_main_loop_quit(mainloop);
- g_warning("Forced to Kill");
- passed = FALSE;
- return FALSE;
+ g_main_loop_quit(mainloop);
+ g_warning("Forced to Kill");
+ passed = FALSE;
+ return FALSE;
}
-static DBusHandlerResult
-dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_data)
+static GDBusMessage* dbus_filter (GDBusConnection *pConnection, GDBusMessage *pMessage, gboolean bIncoming, void *pUserData)
{
- 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;
+ GDBusMessageType cType = g_dbus_message_get_message_type (pMessage);
+ const gchar *sInterface = g_dbus_message_get_interface (pMessage);
+ const gchar *sMember = g_dbus_message_get_member (pMessage);
+ int nInterfaceComp = g_strcmp0 (sInterface, NOTIFICATION_WATCHER_DBUS_ADDR);
+ int nMemberComp = g_strcmp0 (sMember, "RegisterStatusNotifierItem");
+
+ if (cType == G_DBUS_MESSAGE_TYPE_METHOD_CALL && nInterfaceComp == 0 && nMemberComp == 0)
+ {
+ GDBusMessage *pReply = g_dbus_message_new_method_reply (pMessage);
+ g_dbus_connection_send_message (pConnection, pReply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (pReply);
+ g_object_unref (pMessage);
+ pMessage = NULL;
+ }
+
+ return pMessage;
}
gint
main (gint argc, gchar * argv[])
{
- GError * error = NULL;
- DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL) {
- g_error("Unable to get session bus: %s", error->message);
- 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);
-
- g_usleep(500000);
-
- DBusGProxy * props = dbus_g_proxy_new_for_name_owner(session_bus,
- ":1.2",
- "/org/ayatana/NotificationItem/my_id",
- DBUS_INTERFACE_PROPERTIES,
- &error);
- if (error != NULL) {
- g_error("Unable to get property proxy: %s", error->message);
- return 1;
- }
-
- dbus_g_proxy_begin_call (props,
- "Get",
- prop_id_cb,
- NULL, NULL,
- G_TYPE_STRING, NOTIFICATION_ITEM_DBUS_IFACE,
- G_TYPE_STRING, "Id",
- G_TYPE_INVALID);
- dbus_g_proxy_begin_call (props,
- "Get",
- prop_category_cb,
- NULL, NULL,
- G_TYPE_STRING, NOTIFICATION_ITEM_DBUS_IFACE,
- G_TYPE_STRING, "Category",
- G_TYPE_INVALID);
- dbus_g_proxy_begin_call (props,
- "Get",
- prop_status_cb,
- NULL, NULL,
- G_TYPE_STRING, NOTIFICATION_ITEM_DBUS_IFACE,
- G_TYPE_STRING, "Status",
- G_TYPE_INVALID);
- dbus_g_proxy_begin_call (props,
- "Get",
- prop_icon_name_cb,
- NULL, NULL,
- G_TYPE_STRING, NOTIFICATION_ITEM_DBUS_IFACE,
- G_TYPE_STRING, "IconName",
- G_TYPE_INVALID);
- dbus_g_proxy_begin_call (props,
- "Get",
- prop_attention_icon_name_cb,
- NULL, NULL,
- G_TYPE_STRING, NOTIFICATION_ITEM_DBUS_IFACE,
- G_TYPE_STRING, "AttentionIconName",
- G_TYPE_INVALID);
-
- g_timeout_add_seconds(2, kill_func, NULL);
-
- mainloop = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(mainloop);
-
- if (passed) {
- g_debug("Quiting");
- return 0;
- } else {
- g_debug("Quiting as we're a failure");
- return 1;
- }
- return 0;
+ GError *pError = NULL;
+ GDBusProxy *pProxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, NULL, &pError);
+
+ if (pError != NULL)
+ {
+ g_error ("Unable to get session bus: %s", pError->message);
+ g_error_free (pError);
+
+ return 1;
+ }
+
+ GDBusConnection *pConnection = g_dbus_proxy_get_connection (pProxy);
+ guint nName = g_bus_own_name_on_connection (pConnection, NOTIFICATION_WATCHER_DBUS_ADDR, G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL);
+
+ if (!nName)
+ {
+ g_error ("Unable to call to request name");
+
+ return 1;
+ }
+
+ if (nName != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+ {
+ g_error ("Unable to get name");
+
+ return 1;
+ }
+
+ g_dbus_connection_add_filter (pConnection, dbus_filter, NULL, NULL);
+ g_usleep(500000);
+ GDBusProxy *pProps = g_dbus_proxy_new_sync (pConnection, G_DBUS_PROXY_FLAGS_NONE, NULL, ":1.2", "/org/ayatana/NotificationItem/my_id", DBUS_INTERFACE_PROPERTIES, NULL, &pError);
+
+ if (pError != NULL)
+ {
+ g_error ("Unable to get property proxy: %s", pError->message);
+ g_error_free (pError);
+
+ return 1;
+ }
+
+ g_dbus_proxy_call (pProps, "Get", g_variant_new ("(ss)", NOTIFICATION_ITEM_DBUS_IFACE, "Id"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) prop_id_cb, NULL);
+ g_dbus_proxy_call (pProps, "Get", g_variant_new ("(ss)", NOTIFICATION_ITEM_DBUS_IFACE, "Category"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) prop_category_cb, NULL);
+ g_dbus_proxy_call (pProps, "Get", g_variant_new ("(ss)", NOTIFICATION_ITEM_DBUS_IFACE, "Status"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) prop_status_cb, NULL);
+ g_dbus_proxy_call (pProps, "Get", g_variant_new ("(ss)", NOTIFICATION_ITEM_DBUS_IFACE, "IconName"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) prop_icon_name_cb, NULL);
+ g_dbus_proxy_call (pProps, "Get", g_variant_new ("(ss)", NOTIFICATION_ITEM_DBUS_IFACE, "AttentionIconName"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) prop_attention_icon_name_cb, NULL);
+ g_timeout_add_seconds(2, kill_func, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ if (passed) {
+ g_debug("Quiting");
+ return 0;
+ } else {
+ g_debug("Quiting as we're a failure");
+ return 1;
+ }
+ return 0;
}
diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c
index c87ef8c..3c6f630 100644
--- a/tests/test-libappindicator-fallback-item.c
+++ b/tests/test-libappindicator-fallback-item.c
@@ -1,8 +1,7 @@
#include <glib.h>
#include <glib-object.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-bindings.h>
#include <app-indicator.h>
+#include "../src/dbus-shared.h"
#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE (test_libappindicator_fallback_item_get_type ())
#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItem))
@@ -15,12 +14,12 @@ typedef struct _TestLibappindicatorFallbackItem TestLibappindicatorFallback
typedef struct _TestLibappindicatorFallbackItemClass TestLibappindicatorFallbackItemClass;
struct _TestLibappindicatorFallbackItemClass {
- AppIndicatorClass parent_class;
+ AppIndicatorClass parent_class;
};
struct _TestLibappindicatorFallbackItem {
- AppIndicator parent;
+ AppIndicator parent;
};
@@ -39,10 +38,10 @@ G_DEFINE_TYPE (TestLibappindicatorFallbackItem, test_libappindicator_fallback_it
static void
test_libappindicator_fallback_item_class_init (TestLibappindicatorFallbackItemClass *klass)
{
- AppIndicatorClass * aiclass = APP_INDICATOR_CLASS(klass);
+ AppIndicatorClass * aiclass = APP_INDICATOR_CLASS(klass);
- aiclass->fallback = fallback;
- aiclass->unfallback = unfallback;
+ aiclass->fallback = fallback;
+ aiclass->unfallback = unfallback;
}
static void
@@ -54,11 +53,11 @@ GMainLoop * mainloop = NULL;
gboolean passed = FALSE;
enum {
- STATE_INIT,
- STATE_FALLBACK,
- STATE_UNFALLBACK,
- STATE_REFALLBACK,
- STATE_REUNFALLBACK
+ STATE_INIT,
+ STATE_FALLBACK,
+ STATE_UNFALLBACK,
+ STATE_REFALLBACK,
+ STATE_REUNFALLBACK
};
gint state = STATE_INIT;
@@ -66,88 +65,99 @@ gint state = STATE_INIT;
static GtkStatusIcon *
fallback (AppIndicator * indicator)
{
- g_debug("Fallback");
- if (state == STATE_INIT) {
- state = STATE_FALLBACK;
- } else if (state == STATE_UNFALLBACK) {
- state = STATE_REFALLBACK;
- } else {
- g_debug("Error, fallback in state: %d", state);
- passed = FALSE;
- }
- return (GtkStatusIcon *)5;
+ g_debug("Fallback");
+ if (state == STATE_INIT) {
+ state = STATE_FALLBACK;
+ } else if (state == STATE_UNFALLBACK) {
+ state = STATE_REFALLBACK;
+ } else {
+ g_debug("Error, fallback in state: %d", state);
+ passed = FALSE;
+ }
+ return (GtkStatusIcon *)5;
}
static void
unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon)
{
- g_debug("Unfallback");
- if (state == STATE_FALLBACK) {
- state = STATE_UNFALLBACK;
- } else if (state == STATE_REFALLBACK) {
- state = STATE_REUNFALLBACK;
- passed = TRUE;
- g_main_loop_quit(mainloop);
- } else {
- g_debug("Error, unfallback in state: %d", state);
- passed = FALSE;
- }
- return;
+ g_debug("Unfallback");
+ if (state == STATE_FALLBACK) {
+ state = STATE_UNFALLBACK;
+ } else if (state == STATE_REFALLBACK) {
+ state = STATE_REUNFALLBACK;
+ passed = TRUE;
+ g_main_loop_quit(mainloop);
+ } else {
+ g_debug("Error, unfallback in state: %d", state);
+ passed = FALSE;
+ }
+ return;
}
gboolean
kill_func (gpointer data)
{
- g_debug("Kill Function");
- g_main_loop_quit(mainloop);
- return FALSE;
+ g_debug("Kill Function");
+ g_main_loop_quit(mainloop);
+ return FALSE;
}
int
main (int argc, char ** argv)
{
- gtk_init(&argc, &argv);
-
- GError * error = NULL;
- DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL) {
- g_error("Unable to get session bus: %s", error->message);
- 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, "org.test", 0, &nameret, NULL)) {
- 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;
- }
-
- TestLibappindicatorFallbackItem * item = g_object_new(TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE,
- "id", "test-id",
- "category", "Other",
- "icon-name", "bob",
- NULL);
-
- GtkWidget * menu = gtk_menu_new();
- app_indicator_set_menu(APP_INDICATOR(item), GTK_MENU(menu));
-
- g_timeout_add_seconds(20, kill_func, NULL);
-
- mainloop = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(mainloop);
-
- g_object_unref(G_OBJECT(item));
-
- if (passed) {
- return 0;
- } else {
- return 1;
- }
+ gtk_init(&argc, &argv);
+ GError *pError = NULL;
+ GDBusProxy *pProxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, NULL, &pError);
+
+ if (pError != NULL)
+ {
+ g_error ("Unable to get session bus: %s", pError->message);
+ g_error_free (pError);
+
+ return 1;
+ }
+
+ GVariant *pResult = g_dbus_proxy_call_sync (pProxy, "RequestName", g_variant_new ("(su)", "org.test", 0), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &pError);
+ gint nName = 0;
+
+ if (pResult)
+ {
+ g_variant_get (pResult, "(u)", &nName);
+ g_variant_unref (pResult);
+ }
+ else
+ {
+ g_error ("Unable to get name: %s", pError->message);
+
+ return 1;
+ }
+
+ if (nName != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+ {
+ g_error ("Unable to get name");
+
+ return 1;
+ }
+
+ TestLibappindicatorFallbackItem * item = g_object_new(TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE,
+ "id", "test-id",
+ "category", "Other",
+ "icon-name", "bob",
+ NULL);
+
+ GtkWidget * menu = gtk_menu_new();
+ app_indicator_set_menu(APP_INDICATOR(item), GTK_MENU(menu));
+
+ g_timeout_add_seconds(20, kill_func, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ g_object_unref(G_OBJECT(item));
+
+ if (passed) {
+ return 0;
+ } else {
+ return 1;
+ }
}
diff --git a/tests/test-libappindicator-fallback-watcher.c b/tests/test-libappindicator-fallback-watcher.c
index 2648902..9261571 100644
--- a/tests/test-libappindicator-fallback-watcher.c
+++ b/tests/test-libappindicator-fallback-watcher.c
@@ -3,9 +3,11 @@ This puts the NotificationWatcher on the bus, kinda. Enough to
trick the Item into unfalling back.
Copyright 2010 Canonical Ltd.
+Copyright 2023 Robert Tari
Authors:
Ted Gould <ted@canonical.com>
+ Robert Tari <robert@tari.in>
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License version 3, as published
@@ -21,96 +23,111 @@ 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 <gio/gio.h>
#include "../src/dbus-shared.h"
gboolean kill_func (gpointer userdata);
static GMainLoop * mainloop = NULL;
-static DBusHandlerResult
-dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_data)
+static GDBusMessage* dbus_filter (GDBusConnection *pConnection, GDBusMessage *pMessage, gboolean bIncoming, void *pUserData)
{
- 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);
-
- /* Let the messages get out, but we're done at this point */
- g_timeout_add(50, kill_func, NULL);
-
- return DBUS_HANDLER_RESULT_HANDLED;
- }
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ GDBusMessageType cType = g_dbus_message_get_message_type (pMessage);
+ const gchar *sMember = g_dbus_message_get_member (pMessage);
+ int nMemberComp = g_strcmp0 (sMember, "RegisterStatusNotifierItem");
+
+ if (cType == G_DBUS_MESSAGE_TYPE_METHOD_CALL && nMemberComp == 0)
+ {
+ GDBusMessage *pReply = g_dbus_message_new_method_reply (pMessage);
+ g_dbus_connection_send_message (pConnection, pReply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (pReply);
+ g_timeout_add (50, kill_func, NULL);
+ g_object_unref (pMessage);
+ pMessage = NULL;
+ }
+
+ return pMessage;
}
gboolean
kill_func (gpointer userdata)
{
- g_main_loop_quit(mainloop);
- return FALSE;
+ g_main_loop_quit(mainloop);
+ return FALSE;
}
int
main (int argv, char ** argc)
{
- g_debug("Waiting to init.");
+ g_debug("Waiting to init.");
+
+ GError *pError = NULL;
+ GDBusProxy * pProxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, NULL, &pError);
+
+ if (pError != NULL)
+ {
+ g_error("Unable to get session bus: %s", pError->message);
+ g_error_free (pError);
+
+ return 1;
+ }
+
+ g_usleep (500000);
+ gboolean bOwner = FALSE;
+ GVariant *pResult = g_dbus_proxy_call_sync (pProxy, "NameHasOwner", g_variant_new ("(s)", "org.test"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &pError);
+ if (pResult)
+ {
+ g_variant_get (pResult, "(b)", &bOwner);
+ g_variant_unref (pResult);
+ }
+ else
+ {
+ g_error ("Error getting name owner: %s", pError->message);
+ g_error_free (pError);
- GError * error = NULL;
- DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL) {
- g_error("Unable to get session bus: %s", error->message);
- return 1;
- }
+ return 1;
+ }
- DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
+ if (!bOwner)
+ {
+ g_error ("Unable to get name owner");
- gboolean has_owner = FALSE;
- gint owner_count = 0;
- while (!has_owner && owner_count < 10000) {
- org_freedesktop_DBus_name_has_owner(bus_proxy, "org.test", &has_owner, NULL);
- owner_count++;
- g_usleep(500000);
- }
+ return 1;
+ }
- if (owner_count == 10000) {
- g_error("Unable to get name owner after 10000 tries");
- return 1;
- }
+ g_usleep(500000);
+ g_debug("Initing");
- g_usleep(500000);
+ GDBusConnection *pConnection = g_dbus_proxy_get_connection (pProxy);
+ guint nName = g_bus_own_name_on_connection (pConnection, NOTIFICATION_WATCHER_DBUS_ADDR, G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL);
- g_debug("Initing");
+ if (!nName)
+ {
+ g_error ("Unable to call to request name");
- guint nameret = 0;
+ return 1;
+ }
- 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 (nName != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+ {
+ g_error ("Unable to get name");
- if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
- g_error("Unable to get name");
- return 1;
- }
+ return 1;
+ }
- dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_filter, NULL, NULL);
+ g_dbus_connection_add_filter (pConnection, dbus_filter, NULL, NULL);
- /* This is the final kill function. It really shouldn't happen
- unless we get an error. */
- g_timeout_add_seconds(20, kill_func, NULL);
+ /* This is the final kill function. It really shouldn't happen
+ unless we get an error. */
+ g_timeout_add_seconds(20, kill_func, NULL);
- g_debug("Entering Mainloop");
+ g_debug("Entering Mainloop");
- mainloop = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(mainloop);
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
- g_debug("Exiting");
+ g_debug("Exiting");
- return 0;
+ return 0;
}
diff --git a/tests/test-libappindicator-status-client.c b/tests/test-libappindicator-status-client.c
index cd60e6c..beeeaad 100644
--- a/tests/test-libappindicator-status-client.c
+++ b/tests/test-libappindicator-status-client.c
@@ -3,9 +3,11 @@ Tests for the libappindicator library that are over DBus. This is
the client side of those tests.
Copyright 2009 Canonical Ltd.
+Copyright 2023 Robert Tari
Authors:
Ted Gould <ted@canonical.com>
+ Robert Tari <robert@tari.in>
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License version 3, as published
@@ -20,11 +22,8 @@ You should have received a copy of the GNU General Public License along
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 <gio/gio.h>
#include "../src/dbus-shared.h"
static GMainLoop * mainloop = NULL;
@@ -37,115 +36,127 @@ static guint toggle_count = 0;
#define ACTIVE_STR "Active"
#define ATTN_STR "NeedsAttention"
-static DBusHandlerResult
-dbus_reg_filter (DBusConnection * connection, DBusMessage * message, void * user_data)
+static GDBusMessage* dbus_reg_filter (GDBusConnection *pConnection, GDBusMessage *pMessage, gboolean bIncoming, void *pUserData)
{
- 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;
+ GDBusMessageType cType = g_dbus_message_get_message_type (pMessage);
+ const gchar *sInterface = g_dbus_message_get_interface (pMessage);
+ const gchar *sMember = g_dbus_message_get_member (pMessage);
+ int nInterfaceComp = g_strcmp0 (sInterface, NOTIFICATION_WATCHER_DBUS_ADDR);
+ int nMemberComp = g_strcmp0 (sMember, "RegisterStatusNotifierItem");
+
+ if (cType == G_DBUS_MESSAGE_TYPE_METHOD_CALL && nInterfaceComp == 0 && nMemberComp == 0)
+ {
+ GDBusMessage *pReply = g_dbus_message_new_method_reply (pMessage);
+ g_dbus_connection_send_message (pConnection, pReply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (pReply);
+
+ g_object_unref (pMessage);
+ pMessage = NULL;
+ }
+
+ return pMessage;
}
-
-static DBusHandlerResult
-dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_data)
+void onNewStatus (GDBusConnection* pConnection, const gchar *sSender, const gchar *sPath, const gchar *sInterface, const gchar *sSignal, GVariant *pParameters, gpointer pUserData)
{
- if (!dbus_message_is_signal(message, NOTIFICATION_ITEM_DBUS_IFACE, "NewStatus")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- gchar * string;
-
- DBusError derror;
- dbus_error_init(&derror);
- if (!dbus_message_get_args(message, &derror,
- DBUS_TYPE_STRING, &string,
- DBUS_TYPE_INVALID)) {
- g_warning("Couldn't get parameters");
- dbus_error_free(&derror);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- watchdog_hit = TRUE;
-
- if (g_strcmp0(string, ACTIVE_STR) == 0) {
- if (active) {
- g_warning("Got active when already active");
- passed = FALSE;
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- active = TRUE;
- } else {
- active = FALSE;
- }
-
- toggle_count++;
-
- if (toggle_count == 100) {
- g_main_loop_quit(mainloop);
- }
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ const gchar *sParam = NULL;
+ g_variant_get (pParameters, "(s)", &sParam);
+
+ if (!sParam)
+ {
+ g_warning ("Couldn't get parameter");
+
+ return;
+ }
+
+ watchdog_hit = TRUE;
+ int nComp = g_strcmp0 (sParam, ACTIVE_STR);
+
+ if (!nComp)
+ {
+ if (active)
+ {
+ g_warning ("Got active when already active");
+ passed = FALSE;
+
+ return;
+ }
+
+ active = TRUE;
+ }
+ else
+ {
+ active = FALSE;
+ }
+
+ toggle_count++;
+
+ if (toggle_count == 100)
+ {
+ g_main_loop_quit (mainloop);
+ }
}
gboolean
kill_func (gpointer userdata)
{
- if (watchdog_hit == FALSE) {
- g_main_loop_quit(mainloop);
- g_warning("Forced to Kill");
- g_warning("Toggle count: %d", toggle_count);
- passed = FALSE;
- return FALSE;
- }
- watchdog_hit = FALSE;
- return TRUE;
+ if (watchdog_hit == FALSE) {
+ g_main_loop_quit(mainloop);
+ g_warning("Forced to Kill");
+ g_warning("Toggle count: %d", toggle_count);
+ passed = FALSE;
+ return FALSE;
+ }
+ watchdog_hit = FALSE;
+ return TRUE;
}
gint
main (gint argc, gchar * argv[])
{
- GError * error = NULL;
- DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL) {
- g_error("Unable to get session bus: %s", error->message);
- 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_reg_filter, NULL, NULL);
-
- dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_filter, NULL, NULL);
- dbus_bus_add_match(dbus_g_connection_get_connection(session_bus), "type='signal',interface='" NOTIFICATION_ITEM_DBUS_IFACE "',member='NewStatus'", NULL);
-
- watchdog_hit = TRUE;
- g_timeout_add_seconds(20, kill_func, NULL);
-
- mainloop = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(mainloop);
-
- if (passed) {
- g_debug("Quiting");
- return 0;
- } else {
- g_debug("Quiting as we're a failure");
- return 1;
- }
- return 0;
+ GError *pError = NULL;
+ GDBusProxy *pProxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, NULL, &pError);
+
+ if (pError != NULL)
+ {
+ g_error("Unable to get session bus: %s", pError->message);
+ g_error_free (pError);
+
+ return 1;
+ }
+
+ GDBusConnection *pConnection = g_dbus_proxy_get_connection (pProxy);
+ guint nName = g_bus_own_name_on_connection (pConnection, NOTIFICATION_WATCHER_DBUS_ADDR, G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL);
+
+ if (!nName)
+ {
+ g_error ("Unable to call to request name");
+
+ return 1;
+ }
+
+ if (nName != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+ {
+ g_error ("Unable to get name");
+
+ return 1;
+ }
+
+ g_dbus_connection_add_filter (pConnection, dbus_reg_filter, NULL, NULL);
+ g_dbus_connection_signal_subscribe (pConnection, NULL, NOTIFICATION_ITEM_DBUS_IFACE, "NewStatus", NULL, NULL, G_DBUS_SIGNAL_FLAGS_NONE, onNewStatus, NULL, NULL);
+
+ watchdog_hit = TRUE;
+ g_timeout_add_seconds(20, kill_func, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ if (passed) {
+ g_debug("Quiting");
+ return 0;
+ } else {
+ g_debug("Quiting as we're a failure");
+ return 1;
+ }
+ return 0;
}
diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c
index 68c6a93..0273398 100644
--- a/tests/test-libappindicator.c
+++ b/tests/test-libappindicator.c
@@ -68,15 +68,12 @@ test_libappindicator_prop_signals (void)
gboolean signaled = FALSE;
gulong handlerid;
- handlerid = 0;
handlerid = g_signal_connect(G_OBJECT(ci), "new-icon", G_CALLBACK(test_libappindicator_prop_signals_helper), &signaled);
g_assert(handlerid != 0);
- handlerid = 0;
handlerid = g_signal_connect(G_OBJECT(ci), "new-attention-icon", G_CALLBACK(test_libappindicator_prop_signals_helper), &signaled);
g_assert(handlerid != 0);
- handlerid = 0;
handlerid = g_signal_connect(G_OBJECT(ci), "new-status", G_CALLBACK(test_libappindicator_prop_signals_status_helper), &signaled);
g_assert(handlerid != 0);