← Back to team overview

ayatana-commits team mailing list archive

[Branch ~indicator-applet-developers/indicator-me/trunk] Rev 120: Ported to libgwibber 0.0.7

 

------------------------------------------------------------
revno: 120
committer: Ken VanDine <ken.vandine@xxxxxxxxxxxxx>
branch nick: indicator-me-gdbus
timestamp: Thu 2011-01-13 16:53:43 -0600
message:
  Ported to libgwibber 0.0.7
modified:
  configure.ac
  src/entry-menu-item.c
  src/me-service-gwibber.c
  src/me-service-gwibber.h


--
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 'configure.ac'
--- configure.ac	2011-01-12 22:40:11 +0000
+++ configure.ac	2011-01-13 22:53:43 +0000
@@ -6,7 +6,7 @@
 AC_PREREQ(2.53)
 
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-me, 0.2.10)
+AM_INIT_AUTOMAKE(indicator-me, 0.2.11)
 
 AM_MAINTAINER_MODE
 
@@ -29,7 +29,7 @@
 
 GTK_REQUIRED_VERSION=2.12
 INDICATOR_REQUIRED_VERSION=0.3.0
-GWIBBER_REQUIRED_VERSION=0.0.4
+GWIBBER_REQUIRED_VERSION=0.0.7
 DBUSMENUGLIB_REQUIRED_VERSION=0.3.90
 DBUSMENUGTK_REQUIRED_VERSION=0.3.90
 TELEPATHYGLIB_REQUIRED_VERSION=0.9.0

=== modified file 'src/entry-menu-item.c'
--- src/entry-menu-item.c	2011-01-10 20:54:13 +0000
+++ src/entry-menu-item.c	2011-01-13 22:53:43 +0000
@@ -124,11 +124,18 @@
 			  GVariant *value, guint timestamp)
 {
 	/* EntryMenuItemPrivate * priv = ENTRY_MENU_ITEM_GET_PRIVATE(self); */
-
-	g_debug ("handle_event");
 	if (g_strcmp0 (name, "send") == 0) {
+		gchar * msg = NULL;
+		if (g_variant_is_of_type (value, G_VARIANT_TYPE_VARIANT)) {
+			msg = g_strdup(g_variant_get_string(g_variant_get_variant (value), NULL));
+
+		} else if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING)) {
+			msg = g_strdup(g_variant_get_string(value, NULL));
+
+		}
+
 		MeGwibberService *me_gwibber_service = me_gwibber_service_get ();
-		me_gwibber_service_send (me_gwibber_service, g_variant_get_string (value, NULL));
+		me_gwibber_service_send (me_gwibber_service, g_strdup(msg));
 		dbusmenu_menuitem_property_set (mi, ENTRY_MENUITEM_PROP_TEXT, "");
 	}
 

=== modified file 'src/me-service-gwibber.c'
--- src/me-service-gwibber.c	2010-09-15 21:07:40 +0000
+++ src/me-service-gwibber.c	2011-01-13 22:53:43 +0000
@@ -130,21 +130,13 @@
 	return;
 }
 
-static gboolean
-check_account_send_enabled (GHashTable * account_table) {
-        return g_value_get_boolean(g_hash_table_lookup(account_table, "send_enabled"));
-}
-
 static void
 query_account_manager (MeGwibberService *self)
 {
 	g_return_if_fail (IS_ME_GWIBBER_SERVICE (self));
 
-	gpointer accounts_table;
-	gpointer account_table;
-	GHashTableIter accounts_iter;
-	gpointer account;
-	gboolean send_enabled;
+	GList* accounts_list;
+	GwibberAccount* account;
 
 	MeGwibberServicePrivate * priv = ME_GWIBBER_SERVICE_GET_PRIVATE(self);
 
@@ -152,26 +144,25 @@
 		g_warning ("no accounts, can't query for accounts");
 		goto reset_accounts_string;
 	}
+	accounts_list = gwibber_accounts_list (priv->me_gwibber_accounts);
 	
-        accounts_table = gwibber_accounts_list (priv->me_gwibber_accounts);
-        if (accounts_table == NULL) {
+        if (accounts_list == NULL) {
                 g_warning ("failed to get accounts list");
 				goto reset_accounts_string;
         }
 
-	g_hash_table_iter_init (&accounts_iter, accounts_table);
-
 	priv->has_configured_accounts = FALSE;
 	GList *list = NULL;
 
-	while (g_hash_table_iter_next (&accounts_iter, &account, &account_table)) {
-		send_enabled = check_account_send_enabled (account_table);
-		if (send_enabled) {
+	GList* account_it;
+	for (account_it = accounts_list; account_it != NULL; account_it = account_it->next) {
+		account = g_object_ref ((GwibberAccount*) account_it->data);
+		if (g_strcmp0(gwibber_account_get_send_enabled (account), "1") == 0) {
 			priv->has_configured_accounts = TRUE;
-			GValue *value = g_hash_table_lookup (account_table, "service");
-			if (value != NULL)
-				list = g_list_append (list,
-									  g_strdup (g_value_get_string (value)));
+			const gchar * service_name = gwibber_account_get_service (account);
+			if (service_name != NULL) {
+				list = g_list_append (list, g_strdup (service_name));
+			}
 		}
 	}
 
@@ -206,8 +197,6 @@
 				   ME_GWIBBER_SERVICE_SIGNAL_STATUS_CHANGED_ID,
 				   0, priv->status, TRUE);
 
-	g_hash_table_destroy(accounts_table);
-
 	return;
 
 reset_accounts_string:
@@ -280,7 +269,6 @@
 me_gwibber_accounts_exists_cb (GwibberAccounts * me_gwibber_accounts, gboolean exists, gpointer userdata)
 {
 	MeGwibberServicePrivate * priv = ME_GWIBBER_SERVICE_GET_PRIVATE(ME_GWIBBER_SERVICE (userdata));
-
 	if (exists) {
 		if (priv->me_gwibber_accounts == NULL) {
 			priv->me_gwibber_accounts = gwibber_accounts_new ();;
@@ -304,16 +292,12 @@
 }
 
 void
-me_gwibber_service_send (MeGwibberService *self, const gchar *msg)
+me_gwibber_service_send (MeGwibberService *self, gchar * msg)
 {
 	g_return_if_fail (IS_ME_GWIBBER_SERVICE (self));
 
 	MeGwibberServicePrivate * priv = ME_GWIBBER_SERVICE_GET_PRIVATE(self);
 
-	GValue value = {0};
-	g_value_init(&value, G_TYPE_STRING);
-	g_value_set_string(&value, msg);
-
 	if (priv->me_gwibber_service == NULL) {
 		setup_service_proxies (self);
 		if (priv->me_gwibber_service == NULL) {
@@ -322,9 +306,7 @@
 		}
 	}
 
-	gwibber_service_send_message (priv->me_gwibber_service, g_value_get_string (&value));
-
-	g_value_unset(&value);
+	gwibber_service_send_message (priv->me_gwibber_service, msg);
 
 	return;
 }

=== modified file 'src/me-service-gwibber.h'
--- src/me-service-gwibber.h	2010-09-15 21:07:40 +0000
+++ src/me-service-gwibber.h	2011-01-13 22:53:43 +0000
@@ -66,7 +66,7 @@
 GType me_gwibber_service_get_type (void) G_GNUC_CONST;
 MeGwibberService * me_gwibber_service_new (void);
 MeGwibberService * me_gwibber_service_get (void);
-void me_gwibber_service_send (MeGwibberService *self, const gchar *msg);
+void me_gwibber_service_send (MeGwibberService *self, gchar *msg);
 gboolean me_gwibber_service_has_configured_accounts (MeGwibberService *self);
 const gchar * me_gwibber_service_get_accounts_string (MeGwibberService *self);