Tue, 13 Oct 2020 00:42:59 -0500
Replace pidgin_set_urgent with gtk_window_set_urgency_hint
Testing Done:
Compiled and grepped for usage of the winpidgin functions that were removed.
Reviewed at https://reviews.imfreedom.org/r/161/
|
17681
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
1 | /* |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
2 | * GtkBuddyNote - Store notes on particular buddies |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
3 | * Copyright (C) 2007 Etan Reisner <deryni@pidgin.im> |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
4 | * |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU General Public License |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
7 | * as published by the Free Software Foundation; either version 2 |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
8 | * of the License, or (at your option) any later version. |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
9 | * |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
14 | * |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
16 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18889
diff
changeset
|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. |
|
17681
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
18 | */ |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
19 | |
|
40496
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
20 | #include <glib/gi18n.h> |
|
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
21 | |
|
40502
875489636847
pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents:
40496
diff
changeset
|
22 | #include <purple.h> |
|
17681
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
23 | |
|
40502
875489636847
pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents:
40496
diff
changeset
|
24 | #include <pidgin.h> |
|
17681
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
25 | |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
26 | static void |
|
34864
0e292d8887de
Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents:
34708
diff
changeset
|
27 | append_to_tooltip(PurpleBlistNode *node, GString *text, gboolean full) |
|
17681
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
28 | { |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
29 | if (full) { |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
30 | const gchar *note = purple_blist_node_get_string(node, "notes"); |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
31 | |
|
18324
7ebbdeaaa30d
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17681
diff
changeset
|
32 | if ((note != NULL) && (*note != '\0')) { |
|
29770
ae8b684d1a59
Escape buddy notes when adding them to the tooltip so notes can't totally
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
33 | char *tmp, *esc; |
|
20095
c3c62efefdd0
applied changes from 23c81a483086f0c1541212be4c849abb05f9f3bd
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
34 | purple_markup_html_to_xhtml(note, NULL, &tmp); |
|
29770
ae8b684d1a59
Escape buddy notes when adding them to the tooltip so notes can't totally
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
35 | esc = g_markup_escape_text(tmp, -1); |
|
ae8b684d1a59
Escape buddy notes when adding them to the tooltip so notes can't totally
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
36 | g_free(tmp); |
|
18324
7ebbdeaaa30d
Make gtkbuddynote load itself if it finds buddynote was loaded and it is
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17681
diff
changeset
|
37 | g_string_append_printf(text, _("\n<b>Buddy Note</b>: %s"), |
|
29770
ae8b684d1a59
Escape buddy notes when adding them to the tooltip so notes can't totally
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
38 | esc); |
|
ae8b684d1a59
Escape buddy notes when adding them to the tooltip so notes can't totally
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
39 | g_free(esc); |
|
17681
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
40 | } |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
41 | } |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
42 | } |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
43 | |
|
36756
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
44 | static PidginPluginInfo * |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
45 | plugin_query(GError **error) |
|
17681
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
46 | { |
|
36756
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
47 | const gchar * const authors[] = { |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
48 | "Etan Reisner <deryni@pidgin.im>", |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
49 | NULL |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
50 | }; |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
51 | |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
52 | const gchar * const dependencies[] = { |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
53 | "core-plugin_pack-buddynote", |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
54 | NULL |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
55 | }; |
|
18889
2eda48021b49
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 <datallah@pidgin.im>
parents:
18324
diff
changeset
|
56 | |
|
36756
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
57 | return pidgin_plugin_info_new( |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
58 | "id", "gtkbuddynote", |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
59 | "name", N_("Buddy Note Tooltips"), |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
60 | "version", DISPLAY_VERSION, |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
61 | "category", N_("User interface"), |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
62 | "summary", N_("Shows stored buddy notes on the buddy's tooltip."), |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
63 | "description", N_("Shows stored buddy notes on the buddy's tooltip."), |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
64 | "authors", authors, |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
65 | "website", PURPLE_WEBSITE, |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
66 | "abi-version", PURPLE_ABI_VERSION, |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
67 | "dependencies", dependencies, |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
68 | NULL |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
69 | ); |
|
17681
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
70 | } |
|
b16ce226d996
Fix #318 which asked for the buddynote plugins notes to be shown in the
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
71 | |
|
36756
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
72 | static gboolean |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
73 | plugin_load(PurplePlugin *plugin, GError **error) |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
74 | { |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
75 | purple_signal_connect(pidgin_blist_get_handle(), "drawing-tooltip", |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
76 | plugin, PURPLE_CALLBACK(append_to_tooltip), NULL); |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
77 | return TRUE; |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
78 | } |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
79 | |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
80 | static gboolean |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
81 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
82 | { |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
83 | return TRUE; |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
84 | } |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
85 | |
|
1bcc14114857
Refactored gtkbuddynote to use the new plugin API.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
86 | PURPLE_PLUGIN_INIT(gtkbuddynote, plugin_query, plugin_load, plugin_unload); |