From 149de106bfb648c17ac345eaedaa701ee427f0c4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Jul 2010 09:47:12 -0500 Subject: Removing the style lookup that wasn't used. --- libindicator/indicator-image-helper.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 86d6c25..2492227 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -40,18 +40,6 @@ refresh_image (GtkImage * image) gint icon_size = 22; - GtkStyle * style = gtk_widget_get_style(GTK_WIDGET(image)); - GValue styleprop = {0}; - gtk_style_get_style_property(style, GTK_TYPE_IMAGE, "x-ayatana-indicator-dynamic", &styleprop); - - if (G_VALUE_HOLDS_BOOLEAN(&styleprop) && g_value_get_boolean(&styleprop)) { - PangoContext * context = gtk_widget_get_pango_context(GTK_WIDGET(image)); - PangoFontMetrics * metrics = pango_context_get_metrics(context, style->font_desc, pango_context_get_language(context)); - icon_size = PANGO_PIXELS(pango_font_metrics_get_ascent(metrics)) + PANGO_PIXELS(pango_font_metrics_get_descent(metrics)); - g_debug("Looking for icon size %d", icon_size); - pango_font_metrics_unref(metrics); - } - /* Look through the themes for that icon */ GtkIconInfo * icon_info = gtk_icon_theme_lookup_by_gicon(default_theme, icon_names, icon_size, 0); if (icon_info == NULL) { -- cgit v1.2.3 From 8a1255676ed6c7091e9c1c2dfda183dacf00ab31 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Jul 2010 10:36:27 -0500 Subject: Switching the watchers data structure over to a hashtable. --- libindicator/indicator-service.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index fc3c7de..74b5a2e 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -51,7 +51,7 @@ struct _IndicatorServicePrivate { gchar * name; DBusGProxy * dbus_proxy; guint timeout; - GList * watchers; + GHashTable * watchers; guint this_service_version; }; @@ -160,6 +160,8 @@ indicator_service_init (IndicatorService *self) priv->watchers = NULL; priv->this_service_version = 0; + priv->watchers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref); + /* Start talkin' dbus */ GError * error = NULL; DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_STARTER, &error); @@ -230,8 +232,7 @@ indicator_service_finalize (GObject *object) } if (priv->watchers != NULL) { - g_list_foreach(priv->watchers, (GFunc)g_free, NULL); - g_list_free(priv->watchers); + g_hash_table_destroy(priv->watchers); priv->watchers = NULL; } @@ -382,8 +383,12 @@ _indicator_service_server_watch (IndicatorService * service, DBusGMethodInvocati g_return_val_if_fail(INDICATOR_IS_SERVICE(service), FALSE); IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(service); - priv->watchers = g_list_append(priv->watchers, - g_strdup(dbus_g_method_get_sender(method))); + const gchar * sender = dbus_g_method_get_sender(method); + if (g_hash_table_lookup(priv->watchers, sender) == NULL) { + DBusGProxy * senderproxy = (gpointer)1; + + g_hash_table_insert(priv->watchers, g_strdup(sender), senderproxy); + } if (priv->timeout != 0) { g_source_remove(priv->timeout); @@ -394,13 +399,6 @@ _indicator_service_server_watch (IndicatorService * service, DBusGMethodInvocati return TRUE; } -/* Mung g_strcmp0 into GCompareFunc */ -static gint -find_watcher (gconstpointer a, gconstpointer b) -{ - return g_strcmp0((const gchar *)a, (const gchar *)b); -} - /* A function connecting into the dbus interface for the "UnWatch" function. It is also an async function to get the sender. It then looks the sender up and removes them @@ -413,19 +411,17 @@ _indicator_service_server_un_watch (IndicatorService * service, DBusGMethodInvoc IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(service); /* Remove us from the watcher list here */ - GList * watcher_item = g_list_find_custom(priv->watchers, dbus_g_method_get_sender(method), find_watcher); + gpointer watcher_item = g_hash_table_lookup(priv->watchers, dbus_g_method_get_sender(method)); if (watcher_item != NULL) { /* Free the watcher */ - gchar * name = watcher_item->data; - priv->watchers = g_list_remove(priv->watchers, name); - g_free(name); + g_hash_table_remove(priv->watchers, dbus_g_method_get_sender(method)); } else { /* Odd that we couldn't find the person, but, eh */ g_warning("Unable to find watcher who is unwatching: %s", dbus_g_method_get_sender(method)); } /* If we're out of watchers set the timeout for shutdown */ - if (priv->watchers == NULL) { + if (g_hash_table_size(priv->watchers) == 0) { if (priv->timeout != 0) { /* This should never really happen, but let's ensure that bad things don't happen if it does. */ -- cgit v1.2.3 From 632c3f997f091be8daeedcd0eaf7f1043dca5530 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Jul 2010 10:39:12 -0500 Subject: Making ths bus tracked in the private structure --- libindicator/indicator-service.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 74b5a2e..d3e873b 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -50,6 +50,7 @@ typedef struct _IndicatorServicePrivate IndicatorServicePrivate; struct _IndicatorServicePrivate { gchar * name; DBusGProxy * dbus_proxy; + DBusGConnection * bus; guint timeout; GHashTable * watchers; guint this_service_version; @@ -158,13 +159,14 @@ indicator_service_init (IndicatorService *self) priv->dbus_proxy = NULL; priv->timeout = 0; priv->watchers = NULL; + priv->bus = NULL; priv->this_service_version = 0; priv->watchers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref); /* Start talkin' dbus */ GError * error = NULL; - DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_STARTER, &error); + priv->bus = dbus_g_bus_get(DBUS_BUS_STARTER, &error); if (error != NULL) { g_error("Unable to get starter bus: %s", error->message); g_error_free(error); @@ -173,7 +175,7 @@ indicator_service_init (IndicatorService *self) /* I think this should automatically, but I can't find confirmation of that, so we're putting the extra little code in here. */ error = NULL; - bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); + priv->bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); if (error != NULL) { g_error("Unable to get session bus: %s", error->message); g_error_free(error); @@ -181,7 +183,7 @@ indicator_service_init (IndicatorService *self) } } - priv->dbus_proxy = dbus_g_proxy_new_for_name_owner(bus, + priv->dbus_proxy = dbus_g_proxy_new_for_name_owner(priv->bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, @@ -192,7 +194,7 @@ indicator_service_init (IndicatorService *self) return; } - dbus_g_connection_register_g_object(bus, + dbus_g_connection_register_g_object(priv->bus, INDICATOR_SERVICE_OBJECT, G_OBJECT(self)); -- cgit v1.2.3 From d23ca44c07ddf691ae41b4a6c5c10b794f1de765 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Jul 2010 10:47:58 -0500 Subject: Actually creating a proxy to see if we can detect the watcher going away. --- libindicator/indicator-service.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index d3e873b..01fabce 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -387,9 +387,19 @@ _indicator_service_server_watch (IndicatorService * service, DBusGMethodInvocati const gchar * sender = dbus_g_method_get_sender(method); if (g_hash_table_lookup(priv->watchers, sender) == NULL) { - DBusGProxy * senderproxy = (gpointer)1; - - g_hash_table_insert(priv->watchers, g_strdup(sender), senderproxy); + GError * error = NULL; + DBusGProxy * senderproxy = dbus_g_proxy_new_for_name_owner(priv->bus, + sender, + "/", + DBUS_INTERFACE_INTROSPECTABLE, + &error); + + if (error == NULL) { + g_hash_table_insert(priv->watchers, g_strdup(sender), senderproxy); + } else { + g_warning("Unable to create proxy for watcher '%s': %s", sender, error->message); + g_error_free(error); + } } if (priv->timeout != 0) { -- cgit v1.2.3 From dd7106ee06b70f95879875acccab132a3ef2a8cb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Jul 2010 11:04:41 -0500 Subject: Creating a callback for the destory signal, but then moving the unwatch into a core function so that we can call it. --- libindicator/indicator-service.c | 42 ++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 01fabce..15335f3 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -29,6 +29,7 @@ License along with this library. If not, see #include "indicator-service.h" +static void unwatch_core (IndicatorService * service, const gchar * name); /* DBus Prototypes */ static gboolean _indicator_service_server_watch (IndicatorService * service, DBusGMethodInvocation * method); static gboolean _indicator_service_server_un_watch (IndicatorService * service, DBusGMethodInvocation * method); @@ -375,6 +376,19 @@ try_and_get_name (IndicatorService * service) return; } +/* If the proxy gets destroyed that's the same as getting an + unwatch signal. Make it so. */ +static void +proxy_destroyed (GObject * proxy, gpointer user_data) +{ + g_return_if_fail(INDICATOR_IS_SERVICE(user_data)); + + const gchar * name = dbus_g_proxy_get_bus_name(DBUS_G_PROXY(proxy)); + unwatch_core(INDICATOR_SERVICE(user_data), name); + + return; +} + /* Here is the function that gets called by the dbus interface "Watch" function. It is an async function so that we can get the sender and store that information. We @@ -394,6 +408,8 @@ _indicator_service_server_watch (IndicatorService * service, DBusGMethodInvocati DBUS_INTERFACE_INTROSPECTABLE, &error); + g_signal_connect(G_OBJECT(senderproxy), "destroy", G_CALLBACK(proxy_destroyed), service); + if (error == NULL) { g_hash_table_insert(priv->watchers, g_strdup(sender), senderproxy); } else { @@ -413,23 +429,34 @@ _indicator_service_server_watch (IndicatorService * service, DBusGMethodInvocati /* A function connecting into the dbus interface for the "UnWatch" function. It is also an async function to get - the sender. It then looks the sender up and removes them - from the list of watchers. If there are none left, it then - starts the timer for the shutdown signal. */ + the sender and passes everything to unwatch_core to remove it. */ static gboolean _indicator_service_server_un_watch (IndicatorService * service, DBusGMethodInvocation * method) { g_return_val_if_fail(INDICATOR_IS_SERVICE(service), FALSE); + + unwatch_core(service, dbus_g_method_get_sender(method)); + + dbus_g_method_return(method); + return TRUE; +} + +/* Performs the core of loosing a watcher; it removes them + from the list of watchers. If there are none left, it then + starts the timer for the shutdown signal. */ +static void +unwatch_core (IndicatorService * service, const gchar * name) +{ IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(service); /* Remove us from the watcher list here */ - gpointer watcher_item = g_hash_table_lookup(priv->watchers, dbus_g_method_get_sender(method)); + gpointer watcher_item = g_hash_table_lookup(priv->watchers, name); if (watcher_item != NULL) { /* Free the watcher */ - g_hash_table_remove(priv->watchers, dbus_g_method_get_sender(method)); + g_hash_table_remove(priv->watchers, name); } else { /* Odd that we couldn't find the person, but, eh */ - g_warning("Unable to find watcher who is unwatching: %s", dbus_g_method_get_sender(method)); + g_warning("Unable to find watcher who is unwatching: %s", name); } /* If we're out of watchers set the timeout for shutdown */ @@ -445,8 +472,7 @@ _indicator_service_server_un_watch (IndicatorService * service, DBusGMethodInvoc priv->timeout = g_timeout_add(500, timeout_no_watchers, service); } - dbus_g_method_return(method); - return TRUE; + return; } /* API */ -- cgit v1.2.3 From 46c8b3fee8172b80d0b0ee87887e4b3375c6f659 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Jul 2010 12:23:14 -0500 Subject: Disconnecting signal before removing from hashtable so we don't try twice. --- libindicator/indicator-service.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 15335f3..c29456e 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -453,6 +453,7 @@ unwatch_core (IndicatorService * service, const gchar * name) gpointer watcher_item = g_hash_table_lookup(priv->watchers, name); if (watcher_item != NULL) { /* Free the watcher */ + g_signal_handlers_disconnect_by_func(G_OBJECT(watcher_item), G_CALLBACK(proxy_destroyed), service); g_hash_table_remove(priv->watchers, name); } else { /* Odd that we couldn't find the person, but, eh */ -- cgit v1.2.3 From 974328f02da5a9c37f3f1e42db5794eb88c5e8ba Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Jul 2010 12:31:56 -0500 Subject: Unreffing the objects in dispose and ensuring we disconnect the signals first. --- libindicator/indicator-service.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index c29456e..a2aea24 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -30,6 +30,8 @@ License along with this library. If not, see #include "indicator-service.h" static void unwatch_core (IndicatorService * service, const gchar * name); +static void proxy_destroyed (GObject * proxy, gpointer user_data); +static gboolean watchers_remove (gpointer key, gpointer value, gpointer user_data); /* DBus Prototypes */ static gboolean _indicator_service_server_watch (IndicatorService * service, DBusGMethodInvocation * method); static gboolean _indicator_service_server_un_watch (IndicatorService * service, DBusGMethodInvocation * method); @@ -209,6 +211,10 @@ indicator_service_dispose (GObject *object) { IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(object); + if (priv->watchers != NULL) { + g_hash_table_foreach_remove(priv->watchers, watchers_remove, object); + } + if (priv->dbus_proxy != NULL) { g_object_unref(G_OBJECT(priv->dbus_proxy)); priv->dbus_proxy = NULL; @@ -314,6 +320,15 @@ get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspe return; } +/* A function to remove the signals on a proxy before we destroy + it because in this case we've stopped caring. */ +static gboolean +watchers_remove (gpointer key, gpointer value, gpointer user_data) +{ + g_signal_handlers_disconnect_by_func(G_OBJECT(value), G_CALLBACK(proxy_destroyed), user_data); + return TRUE; +} + /* This is the function that gets executed if we timeout because there are no watchers. We sent the shutdown signal and hope someone does something sane with it. */ -- cgit v1.2.3 From 647f8ea91cc304a0b14a255fcd07560046735eac Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Jul 2010 12:34:24 -0500 Subject: Use the same function so we know everything is all right. --- libindicator/indicator-service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index a2aea24..7c5826e 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -468,7 +468,7 @@ unwatch_core (IndicatorService * service, const gchar * name) gpointer watcher_item = g_hash_table_lookup(priv->watchers, name); if (watcher_item != NULL) { /* Free the watcher */ - g_signal_handlers_disconnect_by_func(G_OBJECT(watcher_item), G_CALLBACK(proxy_destroyed), service); + watchers_remove((gpointer)name, watcher_item, service); g_hash_table_remove(priv->watchers, name); } else { /* Odd that we couldn't find the person, but, eh */ -- cgit v1.2.3 From 7412490502f6f249479c1f4d7e07ab868530dcd0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Jul 2010 12:36:50 -0500 Subject: Documenting the choices of not having a nice callback func. --- libindicator/indicator-service.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 7c5826e..db234e2 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -165,6 +165,10 @@ indicator_service_init (IndicatorService *self) priv->bus = NULL; priv->this_service_version = 0; + /* NOTE: We're using g_object_unref here because that's what needs to + happen, but you really should call watchers_remove first as well + since that disconnects the signals. We can't do that with a callback + here because there is no user data to pass the object as well. */ priv->watchers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref); /* Start talkin' dbus */ -- cgit v1.2.3 From bc5e925ed181f2b64229afcac41bb4ba4f9aa4d1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Jul 2010 15:12:12 -0500 Subject: 0.3.9 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 8ae0c74..2622d73 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(libindicator, 0.3.8, ted@canonical.com) +AC_INIT(libindicator, 0.3.9, ted@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libindicator, 0.3.8) +AM_INIT_AUTOMAKE(libindicator, 0.3.9) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) -- cgit v1.2.3 From 613ad629e7409c8d8542851c3b84f1e313877378 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 09:22:20 -0500 Subject: Freeing the service. --- tests/service-version-good-service.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/service-version-good-service.c b/tests/service-version-good-service.c index bcfe46d..12a6a32 100644 --- a/tests/service-version-good-service.c +++ b/tests/service-version-good-service.c @@ -5,12 +5,19 @@ static GMainLoop * mainloop = NULL; static gboolean passed = FALSE; +static IndicatorService * is = NULL; gboolean timeout (gpointer data) { passed = FALSE; g_debug("Timeout with no shutdown."); + + if (is != NULL) { + g_object_unref(is); + is = NULL; + } + g_main_loop_quit(mainloop); return FALSE; } @@ -20,6 +27,12 @@ shutdown (void) { g_debug("Shutdown"); passed = TRUE; + + if (is != NULL) { + g_object_unref(is); + is = NULL; + } + g_main_loop_quit(mainloop); return; } @@ -29,7 +42,7 @@ main (int argc, char ** argv) { g_type_init(); - IndicatorService * is = indicator_service_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); + is = indicator_service_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); g_signal_connect(G_OBJECT(is), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, shutdown, NULL); g_timeout_add_seconds(1, timeout, NULL); -- cgit v1.2.3 From dac4891e4e3c809ccc3ac08f0d7e317962808792 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 09:30:25 -0500 Subject: A could of protections for the core. --- libindicator/indicator-service.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index db234e2..fc35a03 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -466,6 +466,9 @@ _indicator_service_server_un_watch (IndicatorService * service, DBusGMethodInvoc static void unwatch_core (IndicatorService * service, const gchar * name) { + g_return_if_fail(name != NULL); + g_return_if_fail(INDICATOR_IS_SERVICE(service)); + IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(service); /* Remove us from the watcher list here */ -- cgit v1.2.3 From 74a24d7651432fb151cddb024a562bdb71aaee57 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 09:53:20 -0500 Subject: Stop asking for the name, instead let's find it on our own. --- libindicator/indicator-service.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index fc35a03..d0f8ed2 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -395,14 +395,26 @@ try_and_get_name (IndicatorService * service) return; } +/* Look in the hash table for the proxy, as it won't give us + its name. */ +static gboolean +hash_table_find (gpointer key, gpointer value, gpointer user_data) +{ + if (value == user_data) { + return TRUE; + } + return FALSE; +} + /* If the proxy gets destroyed that's the same as getting an unwatch signal. Make it so. */ static void proxy_destroyed (GObject * proxy, gpointer user_data) { g_return_if_fail(INDICATOR_IS_SERVICE(user_data)); + IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(user_data); - const gchar * name = dbus_g_proxy_get_bus_name(DBUS_G_PROXY(proxy)); + gchar * name = (gchar *)g_hash_table_find(priv->watchers, hash_table_find, proxy); unwatch_core(INDICATOR_SERVICE(user_data), name); return; -- cgit v1.2.3 From 01130c5baedfd8547c984a14423a613282e71d42 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:39:44 -0500 Subject: Start a multi watch test --- tests/Makefile.am | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Makefile.am b/tests/Makefile.am index 13fef2d..04a6ed3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -303,6 +303,18 @@ service-version-tester: service-version-manager service-version-bad-service serv TESTS += service-version-tester DISTCLEANFILES += service-version-tester service-version-bad.service service-version-good.service +############################# +# Service Versions +############################# + +service-version-multiwatch-tester: service-version-manager service-version-good-service session.conf service-version-good.service Makefile.am + @echo "#!/bin/sh" > $@ + @echo dbus-test-runner --dbus-config $(builddir)/session.conf --task ./service-version-manager --task-name Manager1 --task ./service-version-manager --task-name Manager2 >> $@ + @chmod +x $@ + +TESTS += service-version-multiwatch-tester +DISTCLEANFILES += service-version-multiwatch-tester + ############################# # Service Manager Shutdown ############################# -- cgit v1.2.3 From 6786532d0efae7037c1b5d4f970359c6410d2cd7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:42:20 -0500 Subject: Making a new manager --- tests/Makefile.am | 18 +++++++++-- tests/service-version-multiwatch-manager.c | 52 ++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 tests/service-version-multiwatch-manager.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 04a6ed3..35e07f4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -307,9 +307,23 @@ DISTCLEANFILES += service-version-tester service-version-bad.service service-ver # Service Versions ############################# -service-version-multiwatch-tester: service-version-manager service-version-good-service session.conf service-version-good.service Makefile.am +check_PROGRAMS += service-version-multiwatch-manager + +service_version_manager_SOURCES = \ + service-version-values.h \ + service-version-multiwatch-manager.c + +service_version_multiwatch_manager_CFLAGS = \ + -Wall -Werror \ + $(LIBINDICATOR_CFLAGS) -I$(top_srcdir) + +service_version_multiwatch_manager_LDADD = \ + $(LIBINDICATOR_LIBS) \ + $(top_builddir)/libindicator/.libs/libindicator.a + +service-version-multiwatch-tester: service-version-multiwatch-manager service-version-good-service session.conf service-version-good.service Makefile.am @echo "#!/bin/sh" > $@ - @echo dbus-test-runner --dbus-config $(builddir)/session.conf --task ./service-version-manager --task-name Manager1 --task ./service-version-manager --task-name Manager2 >> $@ + @echo dbus-test-runner --dbus-config $(builddir)/session.conf --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ @chmod +x $@ TESTS += service-version-multiwatch-tester diff --git a/tests/service-version-multiwatch-manager.c b/tests/service-version-multiwatch-manager.c new file mode 100644 index 0000000..7293d43 --- /dev/null +++ b/tests/service-version-multiwatch-manager.c @@ -0,0 +1,52 @@ + +#include +#include "libindicator/indicator-service-manager.h" +#include "service-version-values.h" + +static GMainLoop * mainloop = NULL; +static gboolean passed = FALSE; + +gboolean +timeout (gpointer data) +{ + g_debug("Timeout."); + passed = FALSE; + g_main_loop_quit(mainloop); + return FALSE; +} + +void +connection_good (IndicatorServiceManager * sm, gboolean connected, gpointer user_data) +{ + if (!connected) return; + g_debug("Connection From Service."); + passed = TRUE; + g_main_loop_quit(mainloop); + return; +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); + g_print("Manager: DBUS_SESSION_BUS_ADDRESS = %s\n", g_getenv("DBUS_SESSION_BUS_ADDRESS")); + + IndicatorServiceManager * goodis = indicator_service_manager_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); + g_signal_connect(G_OBJECT(goodis), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_good), NULL); + + g_timeout_add_seconds(1, timeout, NULL); + + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); + + g_object_unref(goodis); + + g_debug("Quiting"); + if (passed) { + g_debug("Passed"); + return 0; + } + g_debug("Failed"); + return 1; +} -- cgit v1.2.3 From 054704d88d207c21c95823e6a8f1d1e4a884eece Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:42:46 -0500 Subject: Ignoring the new builds. --- .bzrignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bzrignore b/.bzrignore index 38d60ed..f48ec1e 100644 --- a/.bzrignore +++ b/.bzrignore @@ -152,3 +152,5 @@ tests/test-desktop-shortcuts tests/test-desktop-shortcuts-tester tests/test-desktop-shortcuts-touch-test libindicator/libindicator_la-indicator-image-helper.lo +tests/service-version-multiwatch-manager +tests/service-version-multiwatch-tester -- cgit v1.2.3 From 5731c1e07e2c2ca4d192213b3128bc5b7a3339b8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:45:18 -0500 Subject: Starting the service ourselves. --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 35e07f4..7690f10 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -323,7 +323,7 @@ service_version_multiwatch_manager_LDADD = \ service-version-multiwatch-tester: service-version-multiwatch-manager service-version-good-service session.conf service-version-good.service Makefile.am @echo "#!/bin/sh" > $@ - @echo dbus-test-runner --dbus-config $(builddir)/session.conf --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ + @echo dbus-test-runner --dbus-config $(builddir)/session.conf --task ./service-version-good-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ @chmod +x $@ TESTS += service-version-multiwatch-tester -- cgit v1.2.3 From 56dd41e5fcadc452ad1c5b0892e3cd0b5fa3da2f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:50:25 -0500 Subject: Delaying the watchers to ensure that we don't dbus activate, and removing the session.conf to even allow for that. --- tests/Makefile.am | 4 ++-- tests/service-version-multiwatch-manager.c | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 7690f10..12d6dc3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -321,9 +321,9 @@ service_version_multiwatch_manager_LDADD = \ $(LIBINDICATOR_LIBS) \ $(top_builddir)/libindicator/.libs/libindicator.a -service-version-multiwatch-tester: service-version-multiwatch-manager service-version-good-service session.conf service-version-good.service Makefile.am +service-version-multiwatch-tester: service-version-multiwatch-manager service-version-good-service Makefile.am @echo "#!/bin/sh" > $@ - @echo dbus-test-runner --dbus-config $(builddir)/session.conf --task ./service-version-good-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ + @echo dbus-test-runner --task ./service-version-good-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ @chmod +x $@ TESTS += service-version-multiwatch-tester diff --git a/tests/service-version-multiwatch-manager.c b/tests/service-version-multiwatch-manager.c index 7293d43..2edbd73 100644 --- a/tests/service-version-multiwatch-manager.c +++ b/tests/service-version-multiwatch-manager.c @@ -5,6 +5,7 @@ static GMainLoop * mainloop = NULL; static gboolean passed = FALSE; +static IndicatorServiceManager * goodis = NULL; gboolean timeout (gpointer data) @@ -25,6 +26,17 @@ connection_good (IndicatorServiceManager * sm, gboolean connected, gpointer user return; } +gboolean +delay_start (gpointer data) +{ + goodis = indicator_service_manager_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); + g_signal_connect(G_OBJECT(goodis), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_good), NULL); + + g_timeout_add_seconds(1, timeout, NULL); + + return FALSE; +} + int main (int argc, char ** argv) { @@ -32,10 +44,7 @@ main (int argc, char ** argv) g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); g_print("Manager: DBUS_SESSION_BUS_ADDRESS = %s\n", g_getenv("DBUS_SESSION_BUS_ADDRESS")); - IndicatorServiceManager * goodis = indicator_service_manager_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); - g_signal_connect(G_OBJECT(goodis), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_good), NULL); - - g_timeout_add_seconds(1, timeout, NULL); + g_timeout_add(500, delay_start, NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); -- cgit v1.2.3 From 7c7b497e39c3a00b898a3d854a284de06e5fd081 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:52:28 -0500 Subject: Okay, we need our own service too. Bah. --- .bzrignore | 1 + tests/Makefile.am | 18 ++++++++++-- tests/service-version-multiwatch-service.c | 47 ++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 tests/service-version-multiwatch-service.c diff --git a/.bzrignore b/.bzrignore index f48ec1e..cef9d4e 100644 --- a/.bzrignore +++ b/.bzrignore @@ -154,3 +154,4 @@ tests/test-desktop-shortcuts-touch-test libindicator/libindicator_la-indicator-image-helper.lo tests/service-version-multiwatch-manager tests/service-version-multiwatch-tester +tests/service-version-multiwatch-service diff --git a/tests/Makefile.am b/tests/Makefile.am index 12d6dc3..6a7fb42 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -321,9 +321,23 @@ service_version_multiwatch_manager_LDADD = \ $(LIBINDICATOR_LIBS) \ $(top_builddir)/libindicator/.libs/libindicator.a -service-version-multiwatch-tester: service-version-multiwatch-manager service-version-good-service Makefile.am +check_PROGRAMS += service-version-multiwatch-service + +service_version_multiwatch_service_SOURCES = \ + service-version-values.h \ + service-version-multiwatch-service.c + +service_version_multiwatch_service_CFLAGS = \ + -Wall -Werror \ + $(LIBINDICATOR_CFLAGS) -I$(top_srcdir) + +service_version_multiwatch_service_LDADD = \ + $(LIBINDICATOR_LIBS) \ + $(top_builddir)/libindicator/.libs/libindicator.a + +service-version-multiwatch-tester: service-version-multiwatch-manager service-version-multiwatch-service Makefile.am @echo "#!/bin/sh" > $@ - @echo dbus-test-runner --task ./service-version-good-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ + @echo dbus-test-runner --task ./service-version-multiwatch-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ @chmod +x $@ TESTS += service-version-multiwatch-tester diff --git a/tests/service-version-multiwatch-service.c b/tests/service-version-multiwatch-service.c new file mode 100644 index 0000000..bcfe46d --- /dev/null +++ b/tests/service-version-multiwatch-service.c @@ -0,0 +1,47 @@ + +#include +#include "libindicator/indicator-service.h" +#include "service-version-values.h" + +static GMainLoop * mainloop = NULL; +static gboolean passed = FALSE; + +gboolean +timeout (gpointer data) +{ + passed = FALSE; + g_debug("Timeout with no shutdown."); + g_main_loop_quit(mainloop); + return FALSE; +} + +void +shutdown (void) +{ + g_debug("Shutdown"); + passed = TRUE; + g_main_loop_quit(mainloop); + return; +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + + IndicatorService * is = indicator_service_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); + g_signal_connect(G_OBJECT(is), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, shutdown, NULL); + + g_timeout_add_seconds(1, timeout, NULL); + + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); + + g_debug("Quiting"); + if (passed) { + g_debug("Passed"); + return 0; + } + g_debug("Failed"); + return 1; +} -- cgit v1.2.3 From 990a881daae02537ecc76272471bc012ca17773a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:53:48 -0500 Subject: Longer timeout --- tests/service-version-multiwatch-service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/service-version-multiwatch-service.c b/tests/service-version-multiwatch-service.c index bcfe46d..ac92b36 100644 --- a/tests/service-version-multiwatch-service.c +++ b/tests/service-version-multiwatch-service.c @@ -32,7 +32,7 @@ main (int argc, char ** argv) IndicatorService * is = indicator_service_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); g_signal_connect(G_OBJECT(is), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, shutdown, NULL); - g_timeout_add_seconds(1, timeout, NULL); + g_timeout_add_seconds(2, timeout, NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); -- cgit v1.2.3 From dceee48da02357fcb92e45f030711a6e734a0f73 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:55:59 -0500 Subject: Up to 5 watchers. --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 6a7fb42..852a963 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -337,7 +337,7 @@ service_version_multiwatch_service_LDADD = \ service-version-multiwatch-tester: service-version-multiwatch-manager service-version-multiwatch-service Makefile.am @echo "#!/bin/sh" > $@ - @echo dbus-test-runner --task ./service-version-multiwatch-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ + @echo dbus-test-runner --task ./service-version-multiwatch-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 --task ./service-version-multiwatch-manager --task-name Manager3 --task ./service-version-multiwatch-manager --task-name Manager4 --task ./service-version-multiwatch-manager --task-name Manager5 >> $@ @chmod +x $@ TESTS += service-version-multiwatch-tester -- cgit v1.2.3 From b43f81d0ece9bb9c150ccbeba793f385bef6ce3b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:58:17 -0500 Subject: A couple debug messages to make the test easier to read the output from. --- tests/service-version-multiwatch-manager.c | 2 ++ tests/service-version-multiwatch-service.c | 1 + 2 files changed, 3 insertions(+) diff --git a/tests/service-version-multiwatch-manager.c b/tests/service-version-multiwatch-manager.c index 2edbd73..771426f 100644 --- a/tests/service-version-multiwatch-manager.c +++ b/tests/service-version-multiwatch-manager.c @@ -29,6 +29,8 @@ connection_good (IndicatorServiceManager * sm, gboolean connected, gpointer user gboolean delay_start (gpointer data) { + g_debug("Starting Manager"); + goodis = indicator_service_manager_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); g_signal_connect(G_OBJECT(goodis), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_good), NULL); diff --git a/tests/service-version-multiwatch-service.c b/tests/service-version-multiwatch-service.c index ac92b36..9920306 100644 --- a/tests/service-version-multiwatch-service.c +++ b/tests/service-version-multiwatch-service.c @@ -28,6 +28,7 @@ int main (int argc, char ** argv) { g_type_init(); + g_debug("Service starting"); IndicatorService * is = indicator_service_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); g_signal_connect(G_OBJECT(is), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, shutdown, NULL); -- cgit v1.2.3 -- cgit v1.2.3 From b0360dd4abbc5074909f0e4ccb2c21dff74bce29 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 13:06:58 -0500 Subject: Adding an impolite manager. --- .bzrignore | 1 + tests/Makefile.am | 18 ++++++- .../service-version-multiwatch-manager-impolite.c | 61 ++++++++++++++++++++++ 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 tests/service-version-multiwatch-manager-impolite.c diff --git a/.bzrignore b/.bzrignore index cef9d4e..c3c6afd 100644 --- a/.bzrignore +++ b/.bzrignore @@ -155,3 +155,4 @@ libindicator/libindicator_la-indicator-image-helper.lo tests/service-version-multiwatch-manager tests/service-version-multiwatch-tester tests/service-version-multiwatch-service +tests/service-version-multiwatch-manager-impolite diff --git a/tests/Makefile.am b/tests/Makefile.am index 852a963..2b3b170 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -321,6 +321,20 @@ service_version_multiwatch_manager_LDADD = \ $(LIBINDICATOR_LIBS) \ $(top_builddir)/libindicator/.libs/libindicator.a +check_PROGRAMS += service-version-multiwatch-manager-impolite + +service_version_manager_impolite_SOURCES = \ + service-version-values.h \ + service-version-multiwatch-manager-impolite.c + +service_version_multiwatch_manager_impolite_CFLAGS = \ + -Wall -Werror \ + $(LIBINDICATOR_CFLAGS) -I$(top_srcdir) + +service_version_multiwatch_manager_impolite_LDADD = \ + $(LIBINDICATOR_LIBS) \ + $(top_builddir)/libindicator/.libs/libindicator.a + check_PROGRAMS += service-version-multiwatch-service service_version_multiwatch_service_SOURCES = \ @@ -335,9 +349,9 @@ service_version_multiwatch_service_LDADD = \ $(LIBINDICATOR_LIBS) \ $(top_builddir)/libindicator/.libs/libindicator.a -service-version-multiwatch-tester: service-version-multiwatch-manager service-version-multiwatch-service Makefile.am +service-version-multiwatch-tester: service-version-multiwatch-manager service-version-multiwatch-service service-version-multiwatch-manager-impolite Makefile.am @echo "#!/bin/sh" > $@ - @echo dbus-test-runner --task ./service-version-multiwatch-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 --task ./service-version-multiwatch-manager --task-name Manager3 --task ./service-version-multiwatch-manager --task-name Manager4 --task ./service-version-multiwatch-manager --task-name Manager5 >> $@ + @echo dbus-test-runner --task ./service-version-multiwatch-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 --task ./service-version-multiwatch-manager --task-name Manager3 --task ./service-version-multiwatch-manager --task-name Manager4 --task ./service-version-multiwatch-manager --task-name Manager5 --task ./service-version-multiwatch-manager-impolite --task-name Impolite1 >> $@ @chmod +x $@ TESTS += service-version-multiwatch-tester diff --git a/tests/service-version-multiwatch-manager-impolite.c b/tests/service-version-multiwatch-manager-impolite.c new file mode 100644 index 0000000..8bfd3c6 --- /dev/null +++ b/tests/service-version-multiwatch-manager-impolite.c @@ -0,0 +1,61 @@ + +#include +#include "libindicator/indicator-service-manager.h" +#include "service-version-values.h" + +static GMainLoop * mainloop = NULL; +static gboolean passed = FALSE; +static IndicatorServiceManager * goodis = NULL; + +gboolean +timeout (gpointer data) +{ + g_debug("Timeout."); + passed = FALSE; + g_main_loop_quit(mainloop); + return FALSE; +} + +void +connection_good (IndicatorServiceManager * sm, gboolean connected, gpointer user_data) +{ + if (!connected) return; + g_debug("Connection From Service."); + passed = TRUE; + g_main_loop_quit(mainloop); + return; +} + +gboolean +delay_start (gpointer data) +{ + g_debug("Starting Manager"); + + goodis = indicator_service_manager_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); + g_signal_connect(G_OBJECT(goodis), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_good), NULL); + + g_timeout_add_seconds(1, timeout, NULL); + + return FALSE; +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); + g_print("Manager: DBUS_SESSION_BUS_ADDRESS = %s\n", g_getenv("DBUS_SESSION_BUS_ADDRESS")); + + g_timeout_add(500, delay_start, NULL); + + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); + + g_debug("Quiting"); + if (passed) { + g_debug("Passed"); + return 0; + } + g_debug("Failed"); + return 1; +} -- cgit v1.2.3 From 57503088efa419f9c7ceb6c77a06df5c3a1a2556 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 13:07:57 -0500 Subject: Lots of impoliteness to make sure. --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 2b3b170..9d5e496 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -351,7 +351,7 @@ service_version_multiwatch_service_LDADD = \ service-version-multiwatch-tester: service-version-multiwatch-manager service-version-multiwatch-service service-version-multiwatch-manager-impolite Makefile.am @echo "#!/bin/sh" > $@ - @echo dbus-test-runner --task ./service-version-multiwatch-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 --task ./service-version-multiwatch-manager --task-name Manager3 --task ./service-version-multiwatch-manager --task-name Manager4 --task ./service-version-multiwatch-manager --task-name Manager5 --task ./service-version-multiwatch-manager-impolite --task-name Impolite1 >> $@ + @echo dbus-test-runner --task ./service-version-multiwatch-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 --task ./service-version-multiwatch-manager --task-name Manager3 --task ./service-version-multiwatch-manager --task-name Manager4 --task ./service-version-multiwatch-manager --task-name Manager5 --task ./service-version-multiwatch-manager-impolite --task-name Impolite1 --task ./service-version-multiwatch-manager-impolite --task-name Impolite2 --task ./service-version-multiwatch-manager-impolite --task-name Impolite3 >> $@ @chmod +x $@ TESTS += service-version-multiwatch-tester -- cgit v1.2.3 From c7eee08171b40c224564a5fffd3a4c5f0e32f7c9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 13:13:21 -0500 Subject: We want the key not the value. --- libindicator/indicator-service.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index d0f8ed2..55fb650 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -395,12 +395,20 @@ try_and_get_name (IndicatorService * service) return; } +typedef struct _hash_table_find_t hash_table_find_t; +struct _hash_table_find_t { + GObject * proxy; + gchar * name; +}; + /* Look in the hash table for the proxy, as it won't give us its name. */ static gboolean hash_table_find (gpointer key, gpointer value, gpointer user_data) { - if (value == user_data) { + hash_table_find_t * finddata = (hash_table_find_t *)user_data; + if (value == finddata->proxy) { + finddata->name = key; return TRUE; } return FALSE; @@ -414,8 +422,11 @@ proxy_destroyed (GObject * proxy, gpointer user_data) g_return_if_fail(INDICATOR_IS_SERVICE(user_data)); IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(user_data); - gchar * name = (gchar *)g_hash_table_find(priv->watchers, hash_table_find, proxy); - unwatch_core(INDICATOR_SERVICE(user_data), name); + hash_table_find_t finddata = {0}; + finddata.proxy = proxy; + + g_hash_table_find(priv->watchers, hash_table_find, &finddata); + unwatch_core(INDICATOR_SERVICE(user_data), finddata.name); return; } -- cgit v1.2.3 From bf315eb7328baef9eed1c888ce85e070bcbb1e2a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jul 2010 11:17:21 -0500 Subject: Adding a new variable to adjust the time of the kill switch. --- libindicator/indicator-service.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 55fb650..e9005db 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -55,6 +55,7 @@ struct _IndicatorServicePrivate { DBusGProxy * dbus_proxy; DBusGConnection * bus; guint timeout; + guint timeout_length; GHashTable * watchers; guint this_service_version; }; @@ -164,6 +165,16 @@ indicator_service_init (IndicatorService *self) priv->watchers = NULL; priv->bus = NULL; priv->this_service_version = 0; + priv->timeout_length = 500; + + const gchar * timeoutenv = g_getenv("INDICATOR_SERVICE_SHUTDOWN_TIMEOUT"); + if (timeoutenv != NULL) { + gdouble newtimeout = g_strtod(timeoutenv, NULL); + if (newtimeout >= 1.0f) { + priv->timeout_length = newtimeout; + g_debug("Setting shutdown timeout to: %u", priv->timeout_length); + } + } /* NOTE: We're using g_object_unref here because that's what needs to happen, but you really should call watchers_remove first as well @@ -373,7 +384,9 @@ try_and_get_name_cb (DBusGProxy * proxy, guint status, GError * error, gpointer } IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(service); - priv->timeout = g_timeout_add_seconds(1, timeout_no_watchers, service); + /* Allow some extra time at start up as things can be in high + contention then. */ + priv->timeout = g_timeout_add(priv->timeout_length * 2, timeout_no_watchers, service); return; } @@ -515,7 +528,7 @@ unwatch_core (IndicatorService * service, const gchar * name) priv->timeout = 0; } /* If we don't get a new watcher quickly, we'll shutdown. */ - priv->timeout = g_timeout_add(500, timeout_no_watchers, service); + priv->timeout = g_timeout_add(priv->timeout_length, timeout_no_watchers, service); } return; -- cgit v1.2.3 From 362a2d76391c48ab73538bc5c2106d00ec481c7f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 15 Jul 2010 09:49:53 -0500 Subject: 0.3.10 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 2622d73..7f17df0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(libindicator, 0.3.9, ted@canonical.com) +AC_INIT(libindicator, 0.3.10, ted@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libindicator, 0.3.9) +AM_INIT_AUTOMAKE(libindicator, 0.3.10) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) -- cgit v1.2.3 From bec9f56f7d1eae4f1cdcecf572babfec58e72d32 Mon Sep 17 00:00:00 2001 From: Karl Date: Mon, 9 Aug 2010 10:41:11 +0100 Subject: Added absolute filename fixes --- libindicator/indicator-image-helper.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 2492227..2ff97e6 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -30,6 +30,9 @@ static void refresh_image (GtkImage * image) { g_return_if_fail(GTK_IS_IMAGE(image)); + gchar * icon_filename = NULL; + GtkIconInfo * icon_info = NULL; + gint icon_size = 22; GIcon * icon_names = (GIcon *)g_object_get_data(G_OBJECT(image), INDICATOR_NAMES_DATA); g_return_if_fail(icon_names != NULL); @@ -38,23 +41,29 @@ refresh_image (GtkImage * image) GtkIconTheme * default_theme = gtk_icon_theme_get_default(); g_return_if_fail(default_theme != NULL); - gint icon_size = 22; - /* Look through the themes for that icon */ - GtkIconInfo * icon_info = gtk_icon_theme_lookup_by_gicon(default_theme, icon_names, icon_size, 0); + icon_info = gtk_icon_theme_lookup_by_gicon(default_theme, icon_names, icon_size, 0); if (icon_info == NULL) { - g_warning("Unable to find icon in theme."); - return; + /* Try using the second item in the names, which should be the original filename supplied */ + const gchar * const * names = g_themed_icon_get_names(G_THEMED_ICON( icon_names )); + if (names) { + icon_filename = g_strdup(names[1]); + } else { + g_warning("Unable to find icon\n"); + return; + } + } else { + /* Grab the filename */ + icon_filename = (gchar *)gtk_icon_info_get_filename(icon_info); } - - /* Grab the filename */ - const gchar * icon_filename = gtk_icon_info_get_filename(icon_info); - g_return_if_fail(icon_filename != NULL); /* An error because we shouldn't get info without a filename */ + g_return_if_fail(icon_filename != NULL); /* An error because we don't have a filename */ /* Build a pixbuf */ GError * error = NULL; GdkPixbuf * pixbuf = gdk_pixbuf_new_from_file(icon_filename, &error); - gtk_icon_info_free(icon_info); + + if (icon_info != NULL) + gtk_icon_info_free(icon_info); if (pixbuf == NULL) { g_error("Unable to load icon from file '%s' because: %s", icon_filename, error == NULL ? "I don't know" : error->message); @@ -126,15 +135,16 @@ indicator_image_helper_update (GtkImage * image, const gchar * name) g_return_if_fail(name != NULL); g_return_if_fail(name[0] != '\0'); g_return_if_fail(image != NULL); + gboolean seen_previously = FALSE; /* Build us a GIcon */ GIcon * icon_names = g_themed_icon_new_with_default_fallbacks(name); + g_warn_if_fail(icon_names != NULL); g_return_if_fail(icon_names != NULL); - gboolean seen_previously = (g_object_get_data(G_OBJECT(image), INDICATOR_NAMES_DATA) != NULL); - /* Attach our names to the image */ g_object_set_data_full(G_OBJECT(image), INDICATOR_NAMES_DATA, icon_names, g_object_unref); + seen_previously = (g_object_get_data(G_OBJECT(image), INDICATOR_NAMES_DATA) != NULL); /* Put the pixbuf in */ refresh_image(image); -- cgit v1.2.3 From 53265a332a1d59a2f0867207fcd81926bf40ff6c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 12 Aug 2010 14:40:42 -0500 Subject: 0.3.11 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 7f17df0..23350c6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(libindicator, 0.3.10, ted@canonical.com) +AC_INIT(libindicator, 0.3.11, ted@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libindicator, 0.3.10) +AM_INIT_AUTOMAKE(libindicator, 0.3.11) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) -- cgit v1.2.3 From 89924de7c425e5cc6e6c201b2bb4e05c979aec7a Mon Sep 17 00:00:00 2001 From: Mikkel Kamstrup Erlandsen Date: Fri, 13 Aug 2010 10:17:33 +0200 Subject: Add an --enable-debug flag to configure script that forces a -g to gcc --- configure.ac | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/configure.ac b/configure.ac index 23350c6..9065602 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,20 @@ AC_DEFINE_PATH(PREFIX, "${prefix}", [prefix directory]) AC_DEFINE_PATH(SYSCONFDIR, "${sysconfdir}", [system configuration dir]) AC_DEFINE_PATH(LIBDIR, "${libdir}", [system configuration dir]) +######################### +# Debug symbols +######################### +AC_ARG_ENABLE([debug], + AC_HELP_STRING([--enable-debug], [build with debug symbols]),, + [enable_debug=no]) + +if test "x$enable_debug" = "xyes"; then + CFLAGS="-g $CFLAGS" + AC_DEFINE(ENABLE_DEBUG, 1, [build with extra debug information]) +fi + +AM_CONDITIONAL(ENABLE_DEBUG, test "$enable_debug" = "yes") + ########################### # Files ########################### @@ -105,4 +119,6 @@ AC_MSG_NOTICE([ Libindicator Configuration: Prefix: $prefix + + Enable debugging: $enable_debug ]) -- cgit v1.2.3 From 6878f1743e25a849d0a883259f06345814280637 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 16 Aug 2010 09:14:49 -0500 Subject: Changing the message to a warning and clearing the GtkImage. --- libindicator/indicator-image-helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 6b11f6f..b404b8f 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -50,6 +50,7 @@ refresh_image (GtkImage * image) icon_filename = names[1]; } else { g_warning("Unable to find icon\n"); + gtk_image_clear(image); return; } } else { @@ -67,7 +68,8 @@ refresh_image (GtkImage * image) } if (pixbuf == NULL) { - g_error("Unable to load icon from file '%s' because: %s", icon_filename, error == NULL ? "I don't know" : error->message); + g_warning("Unable to load icon from file '%s' because: %s", icon_filename, error == NULL ? "I don't know" : error->message); + gtk_image_clear(image); return; } -- cgit v1.2.3 From 7df0fe9109e7ffab293cf5d720cc708d5e6ff89f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 18 Aug 2010 10:59:48 -0500 Subject: 0.3.12 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 9065602..ba47820 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(libindicator, 0.3.11, ted@canonical.com) +AC_INIT(libindicator, 0.3.12, ted@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libindicator, 0.3.11) +AM_INIT_AUTOMAKE(libindicator, 0.3.12) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) -- cgit v1.2.3 From 98ec2f386f7b9409a2c745808ea6d5e329175bcd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Sep 2010 09:50:09 -0500 Subject: Adding slot for the menu show signal --- libindicator/indicator-object.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 3c6bec5..cddf7c8 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -79,8 +79,7 @@ typedef struct _IndicatorObjectEntry IndicatorObjectEntry; @entry_added: Slot for #IndicatorObject::entry-added @entry_removed: Slot for #IndicatorObject::entry-removed @entry_moved: Slot for #IndicatorObject::entry-moved - @indicator_object_reserved_1: Reserved for future use - @indicator_object_reserved_2: Reserved for future use + @menu_show: Slot for #IndicatorObject::menu-show */ struct _IndicatorObjectClass { GObjectClass parent_class; @@ -94,13 +93,13 @@ struct _IndicatorObjectClass { guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry); /* Signals */ - void (*entry_added) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); - void (*entry_removed) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); - void (*entry_moved) (IndicatorObject * io, IndicatorObjectEntry * entry, guint old_pos, guint new_pos, gpointer user_data); - void (*scroll) (IndicatorObject * io, gint delta, IndicatorScrollDirection direction); + void (*entry_added) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); + void (*entry_removed) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); + void (*entry_moved) (IndicatorObject * io, IndicatorObjectEntry * entry, guint old_pos, guint new_pos, gpointer user_data); + void (*scroll) (IndicatorObject * io, gint delta, IndicatorScrollDirection direction); + void (*menu_show) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data); /* Reserved */ - void (* indicator_object_reserved_1) (void); }; /** -- cgit v1.2.3 From 06b508479f76b2d90425ad0e16c65c94c3c8eb49 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Sep 2010 09:51:06 -0500 Subject: Forgot the signal name --- libindicator/indicator-object.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index cddf7c8..32a35f9 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -51,6 +51,8 @@ typedef enum #define INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, INDICATOR_OBJECT_TYPE)) #define INDICATOR_OBJECT_SIGNAL_SCROLL "scroll" #define INDICATOR_OBJECT_SIGNAL_SCROLL_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_SCROLL, INDICATOR_OBJECT_TYPE)) +#define INDICATOR_OBJECT_SIGNAL_MENU_SHOW "menu-show" +#define INDICATOR_OBJECT_SIGNAL_MENU_SHOW_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_MENU_SHOW, INDICATOR_OBJECT_TYPE)) typedef struct _IndicatorObject IndicatorObject; typedef struct _IndicatorObjectClass IndicatorObjectClass; -- cgit v1.2.3 From 69221d8f85a2e1b5f3638e7dfc988b772f74737e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Sep 2010 09:55:16 -0500 Subject: Adding in the signal for the menu showing --- libindicator/indicator-object-marshal.list | 1 + libindicator/indicator-object.c | 53 ++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/libindicator/indicator-object-marshal.list b/libindicator/indicator-object-marshal.list index d9dd126..bb447bb 100644 --- a/libindicator/indicator-object-marshal.list +++ b/libindicator/indicator-object-marshal.list @@ -1,2 +1,3 @@ VOID: POINTER, UINT, UINT VOID: UINT,ENUM +VOID: POINTER, UINT diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 511a407..a5fd740 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -57,7 +57,8 @@ enum { ENTRY_ADDED, ENTRY_REMOVED, ENTRY_MOVED, - SCROLL, + SCROLL, + MENU_SHOW, LAST_SIGNAL }; @@ -145,22 +146,40 @@ indicator_object_class_init (IndicatorObjectClass *klass) G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_NONE); - /** - IndicatorObject::scroll: - @arg0: The #IndicatorObject object - @arg1: The delta of the scroll event - @arg2: The orientation of the scroll event. - - When the indicator receives a mouse scroll wheel event - from the user, this signal is emitted. - */ - signals[SCROLL] = g_signal_new (INDICATOR_OBJECT_SIGNAL_SCROLL, - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (IndicatorObjectClass, scroll), - NULL, NULL, - _indicator_object_marshal_VOID__UINT_ENUM, - G_TYPE_NONE, 2, G_TYPE_UINT, INDICATOR_OBJECT_TYPE_SCROLL_DIRECTION); + /** + IndicatorObject::scroll: + @arg0: The #IndicatorObject object + @arg1: The delta of the scroll event + @arg2: The orientation of the scroll event. + + When the indicator receives a mouse scroll wheel event + from the user, this signal is emitted. + */ + signals[SCROLL] = g_signal_new (INDICATOR_OBJECT_SIGNAL_SCROLL, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IndicatorObjectClass, scroll), + NULL, NULL, + _indicator_object_marshal_VOID__UINT_ENUM, + G_TYPE_NONE, 2, G_TYPE_UINT, INDICATOR_OBJECT_TYPE_SCROLL_DIRECTION); + + /** + IndicatorObject::menu-show: + @arg0: The #IndicatorObject object + @arg1: A pointer to the #IndicatorObjectEntry that + is being shown. + @arg2: The timestamp of the event + + Used when the indicator wants to signal up the stack + that the menu should be shown. + */ + signals[MENU_SHOW] = g_signal_new (INDICATOR_OBJECT_SIGNAL_MENU_SHOW, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IndicatorObjectClass, menu_show), + NULL, NULL, + _indicator_object_marshal_VOID__POINTER_UINT, + G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT); return; -- cgit v1.2.3 From b933e7cfa64bd777ba7dc2d13ab8fa102f5cd4b4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 15 Sep 2010 08:58:07 -0500 Subject: Putting a printout in for showing menus. --- tools/indicator-loader.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/indicator-loader.c b/tools/indicator-loader.c index 0f4a7be..747b216 100644 --- a/tools/indicator-loader.c +++ b/tools/indicator-loader.c @@ -79,6 +79,13 @@ entry_removed (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user return; } +static void +menu_show (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data) +{ + g_debug("Show Menu: %s", entry->label != NULL ? gtk_label_get_text(entry->label) : "No Label"); + return; +} + static gboolean load_module (const gchar * name, GtkWidget * menu) { @@ -97,6 +104,7 @@ load_module (const gchar * name, GtkWidget * menu) /* Connect to it's signals */ g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, G_CALLBACK(entry_added), menu); g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_removed), menu); + g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_MENU_SHOW, G_CALLBACK(menu_show), NULL); /* Work on the entries */ GList * entries = indicator_object_get_entries(io); -- cgit v1.2.3 From bc8ba95828914624a74299957a58b36bbf769e5a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 15 Sep 2010 11:42:57 -0500 Subject: 0.3.13 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ba47820..ee226e8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(libindicator, 0.3.12, ted@canonical.com) +AC_INIT(libindicator, 0.3.13, ted@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libindicator, 0.3.12) +AM_INIT_AUTOMAKE(libindicator, 0.3.13) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) -- cgit v1.2.3 From 90b4c191ef8eb28244ea405669a3671f0e5060c5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 16 Sep 2010 15:56:50 -0500 Subject: Adding a function to push activate back down. --- libindicator/indicator-object.c | 19 +++++++++++++++++++ libindicator/indicator-object.h | 1 + 2 files changed, 20 insertions(+) diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index a5fd740..63eed05 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -432,3 +432,22 @@ indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entr return 0; } + +/** + indicator_object_entry_activate: + @io: #IndicatorObject to query + @entry: The #IndicatorObjectEntry whose entry was shown + + Used to signal to the indicator that the menu on an entry has + been clicked on. This can either be an activate or a showing + of the menu. Note, this does not actually show the menu that's + left up to the reader. +*/ +void +indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry) +{ + + + + return; +} diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 32a35f9..8714093 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -132,6 +132,7 @@ IndicatorObject * indicator_object_new_from_file (const gchar * file); GList * indicator_object_get_entries (IndicatorObject * io); guint indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entry); +void indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry); G_END_DECLS -- cgit v1.2.3 From 64db4d0d0dd0eb801b0dd2214d7723ba10f4ba81 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 16 Sep 2010 16:06:41 -0500 Subject: Breaking the ABI and adding a subclassable function. --- libindicator/indicator-object.c | 3 ++- libindicator/indicator-object.h | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 63eed05..ecd0966 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -437,6 +437,7 @@ indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entr indicator_object_entry_activate: @io: #IndicatorObject to query @entry: The #IndicatorObjectEntry whose entry was shown + @timestamp: The X11 timestamp of the event Used to signal to the indicator that the menu on an entry has been clicked on. This can either be an activate or a showing @@ -444,7 +445,7 @@ indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entr left up to the reader. */ void -indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry) +indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp) { diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 8714093..79f4757 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -94,6 +94,8 @@ struct _IndicatorObjectClass { GList * (*get_entries) (IndicatorObject * io); guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry); + void (*entry_activate) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); + /* Signals */ void (*entry_added) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); void (*entry_removed) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); @@ -102,6 +104,12 @@ struct _IndicatorObjectClass { void (*menu_show) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data); /* Reserved */ + void (*reserved1) (void); + void (*reserved2) (void); + void (*reserved3) (void); + void (*reserved4) (void); + void (*reserved5) (void); + void (*reserved6) (void); }; /** @@ -132,7 +140,7 @@ IndicatorObject * indicator_object_new_from_file (const gchar * file); GList * indicator_object_get_entries (IndicatorObject * io); guint indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entry); -void indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry); +void indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); G_END_DECLS -- cgit v1.2.3 From daffbe647964a04f1f8da94f12cfd9746ad7483b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 16 Sep 2010 16:09:26 -0500 Subject: Fleshing out the entry activate function --- libindicator/indicator-object.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index ecd0966..41484a6 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -447,8 +447,13 @@ indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entr void indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp) { + g_return_if_fail(INDICATOR_IS_OBJECT(io)); + IndicatorObjectClass * class = INDICATOR_OBJECT_GET_CLASS(io); - + if (class->entry_activate != NULL) { + return class->entry_activate(io, entry, timestamp); + } return; } + -- cgit v1.2.3 From 6269aec66333ed1e308ebc22182ceaa57217ad36 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 16 Sep 2010 16:15:31 -0500 Subject: Creating a callback on the loader to signal the event press down to the entry. --- tools/indicator-loader.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/indicator-loader.c b/tools/indicator-loader.c index 747b216..03614aa 100644 --- a/tools/indicator-loader.c +++ b/tools/indicator-loader.c @@ -27,6 +27,17 @@ License along with this library. If not, see #define ENTRY_DATA_NAME "indicator-custom-entry-data" +static void +activate_entry (GtkWidget * widget, gpointer user_data) +{ + g_return_if_fail(INDICATOR_IS_OBJECT(user_data)); + gpointer entry = g_object_get_data(G_OBJECT(widget), ENTRY_DATA_NAME); + g_return_if_fail(entry == NULL); + + indicator_object_entry_activate(INDICATOR_OBJECT(user_data), (IndicatorObjectEntry *)entry, gtk_get_current_event_time()); + return; +} + static void entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data) { @@ -48,6 +59,8 @@ entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_d gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entry->menu)); } + g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(activate_entry), io); + gtk_menu_shell_append(GTK_MENU_SHELL(user_data), menuitem); gtk_widget_show(menuitem); -- cgit v1.2.3 From 99dc263ab476e69931cff4bf06d9ae0cba3ce4ff Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 16 Sep 2010 16:37:08 -0500 Subject: Changing indicator directory to '4' --- libindicator/indicator.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindicator/indicator.pc.in b/libindicator/indicator.pc.in index 91b70b1..abc5590 100644 --- a/libindicator/indicator.pc.in +++ b/libindicator/indicator.pc.in @@ -4,7 +4,7 @@ libdir=@libdir@ bindir=@bindir@ includedir=@includedir@ -indicatordir=${libdir}/indicators/3/ +indicatordir=${libdir}/indicators/4/ iconsdir=@datarootdir@/@PACKAGE@/icons/ Cflags: -I${includedir}/libindicator-0.3 -- cgit v1.2.3 From 03641dce0d1c38ef5fb2447b33f88e9d66c6aecf Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 17 Sep 2010 09:16:17 -0500 Subject: Adding some version information so we don't need a conflicts --- libindicator/Makefile.am | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libindicator/Makefile.am b/libindicator/Makefile.am index 983a6a5..f942f0d 100644 --- a/libindicator/Makefile.am +++ b/libindicator/Makefile.am @@ -42,6 +42,11 @@ libindicator_la_CFLAGS = \ libindicator_la_LIBADD = \ $(LIBINDICATOR_LIBS) +libindicator_la_LDFLAGS = \ + -version-info 1:0:0 \ + -no-undefined \ + -export-symbols-regex "^[^_].*" + pkgconfig_DATA = indicator.pc pkgconfigdir = $(libdir)/pkgconfig -- cgit v1.2.3 From 25d85a1210b7e3bbe5ba42bfc304c26a687ea31c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 21 Sep 2010 11:17:50 -0500 Subject: Adding dist hooks for AUTHORS and ChangeLog --- Makefile.am | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Makefile.am b/Makefile.am index 8894e24..f290d63 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,3 +7,29 @@ SUBDIRS = \ DISTCLEANFILES = \ libindicator-*.tar.gz +dist-hook: + @if test -d "$(top_srcdir)/.bzr"; \ + then \ + echo Creating ChangeLog && \ + ( cd "$(top_srcdir)" && \ + echo '# Generated by Makefile. Do not edit.'; echo; \ + $(top_srcdir)/missing --run bzr log --gnu-changelog ) > ChangeLog.tmp \ + && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \ + || (rm -f ChangeLog.tmp; \ + echo Failed to generate ChangeLog >&2 ); \ + else \ + echo Failed to generate ChangeLog: not a branch >&2; \ + fi + @if test -d "$(top_srcdir)/.bzr"; \ + then \ + echo Creating AUTHORS && \ + ( cd "$(top_srcdir)" && \ + echo '# Generated by Makefile. Do not edit.'; echo; \ + $(top_srcdir)/missing --run bzr log --long --levels=0 | grep -e "^\s*author:" -e "^\s*committer:" | cut -d ":" -f 2 | cut -d "<" -f 1 | sort -u) > AUTHORS.tmp \ + && mv -f AUTHORS.tmp $(top_distdir)/AUTHORS \ + || (rm -f AUTHORS.tmp; \ + echo Failed to generate AUTHORS >&2 ); \ + else \ + echo Failed to generate AUTHORS: not a branch >&2; \ + fi + -- cgit v1.2.3 From 53e57ef79ef72c081924b6a4bf42eee6ccadb190 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 21 Sep 2010 11:27:07 -0500 Subject: Changing AUTHORS to mention it's built --- AUTHORS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index f2712a9..0aa9e30 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,2 +1,2 @@ -Ted Gould -Cody Russell \ No newline at end of file +# Generated by Makefile at dist + -- cgit v1.2.3 From 558a37d1ad6479d912c8af6f209f7ba3b7cdc823 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 21 Sep 2010 15:48:56 -0500 Subject: 0.3.14 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ee226e8..d9a6240 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(libindicator, 0.3.13, ted@canonical.com) +AC_INIT(libindicator, 0.3.14, ted@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libindicator, 0.3.13) +AM_INIT_AUTOMAKE(libindicator, 0.3.14) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) -- cgit v1.2.3 From fc94eab8fd3749f0c9c68451f359c9e1efcdfd3b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Oct 2010 12:24:12 -0500 Subject: All the environment flags we should set for debugging --- tools/indicator-debugging | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tools/indicator-debugging diff --git a/tools/indicator-debugging b/tools/indicator-debugging new file mode 100644 index 0000000..afc2093 --- /dev/null +++ b/tools/indicator-debugging @@ -0,0 +1,8 @@ +# Timeout after 1 minute +export INDICATOR_SERVICE_SHUTDOWN_TIMEOUT=60000 + +# If no one connects, still stay alive +export INDICATOR_ALLOW_NO_WATCHERS=1 + +# Don't restart the services if they crash +export INDICATOR_SERVICE_RESTART_DISABLE=1 -- cgit v1.2.3 From 2e3ea76f4947c1148f6c3a8b870e0e319deaa20c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Oct 2010 12:37:08 -0500 Subject: Installing the environment file in the session dir --- tools/Makefile.am | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/Makefile.am b/tools/Makefile.am index 5e5ef8d..4b959a5 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -19,3 +19,8 @@ indicator_loader_LDADD = \ -L$(top_builddir)/libindicator/.libs \ -lindicator +xsessiondir = $(sysconfdir)/X11/Xsession.d + +xsession_DATA = indicator-debugging + +EXTRA_DIST = $(xsession_DATA) -- cgit v1.2.3 From 0f99ed218d71e96d2fa5f10c5f0791b61445f8aa Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Oct 2010 12:39:13 -0500 Subject: Adding a number in the name --- tools/80indicator-debugging | 8 ++++++++ tools/Makefile.am | 2 +- tools/indicator-debugging | 8 -------- 3 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 tools/80indicator-debugging delete mode 100644 tools/indicator-debugging diff --git a/tools/80indicator-debugging b/tools/80indicator-debugging new file mode 100644 index 0000000..afc2093 --- /dev/null +++ b/tools/80indicator-debugging @@ -0,0 +1,8 @@ +# Timeout after 1 minute +export INDICATOR_SERVICE_SHUTDOWN_TIMEOUT=60000 + +# If no one connects, still stay alive +export INDICATOR_ALLOW_NO_WATCHERS=1 + +# Don't restart the services if they crash +export INDICATOR_SERVICE_RESTART_DISABLE=1 diff --git a/tools/Makefile.am b/tools/Makefile.am index 4b959a5..168cea8 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -21,6 +21,6 @@ indicator_loader_LDADD = \ xsessiondir = $(sysconfdir)/X11/Xsession.d -xsession_DATA = indicator-debugging +xsession_DATA = 80indicator-debugging EXTRA_DIST = $(xsession_DATA) diff --git a/tools/indicator-debugging b/tools/indicator-debugging deleted file mode 100644 index afc2093..0000000 --- a/tools/indicator-debugging +++ /dev/null @@ -1,8 +0,0 @@ -# Timeout after 1 minute -export INDICATOR_SERVICE_SHUTDOWN_TIMEOUT=60000 - -# If no one connects, still stay alive -export INDICATOR_ALLOW_NO_WATCHERS=1 - -# Don't restart the services if they crash -export INDICATOR_SERVICE_RESTART_DISABLE=1 -- cgit v1.2.3 From b877951a5c45aaaa49718748b5f786681e3e9622 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Oct 2010 12:41:16 -0500 Subject: Add mean comment --- tools/80indicator-debugging | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/80indicator-debugging b/tools/80indicator-debugging index afc2093..f21559c 100644 --- a/tools/80indicator-debugging +++ b/tools/80indicator-debugging @@ -1,3 +1,9 @@ +# These are environment variables that effect the behavior +# of libindicator's service manager and indicator service +# objects. They turn off various robustness features that +# make debugging difficult and are not recommended for +# daily use. Development use only! + # Timeout after 1 minute export INDICATOR_SERVICE_SHUTDOWN_TIMEOUT=60000 -- cgit v1.2.3