cpw.darkrain42.xmpp.disco: f88f493c: Remove the pseudo-row child of expandabl...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Wed Jun 3 01:01:07 EDT 2009


-----------------------------------------------------------------
Revision: f88f493ce9e17c338e5a22edad2aaafb80069813
Ancestor: 9a85be08ea1f8ddacafc2718ac1600bf259a7991
Author: darkrain42 at pidgin.im
Date: 2009-06-03T04:55:06
Branch: im.pidgin.cpw.darkrain42.xmpp.disco
URL: http://d.pidgin.im/viewmtn/revision/info/f88f493ce9e17c338e5a22edad2aaafb80069813

Modified files:
        pidgin/plugins/disco/gtkdisco.c
        pidgin/plugins/disco/xmppdisco.c

ChangeLog: 

Remove the pseudo-row child of expandable services if there are no children.

Patch from nops. Refs #556.

-------------- next part --------------
============================================================
--- pidgin/plugins/disco/gtkdisco.c	e233f16f4e9183923405ffc45470ff8f9c40a724
+++ pidgin/plugins/disco/gtkdisco.c	6b89196ded70a67b74922d03393cc2123d86a852
@@ -512,7 +512,10 @@ void pidgin_disco_add_service(PidginDisc
 	dialog = pdl->dialog;
 	g_return_if_fail(dialog != NULL);
 
-	purple_debug_info("xmppdisco", "Adding service \"%s\"\n", service->name);
+	if (service != NULL)
+		purple_debug_info("xmppdisco", "Adding service \"%s\"\n", service->name);
+	else
+		purple_debug_info("xmppdisco", "Service \"%s\" has no childrens\n", parent->name);
 
 	gtk_progress_bar_pulse(GTK_PROGRESS_BAR(dialog->progress));
 
@@ -537,6 +540,12 @@ void pidgin_disco_add_service(PidginDisc
 		}
 	}
 
+	if (service == NULL) {
+		if (parent != NULL && !append)
+			gtk_tree_store_remove(pdl->model, &child);
+		return;
+	}
+
 	if (append)
 		gtk_tree_store_append(pdl->model, &iter, (parent ? &parent_iter : NULL));
 	else
============================================================
--- pidgin/plugins/disco/xmppdisco.c	d09d403af7a1dfb37750b340ffa0a21b05fd3aac
+++ pidgin/plugins/disco/xmppdisco.c	c7b241b8c9644bc3bfe97d787ca465f6831aa6d8
@@ -348,6 +348,7 @@ got_items_cb(PurpleConnection *pc, const
 	struct item_data *item_data = data;
 	PidginDiscoList *list = item_data->list;
 	xmlnode *query;
+	gboolean has_items = FALSE;
 
 	--list->fetch_count;
 
@@ -364,6 +365,8 @@ got_items_cb(PurpleConnection *pc, const
 			const char *name = xmlnode_get_attrib(item, "name");
 			const char *node = xmlnode_get_attrib(item, "node");
 
+			has_items = TRUE;
+
 			if (item_data->parent->type == XMPP_DISCO_SERVICE_TYPE_CHAT) {
 				/* This is a hacky first-order approximation. Any MUC
 				 * component that has a >1 level hierarchy (a Yahoo MUC
@@ -397,6 +400,9 @@ got_items_cb(PurpleConnection *pc, const
 		}
 	}
 
+	if (!has_items)
+		pidgin_disco_add_service(list, NULL, item_data->parent);
+
 out:
 	if (list->fetch_count == 0)
 		pidgin_disco_list_set_in_progress(list, FALSE);


More information about the Commits mailing list