Mercurial > pidgin.yaz
annotate console/gntnotify.c @ 14856:8a0c3cb93de8
[gaim-migrate @ 17625]
Mark a newish string as translatable
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 30 Oct 2006 03:54:24 +0000 |
parents | 81650a27f253 |
children | d308c7c6f669 |
rev | line source |
---|---|
14558
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
1 /** |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
2 * @file gntnotify.c GNT Notify API |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
3 * @ingroup gntui |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
4 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
5 * gaim |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
6 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
7 * Gaim is the legal property of its developers, whose names are too numerous |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
9 * source distribution. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
10 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
14 * (at your option) any later version. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
15 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
16 * This program is distributed in the hope that it will be useful, |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
19 * GNU General Public License for more details. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
20 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
21 * You should have received a copy of the GNU General Public License |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
22 * along with this program; if not, write to the Free Software |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14306
diff
changeset
|
24 */ |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 #include <gnt.h> |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 #include <gntbox.h> |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 #include <gntbutton.h> |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 #include <gntlabel.h> |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
29 #include <gnttree.h> |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 #include <util.h> |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 #include "gntnotify.h" |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 #include "gntgaim.h" |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
36 static struct |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
37 { |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
38 GntWidget *window; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
39 GntWidget *tree; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
40 } emaildialog; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
41 |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
42 static void |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
43 notify_msg_window_destroy_cb(GntWidget *window, GaimNotifyMsgType type) |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
44 { |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
45 gaim_notify_close(type, window); |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
46 } |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
47 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 static void * |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 gg_notify_message(GaimNotifyMsgType type, const char *title, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 const char *primary, const char *secondary) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 GntWidget *window, *button; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 GntTextFormatFlags pf = 0, sf = 0; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 switch (type) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 case GAIM_NOTIFY_MSG_ERROR: |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 sf |= GNT_TEXT_FLAG_BOLD; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 case GAIM_NOTIFY_MSG_WARNING: |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 pf |= GNT_TEXT_FLAG_UNDERLINE; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 case GAIM_NOTIFY_MSG_INFO: |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 pf |= GNT_TEXT_FLAG_BOLD; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 break; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 window = gnt_box_new(FALSE, TRUE); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 gnt_box_set_title(GNT_BOX(window), title); |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
69 gnt_box_set_fill(GNT_BOX(window), FALSE); |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
70 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 if (primary) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 gnt_box_add_widget(GNT_BOX(window), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 gnt_label_new_with_format(primary, pf)); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 if (secondary) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 gnt_box_add_widget(GNT_BOX(window), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 gnt_label_new_with_format(secondary, sf)); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 button = gnt_button_new(_("OK")); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 gnt_box_add_widget(GNT_BOX(window), button); |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
81 g_signal_connect_swapped(G_OBJECT(button), "activate", |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
82 G_CALLBACK(gnt_widget_destroy), window); |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
83 g_signal_connect(G_OBJECT(window), "destroy", |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
84 G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(type)); |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 gnt_widget_show(window); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 return window; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 /* handle is, in all/most occasions, a GntWidget * */ |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 static void gg_close_notify(GaimNotifyType type, void *handle) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 { |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
93 GntWidget *widget = handle; |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
94 |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
95 if (!widget) |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
96 return; |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
97 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
98 while (widget->parent) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
99 widget = widget->parent; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
100 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
101 if (type == GAIM_NOTIFY_SEARCHRESULTS) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
102 gaim_notify_searchresults_free(g_object_get_data(handle, "notify-results")); |
14306
a8a0b10be4fb
[gaim-migrate @ 16996]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14198
diff
changeset
|
103 #if 1 |
a8a0b10be4fb
[gaim-migrate @ 16996]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14198
diff
changeset
|
104 /* This did not seem to be necessary */ |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
105 g_signal_handlers_disconnect_by_func(G_OBJECT(widget), |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
106 G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(type)); |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
107 #endif |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
108 gnt_widget_destroy(widget); |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 static void *gg_notify_formatted(const char *title, const char *primary, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 const char *secondary, const char *text) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 /* XXX: For now, simply strip the html and use _notify_message. For future use, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 * there should be some way of parsing the makrups from GntTextView */ |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 char *unformat = gaim_markup_strip_html(text); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 char *t = g_strdup_printf("%s%s%s", |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 secondary ? secondary : "", |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 secondary ? "\n" : "", |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 unformat ? unformat : ""); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
121 |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
122 void *ret = gg_notify_message(GAIM_NOTIFY_FORMATTED, title, primary, t); |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
123 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
124 g_free(t); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
125 g_free(unformat); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
126 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
127 return ret; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
130 static void |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
131 reset_email_dialog() |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
132 { |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
133 emaildialog.window = NULL; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
134 emaildialog.tree = NULL; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
135 } |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
136 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
137 static void |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
138 setup_email_dialog() |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
139 { |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
140 GntWidget *box, *tree, *button; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
141 if (emaildialog.window) |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
142 return; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
143 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
144 emaildialog.window = box = gnt_vbox_new(FALSE); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
145 gnt_box_set_toplevel(GNT_BOX(box), TRUE); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
146 gnt_box_set_title(GNT_BOX(box), _("Emails")); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
147 gnt_box_set_fill(GNT_BOX(box), FALSE); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
148 gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
149 gnt_box_set_pad(GNT_BOX(box), 0); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
150 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
151 gnt_box_add_widget(GNT_BOX(box), |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
152 gnt_label_new_with_format(_("You have mail!"), GNT_TEXT_FLAG_BOLD)); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
153 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
154 emaildialog.tree = tree = gnt_tree_new_with_columns(3); |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
155 gnt_tree_set_column_titles(GNT_TREE(tree), _("Account"), _("From"), _("Subject")); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
156 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
157 gnt_tree_set_col_width(GNT_TREE(tree), 0, 15); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
158 gnt_tree_set_col_width(GNT_TREE(tree), 1, 25); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
159 gnt_tree_set_col_width(GNT_TREE(tree), 2, 25); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
160 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
161 gnt_box_add_widget(GNT_BOX(box), tree); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
162 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
163 button = gnt_button_new(_("Close")); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
164 gnt_box_add_widget(GNT_BOX(box), button); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
165 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
166 g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gnt_widget_destroy), box); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
167 g_signal_connect(G_OBJECT(box), "destroy", G_CALLBACK(reset_email_dialog), NULL); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
168 } |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
169 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
170 static void * |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 gg_notify_emails(GaimConnection *gc, size_t count, gboolean detailed, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
172 const char **subjects, const char **froms, const char **tos, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 const char **urls) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 GaimAccount *account = gaim_connection_get_account(gc); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 GString *message = g_string_new(NULL); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 void *ret; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 if (!detailed) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 g_string_append_printf(message, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 ngettext("%s (%s) has %d new message.", |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 "%s (%s) has %d new messages.", |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 (int)count), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 tos ? *tos : gaim_account_get_username(account), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
186 gaim_account_get_protocol_name(account), (int)count); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 else |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 { |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
190 char *to; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
191 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
192 setup_email_dialog(); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
193 |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
194 to = g_strdup_printf("%s (%s)", tos ? *tos : gaim_account_get_username(account), |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
195 gaim_account_get_protocol_name(account)); |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
196 gnt_tree_add_row_after(GNT_TREE(emaildialog.tree), GINT_TO_POINTER(time(NULL)), |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
197 gnt_tree_create_row(GNT_TREE(emaildialog.tree), to, |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
198 froms ? *froms : "[Unknown sender]", |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
199 *subjects), |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
200 NULL, NULL); |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
201 g_free(to); |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
202 gnt_widget_show(emaildialog.window); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
203 return NULL; |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
204 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
205 |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
206 ret = gg_notify_message(GAIM_NOTIFY_EMAIL, _("New Mail"), _("You have mail!"), message->str); |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 g_string_free(message, TRUE); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 return ret; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
209 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
211 static void * |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
212 gg_notify_email(GaimConnection *gc, const char *subject, const char *from, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 const char *to, const char *url) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
214 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
215 return gg_notify_emails(gc, 1, subject != NULL, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
216 subject ? &subject : NULL, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
217 from ? &from : NULL, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
218 to ? &to : NULL, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
219 url ? &url : NULL); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
220 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
221 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
222 static void * |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
223 gg_notify_userinfo(GaimConnection *gc, const char *who, const char *text) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
224 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
225 /* Xeroxed from gtknotify.c */ |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
226 char *primary; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
227 void *ui_handle; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
228 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
229 primary = g_strdup_printf(_("Info for %s"), who); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
230 ui_handle = gg_notify_formatted(_("Buddy Information"), primary, NULL, text); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
231 g_free(primary); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
232 return ui_handle; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
233 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
234 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
235 static void |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
236 notify_button_activated(GntWidget *widget, GaimNotifySearchButton *b) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
237 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
238 GList *list = NULL; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
239 GaimAccount *account = g_object_get_data(G_OBJECT(widget), "notify-account"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
240 gpointer data = g_object_get_data(G_OBJECT(widget), "notify-data"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
241 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
242 list = gnt_tree_get_selection_text_list(GNT_TREE(widget)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
243 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
244 b->callback(gaim_account_get_connection(account), list, data); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
245 g_list_foreach(list, (GFunc)g_free, NULL); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
246 g_list_free(list); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
247 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
248 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
249 static void |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
250 gg_notify_sr_new_rows(GaimConnection *gc, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
251 GaimNotifySearchResults *results, void *data) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
252 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
253 GntTree *tree = GNT_TREE(data); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
254 GList *o; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
255 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
256 /* XXX: Do I need to empty the tree here? */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
257 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
258 for (o = results->rows; o; o = o->next) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
259 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
260 gnt_tree_add_row_after(GNT_TREE(tree), o->data, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
261 gnt_tree_create_row_from_list(GNT_TREE(tree), o->data), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
262 NULL, NULL); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
263 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
264 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
265 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
266 static void * |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
267 gg_notify_searchresults(GaimConnection *gc, const char *title, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
268 const char *primary, const char *secondary, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
269 GaimNotifySearchResults *results, gpointer data) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
270 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
271 GntWidget *window, *tree, *box, *button; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
272 GList *iter; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
273 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
274 window = gnt_vbox_new(FALSE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
275 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
276 gnt_box_set_title(GNT_BOX(window), title); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
277 gnt_box_set_fill(GNT_BOX(window), FALSE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
278 gnt_box_set_pad(GNT_BOX(window), 0); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
279 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
280 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
281 gnt_box_add_widget(GNT_BOX(window), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
282 gnt_label_new_with_format(primary, GNT_TEXT_FLAG_BOLD)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
283 gnt_box_add_widget(GNT_BOX(window), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
284 gnt_label_new_with_format(secondary, GNT_TEXT_FLAG_NORMAL)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
285 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
286 tree = gnt_tree_new_with_columns(g_list_length(results->columns)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
287 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
288 gnt_box_add_widget(GNT_BOX(window), tree); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
289 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
290 box = gnt_hbox_new(TRUE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
291 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
292 for (iter = results->buttons; iter; iter = iter->next) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
293 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
294 GaimNotifySearchButton *b = iter->data; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
295 const char *text; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
296 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
297 switch (b->type) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
298 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
299 case GAIM_NOTIFY_BUTTON_LABELED: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
300 text = b->label; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
301 break; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
302 case GAIM_NOTIFY_BUTTON_CONTINUE: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
303 text = _("Continue"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
304 break; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
305 case GAIM_NOTIFY_BUTTON_ADD: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
306 text = _("Add"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
307 break; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
308 case GAIM_NOTIFY_BUTTON_INFO: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
309 text = _("Info"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
310 break; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
311 case GAIM_NOTIFY_BUTTON_IM: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
312 text = _("IM"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
313 break; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
314 case GAIM_NOTIFY_BUTTON_JOIN: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
315 text = _("Join"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
316 break; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
317 case GAIM_NOTIFY_BUTTON_INVITE: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
318 text = _("Invite"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
319 break; |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
320 default: |
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
321 text = _("(none)"); |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
322 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
323 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
324 button = gnt_button_new(text); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
325 g_object_set_data(G_OBJECT(button), "notify-account", gaim_connection_get_account(gc)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
326 g_object_set_data(G_OBJECT(button), "notify-data", data); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
327 g_signal_connect_swapped(G_OBJECT(button), "activate", |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
328 G_CALLBACK(notify_button_activated), b); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
329 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
330 gnt_box_add_widget(GNT_BOX(box), button); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
331 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
332 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
333 gnt_box_add_widget(GNT_BOX(window), box); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
334 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
335 gg_notify_sr_new_rows(gc, results, tree); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
336 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
337 gnt_widget_show(window); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
338 g_object_set_data(G_OBJECT(window), "notify-results", results); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
339 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
340 return tree; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
341 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
342 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
343 static GaimNotifyUiOps ops = |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
344 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
345 .notify_message = gg_notify_message, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
346 .close_notify = gg_close_notify, /* The rest of the notify-uiops return a GntWidget. |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
347 These widgets should be destroyed from here. */ |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
348 .notify_formatted = gg_notify_formatted, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
349 .notify_email = gg_notify_email, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
350 .notify_emails = gg_notify_emails, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
351 .notify_userinfo = gg_notify_userinfo, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
352 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
353 .notify_searchresults = gg_notify_searchresults, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
354 .notify_searchresults_new_rows = gg_notify_sr_new_rows, |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
355 .notify_uri = NULL /* This is of low-priority to me */ |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
356 }; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
357 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
358 GaimNotifyUiOps *gg_notify_get_ui_ops() |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
359 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
360 return &ops; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
361 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
362 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
363 void gg_notify_init() |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
364 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
365 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
366 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
367 void gg_notify_uninit() |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
368 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
369 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
370 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
371 |