finch/gntnotify.c

Fri, 31 Dec 2021 00:28:23 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 31 Dec 2021 00:28:23 -0600
changeset 41227
960035e8e81a
parent 40616
064ff9f4150a
child 41231
4fd76e8dedf8
permissions
-rw-r--r--

Remove email notification support from finch

Testing Done:
Ran finch, seemed fine.

Reviewed at https://reviews.imfreedom.org/r/1205/

39887
9c8f874c74a0 Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents: 39619
diff changeset
1 /*
9c8f874c74a0 Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents: 39619
diff changeset
2 * finch
14620
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
3 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15906
diff changeset
4 * Finch is the legal property of its developers, whose names are too numerous
14620
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
6 * source distribution.
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
7 *
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
8 * This program is free software; you can redistribute it and/or modify
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
9 * it under the terms of the GNU General Public License as published by
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
11 * (at your option) any later version.
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
12 *
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
13 * This program is distributed in the hope that it will be useful,
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
16 * GNU General Public License for more details.
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
17 *
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
18 * You should have received a copy of the GNU General Public License
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
19 * 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: 18402
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
14620
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14368
diff changeset
21 */
39887
9c8f874c74a0 Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents: 39619
diff changeset
22
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40359
diff changeset
23 #include <glib/gi18n-lib.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40359
diff changeset
24
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40359
diff changeset
25 #include <purple.h>
29106
51c7b2177e42 Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <darkrain42@pidgin.im>
parents: 27829
diff changeset
26
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
27 #include <gnt.h>
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
28
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
29 #include "gntnotify.h"
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
30
14050
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
31 static void
35979
ca8204d663bf Backport warning fixes for Finch from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31741
diff changeset
32 notify_msg_window_destroy_cb(GntWidget *window, PurpleNotifyType type)
14050
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
33 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
34 purple_notify_close(type, window);
14050
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
35 }
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
36
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
37 static void *
37409
9dadde8529a8 Change enum name from PurpleNotifyMsgType to PurpleNotifyMessageType
Jorge Villaseñor <salinasv@pidgin.im>
parents: 36002
diff changeset
38 finch_notify_common(PurpleNotifyType ntype, PurpleNotifyMessageType msgtype,
34458
5c9d451155c5 Clang warnings: clean up finch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34449
diff changeset
39 const char *title, const char *primary, const char *secondary,
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33892
diff changeset
40 PurpleRequestCommonParameters *cpar)
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
41 {
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
42 GntWidget *window, *button;
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
43 GntTextFormatFlags pf = 0, sf = 0;
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
44
35979
ca8204d663bf Backport warning fixes for Finch from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31741
diff changeset
45 switch (msgtype)
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
46 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
47 case PURPLE_NOTIFY_MSG_ERROR:
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
48 sf |= GNT_TEXT_FLAG_BOLD;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35990
diff changeset
49 /* fall through */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
50 case PURPLE_NOTIFY_MSG_WARNING:
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
51 pf |= GNT_TEXT_FLAG_UNDERLINE;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35990
diff changeset
52 /* fall through */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
53 case PURPLE_NOTIFY_MSG_INFO:
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
54 pf |= GNT_TEXT_FLAG_BOLD;
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
55 break;
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
56 }
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
57
22991
a5a6aafb28b4 Show the url, instead of silently ignoring a url-open request.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22104
diff changeset
58 window = gnt_window_box_new(FALSE, TRUE);
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
59 gnt_box_set_title(GNT_BOX(window), title);
14015
e543d2109729 [gaim-migrate @ 16501]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
60 gnt_box_set_fill(GNT_BOX(window), FALSE);
e543d2109729 [gaim-migrate @ 16501]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14014
diff changeset
61 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID);
17846
e8ee63f71029 Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17845
diff changeset
62 gnt_box_set_pad(GNT_BOX(window), 0);
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
63
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
64 if (primary)
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
65 gnt_box_add_widget(GNT_BOX(window),
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
66 gnt_label_new_with_format(primary, pf));
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
67
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
68 button = gnt_button_new(_("OK"));
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
69
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
70 if (secondary) {
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
71 GntWidget *msg;
35979
ca8204d663bf Backport warning fixes for Finch from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31741
diff changeset
72 if (ntype == PURPLE_NOTIFY_FORMATTED) {
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
73 int width = -1, height = -1;
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
74 char *plain = (char*)secondary;
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
75 msg = gnt_text_view_new();
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
76 gnt_text_view_set_flag(GNT_TEXT_VIEW(msg), GNT_TEXT_VIEW_TOP_ALIGN | GNT_TEXT_VIEW_NO_SCROLL);
35979
ca8204d663bf Backport warning fixes for Finch from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31741
diff changeset
77
ca8204d663bf Backport warning fixes for Finch from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31741
diff changeset
78 plain = purple_markup_strip_html(secondary);
ca8204d663bf Backport warning fixes for Finch from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31741
diff changeset
79 if (!gnt_util_parse_xhtml_to_textview(secondary, GNT_TEXT_VIEW(msg)))
ca8204d663bf Backport warning fixes for Finch from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31741
diff changeset
80 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(msg), plain, sf);
ca8204d663bf Backport warning fixes for Finch from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31741
diff changeset
81
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
82 gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(msg), button);
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
83 gnt_util_get_text_bound(plain, &width, &height);
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
84 gnt_widget_set_size(msg, width + 3, height + 1);
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
85 if (plain != secondary)
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
86 g_free(plain);
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
87 } else {
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
88 msg = gnt_label_new_with_format(secondary, sf);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
89 }
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
90 gnt_box_add_widget(GNT_BOX(window), msg);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
91 g_object_set_data(G_OBJECT(window), "info-widget", msg);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
92 }
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
93
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
94 gnt_box_add_widget(GNT_BOX(window), button);
14050
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
95 g_signal_connect_swapped(G_OBJECT(button), "activate",
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
96 G_CALLBACK(gnt_widget_destroy), window);
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
97 g_signal_connect(G_OBJECT(window), "destroy",
35979
ca8204d663bf Backport warning fixes for Finch from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31741
diff changeset
98 G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(ntype));
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
99
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
100 gnt_widget_show(window);
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
101 return window;
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
102 }
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
103
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
104 /* handle is, in all/most occasions, a GntWidget * */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
105 static void finch_close_notify(PurpleNotifyType type, void *handle)
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
106 {
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
107 GntWidget *widget = handle;
14050
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
108
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
109 if (!widget)
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
110 return;
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
111
39619
2451343ed79b Use gnt_widget_get_toplevel everywhere.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38748
diff changeset
112 widget = gnt_widget_get_toplevel(widget);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29106
diff changeset
113
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
114 if (type == PURPLE_NOTIFY_SEARCHRESULTS)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
115 purple_notify_searchresults_free(g_object_get_data(handle, "notify-results"));
14368
141224b7e90e [gaim-migrate @ 16996]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14260
diff changeset
116 #if 1
141224b7e90e [gaim-migrate @ 16996]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14260
diff changeset
117 /* This did not seem to be necessary */
14050
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
118 g_signal_handlers_disconnect_by_func(G_OBJECT(widget),
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
119 G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(type));
800c76ca93f7 [gaim-migrate @ 16561]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14041
diff changeset
120 #endif
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
121 gnt_widget_destroy(widget);
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
122 }
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
123
34458
5c9d451155c5 Clang warnings: clean up finch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34449
diff changeset
124 static void *
37409
9dadde8529a8 Change enum name from PurpleNotifyMsgType to PurpleNotifyMessageType
Jorge Villaseñor <salinasv@pidgin.im>
parents: 36002
diff changeset
125 finch_notify_message(PurpleNotifyMessageType type, const char *title,
34458
5c9d451155c5 Clang warnings: clean up finch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34449
diff changeset
126 const char *primary, const char *secondary,
5c9d451155c5 Clang warnings: clean up finch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34449
diff changeset
127 PurpleRequestCommonParameters *cpar)
5c9d451155c5 Clang warnings: clean up finch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34449
diff changeset
128 {
5c9d451155c5 Clang warnings: clean up finch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34449
diff changeset
129 return finch_notify_common(PURPLE_NOTIFY_MESSAGE, type, title, primary,
5c9d451155c5 Clang warnings: clean up finch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34449
diff changeset
130 secondary, cpar);
5c9d451155c5 Clang warnings: clean up finch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34449
diff changeset
131 }
5c9d451155c5 Clang warnings: clean up finch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34449
diff changeset
132
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15252
diff changeset
133 static void *finch_notify_formatted(const char *title, const char *primary,
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
134 const char *secondary, const char *text)
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
135 {
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
136 char *xhtml = NULL;
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
137 char *t = g_strdup_printf("<span>%s%s%s</span>",
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
138 secondary ? secondary : "",
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
139 secondary ? "\n" : "",
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
140 text ? text : "");
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
141 void *ret;
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
142
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
143 purple_markup_html_to_xhtml(t, &xhtml, NULL);
35979
ca8204d663bf Backport warning fixes for Finch from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31741
diff changeset
144 ret = finch_notify_common(PURPLE_NOTIFY_FORMATTED,
34458
5c9d451155c5 Clang warnings: clean up finch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34449
diff changeset
145 PURPLE_NOTIFY_MSG_INFO, title, primary, xhtml, NULL);
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
146
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
147 g_free(t);
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
148 g_free(xhtml);
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
149
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
150 return ret;
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
151 }
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
152
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
153 /** User information. **/
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
154 static GHashTable *userinfo;
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
155
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
156 static char *
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
157 userinfo_hash(PurpleAccount *account, const char *who)
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
158 {
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
159 char key[256];
25708
7e97dbce8223 applied changes from aa7ce93329f5ccbe74640a92b6656ae402d8eea8
Ethan Blanton <elb@pidgin.im>
parents: 24225
diff changeset
160 g_snprintf(key, sizeof(key), "%s - %s", purple_account_get_username(account), purple_normalize(account, who));
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
161 return g_utf8_strup(key, -1);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
162 }
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
163
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
164 static void
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
165 remove_userinfo(GntWidget *widget, gpointer key)
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
166 {
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
167 g_hash_table_remove(userinfo, key);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
168 }
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
169
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
170 static char *
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
171 purple_notify_user_info_get_xhtml(PurpleNotifyUserInfo *user_info)
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
172 {
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
173 GList *l;
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
174 GString *text;
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
175
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
176 text = g_string_new("<span>");
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
177
32193
42173d1c1317 Change PurpleNotifyUserInfo->user_info_entries from a GList to a GQueue.
Mark Doliner <markdoliner@pidgin.im>
parents: 31782
diff changeset
178 for (l = purple_notify_user_info_get_entries(user_info)->head; l != NULL;
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
179 l = l->next) {
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
180 PurpleNotifyUserInfoEntry *user_info_entry = l->data;
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 34458
diff changeset
181 PurpleNotifyUserInfoEntryType type = purple_notify_user_info_entry_get_entry_type(user_info_entry);
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
182 const char *label = purple_notify_user_info_entry_get_label(user_info_entry);
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
183 const char *value = purple_notify_user_info_entry_get_value(user_info_entry);
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
184
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
185 /* Handle the label/value pair itself */
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
186 if (type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER)
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
187 g_string_append(text, "<u>");
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
188 if (label)
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
189 g_string_append_printf(text, "<b>%s</b>", label);
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
190 g_string_append(text, "<span>");
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
191 if (label && value)
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
192 g_string_append(text, ": ");
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
193 if (value) {
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
194 char *strip = purple_markup_strip_html(value);
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
195 g_string_append(text, strip);
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
196 g_free(strip);
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
197 }
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
198 g_string_append(text, "</span>");
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
199 if (type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER)
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
200 g_string_append(text, "</u>");
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
201 else if (type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK)
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
202 g_string_append(text, "<HR/>");
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
203 g_string_append(text, "<BR/>");
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
204 }
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
205 g_string_append(text, "</span>");
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
206
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
207 return g_string_free(text, FALSE);
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
208 }
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
209
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
210 static void *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
211 finch_notify_userinfo(PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info)
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
212 {
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
213 char *primary;
15207
31d9665a2a7d [gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents: 14620
diff changeset
214 char *info;
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
215 void *ui_handle;
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
216 char *key = userinfo_hash(purple_connection_get_account(gc), who);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
217
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
218 info = purple_notify_user_info_get_xhtml(user_info);
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
219
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
220 ui_handle = g_hash_table_lookup(userinfo, key);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
221 if (ui_handle != NULL) {
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
222 GntTextView *msg = GNT_TEXT_VIEW(g_object_get_data(G_OBJECT(ui_handle), "info-widget"));
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
223 char *strip = purple_markup_strip_html(info);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
224 int tvw, tvh, width, height, ntvw, ntvh;
39619
2451343ed79b Use gnt_widget_get_toplevel everywhere.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38748
diff changeset
225 GntWidget *window;
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
226
39619
2451343ed79b Use gnt_widget_get_toplevel everywhere.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38748
diff changeset
227 ui_handle = window = gnt_widget_get_toplevel(GNT_WIDGET(ui_handle));
2451343ed79b Use gnt_widget_get_toplevel everywhere.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38748
diff changeset
228 gnt_widget_get_size(window, &width, &height);
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
229 gnt_widget_get_size(GNT_WIDGET(msg), &tvw, &tvh);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
230
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
231 gnt_text_view_clear(msg);
24225
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
232 if (!gnt_util_parse_xhtml_to_textview(info, msg))
7b54e1675a58 Try to preserve HTML attributes in notification dialogs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23319
diff changeset
233 gnt_text_view_append_text_with_flags(msg, strip, GNT_TEXT_FLAG_NORMAL);
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
234 gnt_text_view_scroll(msg, 0);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
235 gnt_util_get_text_bound(strip, &ntvw, &ntvh);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
236 ntvw += 3;
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
237 ntvh++;
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
238
39619
2451343ed79b Use gnt_widget_get_toplevel everywhere.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38748
diff changeset
239 gnt_screen_resize_widget(window, width + MAX(0, ntvw - tvw), height + MAX(0, ntvh - tvh));
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
240 g_free(strip);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
241 g_free(key);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
242 } else {
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
243 primary = g_strdup_printf(_("Info for %s"), who);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
244 ui_handle = finch_notify_formatted(_("Buddy Information"), primary, NULL, info);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
245 g_hash_table_insert(userinfo, key, ui_handle);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
246 g_free(primary);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
247 g_signal_connect(G_OBJECT(ui_handle), "destroy", G_CALLBACK(remove_userinfo), key);
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
248 }
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
249
15207
31d9665a2a7d [gaim-migrate @ 17931]
Evan Schoenberg <evands@pidgin.im>
parents: 14620
diff changeset
250 g_free(info);
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
251 return ui_handle;
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
252 }
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
253
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
254 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
255 notify_button_activated(GntWidget *widget, PurpleNotifySearchButton *b)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
256 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
257 GList *list = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
258 PurpleAccount *account = g_object_get_data(G_OBJECT(widget), "notify-account");
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
259 gpointer data = g_object_get_data(G_OBJECT(widget), "notify-data");
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
260
18402
f84b9b94e0ac Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
261 list = gnt_tree_get_selection_text_list(GNT_TREE(g_object_get_data(G_OBJECT(widget), "notify-tree")));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
262
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
263 b->callback(purple_account_get_connection(account), list, data);
39897
16b440d4ab36 Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39887
diff changeset
264 g_list_free_full(list, g_free);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
265 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
266
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
267 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
268 finch_notify_sr_new_rows(PurpleConnection *gc,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
269 PurpleNotifySearchResults *results, void *data)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
270 {
38732
d1e7cb57dcac Fix Finch search results display (#17238)
David Woodhouse <dwmw@amazon.co.uk>
parents: 35998
diff changeset
271 GntWindow *window = GNT_WINDOW(data);
d1e7cb57dcac Fix Finch search results display (#17238)
David Woodhouse <dwmw@amazon.co.uk>
parents: 35998
diff changeset
272 GntTree *tree = GNT_TREE(g_object_get_data(G_OBJECT(window), "tree-widget"));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
273 GList *o;
32764
308f04fac4e4 Fix insertion order of search results in Finch.
Howard Chu <hyc@symas.com>
parents: 32754
diff changeset
274 GntTreeRow *prev = NULL;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
275
38732
d1e7cb57dcac Fix Finch search results display (#17238)
David Woodhouse <dwmw@amazon.co.uk>
parents: 35998
diff changeset
276 gnt_tree_remove_all(GNT_TREE(tree));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
277
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
278 for (o = results->rows; o; o = o->next)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
279 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
280 gnt_tree_add_row_after(GNT_TREE(tree), o->data,
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
281 gnt_tree_create_row_from_list(GNT_TREE(tree), o->data),
32764
308f04fac4e4 Fix insertion order of search results in Finch.
Howard Chu <hyc@symas.com>
parents: 32754
diff changeset
282 NULL, prev);
308f04fac4e4 Fix insertion order of search results in Finch.
Howard Chu <hyc@symas.com>
parents: 32754
diff changeset
283 prev = o->data;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
284 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
285 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
286
32754
c5ade9b736d5 Ensure that the user's close callback is invoked when search
Howard Chu <hyc@symas.com>
parents: 32691
diff changeset
287 static void
c5ade9b736d5 Ensure that the user's close callback is invoked when search
Howard Chu <hyc@symas.com>
parents: 32691
diff changeset
288 notify_sr_destroy_cb(GntWidget *window, void *data)
c5ade9b736d5 Ensure that the user's close callback is invoked when search
Howard Chu <hyc@symas.com>
parents: 32691
diff changeset
289 {
c5ade9b736d5 Ensure that the user's close callback is invoked when search
Howard Chu <hyc@symas.com>
parents: 32691
diff changeset
290 purple_notify_close(PURPLE_NOTIFY_SEARCHRESULTS, window);
c5ade9b736d5 Ensure that the user's close callback is invoked when search
Howard Chu <hyc@symas.com>
parents: 32691
diff changeset
291 }
c5ade9b736d5 Ensure that the user's close callback is invoked when search
Howard Chu <hyc@symas.com>
parents: 32691
diff changeset
292
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
293 static void *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
294 finch_notify_searchresults(PurpleConnection *gc, const char *title,
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
295 const char *primary, const char *secondary,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
296 PurpleNotifySearchResults *results, gpointer data)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
297 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
298 GntWidget *window, *tree, *box, *button;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
299 GList *iter;
18402
f84b9b94e0ac Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
300 int columns, i;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
301
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
302 window = gnt_vbox_new(FALSE);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
303 gnt_box_set_toplevel(GNT_BOX(window), TRUE);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
304 gnt_box_set_title(GNT_BOX(window), title);
18402
f84b9b94e0ac Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
305 gnt_box_set_fill(GNT_BOX(window), TRUE);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
306 gnt_box_set_pad(GNT_BOX(window), 0);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
307 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
308
18402
f84b9b94e0ac Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
309 if (primary)
f84b9b94e0ac Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
310 gnt_box_add_widget(GNT_BOX(window),
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
311 gnt_label_new_with_format(primary, GNT_TEXT_FLAG_BOLD));
18402
f84b9b94e0ac Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
312 if (secondary)
f84b9b94e0ac Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
313 gnt_box_add_widget(GNT_BOX(window),
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
314 gnt_label_new_with_format(secondary, GNT_TEXT_FLAG_NORMAL));
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
315
20355
dacdf6087e16 Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents: 20147
diff changeset
316 columns = g_list_length(results->columns);
18402
f84b9b94e0ac Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
317 tree = gnt_tree_new_with_columns(columns);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
318 gnt_tree_set_show_title(GNT_TREE(tree), TRUE);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
319 gnt_box_add_widget(GNT_BOX(window), tree);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
320
20355
dacdf6087e16 Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents: 20147
diff changeset
321 i = 0;
dacdf6087e16 Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents: 20147
diff changeset
322 for (iter = results->columns; iter; iter = iter->next)
dacdf6087e16 Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents: 20147
diff changeset
323 {
20984
d8539239d231 Fix the searchresult thingy nosnilmot fixed in pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20875
diff changeset
324 PurpleNotifySearchColumn *column = iter->data;
32691
d6eb58903f8b Hide struct PurpleNotifySearchColumn.
Andrew Victor <andrew.victor@mxit.com>
parents: 32193
diff changeset
325 gnt_tree_set_column_title(GNT_TREE(tree), i, purple_notify_searchresult_column_get_title(column));
31696
67d180e0f68d Add API:
Andrew Victor <andrew.victor@mxit.com>
parents: 31294
diff changeset
326
67d180e0f68d Add API:
Andrew Victor <andrew.victor@mxit.com>
parents: 31294
diff changeset
327 if (!purple_notify_searchresult_column_is_visible(column))
67d180e0f68d Add API:
Andrew Victor <andrew.victor@mxit.com>
parents: 31294
diff changeset
328 gnt_tree_set_column_visible(GNT_TREE(tree), i, FALSE);
20355
dacdf6087e16 Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents: 20147
diff changeset
329 i++;
dacdf6087e16 Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents: 20147
diff changeset
330 }
18402
f84b9b94e0ac Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
331
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
332 box = gnt_hbox_new(TRUE);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
333
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
334 for (iter = results->buttons; iter; iter = iter->next)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
335 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
336 PurpleNotifySearchButton *b = iter->data;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
337 const char *text;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
338
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
339 switch (b->type)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
340 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
341 case PURPLE_NOTIFY_BUTTON_LABELED:
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
342 text = b->label;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
343 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
344 case PURPLE_NOTIFY_BUTTON_CONTINUE:
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
345 text = _("Continue");
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
346 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
347 case PURPLE_NOTIFY_BUTTON_ADD:
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
348 text = _("Add");
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
349 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
350 case PURPLE_NOTIFY_BUTTON_INFO:
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
351 text = _("Info");
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
352 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
353 case PURPLE_NOTIFY_BUTTON_IM:
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
354 text = _("IM");
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
355 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
356 case PURPLE_NOTIFY_BUTTON_JOIN:
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
357 text = _("Join");
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
358 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
359 case PURPLE_NOTIFY_BUTTON_INVITE:
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
360 text = _("Invite");
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
361 break;
14260
a21577fbb4d2 [gaim-migrate @ 16870]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
362 default:
a21577fbb4d2 [gaim-migrate @ 16870]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14167
diff changeset
363 text = _("(none)");
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
364 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
365
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
366 button = gnt_button_new(text);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
367 g_object_set_data(G_OBJECT(button), "notify-account", purple_connection_get_account(gc));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
368 g_object_set_data(G_OBJECT(button), "notify-data", data);
18402
f84b9b94e0ac Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
369 g_object_set_data(G_OBJECT(button), "notify-tree", tree);
f84b9b94e0ac Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18273
diff changeset
370 g_signal_connect(G_OBJECT(button), "activate",
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
371 G_CALLBACK(notify_button_activated), b);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
372
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
373 gnt_box_add_widget(GNT_BOX(box), button);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
374 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
375
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
376 gnt_box_add_widget(GNT_BOX(window), box);
32754
c5ade9b736d5 Ensure that the user's close callback is invoked when search
Howard Chu <hyc@symas.com>
parents: 32691
diff changeset
377 g_signal_connect(G_OBJECT(tree), "destroy",
c5ade9b736d5 Ensure that the user's close callback is invoked when search
Howard Chu <hyc@symas.com>
parents: 32691
diff changeset
378 G_CALLBACK(notify_sr_destroy_cb), NULL);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
379
38732
d1e7cb57dcac Fix Finch search results display (#17238)
David Woodhouse <dwmw@amazon.co.uk>
parents: 35998
diff changeset
380 g_object_set_data(G_OBJECT(window), "tree-widget", tree);
d1e7cb57dcac Fix Finch search results display (#17238)
David Woodhouse <dwmw@amazon.co.uk>
parents: 35998
diff changeset
381 finch_notify_sr_new_rows(gc, results, window);
d1e7cb57dcac Fix Finch search results display (#17238)
David Woodhouse <dwmw@amazon.co.uk>
parents: 35998
diff changeset
382
d1e7cb57dcac Fix Finch search results display (#17238)
David Woodhouse <dwmw@amazon.co.uk>
parents: 35998
diff changeset
383 g_signal_connect(G_OBJECT(window), "destroy",
d1e7cb57dcac Fix Finch search results display (#17238)
David Woodhouse <dwmw@amazon.co.uk>
parents: 35998
diff changeset
384 G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(PURPLE_NOTIFY_SEARCHRESULTS));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
385
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
386 gnt_widget_show(window);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
387 g_object_set_data(G_OBJECT(window), "notify-results", results);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
388
38732
d1e7cb57dcac Fix Finch search results display (#17238)
David Woodhouse <dwmw@amazon.co.uk>
parents: 35998
diff changeset
389 return window;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
390 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14033
diff changeset
391
22991
a5a6aafb28b4 Show the url, instead of silently ignoring a url-open request.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22104
diff changeset
392 static void *
a5a6aafb28b4 Show the url, instead of silently ignoring a url-open request.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22104
diff changeset
393 finch_notify_uri(const char *url)
a5a6aafb28b4 Show the url, instead of silently ignoring a url-open request.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22104
diff changeset
394 {
35979
ca8204d663bf Backport warning fixes for Finch from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31741
diff changeset
395 return finch_notify_common(PURPLE_NOTIFY_URI, PURPLE_NOTIFY_MSG_INFO,
34458
5c9d451155c5 Clang warnings: clean up finch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34449
diff changeset
396 _("URI"), url, NULL, NULL);
22991
a5a6aafb28b4 Show the url, instead of silently ignoring a url-open request.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22104
diff changeset
397 }
a5a6aafb28b4 Show the url, instead of silently ignoring a url-open request.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22104
diff changeset
398
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29106
diff changeset
399 static PurpleNotifyUiOps ops =
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
400 {
17164
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 16981
diff changeset
401 finch_notify_message,
41227
960035e8e81a Remove email notification support from finch
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
402 NULL,
960035e8e81a Remove email notification support from finch
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
403 NULL,
17164
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 16981
diff changeset
404 finch_notify_formatted,
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 16981
diff changeset
405 finch_notify_searchresults,
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 16981
diff changeset
406 finch_notify_sr_new_rows,
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 16981
diff changeset
407 finch_notify_userinfo,
22991
a5a6aafb28b4 Show the url, instead of silently ignoring a url-open request.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22104
diff changeset
408 finch_notify_uri,
17164
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 16981
diff changeset
409 finch_close_notify, /* The rest of the notify-uiops return a GntWidget.
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 16981
diff changeset
410 These widgets should be destroyed from here. */
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 16981
diff changeset
411 NULL,
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 16981
diff changeset
412 NULL,
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 16981
diff changeset
413 NULL,
3a005b9e8f28 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents: 16981
diff changeset
414 NULL
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
415
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
416 };
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
417
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
418 PurpleNotifyUiOps *finch_notify_get_ui_ops()
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
419 {
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
420 return &ops;
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
421 }
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
422
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15252
diff changeset
423 void finch_notify_init()
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
424 {
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
425 userinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
426 }
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
427
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15252
diff changeset
428 void finch_notify_uninit()
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
429 {
16981
f4fd66d0bc51 When getting information, show "Information: Retrieving..." before the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16255
diff changeset
430 g_hash_table_destroy(userinfo);
14014
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
431 }
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
432
223d99ce2f06 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
433

mercurial