Mercurial > pidgin.yaz
annotate pidgin/plugins/gtkbuddynote.c @ 31473:fa1a0dccd4fa
Changelog tray icon fix.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Tue, 14 Dec 2010 06:19:13 +0000 |
parents | fddded5ee514 |
children |
rev | line source |
---|---|
17812
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
1 /* |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
2 * GtkBuddyNote - Store notes on particular buddies |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
3 * Copyright (C) 2007 Etan Reisner <deryni@pidgin.im> |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
4 * |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
6 * modify it under the terms of the GNU General Public License |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
7 * as published by the Free Software Foundation; either version 2 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
8 * of the License, or (at your option) any later version. |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
9 * |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
13 * GNU General Public License for more details. |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
14 * |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
16 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18626
diff
changeset
|
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. |
17812
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
18 */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
19 #include "internal.h" |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
20 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
21 #include <gtkblist.h> |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
22 #include <gtkplugin.h> |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
23 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
24 #include <debug.h> |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
25 #include <version.h> |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
26 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
27 static void |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
28 append_to_tooltip(PurpleBlistNode *node, GString *text, gboolean full) |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
29 { |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
30 if (full) { |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
31 const gchar *note = purple_blist_node_get_string(node, "notes"); |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
32 |
18264
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
33 if ((note != NULL) && (*note != '\0')) { |
29888
fddded5ee514
Escape buddy notes when adding them to the tooltip so notes can't totally
Stu Tomlinson <stu@nosnilmot.com>
parents:
21030
diff
changeset
|
34 char *tmp, *esc; |
20157
2a8b576590d8
Convert buddy notes to plain text before displaying in the tooltip to
Stu Tomlinson <stu@nosnilmot.com>
parents:
19680
diff
changeset
|
35 purple_markup_html_to_xhtml(note, NULL, &tmp); |
29888
fddded5ee514
Escape buddy notes when adding them to the tooltip so notes can't totally
Stu Tomlinson <stu@nosnilmot.com>
parents:
21030
diff
changeset
|
36 esc = g_markup_escape_text(tmp, -1); |
fddded5ee514
Escape buddy notes when adding them to the tooltip so notes can't totally
Stu Tomlinson <stu@nosnilmot.com>
parents:
21030
diff
changeset
|
37 g_free(tmp); |
18264
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
38 g_string_append_printf(text, _("\n<b>Buddy Note</b>: %s"), |
29888
fddded5ee514
Escape buddy notes when adding them to the tooltip so notes can't totally
Stu Tomlinson <stu@nosnilmot.com>
parents:
21030
diff
changeset
|
39 esc); |
fddded5ee514
Escape buddy notes when adding them to the tooltip so notes can't totally
Stu Tomlinson <stu@nosnilmot.com>
parents:
21030
diff
changeset
|
40 g_free(esc); |
17812
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
41 } |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
42 } |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
43 } |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
44 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
45 static gboolean |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
46 plugin_load(PurplePlugin *plugin) |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
47 { |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
48 purple_signal_connect(pidgin_blist_get_handle(), "drawing-tooltip", |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
49 plugin, PURPLE_CALLBACK(append_to_tooltip), NULL); |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
50 return TRUE; |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
51 } |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
52 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
53 static gboolean |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
54 plugin_unload(PurplePlugin *plugin) |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
55 { |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
56 PurplePlugin *buddynote = NULL; |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
57 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
58 buddynote = purple_plugins_find_with_id("core-plugin_pack-buddynote"); |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
59 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
60 purple_plugin_unload(buddynote); |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
61 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
62 return TRUE; |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
63 } |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
64 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
65 static PurplePluginInfo info = |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
66 { |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
67 PURPLE_PLUGIN_MAGIC, |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
68 PURPLE_MAJOR_VERSION, /**< major version */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
69 PURPLE_MINOR_VERSION, /**< minor version */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
70 PURPLE_PLUGIN_STANDARD, /**< type */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
71 PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
72 0, /**< flags */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
73 NULL, /**< dependencies */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
74 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
75 "gtkbuddynote", /**< id */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
76 N_("Buddy Notes"), /**< name */ |
21030
3cc856ca2338
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents:
20157
diff
changeset
|
77 DISPLAY_VERSION, /**< version */ |
17812
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
78 N_("Store notes on particular buddies."), /**< summary */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
79 N_("Adds the option to store notes for buddies " |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
80 "on your buddy list."), /**< description */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
81 "Etan Reisner <deryni@pidgin.im>", /**< author */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
82 PURPLE_WEBSITE, /**< homepage */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
83 plugin_load, /**< load */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
84 plugin_unload, /**< unload */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
85 NULL, /**< destroy */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
86 NULL, /**< ui_info */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
87 NULL, /**< extra_info */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
88 NULL, /**< prefs_info */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
89 NULL, /**< actions */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
90 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
91 /* padding */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
92 NULL, |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
93 NULL, |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
94 NULL, |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
95 NULL |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
96 }; |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
97 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
98 static gboolean |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
99 check_for_buddynote(gpointer data) |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
100 { |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
101 PurplePlugin *buddynote = NULL; |
18264
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
102 PurplePlugin *plugin = (PurplePlugin *)data; |
17812
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
103 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
104 buddynote = purple_plugins_find_with_id("core-plugin_pack-buddynote"); |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
105 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
106 if (buddynote == NULL) { |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
107 buddynote = purple_plugins_find_with_basename("buddynote"); |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
108 } |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
109 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
110 if (buddynote != NULL) { |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
111 PurplePluginInfo *bninfo = buddynote->info; |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
112 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
113 bninfo->flags = PURPLE_PLUGIN_FLAG_INVISIBLE; |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
114 |
18264
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
115 |
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
116 /* If non-gtk buddy note plugin is loaded, but we are not, then load |
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
117 * ourselves, otherwise people upgrading from pre-gtkbuddynote days |
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
118 * will not have 'Buddy Notes' showing as loaded in the plugins list. |
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
119 * We also trigger a save on the list of plugins because it's not been |
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
120 * loaded through the UI. */ |
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
121 if (purple_plugin_is_loaded(buddynote) && |
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
122 !purple_plugin_is_loaded(plugin)) { |
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
123 purple_plugin_load(plugin); |
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
124 pidgin_plugins_save(); |
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
125 } |
a2c488006756
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <stu@nosnilmot.com>
parents:
17812
diff
changeset
|
126 |
17812
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
127 } else { |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
128 info.flags = PURPLE_PLUGIN_FLAG_INVISIBLE; |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
129 } |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
130 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
131 return FALSE; |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
132 } |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
133 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
134 static void |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
135 init_plugin(PurplePlugin *plugin) |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
136 { |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
137 /* Use g_idle_add so that the rest of the plugins can get loaded |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
138 * before we do our check. */ |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
139 g_idle_add(check_for_buddynote, plugin); |
18626
f05360b5470d
Fix core plugin dependency registering for gtkbuddynote to happen in plugin_init() so that it can work correctly. Add an additional sanity check in the core plugin unloading so that messed up dependency registrations don't cause crashes in the future. Thanks to deryni for helping figure this out.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18264
diff
changeset
|
140 |
f05360b5470d
Fix core plugin dependency registering for gtkbuddynote to happen in plugin_init() so that it can work correctly. Add an additional sanity check in the core plugin unloading so that messed up dependency registrations don't cause crashes in the future. Thanks to deryni for helping figure this out.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18264
diff
changeset
|
141 info.dependencies = g_list_append(info.dependencies, |
f05360b5470d
Fix core plugin dependency registering for gtkbuddynote to happen in plugin_init() so that it can work correctly. Add an additional sanity check in the core plugin unloading so that messed up dependency registrations don't cause crashes in the future. Thanks to deryni for helping figure this out.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18264
diff
changeset
|
142 "core-plugin_pack-buddynote"); |
17812
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
143 } |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
144 |
f2869d5facfe
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
diff
changeset
|
145 PURPLE_INIT_PLUGIN(gtkbuddynote, init_plugin, info) |