comparison pidgin/plugins/gtkbuddynote.c @ 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 f2869d5facfe
children f05360b5470d
comparison
equal deleted inserted replaced
18263:8d425f1abf95 18264:a2c488006756
28 append_to_tooltip(PurpleBlistNode *node, GString *text, gboolean full) 28 append_to_tooltip(PurpleBlistNode *node, GString *text, gboolean full)
29 { 29 {
30 if (full) { 30 if (full) {
31 const gchar *note = purple_blist_node_get_string(node, "notes"); 31 const gchar *note = purple_blist_node_get_string(node, "notes");
32 32
33 if (note != NULL) { 33 if ((note != NULL) && (*note != '\0')) {
34 g_string_append_printf(text, _("\nBuddy Note: %s"), 34 g_string_append_printf(text, _("\n<b>Buddy Note</b>: %s"),
35 note); 35 note);
36 } 36 }
37 } 37 }
38 } 38 }
39 39
92 92
93 static gboolean 93 static gboolean
94 check_for_buddynote(gpointer data) 94 check_for_buddynote(gpointer data)
95 { 95 {
96 PurplePlugin *buddynote = NULL; 96 PurplePlugin *buddynote = NULL;
97 PurplePlugin *plugin = (PurplePlugin *)data;
97 98
98 buddynote = purple_plugins_find_with_id("core-plugin_pack-buddynote"); 99 buddynote = purple_plugins_find_with_id("core-plugin_pack-buddynote");
99 100
100 if (buddynote == NULL) { 101 if (buddynote == NULL) {
101 buddynote = purple_plugins_find_with_basename("buddynote"); 102 buddynote = purple_plugins_find_with_basename("buddynote");
106 107
107 bninfo->flags = PURPLE_PLUGIN_FLAG_INVISIBLE; 108 bninfo->flags = PURPLE_PLUGIN_FLAG_INVISIBLE;
108 109
109 info.dependencies = g_list_append(info.dependencies, 110 info.dependencies = g_list_append(info.dependencies,
110 "core-plugin_pack-buddynote"); 111 "core-plugin_pack-buddynote");
112
113 /* If non-gtk buddy note plugin is loaded, but we are not, then load
114 * ourselves, otherwise people upgrading from pre-gtkbuddynote days
115 * will not have 'Buddy Notes' showing as loaded in the plugins list.
116 * We also trigger a save on the list of plugins because it's not been
117 * loaded through the UI. */
118 if (purple_plugin_is_loaded(buddynote) &&
119 !purple_plugin_is_loaded(plugin)) {
120 purple_plugin_load(plugin);
121 pidgin_plugins_save();
122 }
123
111 } else { 124 } else {
112 info.flags = PURPLE_PLUGIN_FLAG_INVISIBLE; 125 info.flags = PURPLE_PLUGIN_FLAG_INVISIBLE;
113 } 126 }
114 127
115 return FALSE; 128 return FALSE;