changeset 18264:a2c488006756

Make gtkbuddynote load itself if it finds buddynote was loaded and it is not, which will make things work better for people upgrading from a version that had no gtkbuddynote plugin. Also don't show empty buddy notes in the tooltip, and make the formatting of the tooltip more in line with other stuff in there
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 24 Jun 2007 14:52:00 +0000
parents 8d425f1abf95
children 4d3b54d818a0 8119af5b3649 db41905e7cc4
files pidgin/plugins/gtkbuddynote.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/gtkbuddynote.c	Sun Jun 24 14:10:03 2007 +0000
+++ b/pidgin/plugins/gtkbuddynote.c	Sun Jun 24 14:52:00 2007 +0000
@@ -30,8 +30,8 @@
 	if (full) {
 		const gchar *note = purple_blist_node_get_string(node, "notes");
 
-		if (note != NULL) {
-			g_string_append_printf(text, _("\nBuddy Note: %s"),
+		if ((note != NULL) && (*note != '\0')) {
+			g_string_append_printf(text, _("\n<b>Buddy Note</b>: %s"),
 			                       note);
 		}
 	}
@@ -94,6 +94,7 @@
 check_for_buddynote(gpointer data)
 {
 	PurplePlugin *buddynote = NULL;
+	PurplePlugin *plugin = (PurplePlugin *)data;
 
 	buddynote = purple_plugins_find_with_id("core-plugin_pack-buddynote");
 
@@ -108,6 +109,18 @@
 
 		info.dependencies = g_list_append(info.dependencies,
 		                                  "core-plugin_pack-buddynote");
+
+		/* If non-gtk buddy note plugin is loaded, but we are not, then load
+		 * ourselves, otherwise people upgrading from pre-gtkbuddynote days
+		 * will not have 'Buddy Notes' showing as loaded in the plugins list.
+		 * We also trigger a save on the list of plugins because it's not been
+		 * loaded through the UI. */
+		if (purple_plugin_is_loaded(buddynote) &&
+		    !purple_plugin_is_loaded(plugin)) {
+			purple_plugin_load(plugin);
+			pidgin_plugins_save();
+		}
+
 	} else {
 		info.flags = PURPLE_PLUGIN_FLAG_INVISIBLE;
 	}