From 2a913873186288d10321fc13de7565a198da568c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 11 Jan 2010 13:21:50 -0600 Subject: Adding in the class functions for handling the fallback. --- src/libappindicator/app-indicator.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/libappindicator/app-indicator.h b/src/libappindicator/app-indicator.h index a680c33..a8d82ab 100644 --- a/src/libappindicator/app-indicator.h +++ b/src/libappindicator/app-indicator.h @@ -148,10 +148,12 @@ typedef struct _AppIndicatorPrivate AppIndicatorPrivate; @new_attention_icon: Slot for #AppIndicator::new-attention-icon. @new_status: Slot for #AppIndicator::new-status. @connection_changed: Slot for #AppIndicator::connection-changed. + @fallback: Function that gets called to make a #GtkStatusIcon when + there is no Application Indicator area available. + @unfallback: The function that gets called if an Application + Indicator area appears after the fallback has been created. @app_indicator_reserved_1: Reserved for future use. @app_indicator_reserved_2: Reserved for future use. - @app_indicator_reserved_3: Reserved for future use. - @app_indicator_reserved_4: Reserved for future use. The signals and external functions that make up the #AppIndicator class object. @@ -174,11 +176,14 @@ struct _AppIndicatorClass { gboolean connected, gpointer user_data); + /* Overridable Functions */ + GtkStatusIcon * (*fallback) (AppIndicator * indicator); + void (*unfallback) (AppIndicator * indicator, + GtkStatusIcon * status_icon); + /* Reserved */ void (*app_indicator_reserved_1)(void); void (*app_indicator_reserved_2)(void); - void (*app_indicator_reserved_3)(void); - void (*app_indicator_reserved_4)(void); }; /** -- cgit v1.2.3 From d8c7246f702c687b4f532cfb66c5eeb545aa175d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 11 Jan 2010 14:05:24 -0600 Subject: Setting the fallback functions so that we can go round trip on setting up this API. --- src/libappindicator/app-indicator.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 7560a97..9f0ca54 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -64,8 +64,9 @@ struct _AppIndicatorPrivate { gchar *icon_name; gchar *attention_icon_name; gchar * icon_path; - DbusmenuServer *menuservice; - GtkWidget *menu; + DbusmenuServer *menuservice; + GtkWidget *menu; + GtkStatusIcon * status_icon; /* Fun stuff */ DBusGProxy *watcher_proxy; @@ -122,6 +123,8 @@ static void app_indicator_get_property (GObject * object, guint prop_id, GValue /* Other stuff */ static void check_connect (AppIndicator * self); static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data); +static GtkStatusIcon * fallback (AppIndicator * self); +static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon); /* GObject type */ G_DEFINE_TYPE (AppIndicator, app_indicator, G_TYPE_OBJECT); @@ -141,6 +144,10 @@ app_indicator_class_init (AppIndicatorClass *klass) object_class->set_property = app_indicator_set_property; object_class->get_property = app_indicator_get_property; + /* Our own funcs */ + klass->fallback = fallback; + klass->unfallback = unfallback; + /* Properties */ g_object_class_install_property (object_class, PROP_ID, @@ -568,6 +575,24 @@ category_from_enum (AppIndicatorCategory category) return value->value_nick; } +/* Creates a StatusIcon that can be used when the application + indicator area isn't available. */ +static GtkStatusIcon * +fallback (AppIndicator * self) +{ + + return NULL; +} + +/* Removes the status icon as the application indicator area + is now up and running again. */ +static void +unfallback (AppIndicator * self, GtkStatusIcon * status_icon) +{ + + return; +} + /* ************************* */ /* Public Functions */ -- cgit v1.2.3 From f8d6a7d026be10ea4cdb486cfa945ad697403f26 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 11 Jan 2010 16:27:19 -0600 Subject: Initing and destroying the status_icon variable --- src/libappindicator/app-indicator.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 9f0ca54..2650342 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -302,6 +302,8 @@ app_indicator_init (AppIndicator *self) priv->watcher_proxy = NULL; priv->connection = NULL; + priv->status_icon = NULL; + /* Put the object on DBus */ GError * error = NULL; priv->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); @@ -325,13 +327,21 @@ app_indicator_init (AppIndicator *self) static void app_indicator_dispose (GObject *object) { - AppIndicator *self = APP_INDICATOR (object); + AppIndicator *self = APP_INDICATOR (object); AppIndicatorPrivate *priv = self->priv; if (priv->status != APP_INDICATOR_STATUS_PASSIVE) { app_indicator_set_status(self, APP_INDICATOR_STATUS_PASSIVE); } + if (priv->status_icon != NULL) { + AppIndicatorClass * class = APP_INDICATOR_CLASS(object); + if (class->unfallback != NULL) { + class->unfallback(self, priv->status_icon); + } + priv->status_icon = NULL; + } + if (priv->menu != NULL) { g_object_unref(G_OBJECT(priv->menu)); priv->menu = NULL; -- cgit v1.2.3 From 40d3056382d3856f8e22d0bd6d2a4f4a411917f2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 11:40:50 -0600 Subject: Start timer fallback --- src/libappindicator/app-indicator.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index e3de406..63f69c9 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -127,6 +127,7 @@ static void app_indicator_get_property (GObject * object, guint prop_id, GValue /* Other stuff */ static void check_connect (AppIndicator * self); static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data); +static void start_fallback_timer (AppIndicator * self, gboolean do_it_now); static GtkStatusIcon * fallback (AppIndicator * self); static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon); @@ -557,8 +558,8 @@ check_connect (AppIndicator *self) &error); if (error != NULL) { g_warning("Unable to create Ayatana Watcher proxy! %s", error->message); - /* TODO: This is where we should start looking at fallbacks */ g_error_free(error); + start_fallback_timer(self, FALSE); return; } @@ -576,6 +577,7 @@ register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) g_warning("Unable to connect to the Notification Watcher: %s", error->message); g_object_unref(G_OBJECT(priv->watcher_proxy)); priv->watcher_proxy = NULL; + start_fallback_timer(APP_INDICATOR(data), TRUE); } return; } @@ -587,6 +589,18 @@ category_from_enum (AppIndicatorCategory category) value = g_enum_get_value ((GEnumClass *)g_type_class_ref (APP_INDICATOR_TYPE_INDICATOR_CATEGORY), category); return value->value_nick; +} + +/* A function that will start the fallback timer if it's not + already started. It sets up the DBus watcher to see if + there is a change. Also, provides an override mode for cases + where it's unlikely that a timer will help anything. */ +static void +start_fallback_timer (AppIndicator * self, gboolean do_it_now) +{ + + + } /* Creates a StatusIcon that can be used when the application -- cgit v1.2.3 From 7e5e095f25954857936213bd7136fb1e18583819 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 11:55:35 -0600 Subject: Some comments --- src/libappindicator/app-indicator.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 63f69c9..b28a876 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -568,12 +568,16 @@ check_connect (AppIndicator *self) return; } +/* Responce from the DBus command to register a service + with a NotificationWatcher. */ static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) { AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(data); if (error != NULL) { + /* They didn't respond, ewww. Not sure what they could + be doing */ g_warning("Unable to connect to the Notification Watcher: %s", error->message); g_object_unref(G_OBJECT(priv->watcher_proxy)); priv->watcher_proxy = NULL; @@ -582,6 +586,8 @@ register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) return; } +/* A helper function to get the nick out of a given + category enum value. */ static const gchar * category_from_enum (AppIndicatorCategory category) { -- cgit v1.2.3 From 9518459fda51ce675794115b401e36cb2f4306f5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 13:37:40 -0600 Subject: Fallback timer pointer lifecycle. --- src/libappindicator/app-indicator.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index b28a876..687ce21 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -66,7 +66,9 @@ struct _AppIndicatorPrivate { gchar * icon_path; DbusmenuServer *menuservice; GtkWidget *menu; + GtkStatusIcon * status_icon; + gint fallback_timer; /* Fun stuff */ DBusGProxy *watcher_proxy; @@ -116,6 +118,9 @@ enum { #define DEFAULT_ITEM_PATH "/org/ayatana/NotificationItem" #define DEFAULT_MENU_PATH "/org/ayatana/NotificationItem/Menu" +/* More constants */ +#define DEFAULT_FALLBACK_TIMER 100 /* in milliseconds */ + /* Boiler plate */ static void app_indicator_class_init (AppIndicatorClass *klass); static void app_indicator_init (AppIndicator *self); @@ -308,6 +313,7 @@ app_indicator_init (AppIndicator *self) priv->connection = NULL; priv->status_icon = NULL; + priv->fallback_timer = 0; /* Put the object on DBus */ GError * error = NULL; @@ -347,6 +353,11 @@ app_indicator_dispose (GObject *object) priv->status_icon = NULL; } + if (priv->fallback_timer != 0) { + g_source_remove(priv->fallback_timer); + priv->fallback_timer = 0; + } + if (priv->menu != NULL) { g_object_unref(G_OBJECT(priv->menu)); priv->menu = NULL; @@ -583,6 +594,9 @@ register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) priv->watcher_proxy = NULL; start_fallback_timer(APP_INDICATOR(data), TRUE); } + + /* TODO: Unfallback here */ + return; } @@ -604,7 +618,13 @@ category_from_enum (AppIndicatorCategory category) static void start_fallback_timer (AppIndicator * self, gboolean do_it_now) { + AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(self); + if (priv->fallback_timer != 0) { + /* The timer is set, let's just be happy with the one + we've already got running */ + return; + } } -- cgit v1.2.3 From 36d47b56783c1b1ea3356d532e00a13f61f174df Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 14:05:33 -0600 Subject: Setup the fallback timer and flesh out it's actions. --- src/libappindicator/app-indicator.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 687ce21..b33a51d 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -133,6 +133,7 @@ static void app_indicator_get_property (GObject * object, guint prop_id, GValue static void check_connect (AppIndicator * self); static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data); static void start_fallback_timer (AppIndicator * self, gboolean do_it_now); +static gboolean fallback_timer_expire (gpointer data); static GtkStatusIcon * fallback (AppIndicator * self); static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon); @@ -626,7 +627,37 @@ start_fallback_timer (AppIndicator * self, gboolean do_it_now) return; } + /* TODO: Setup what we need to check things out */ + if (do_it_now) { + fallback_timer_expire(self); + } else { + priv->fallback_timer = g_timeout_add(DEFAULT_FALLBACK_TIMER, fallback_timer_expire, self); + } + + return; +} + +/* A function that gets executed when we want to change the + state of the fallback. */ +static gboolean +fallback_timer_expire (gpointer data) +{ + AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(data); + AppIndicatorClass * class = APP_INDICATOR_CLASS(data); + + if (priv->status_icon == NULL) { + if (class->fallback != NULL) { + priv->status_icon = class->fallback(APP_INDICATOR(data)); + } + } else { + if (class->unfallback != NULL) { + class->unfallback(APP_INDICATOR(data), priv->status_icon); + priv->status_icon = NULL; + } + } + + return FALSE; } /* Creates a StatusIcon that can be used when the application -- cgit v1.2.3 From 4a1b7228d3fd9cfa163082c2bbf5b2982c6b525b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 15:41:16 -0600 Subject: Getting the start of the fallback tests in place. --- .bzrignore | 2 + tests/Makefile.am | 35 +++++++++++++ tests/test-libappindicator-fallback-watcher.c | 73 +++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 tests/test-libappindicator-fallback-watcher.c diff --git a/.bzrignore b/.bzrignore index 977611c..17798c8 100644 --- a/.bzrignore +++ b/.bzrignore @@ -87,3 +87,5 @@ docs/reference/xml docs/reference/tmpl/app-indicator.sgml docs/reference/tmpl/app-indicator.sgml.bak src/libappindicator/appindicator-0.1.pc +tests/test-libappindicator-fallback-item +tests/test-libappindicator-fallback-watcher diff --git a/tests/Makefile.am b/tests/Makefile.am index 845b41c..e5847c5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -3,6 +3,8 @@ check_PROGRAMS = \ test-libappindicator \ test-libappindicator-dbus-client \ test-libappindicator-dbus-server \ + test-libappindicator-fallback-watcher \ + test-libappindicator-fallback-item \ test-simple-app TESTS = @@ -58,6 +60,39 @@ test_libappindicator_dbus_server_LDADD = \ $(INDICATOR_LIBS) \ $(top_builddir)/src/libappindicator.la +######################################### +## test-libappindicator-fallback +######################################### + +test_libappindicator_fallback_watcher_SOURCES = \ + test-libappindicator-fallback-watcher.c + +test_libappindicator_fallback_watcher_CFLAGS = \ + $(INDICATOR_CFLAGS) \ + -Wall -Werror \ + -I$(top_srcdir)/src + +test_libappindicator_fallback_watcher_LDADD = \ + $(INDICATOR_LIBS) \ + $(top_builddir)/src/libappindicator.la + +test_libappindicator_fallback_item_SOURCES = \ + test-libappindicator-fallback-watcher.c + +test_libappindicator_fallback_item_CFLAGS = \ + $(INDICATOR_CFLAGS) \ + -Wall -Werror \ + -I$(top_srcdir)/src + +test_libappindicator_fallback_item_LDADD = \ + $(INDICATOR_LIBS) \ + $(top_builddir)/src/libappindicator.la + +test-libappindicator-fallback: test-libappindicator-fallback-watcher test-libappindicator-fallback-item Makefile.am + @echo "#!/bin/sh" > $@ + @echo $(DBUS_RUNNER) --task ./test-libappindicator-fallback-watcher --task-name Watcher --ignore-return --task ./test-libappindicator-fallback-item --task-name Item >> $@ + @chmod +x $@ + ######################################### ## Actual tests ######################################### diff --git a/tests/test-libappindicator-fallback-watcher.c b/tests/test-libappindicator-fallback-watcher.c new file mode 100644 index 0000000..67109e5 --- /dev/null +++ b/tests/test-libappindicator-fallback-watcher.c @@ -0,0 +1,73 @@ +/* +This puts the NotificationWatcher on the bus, kinda. Enough to +trick the Item into unfalling back. + +Copyright 2010 Canonical Ltd. + +Authors: + Ted Gould + +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 +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ + +#include +#include +#include + +#include "../src/dbus-shared.h" + +static GMainLoop * mainloop = NULL; + +gboolean +kill_func (gpointer userdata) +{ + g_main_loop_quit(mainloop); + return FALSE; +} + +int +main (int argv, char ** argc) +{ + g_type_init(); + + /* Wait 1/4 a second, which should trigger the fallback */ + g_usleep(250000); + + 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; + } + + /* After we've got the name, let it unfallback, and then we'll drop again */ + g_timeout_add(250, kill_func, NULL); + + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); + + return 0; +} -- cgit v1.2.3 From 348bcfba144c1e2f3025352f23f038829558bc7f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 16:04:58 -0600 Subject: Woah, this is pretty sweet. I hope it works. --- tests/test-libappindicator-fallback-watcher.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test-libappindicator-fallback-watcher.c b/tests/test-libappindicator-fallback-watcher.c index 67109e5..07d8da6 100644 --- a/tests/test-libappindicator-fallback-watcher.c +++ b/tests/test-libappindicator-fallback-watcher.c @@ -23,11 +23,25 @@ with this program. If not, see . #include #include #include +#include #include "../src/dbus-shared.h" static GMainLoop * mainloop = NULL; +static DBusHandlerResult +dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_data) +{ + if (dbus_message_is_method_call(message, NOTIFICATION_WATCHER_DBUS_ADDR, "RegisterStatusNotifierItem")) { + DBusMessage * reply = dbus_message_new_method_return(message); + dbus_connection_send(connection, reply, NULL); + dbus_message_unref(reply); + return DBUS_HANDLER_RESULT_HANDLED; + } + + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +} + gboolean kill_func (gpointer userdata) { @@ -63,6 +77,8 @@ main (int argv, char ** argc) return 1; } + dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_filter, NULL, NULL); + /* After we've got the name, let it unfallback, and then we'll drop again */ g_timeout_add(250, kill_func, NULL); -- cgit v1.2.3 From cc31c237cd5da314e584570220bd0bf359b725be Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 16:31:59 -0600 Subject: Adding in the item side of things. --- tests/Makefile.am | 2 +- tests/test-libappindicator-fallback-item.c | 84 ++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 tests/test-libappindicator-fallback-item.c diff --git a/tests/Makefile.am b/tests/Makefile.am index e5847c5..f543e92 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -77,7 +77,7 @@ test_libappindicator_fallback_watcher_LDADD = \ $(top_builddir)/src/libappindicator.la test_libappindicator_fallback_item_SOURCES = \ - test-libappindicator-fallback-watcher.c + test-libappindicator-fallback-item.c test_libappindicator_fallback_item_CFLAGS = \ $(INDICATOR_CFLAGS) \ diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c new file mode 100644 index 0000000..02724fe --- /dev/null +++ b/tests/test-libappindicator-fallback-item.c @@ -0,0 +1,84 @@ +#include +#include +#include + +#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)) +#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItemClass)) +#define IS_TEST_LIBAPPINDICATOR_FALLBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE)) +#define IS_TEST_LIBAPPINDICATOR_FALLBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE)) +#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItemClass)) + +typedef struct _TestLibappindicatorFallbackItem TestLibappindicatorFallbackItem; +typedef struct _TestLibappindicatorFallbackItemClass TestLibappindicatorFallbackItemClass; + +struct _TestLibappindicatorFallbackItemClass { + AppIndicatorClass parent_class; + +}; + +struct _TestLibappindicatorFallbackItem { + AppIndicator parent; + +}; + +GType test_libappindicator_fallback_item_get_type (void); + +#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItemPrivate)) + +static void test_libappindicator_fallback_item_class_init (TestLibappindicatorFallbackItemClass *klass); +static void test_libappindicator_fallback_item_init (TestLibappindicatorFallbackItem *self); +static GtkStatusIcon * fallback (AppIndicator * indicator); +static void unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon); + +G_DEFINE_TYPE (TestLibappindicatorFallbackItem, test_libappindicator_fallback_item, APP_INDICATOR_TYPE); + +static void +test_libappindicator_fallback_item_class_init (TestLibappindicatorFallbackItemClass *klass) +{ + AppIndicatorClass * aiclass = APP_INDICATOR_CLASS(klass); + + aiclass->fallback = fallback; + aiclass->unfallback = unfallback; +} + +static void +test_libappindicator_fallback_item_init (TestLibappindicatorFallbackItem *self) +{ +} + +GMainLoop * mainloop = NULL; + +static GtkStatusIcon * +fallback (AppIndicator * indicator) +{ + g_debug("Fallback"); + return NULL; +} + +static void +unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon) +{ + g_debug("Unfallback"); + return; +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + + TestLibappindicatorFallbackItem * item = g_object_new(TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, + "id", "test-id", + "category", "other", + "icon-name", "bob", + NULL); + + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); + + g_object_unref(G_OBJECT(item)); + + return 0; +} -- cgit v1.2.3 From d0abe1ebd34409a7074a39c6af017b2cfb49abf4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 16:36:26 -0600 Subject: Printing status in watcher --- tests/test-libappindicator-fallback-watcher.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test-libappindicator-fallback-watcher.c b/tests/test-libappindicator-fallback-watcher.c index 07d8da6..90c7db8 100644 --- a/tests/test-libappindicator-fallback-watcher.c +++ b/tests/test-libappindicator-fallback-watcher.c @@ -54,9 +54,13 @@ main (int argv, char ** argc) { g_type_init(); + g_debug("Waiting to init."); + /* Wait 1/4 a second, which should trigger the fallback */ g_usleep(250000); + g_debug("Initing"); + GError * error = NULL; DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); if (error != NULL) { @@ -82,8 +86,12 @@ main (int argv, char ** argc) /* After we've got the name, let it unfallback, and then we'll drop again */ g_timeout_add(250, kill_func, NULL); + g_debug("Entering Mainloop"); + mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); + g_debug("Exiting"); + return 0; } -- cgit v1.2.3 From a216db21dd72d491edaca5c7746d3a2a23b17dd1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 16:39:27 -0600 Subject: Adding a kill function and letting the test fail over it. --- tests/test-libappindicator-fallback-item.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c index 02724fe..83dc876 100644 --- a/tests/test-libappindicator-fallback-item.c +++ b/tests/test-libappindicator-fallback-item.c @@ -49,6 +49,7 @@ test_libappindicator_fallback_item_init (TestLibappindicatorFallbackItem *self) } GMainLoop * mainloop = NULL; +gboolean passed = FALSE; static GtkStatusIcon * fallback (AppIndicator * indicator) @@ -64,6 +65,14 @@ unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon) return; } +gboolean +kill_func (gpointer data) +{ + g_debug("Kill Function"); + g_main_loop_quit(mainloop); + return FALSE; +} + int main (int argc, char ** argv) { @@ -75,10 +84,16 @@ main (int argc, char ** argv) "icon-name", "bob", NULL); + g_timeout_add_seconds(1, kill_func, NULL); + mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); g_object_unref(G_OBJECT(item)); - return 0; + if (passed) { + return 0; + } else { + return 1; + } } -- cgit v1.2.3 From 9a2102419fa43910995539a90981727838cc6c40 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 16:44:13 -0600 Subject: Adding state transitions that'll get us to a passed state. --- tests/test-libappindicator-fallback-item.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c index 83dc876..ce3182c 100644 --- a/tests/test-libappindicator-fallback-item.c +++ b/tests/test-libappindicator-fallback-item.c @@ -51,10 +51,29 @@ test_libappindicator_fallback_item_init (TestLibappindicatorFallbackItem *self) GMainLoop * mainloop = NULL; gboolean passed = FALSE; +enum { + STATE_INIT, + STATE_FALLBACK, + STATE_UNFALLBACK, + STATE_REFALLBACK +}; + +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; + passed = TRUE; + g_main_loop_quit(mainloop); + } else { + g_debug("Error, fallback in state: %d", state); + passed = FALSE; + } return NULL; } @@ -62,6 +81,12 @@ static void unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon) { g_debug("Unfallback"); + if (state == STATE_FALLBACK) { + state = STATE_UNFALLBACK; + } else { + g_debug("Error, unfallback in state: %d", state); + passed = FALSE; + } return; } -- cgit v1.2.3 From 7783a495fb275ce70757ea1d0fcec67e7855f2d9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 16:45:09 -0600 Subject: Adding the fallback test to the suite --- tests/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Makefile.am b/tests/Makefile.am index f543e92..c94ebdd 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -93,6 +93,8 @@ test-libappindicator-fallback: test-libappindicator-fallback-watcher test-libapp @echo $(DBUS_RUNNER) --task ./test-libappindicator-fallback-watcher --task-name Watcher --ignore-return --task ./test-libappindicator-fallback-item --task-name Item >> $@ @chmod +x $@ +TESTS += test-libappindicator-fallback + ######################################### ## Actual tests ######################################### -- cgit v1.2.3 From bded6da0bb607eac38bb7f32bb74df0543a3de1b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 16:55:39 -0600 Subject: Wrong class function --- src/libappindicator/app-indicator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index b33a51d..c1b9bf8 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -644,7 +644,7 @@ static gboolean fallback_timer_expire (gpointer data) { AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(data); - AppIndicatorClass * class = APP_INDICATOR_CLASS(data); + AppIndicatorClass * class = APP_INDICATOR_GET_CLASS(data); if (priv->status_icon == NULL) { if (class->fallback != NULL) { -- cgit v1.2.3 From f55bf250c331a4384f00ada67df4ff525b8c4ffe Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 17:00:56 -0600 Subject: Adding a menu so that the app indicator will init --- tests/test-libappindicator-fallback-item.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c index ce3182c..38fdeea 100644 --- a/tests/test-libappindicator-fallback-item.c +++ b/tests/test-libappindicator-fallback-item.c @@ -101,13 +101,16 @@ kill_func (gpointer data) int main (int argc, char ** argv) { - g_type_init(); + gtk_init(&argc, &argv); 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(1, kill_func, NULL); -- cgit v1.2.3 From 7e0feb2329d04007a4b98104f1d76a5e6d4384b4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 21:12:46 -0600 Subject: Setting up a dbus proxy and starting to look at owner change events on it when we don't have a NotificationWatcher to look at. --- src/libappindicator/app-indicator.c | 53 ++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index c1b9bf8..4018083 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -73,6 +73,7 @@ struct _AppIndicatorPrivate { /* Fun stuff */ DBusGProxy *watcher_proxy; DBusGConnection *connection; + DBusGProxy * dbus_proxy; }; /* Signals Stuff */ @@ -312,6 +313,7 @@ app_indicator_init (AppIndicator *self) priv->watcher_proxy = NULL; priv->connection = NULL; + priv->dbus_proxy = NULL; priv->status_icon = NULL; priv->fallback_timer = 0; @@ -364,6 +366,11 @@ app_indicator_dispose (GObject *object) priv->menu = NULL; } + if (priv->dbus_proxy != NULL) { + g_object_unref(G_OBJECT(priv->dbus_proxy)); + priv->dbus_proxy = NULL; + } + if (priv->watcher_proxy != NULL) { dbus_g_connection_flush(priv->connection); g_object_unref(G_OBJECT(priv->watcher_proxy)); @@ -612,6 +619,40 @@ category_from_enum (AppIndicatorCategory category) return value->value_nick; } +/* Watching the dbus owner change events to see if someone + we care about pops up! */ +static void +dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, gpointer data) +{ + if (new == NULL || new[0] == '\0') { + /* We only care about folks coming on the bus. Exit quickly otherwise. */ + return; + } + + if (g_strcmp0(name, NOTIFICATION_WATCHER_DBUS_ADDR)) { + /* We only care about this address, reject all others. */ + return; + } + + /* Woot, there's a new notification watcher in town. */ + + AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(data); + + if (priv->fallback_timer != 0) { + /* Stop a timer */ + g_source_remove(priv->fallback_timer); + + /* Stop listening to bus events */ + g_object_unref(G_OBJECT(priv->dbus_proxy)); + priv->dbus_proxy = NULL; + } + + /* Let's start from the very beginning */ + check_connect(APP_INDICATOR(data)); + + return; +} + /* A function that will start the fallback timer if it's not already started. It sets up the DBus watcher to see if there is a change. Also, provides an override mode for cases @@ -627,7 +668,17 @@ start_fallback_timer (AppIndicator * self, gboolean do_it_now) return; } - /* TODO: Setup what we need to check things out */ + if (priv->dbus_proxy == NULL) { + priv->dbus_proxy = dbus_g_proxy_new_for_name(priv->connection, + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS); + dbus_g_proxy_add_signal(priv->dbus_proxy, "NameOwnerChanged", + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(priv->dbus_proxy, "NameOwnerChanged", + G_CALLBACK(dbus_owner_change), self, NULL); + } if (do_it_now) { fallback_timer_expire(self); -- cgit v1.2.3 From 3ac18fb423b9894b85d06acd841ce6d3f5a41132 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 08:24:19 -0600 Subject: Ignoring the generated fallback test itself --- .bzrignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.bzrignore b/.bzrignore index 17798c8..a218817 100644 --- a/.bzrignore +++ b/.bzrignore @@ -89,3 +89,4 @@ docs/reference/tmpl/app-indicator.sgml.bak src/libappindicator/appindicator-0.1.pc tests/test-libappindicator-fallback-item tests/test-libappindicator-fallback-watcher +tests/test-libappindicator-fallback -- cgit v1.2.3 From 5739297b7d0a67be588044a4be2163fb5cafbb78 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 08:33:04 -0600 Subject: Calling the unfallback function if we're doing this for the second time. --- src/libappindicator/app-indicator.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 4018083..7ade413 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -603,7 +603,13 @@ register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) start_fallback_timer(APP_INDICATOR(data), TRUE); } - /* TODO: Unfallback here */ + if (priv->status_icon) { + AppIndicatorClass * class = APP_INDICATOR_GET_CLASS(data); + if (class->unfallback != NULL) { + class->unfallback(APP_INDICATOR(data), priv->status_icon); + priv->status_icon = NULL; + } + } return; } -- cgit v1.2.3 From 5898ca0cf3754ee733ba670feedf5046e921c6e7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 08:33:21 -0600 Subject: Making sure to return a value so that unfallback gets called. --- tests/test-libappindicator-fallback-item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c index 38fdeea..1ff70c8 100644 --- a/tests/test-libappindicator-fallback-item.c +++ b/tests/test-libappindicator-fallback-item.c @@ -74,7 +74,7 @@ fallback (AppIndicator * indicator) g_debug("Error, fallback in state: %d", state); passed = FALSE; } - return NULL; + return (GtkStatusIcon *)5; } static void -- cgit v1.2.3 From 06a6bb7fcbbd703bade0aaff06ab2349b3644724 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 08:38:14 -0600 Subject: Removing a warning. --- src/libappindicator/app-indicator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 7ade413..31b6c6b 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -576,7 +576,8 @@ check_connect (AppIndicator *self) NOTIFICATION_WATCHER_DBUS_IFACE, &error); if (error != NULL) { - g_warning("Unable to create Ayatana Watcher proxy! %s", error->message); + /* Unable to get proxy, but we're handling that now so + it's not a warning anymore. */ g_error_free(error); start_fallback_timer(self, FALSE); return; -- cgit v1.2.3 From c959db1f7d3f188f86c34076637949582b7e9f6b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 09:29:55 -0600 Subject: Adding a function to watch if the watcher proxy gets destroyed. --- src/libappindicator/app-indicator.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 31b6c6b..3fff6df 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -137,6 +137,7 @@ static void start_fallback_timer (AppIndicator * self, gboolean do_it_now); static gboolean fallback_timer_expire (gpointer data); static GtkStatusIcon * fallback (AppIndicator * self); static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon); +static void watcher_proxy_destroyed (GObject * object, gpointer data); /* GObject type */ G_DEFINE_TYPE (AppIndicator, app_indicator, G_TYPE_OBJECT); @@ -559,7 +560,7 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa static void check_connect (AppIndicator *self) { - AppIndicatorPrivate *priv = self->priv; + AppIndicatorPrivate *priv = self->priv; /* We're alreadying connecting or trying to connect. */ if (priv->watcher_proxy != NULL) return; @@ -583,11 +584,25 @@ check_connect (AppIndicator *self) return; } + g_signal_connect(G_OBJECT(priv->watcher_proxy), "destroy", G_CALLBACK(watcher_proxy_destroyed), self); org_freedesktop_StatusNotifierWatcher_register_status_notifier_item_async(priv->watcher_proxy, DEFAULT_ITEM_PATH, register_service_cb, self); return; } +/* A function that gets called when the watcher dies. Like + dies dies. Not our friend anymore. */ +static void +watcher_proxy_destroyed (GObject * object, gpointer data) +{ + AppIndicator * self = APP_INDICATOR(data); + g_return_if_fail(self != NULL); + + self->priv->watcher_proxy = NULL; + start_fallback_timer(self, FALSE); + return; +} + /* Responce from the DBus command to register a service with a NotificationWatcher. */ static void -- cgit v1.2.3 From 89aa4a7b791024085162be440d2ec79afedf1b7d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 10:03:06 -0600 Subject: Clear the fallback timer pointer after using it. --- src/libappindicator/app-indicator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 3fff6df..6bff61a 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -730,6 +730,7 @@ fallback_timer_expire (gpointer data) } } + priv->fallback_timer = 0; return FALSE; } -- cgit v1.2.3 From 88c99aca2e2a95a3dc540285f7dc53d020f526d0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 11:21:31 -0600 Subject: Getting the class the proper way --- src/libappindicator/app-indicator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 6bff61a..259ba3e 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -350,7 +350,7 @@ app_indicator_dispose (GObject *object) } if (priv->status_icon != NULL) { - AppIndicatorClass * class = APP_INDICATOR_CLASS(object); + AppIndicatorClass * class = APP_INDICATOR_GET_CLASS(object); if (class->unfallback != NULL) { class->unfallback(self, priv->status_icon); } -- cgit v1.2.3 From 5d075987c3469ae7f1538143546e94d208abf1cf Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 11:35:42 -0600 Subject: Really we should have gotten the final cleanup unfallback, which we weren't testing for either. --- tests/test-libappindicator-fallback-item.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c index 1ff70c8..291bc7c 100644 --- a/tests/test-libappindicator-fallback-item.c +++ b/tests/test-libappindicator-fallback-item.c @@ -55,7 +55,8 @@ enum { STATE_INIT, STATE_FALLBACK, STATE_UNFALLBACK, - STATE_REFALLBACK + STATE_REFALLBACK, + STATE_REUNFALLBACK }; gint state = STATE_INIT; @@ -68,8 +69,6 @@ fallback (AppIndicator * indicator) state = STATE_FALLBACK; } else if (state == STATE_UNFALLBACK) { state = STATE_REFALLBACK; - passed = TRUE; - g_main_loop_quit(mainloop); } else { g_debug("Error, fallback in state: %d", state); passed = FALSE; @@ -83,6 +82,10 @@ 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; -- cgit v1.2.3 From b1b9134542bd3bcfa6b5492f0a7f1b83cf0ec32f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 12:25:49 -0600 Subject: Fleshing out the fallback function, so it should create an icon. --- src/libappindicator/app-indicator.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 259ba3e..a3ad1ee 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -739,6 +739,24 @@ fallback_timer_expire (gpointer data) static GtkStatusIcon * fallback (AppIndicator * self) { + GtkStatusIcon * icon = gtk_status_icon_new(); + + gtk_status_icon_set_title(icon, app_indicator_get_id(self)); + + switch (app_indicator_get_status(self)) { + case APP_INDICATOR_STATUS_PASSIVE: + gtk_status_icon_set_visible(icon, FALSE); + gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self)); + break; + case APP_INDICATOR_STATUS_ACTIVE: + gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self)); + gtk_status_icon_set_visible(icon, TRUE); + break; + case APP_INDICATOR_STATUS_ATTENTION: + gtk_status_icon_set_from_icon_name(icon, app_indicator_get_attention_icon(self)); + gtk_status_icon_set_visible(icon, TRUE); + break; + }; return NULL; } @@ -748,7 +766,7 @@ fallback (AppIndicator * self) static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon) { - + g_object_unref(G_OBJECT(status_icon)); return; } -- cgit v1.2.3 From 60236935d5da0be2de0833cded25ad9361305a43 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 13:30:32 -0600 Subject: Checking for the status of the variable getting passed in. --- src/libappindicator/app-indicator.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index a3ad1ee..baa2159 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -716,7 +716,9 @@ start_fallback_timer (AppIndicator * self, gboolean do_it_now) static gboolean fallback_timer_expire (gpointer data) { - AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(data); + g_return_val_if_fail(IS_APP_INDICATOR(data), FALSE); + + AppIndicatorPrivate * priv = APP_INDICATOR(data)->priv; AppIndicatorClass * class = APP_INDICATOR_GET_CLASS(data); if (priv->status_icon == NULL) { @@ -727,7 +729,9 @@ fallback_timer_expire (gpointer data) if (class->unfallback != NULL) { class->unfallback(APP_INDICATOR(data), priv->status_icon); priv->status_icon = NULL; - } + } else { + g_warning("Can't 'unfallback' and I have an allocated status_icon. Might be a memory leak!"); + } } priv->fallback_timer = 0; -- cgit v1.2.3 From 519e03cf8628111e9740dd45b160f1fc961666c7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 13:31:10 -0600 Subject: releasing version 0.0.8-0ubuntu1~ppa2~fallback1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9ab7d43..d1be23e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -indicator-application (0.0.8-0ubuntu1~ppa2~fallback1) UNRELEASED; urgency=low +indicator-application (0.0.8-0ubuntu1~ppa2~fallback1) karmic; urgency=low * Upstream update * Fallback support - -- Ted Gould Wed, 13 Jan 2010 12:30:04 -0600 + -- Ted Gould Wed, 13 Jan 2010 13:31:06 -0600 indicator-application (0.0.8-0ubuntu1~ppa1) karmic; urgency=low -- cgit v1.2.3 From df2c07b139f2810a59cef7219faf3e2f459b2ea2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 13:34:31 -0600 Subject: releasing version 0.0.8-0ubuntu1~ppa2~fallback2 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index a6eb32c..b7b150e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -indicator-application (0.0.8-0ubuntu1~ppa2~fallback2) UNRELEASED; urgency=low +indicator-application (0.0.8-0ubuntu1~ppa2~fallback2) karmic; urgency=low * Upstream update * Checking fallback function params - -- Ted Gould Wed, 13 Jan 2010 13:31:20 -0600 + -- Ted Gould Wed, 13 Jan 2010 13:34:29 -0600 indicator-application (0.0.8-0ubuntu1~ppa2~fallback1) karmic; urgency=low -- cgit v1.2.3 From 303db3c924690a134dcc6c0159f3a9dfc5a761fa Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 14:02:23 -0600 Subject: Explicitly checking for the APP_INDICATOR. Confused. --- src/libappindicator/app-indicator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index baa2159..a098170 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -682,6 +682,8 @@ dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, c static void start_fallback_timer (AppIndicator * self, gboolean do_it_now) { + g_return_if_fail(IS_APP_INDICATOR(self)); + AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(self); if (priv->fallback_timer != 0) { -- cgit v1.2.3 From e67b856409825b020e2d71b510d05abc1cdef31c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 14:05:33 -0600 Subject: Checking more for whether we have an APP_INDICATOR object --- src/libappindicator/app-indicator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index a098170..e581829 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -608,7 +608,8 @@ watcher_proxy_destroyed (GObject * object, gpointer data) static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) { - AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(data); + g_return_if_fail(IS_APP_INDICATOR(data)); + AppIndicatorPrivate * priv = APP_INDICATOR(data)->priv; if (error != NULL) { /* They didn't respond, ewww. Not sure what they could @@ -683,8 +684,7 @@ static void start_fallback_timer (AppIndicator * self, gboolean do_it_now) { g_return_if_fail(IS_APP_INDICATOR(self)); - - AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(self); + AppIndicatorPrivate * priv = APP_INDICATOR(self)->priv; if (priv->fallback_timer != 0) { /* The timer is set, let's just be happy with the one -- cgit v1.2.3 From 8baa1ed000f9ca693aea5a03d9ca2f52cad11f8b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 14:08:18 -0600 Subject: releasing version 0.0.8-0ubuntu1~ppa2~fallback3 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4571d08..6456edd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -indicator-application (0.0.8-0ubuntu1~ppa2~fallback3) UNRELEASED; urgency=low +indicator-application (0.0.8-0ubuntu1~ppa2~fallback3) karmic; urgency=low * Upstream update * More checking. - -- Ted Gould Wed, 13 Jan 2010 14:06:06 -0600 + -- Ted Gould Wed, 13 Jan 2010 14:08:15 -0600 indicator-application (0.0.8-0ubuntu1~ppa2~fallback2) karmic; urgency=low -- cgit v1.2.3 From ef9589128e31165cf83b576ac50688db582760f2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 14:53:18 -0600 Subject: Remove the 'destroy' signal handler before destroying the watcher proxy. --- src/libappindicator/app-indicator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index e581829..7dd2894 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -374,6 +374,7 @@ app_indicator_dispose (GObject *object) if (priv->watcher_proxy != NULL) { dbus_g_connection_flush(priv->connection); + g_signal_handlers_disconnect_by_func(G_OBJECT(priv->watcher_proxy), watcher_proxy_destroyed, self); g_object_unref(G_OBJECT(priv->watcher_proxy)); priv->watcher_proxy = NULL; } -- cgit v1.2.3 From 556b0bc067033732e647fcb9241c83c7adb96dee Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 14:56:03 -0600 Subject: releasing version 0.0.8-0ubuntu1~ppa2~fallback4 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7b9a704..dd2cfe7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -indicator-application (0.0.8-0ubuntu1~ppa2~fallback4) UNRELEASED; urgency=low +indicator-application (0.0.8-0ubuntu1~ppa2~fallback4) karmic; urgency=low * Upstream update * Removing the 'destroy' signal handler - -- Ted Gould Wed, 13 Jan 2010 14:54:00 -0600 + -- Ted Gould Wed, 13 Jan 2010 14:56:01 -0600 indicator-application (0.0.8-0ubuntu1~ppa2~fallback3) karmic; urgency=low -- cgit v1.2.3 From bf390ec6d9aa02fe5fed6278f6f9bb249557e210 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 16:10:25 -0600 Subject: Connecting to the activate signal --- src/libappindicator/app-indicator.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 7dd2894..e38e760 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -136,6 +136,7 @@ static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer da static void start_fallback_timer (AppIndicator * self, gboolean do_it_now); static gboolean fallback_timer_expire (gpointer data); static GtkStatusIcon * fallback (AppIndicator * self); +static void status_icon_activate (GtkStatusIcon * icon, gpointer data); static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon); static void watcher_proxy_destroyed (GObject * object, gpointer data); @@ -765,9 +766,20 @@ fallback (AppIndicator * self) break; }; + g_signal_connect(G_OBJECT(icon), "activate", G_CALLBACK(status_icon_activate), self); + return NULL; } +/* Handles the activate action by the status icon by showing + the menu in a popup. */ +static void +status_icon_activate (GtkStatusIcon * icon, gpointer data) +{ + g_debug("Status Icon Activate"); + return; +} + /* Removes the status icon as the application indicator area is now up and running again. */ static void -- cgit v1.2.3 From b83df5ee0146d6974a75d5a6dfc9a434ed8dc7a7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 16:16:11 -0600 Subject: releasing version 0.0.8-0ubuntu1~ppa2~fallback5 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index ff9c010..b21968a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -indicator-application (0.0.8-0ubuntu1~ppa2~fallback5) UNRELEASED; urgency=low +indicator-application (0.0.8-0ubuntu1~ppa2~fallback5) karmic; urgency=low * Upstream update * Looking at StatusIcon fallback - -- Ted Gould Wed, 13 Jan 2010 16:10:41 -0600 + -- Ted Gould Wed, 13 Jan 2010 16:16:09 -0600 indicator-application (0.0.8-0ubuntu1~ppa2~fallback4) karmic; urgency=low -- cgit v1.2.3 From 9489aa2cbda25bb1ed87e87d2fcf550ac0b6142a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 16:23:08 -0600 Subject: Adding in a get_menu function. --- docs/reference/libappindicator-sections.txt | 1 + src/libappindicator/app-indicator.c | 22 +++++++++++++++++++++- src/libappindicator/app-indicator.h | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/reference/libappindicator-sections.txt b/docs/reference/libappindicator-sections.txt index 68b120a..70df0b8 100644 --- a/docs/reference/libappindicator-sections.txt +++ b/docs/reference/libappindicator-sections.txt @@ -28,5 +28,6 @@ app_indicator_get_category app_indicator_get_status app_indicator_get_icon app_indicator_get_attention_icon +app_indicator_get_menu diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index e38e760..4852633 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -776,7 +776,7 @@ fallback (AppIndicator * self) static void status_icon_activate (GtkStatusIcon * icon, gpointer data) { - g_debug("Status Icon Activate"); + return; } @@ -1267,3 +1267,23 @@ app_indicator_get_attention_icon (AppIndicator *self) return self->priv->attention_icon_name; } + +/** + app_indicator_get_menu: + @self: The #AppIndicator object to use + + Gets the menu being used for this application indicator. + + Return value: A menu object or #NULL if one hasn't been set. +*/ +GtkMenu * +app_indicator_get_menu (AppIndicator *self) +{ + AppIndicatorPrivate *priv; + + g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + + priv = self->priv; + + return GTK_MENU(priv->menu); +} diff --git a/src/libappindicator/app-indicator.h b/src/libappindicator/app-indicator.h index a8d82ab..03656ce 100644 --- a/src/libappindicator/app-indicator.h +++ b/src/libappindicator/app-indicator.h @@ -228,6 +228,7 @@ AppIndicatorCategory app_indicator_get_category (AppIndicator * AppIndicatorStatus app_indicator_get_status (AppIndicator *self); const gchar * app_indicator_get_icon (AppIndicator *self); const gchar * app_indicator_get_attention_icon (AppIndicator *self); +GtkMenu * app_indicator_get_menu (AppIndicator *self); G_END_DECLS -- cgit v1.2.3 From 10521bbccfe5ab6cb9dac60a31ee055f7a6384e0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 16:28:34 -0600 Subject: Showing items in sample --- example/simple-client.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/example/simple-client.c b/example/simple-client.c index 8ff3827..83c2335 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -73,26 +73,31 @@ main (int argc, char ** argv) g_signal_connect (item, "activate", G_CALLBACK (item_clicked_cb), "1"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + gtk_widget_show(item); item = gtk_radio_menu_item_new_with_label (NULL, "2"); g_signal_connect (item, "activate", G_CALLBACK (item_clicked_cb), "2"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + gtk_widget_show(item); item = gtk_menu_item_new_with_label ("3"); g_signal_connect (item, "activate", G_CALLBACK (item_clicked_cb), "3"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + gtk_widget_show(item); GtkWidget *toggle_item = gtk_menu_item_new_with_label ("Toggle 3"); g_signal_connect (toggle_item, "activate", G_CALLBACK (toggle_sensitivity_cb), item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), toggle_item); + gtk_widget_show(item); item = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL); g_signal_connect (item, "activate", G_CALLBACK (image_clicked_cb), NULL); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + gtk_widget_show(item); app_indicator_set_menu (ci, GTK_MENU (menu)); -- cgit v1.2.3 From 6068e6cdb6fa92235c662706c8eabcff4207e1fa Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 16:28:53 -0600 Subject: Popping up menu on activate. --- src/libappindicator/app-indicator.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 4852633..f330870 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -776,6 +776,17 @@ fallback (AppIndicator * self) static void status_icon_activate (GtkStatusIcon * icon, gpointer data) { + GtkMenu * menu = app_indicator_get_menu(APP_INDICATOR(data)); + if (menu == NULL) + return; + + gtk_menu_popup(menu, + NULL, /* Parent Menu */ + NULL, /* Parent item */ + gtk_status_icon_position_menu, + icon, + 1, /* Button */ + gtk_get_current_event_time()); return; } -- cgit v1.2.3 From 67493d4ea9196f625b25e53ffbb26d30dace04dd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 18:53:19 -0600 Subject: Showing the toggle_item as well as the others. --- example/simple-client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/simple-client.c b/example/simple-client.c index 83c2335..6dcf5d1 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -91,7 +91,7 @@ main (int argc, char ** argv) g_signal_connect (toggle_item, "activate", G_CALLBACK (toggle_sensitivity_cb), item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), toggle_item); - gtk_widget_show(item); + gtk_widget_show(toggle_item); item = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL); g_signal_connect (item, "activate", -- cgit v1.2.3 From c26cab9055e9d909babb509e606b35ec47574c78 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 19:52:02 -0600 Subject: Making it so that the icon will update in the fallback case with changes to the properties of the AppIndicator. --- src/libappindicator/app-indicator.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index f330870..f66888f 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -136,6 +136,7 @@ static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer da static void start_fallback_timer (AppIndicator * self, gboolean do_it_now); static gboolean fallback_timer_expire (gpointer data); static GtkStatusIcon * fallback (AppIndicator * self); +static void status_icon_changes (GObject * icon, GParamSpec * pspec, gpointer data); static void status_icon_activate (GtkStatusIcon * icon, gpointer data); static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon); static void watcher_proxy_destroyed (GObject * object, gpointer data); @@ -751,6 +752,28 @@ fallback (AppIndicator * self) gtk_status_icon_set_title(icon, app_indicator_get_id(self)); + g_signal_connect(G_OBJECT(self), "notify::" PROP_STATUS_S, + G_CALLBACK(status_icon_changes), icon); + g_signal_connect(G_OBJECT(self), "notify::" PROP_ICON_NAME_S, + G_CALLBACK(status_icon_changes), icon); + g_signal_connect(G_OBJECT(self), "notify::" PROP_ATTENTION_ICON_NAME_S, + G_CALLBACK(status_icon_changes), icon); + + status_icon_changes(G_OBJECT(icon), NULL, self); + + g_signal_connect(G_OBJECT(icon), "activate", G_CALLBACK(status_icon_activate), self); + + return NULL; +} + +/* This tracks changes to either the status or the icons + that are associated with the app indicator */ +static void +status_icon_changes (GObject * oicon, GParamSpec * pspec, gpointer data) +{ + AppIndicator * self = APP_INDICATOR(data); + GtkStatusIcon * icon = GTK_STATUS_ICON(oicon); + switch (app_indicator_get_status(self)) { case APP_INDICATOR_STATUS_PASSIVE: gtk_status_icon_set_visible(icon, FALSE); @@ -766,9 +789,7 @@ fallback (AppIndicator * self) break; }; - g_signal_connect(G_OBJECT(icon), "activate", G_CALLBACK(status_icon_activate), self); - - return NULL; + return; } /* Handles the activate action by the status icon by showing @@ -796,6 +817,7 @@ status_icon_activate (GtkStatusIcon * icon, gpointer data) static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon) { + g_signal_handlers_disconnect_by_func(G_OBJECT(self), status_icon_changes, status_icon); g_object_unref(G_OBJECT(status_icon)); return; } -- cgit v1.2.3 From c303c0c49f7ab1b0747e5cb12111f8b3ac4cd46e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 20:25:33 -0600 Subject: Realized that we didn't really use the 'notify' signal... now using the better ones anyway. --- src/libappindicator/app-indicator.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index f66888f..e1b332a 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -136,7 +136,8 @@ static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer da static void start_fallback_timer (AppIndicator * self, gboolean do_it_now); static gboolean fallback_timer_expire (gpointer data); static GtkStatusIcon * fallback (AppIndicator * self); -static void status_icon_changes (GObject * icon, GParamSpec * pspec, gpointer data); +static void status_icon_status_wrapper (AppIndicator * self, const gchar * status, gpointer data); +static void status_icon_changes (AppIndicator * self, gpointer data); static void status_icon_activate (GtkStatusIcon * icon, gpointer data); static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon); static void watcher_proxy_destroyed (GObject * object, gpointer data); @@ -752,27 +753,34 @@ fallback (AppIndicator * self) gtk_status_icon_set_title(icon, app_indicator_get_id(self)); - g_signal_connect(G_OBJECT(self), "notify::" PROP_STATUS_S, + g_signal_connect(G_OBJECT(self), APP_INDICATOR_SIGNAL_NEW_STATUS, G_CALLBACK(status_icon_changes), icon); - g_signal_connect(G_OBJECT(self), "notify::" PROP_ICON_NAME_S, + g_signal_connect(G_OBJECT(self), APP_INDICATOR_SIGNAL_NEW_ICON, G_CALLBACK(status_icon_changes), icon); - g_signal_connect(G_OBJECT(self), "notify::" PROP_ATTENTION_ICON_NAME_S, + g_signal_connect(G_OBJECT(self), APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON, G_CALLBACK(status_icon_changes), icon); - status_icon_changes(G_OBJECT(icon), NULL, self); + status_icon_changes(self, icon); g_signal_connect(G_OBJECT(icon), "activate", G_CALLBACK(status_icon_activate), self); return NULL; } +/* A wrapper as the status update prototype is a little + bit different, but we want to handle it the same. */ +static void +status_icon_status_wrapper (AppIndicator * self, const gchar * status, gpointer data) +{ + return status_icon_changes(self, data); +} + /* This tracks changes to either the status or the icons that are associated with the app indicator */ static void -status_icon_changes (GObject * oicon, GParamSpec * pspec, gpointer data) +status_icon_changes (AppIndicator * self, gpointer data) { - AppIndicator * self = APP_INDICATOR(data); - GtkStatusIcon * icon = GTK_STATUS_ICON(oicon); + GtkStatusIcon * icon = GTK_STATUS_ICON(data); switch (app_indicator_get_status(self)) { case APP_INDICATOR_STATUS_PASSIVE: @@ -817,6 +825,7 @@ status_icon_activate (GtkStatusIcon * icon, gpointer data) static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon) { + g_signal_handlers_disconnect_by_func(G_OBJECT(self), status_icon_status_wrapper, status_icon); g_signal_handlers_disconnect_by_func(G_OBJECT(self), status_icon_changes, status_icon); g_object_unref(G_OBJECT(status_icon)); return; -- cgit v1.2.3 From 544ac3aa1cae817a4ec66fa4a880ba283298cabf Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Jan 2010 09:52:51 -0600 Subject: Using better naming for 'do_it_now' parameter. --- src/libappindicator/app-indicator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index e1b332a..40c7c3e 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -133,7 +133,7 @@ static void app_indicator_get_property (GObject * object, guint prop_id, GValue /* Other stuff */ static void check_connect (AppIndicator * self); static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data); -static void start_fallback_timer (AppIndicator * self, gboolean do_it_now); +static void start_fallback_timer (AppIndicator * self, gboolean disable_timeout); static gboolean fallback_timer_expire (gpointer data); static GtkStatusIcon * fallback (AppIndicator * self); static void status_icon_status_wrapper (AppIndicator * self, const gchar * status, gpointer data); @@ -685,7 +685,7 @@ dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, c there is a change. Also, provides an override mode for cases where it's unlikely that a timer will help anything. */ static void -start_fallback_timer (AppIndicator * self, gboolean do_it_now) +start_fallback_timer (AppIndicator * self, gboolean disable_timeout) { g_return_if_fail(IS_APP_INDICATOR(self)); AppIndicatorPrivate * priv = APP_INDICATOR(self)->priv; @@ -708,7 +708,7 @@ start_fallback_timer (AppIndicator * self, gboolean do_it_now) G_CALLBACK(dbus_owner_change), self, NULL); } - if (do_it_now) { + if (disable_timeout) { fallback_timer_expire(self); } else { priv->fallback_timer = g_timeout_add(DEFAULT_FALLBACK_TIMER, fallback_timer_expire, self); -- cgit v1.2.3 From 2bfabeb52a894375a76be19cbd034ad56214b766 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Jan 2010 09:54:59 -0600 Subject: Making a more descriptive error on 'unfallback' not existing. --- src/libappindicator/app-indicator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 40c7c3e..c3bce35 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -736,7 +736,7 @@ fallback_timer_expire (gpointer data) class->unfallback(APP_INDICATOR(data), priv->status_icon); priv->status_icon = NULL; } else { - g_warning("Can't 'unfallback' and I have an allocated status_icon. Might be a memory leak!"); + g_warning("No 'unfallback' function but the 'fallback' function returned a non-NULL result."); } } -- cgit v1.2.3 From 09442ab9099e7a35394ec692560c19672bdbc2d2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Jan 2010 09:55:42 -0600 Subject: Returning the icon we've created. --- src/libappindicator/app-indicator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index c3bce35..6c969c2 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -764,7 +764,7 @@ fallback (AppIndicator * self) g_signal_connect(G_OBJECT(icon), "activate", G_CALLBACK(status_icon_activate), self); - return NULL; + return icon; } /* A wrapper as the status update prototype is a little -- cgit v1.2.3 From f0104e11357b5804aea2ecead13f99231b671a75 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Jan 2010 10:36:02 -0600 Subject: 0.0.9 --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 713f40e..ebd6b20 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT(indicator-application, 0.0.8, ted@canonical.com) -AC_COPYRIGHT([Copyright 2009 Canonical]) +AC_INIT(indicator-application, 0.0.9, ted@canonical.com) +AC_COPYRIGHT([Copyright 2009, 2010 Canonical]) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-application, 0.0.8) +AM_INIT_AUTOMAKE(indicator-application, 0.0.9) AM_MAINTAINER_MODE -- cgit v1.2.3 From 82401630c88544b4362141ad29c639eff4819376 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Jan 2010 10:39:46 -0600 Subject: releasing version 0.0.9-0ubuntu1~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0348899..17dc97d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -indicator-application (0.0.9-0ubuntu1~ppa1) UNRELEASED; urgency=low +indicator-application (0.0.9-0ubuntu1~ppa1) karmic; urgency=low * Upstream Release 0.0.9 * Add fallback support for situations where the NotificationWatcher isn't available. - -- Ted Gould Thu, 14 Jan 2010 10:33:04 -0600 + -- Ted Gould Thu, 14 Jan 2010 10:39:43 -0600 indicator-application (0.0.8-0ubuntu1) lucid; urgency=low -- cgit v1.2.3