ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #02749
[Branch ~indicator-applet-developers/indicator-me/trunk] Rev 117: Should be the last of the gdbus/dbusmenu 0.4 port
------------------------------------------------------------
revno: 117
committer: Ken VanDine <ken.vandine@xxxxxxxxxxxxx>
branch nick: indicator-me-gdbus
timestamp: Wed 2011-01-12 16:40:11 -0600
message:
Should be the last of the gdbus/dbusmenu 0.4 port
modified:
.bzrignore
configure.ac
src/Makefile.am
src/indicator-me.c
src/me-service-dbus.c
--
lp:indicator-me
https://code.launchpad.net/~indicator-applet-developers/indicator-me/trunk
Your team ayatana-commits is subscribed to branch lp:indicator-me.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-me/trunk/+edit-subscription
=== modified file '.bzrignore'
--- .bzrignore 2010-01-11 14:41:00 +0000
+++ .bzrignore 2011-01-12 22:40:11 +0000
@@ -59,5 +59,5 @@
src/libme.la
src/libme_la-indicator-me.lo
po/indicator-me.pot
-src/me-service-client.h
-src/me-service-server.h
+src/gen-datetime-service.xml.c
+src/gen-datetime-service.xml.h
=== modified file 'configure.ac'
--- configure.ac 2011-01-10 21:16:11 +0000
+++ configure.ac 2011-01-12 22:40:11 +0000
@@ -31,19 +31,23 @@
INDICATOR_REQUIRED_VERSION=0.3.0
GWIBBER_REQUIRED_VERSION=0.0.4
DBUSMENUGLIB_REQUIRED_VERSION=0.3.90
+DBUSMENUGTK_REQUIRED_VERSION=0.3.90
TELEPATHYGLIB_REQUIRED_VERSION=0.9.0
GCONF_REQUIRED_VERSION=2.0.0
INDICATOR_DISPLAY_OBJECTS=0.1
+GIO_UNIX_REQUIRED_VERSION=2.22
PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
indicator >= $INDICATOR_REQUIRED_VERSION
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
dbus-glib-1
- dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION)
+ dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
+ dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION)
PKG_CHECK_MODULES(MESERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
gconf-2.0 >= $GCONF_REQUIRED_VERSION
indicator >= $INDICATOR_REQUIRED_VERSION
gwibber >= $GWIBBER_REQUIRED_VERSION
+ gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
telepathy-glib >= $TELEPATHYGLIB_REQUIRED_VERSION)
###########################
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2010-02-17 22:52:43 +0000
+++ src/Makefile.am 2011-01-12 22:40:11 +0000
@@ -12,7 +12,9 @@
about-me-menu-item.h \
indicator-me.c \
dbus-shared-names.h \
- me-service-client.h
+ me-service-server.h \
+ gen-me-service.xml.h \
+ gen-me-service.xml.c
libme_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror
libme_la_LIBADD = $(APPLET_LIBS)
libme_la_LDFLAGS = -module -avoid-version
@@ -27,7 +29,6 @@
me-service.c \
me-service-dbus.h \
me-service-dbus.c \
- me-service-server.h \
me-service-gwibber.c \
me-service-gwibber.h \
status-provider.h \
@@ -47,13 +48,6 @@
indicator_me_service_CFLAGS = $(MESERVICE_CFLAGS) -Wall -Werror
indicator_me_service_LDADD = $(MESERVICE_LIBS)
-me-service-client.h: $(srcdir)/me-service.xml
- dbus-binding-tool \
- --prefix=_me_service_client \
- --mode=glib-client \
- --output=me-service-client.h \
- $(srcdir)/me-service.xml
-
me-service-server.h: $(srcdir)/me-service.xml
dbus-binding-tool \
--prefix=_me_service_server \
@@ -61,6 +55,19 @@
--output=me-service-server.h \
$(srcdir)/me-service.xml
+DBUS_SPECS = \
+ me-service.xml
+
+gen-%.xml.h: %.xml
+ @echo "Building $@ from $<"
+ @echo "extern const char * _$(subst -,_,$(subst .,_,$(basename $<)));" > $@
+
+gen-%.xml.c: %.xml
+ @echo "Building $@ from $<"
+ @echo "const char * _$(subst -,_,$(subst .,_,$(basename $<))) = " > $@
+ @sed -e "s:\":\\\\\":g" -e s:^:\": -e s:\$$:\\\\n\": $< >> $@
+ @echo ";" >> $@
+
status-provider-pidgin-marshal.h: $(srcdir)/status-provider-pidgin.list
glib-genmarshal --header \
--prefix=_status_provider_pidgin_marshal $(srcdir)/status-provider-pidgin.list \
@@ -96,8 +103,9 @@
###############
BUILT_SOURCES = \
- me-service-client.h \
me-service-server.h \
+ gen-me-service.xml.h \
+ gen-me-service.xml.c \
status-provider-mc5-marshal.h \
status-provider-mc5-marshal.c \
status-provider-pidgin-marshal.h \
@@ -113,4 +121,3 @@
CLEANFILES = \
$(BUILT_SOURCES)
-
=== modified file 'src/indicator-me.c'
--- src/indicator-me.c 2011-01-10 21:16:11 +0000
+++ src/indicator-me.c 2011-01-12 22:40:11 +0000
@@ -25,12 +25,10 @@
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-gtk/menu.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-bindings.h>
-
#include <libindicator/indicator.h>
#include <libindicator/indicator-object.h>
#include <libindicator/indicator-service-manager.h>
@@ -40,7 +38,7 @@
#include "about-me-menu-item.h"
#include "dbus-shared-names.h"
-#include "me-service-client.h"
+#include "gen-me-service.xml.h"
#define INDICATOR_ME_TYPE (indicator_me_get_type ())
#define INDICATOR_ME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_ME_TYPE, IndicatorMe))
@@ -72,7 +70,8 @@
/* Globals */
static GtkImage * status_image = NULL;
static GtkLabel *label = NULL;
-static DBusGProxy * status_proxy = NULL;
+static GDBusProxy * status_proxy = NULL;
+static GCancellable * status_proxy_cancel = NULL;
static IdoEntryMenuItem *ido_entry = NULL;
@@ -86,13 +85,14 @@
static void indicator_me_dispose (GObject *object);
static void indicator_me_finalize (GObject *object);
static void connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer userdata);
-static void status_icon_cb (DBusGProxy * proxy, char * icons, GError *error, gpointer userdata);
+static void status_icon_cb (GDBusProxy * proxy, char * icons, GError *error, gpointer userdata);
static gboolean new_entry_item (DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
DbusmenuClient * client);
static void entry_activate_cb (GtkEntry *entry, DbusmenuMenuitem *mi);
static void entry_prop_change_cb (DbusmenuMenuitem *mi, gchar *prop, GVariant *value, GtkEntry *entry);
static gboolean entry_hint_is_shown (GtkWidget *widget);
+static void status_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data);
G_DEFINE_TYPE (IndicatorMe, indicator_me, INDICATOR_OBJECT_TYPE);
@@ -143,7 +143,7 @@
}
static void
-username_cb (DBusGProxy * proxy, char * username, GError *error, gpointer userdata)
+username_cb (GDBusProxy * proxy, char * username, GError *error, gpointer userdata)
{
if (label == NULL) {
label = GTK_LABEL(gtk_label_new(NULL));
@@ -160,6 +160,12 @@
}
+static void
+username_changed (GDBusProxy * proxy, char * username, GError *error, gpointer userdata)
+{
+ return username_cb(proxy, username, error, userdata);
+}
+
static GtkLabel *
get_label (IndicatorObject * io)
{
@@ -182,7 +188,7 @@
}
static void
-status_icon_cb (DBusGProxy * proxy, char * icons, GError *error, gpointer userdata)
+status_icon_cb (GDBusProxy * proxy, char * icons, GError *error, gpointer userdata)
{
g_return_if_fail(icons != NULL);
g_return_if_fail(icons[0] != '\0');
@@ -200,7 +206,7 @@
}
static void
-status_icon_changed (DBusGProxy * proxy, gchar * icon, gpointer userdata)
+status_icon_changed (GDBusProxy * proxy, gchar * icon, gpointer userdata)
{
g_debug("Changing status icon: '%s'", icon);
@@ -221,61 +227,97 @@
}
static void
-connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer userdata)
+connection_changed (IndicatorServiceManager * self, gboolean connected, gpointer userdata)
{
if (connected) {
if (status_proxy == NULL) {
GError * error = NULL;
- DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
-
- status_proxy = dbus_g_proxy_new_for_name_owner(sbus,
- INDICATOR_ME_DBUS_NAME,
- INDICATOR_ME_SERVICE_DBUS_OBJECT,
- INDICATOR_ME_SERVICE_DBUS_INTERFACE,
- &error);
+ status_proxy_cancel = g_cancellable_new();
+
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ INDICATOR_ME_DBUS_NAME,
+ INDICATOR_ME_SERVICE_DBUS_OBJECT,
+ INDICATOR_ME_SERVICE_DBUS_INTERFACE,
+ status_proxy_cancel,
+ status_proxy_cb,
+ self);
+
if (error != NULL) {
g_warning("Unable to get status proxy: %s", error->message);
g_error_free(error);
}
- if (status_proxy == NULL) return;
-
- dbus_g_proxy_add_signal(status_proxy, "StatusIconsChanged", G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal(status_proxy, "StatusIconsChanged", G_CALLBACK(status_icon_changed), NULL, NULL);
-
- dbus_g_proxy_add_signal(status_proxy, "UserChanged", G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal(status_proxy, "UserChanged", G_CALLBACK(username_cb), NULL, NULL);
+ if (status_proxy == NULL) return;
+
+ g_signal_connect(status_proxy, "g-signal", G_CALLBACK(status_icon_changed), self);
+ g_signal_connect(status_proxy, "g-signal", G_CALLBACK(username_changed), self);
}
+ /* KEN REMOVED
org_ayatana_indicator_me_service_status_icons_async(status_proxy, status_icon_cb, NULL);
+ */
- /* query the service for the username to display */
+ /* query the service for the username to display */
+ /* KEN REMOVED
org_ayatana_indicator_me_service_pretty_user_name_async(status_proxy, username_cb, NULL);
+ */
} else {
- DbusmenuMenuitem *mi = g_object_get_data (G_OBJECT (ido_entry),
+ DbusmenuMenuitem *mi = g_object_get_data (G_OBJECT (ido_entry),
"dbusmenuitem");
- g_signal_handlers_disconnect_by_func (ido_entry,
+ g_signal_handlers_disconnect_by_func (ido_entry,
G_CALLBACK (entry_activate_cb),
mi);
- g_signal_handlers_disconnect_by_func (ido_entry,
+ g_signal_handlers_disconnect_by_func (ido_entry,
G_CALLBACK (entry_prop_change_cb),
mi);
/* If we're disconnecting, go back to offline */
status_icon_cb(NULL, DEFAULT_ICON, NULL, NULL);
- g_object_unref (status_proxy);
- status_proxy = NULL;
-
- if (ido_entry != NULL) {
- gtk_widget_destroy (GTK_WIDGET (ido_entry));
- ido_entry = NULL;
- }
- }
+ g_object_unref (status_proxy);
+ status_proxy = NULL;
+
+ if (ido_entry != NULL) {
+ gtk_widget_destroy (GTK_WIDGET (ido_entry));
+ ido_entry = NULL;
+ }
+ }
+
+ return;
+}
+
+/* Callback from trying to create the proxy for the service, this
+ could include starting the service. Sometimes it'll fail and
+ we'll try to start that dang service again! */
+static void
+status_proxy_cb (GObject * self, GAsyncResult * res, gpointer user_data)
+{
+ GError * error = NULL;
+
+ g_return_if_fail(self != NULL);
+
+ GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error);
+
+ if (status_proxy_cancel != NULL) {
+ g_object_unref(status_proxy_cancel);
+ status_proxy_cancel = NULL;
+ }
+
+ if (error != NULL) {
+ g_error("Could not grab DBus proxy for %s: %s", INDICATOR_ME_DBUS_NAME, error->message);
+ g_error_free(error);
+ return;
+ }
+
+ /* Okay, we're good to grab the proxy at this point, we're
+ sure that it's ours. */
+ status_proxy = proxy;
return;
}
=== modified file 'src/me-service-dbus.c'
--- src/me-service-dbus.c 2010-02-24 19:54:33 +0000
+++ src/me-service-dbus.c 2011-01-12 22:40:11 +0000
@@ -38,6 +38,7 @@
static gboolean _me_service_server_pretty_user_name (StatusServiceDbus * service, gchar ** username, GError ** error);
#include "me-service-server.h"
+#include "gen-me-service.xml.h"
/* Private */
typedef struct _StatusServiceDbusPrivate StatusServiceDbusPrivate;