From e1f36a8445d1851f15a396ba5488119c298e593d Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Sat, 19 Jun 2010 01:44:59 -0400 Subject: first pass at gtk3 version of libappindicator --- src/app-indicator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index bc43e58..939ca9a 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -1270,7 +1270,7 @@ widget_notify_cb (GtkWidget *widget, { dbusmenu_menuitem_property_set_bool (child, DBUSMENU_MENUITEM_PROP_ENABLED, - GTK_WIDGET_IS_SENSITIVE (widget)); + gtk_widget_is_sensitive (widget)); } else if (pspec->name == g_intern_static_string ("label")) { @@ -1422,7 +1422,7 @@ container_iterate (GtkWidget *widget, dbusmenu_menuitem_property_set_bool (child, DBUSMENU_MENUITEM_PROP_ENABLED, - GTK_WIDGET_IS_SENSITIVE (widget)); + gtk_widget_is_sensitive (widget)); dbusmenu_menuitem_property_set_bool (child, DBUSMENU_MENUITEM_PROP_VISIBLE, gtk_widget_get_visible (widget)); -- cgit v1.2.3 From 3551eb170dd87fbe11148136813e1bb580b90604 Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Wed, 6 Oct 2010 12:08:49 -0400 Subject: instead of always building gtk2 and gtk3, add a --with-gtk= flag to configure to specify which to build with --- src/app-indicator.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 939ca9a..a52a063 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -33,7 +33,11 @@ License version 3 and version 2.1 along with this program. If not, see #include #include +#ifdef HAVE_GTK3 +#include +#else #include +#endif #include "app-indicator.h" #include "app-indicator-enum-types.h" @@ -1194,13 +1198,17 @@ static void update_icon_name (DbusmenuMenuitem *menuitem, GtkImage *image) { + const gchar *icon_name = NULL; + if (gtk_image_get_storage_type (image) != GTK_IMAGE_ICON_NAME) return; + gtk_image_get_icon_name (image, &icon_name, NULL); + if (should_show_image (image)) dbusmenu_menuitem_property_set (menuitem, DBUSMENU_MENUITEM_PROP_ICON_NAME, - image->data.name.icon_name); + icon_name); else dbusmenu_menuitem_property_remove (menuitem, DBUSMENU_MENUITEM_PROP_ICON_NAME); @@ -1212,16 +1220,18 @@ update_stock_item (DbusmenuMenuitem *menuitem, GtkImage *image) { GtkStockItem stock; + gchar *stock_id = NULL; if (gtk_image_get_storage_type (image) != GTK_IMAGE_STOCK) return FALSE; - gtk_stock_lookup (image->data.stock.stock_id, &stock); + gtk_image_get_stock (image, &stock_id, NULL); + gtk_stock_lookup (stock_id, &stock); if (should_show_image (image)) dbusmenu_menuitem_property_set (menuitem, DBUSMENU_MENUITEM_PROP_ICON_NAME, - image->data.stock.stock_id); + stock_id); else dbusmenu_menuitem_property_remove (menuitem, DBUSMENU_MENUITEM_PROP_ICON_NAME); -- cgit v1.2.3 From 3758df51a8e1f7e5b7585a0a62ad07400d1f55fd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 19 Oct 2010 18:47:22 -0500 Subject: Adding a check for the name to ensure we didn't miss it --- src/app-indicator.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 6511589..44b1050 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -32,6 +32,8 @@ License version 3 and version 2.1 along with this program. If not, see #endif #include +#include + #include #include @@ -1052,6 +1054,17 @@ dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, c return; } +/* Checking to see if someone already has the name we're looking for */ +static void +check_owner_cb (DBusGProxy *proxy, gboolean exists, GError *error, gpointer userdata) +{ + if (exists) { + dbus_owner_change(proxy, NOTIFICATION_WATCHER_DBUS_ADDR, NULL, "Non NULL", userdata); + } + + return; +} + /* This is an idle function to create the proxy. This is mostly because start_fallback_timer can get called in the distruction of a proxy and thus the proxy manager gets confused when creating @@ -1074,6 +1087,11 @@ setup_name_owner_proxy (gpointer data) G_TYPE_INVALID); dbus_g_proxy_connect_signal(priv->dbus_proxy, "NameOwnerChanged", G_CALLBACK(dbus_owner_change), data, NULL); + + /* Check to see if anyone has the name we're looking for + just incase we missed it changing. */ + + org_freedesktop_DBus_name_has_owner_async(priv->dbus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, check_owner_cb, data); } return FALSE; -- cgit v1.2.3 From ccea5af6d5cce8bcb3a6f14fa8a4325708e0e71c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 19 Oct 2010 18:48:39 -0500 Subject: Add a nice little warning in --- src/app-indicator.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 44b1050..5a9e531 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -1058,6 +1058,11 @@ dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, c static void check_owner_cb (DBusGProxy *proxy, gboolean exists, GError *error, gpointer userdata) { + if (error != NULL) { + g_warning("Unable to check for '" NOTIFICATION_WATCHER_DBUS_ADDR "' on DBus. No worries, but concerning."); + return; + } + if (exists) { dbus_owner_change(proxy, NOTIFICATION_WATCHER_DBUS_ADDR, NULL, "Non NULL", userdata); } -- cgit v1.2.3 From b176944e2d256abca0ced734f31e09d621a19998 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 20 Oct 2010 15:22:46 -0400 Subject: Uhg, we need a message to know if we've fixed the bug. --- src/app-indicator.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 5a9e531..4f7daa8 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -1064,6 +1064,7 @@ check_owner_cb (DBusGProxy *proxy, gboolean exists, GError *error, gpointer user } if (exists) { + g_debug("Woah, we actually has a race condition with dbus"); dbus_owner_change(proxy, NOTIFICATION_WATCHER_DBUS_ADDR, NULL, "Non NULL", userdata); } -- cgit v1.2.3