Mercurial > pidgin.yaz
annotate console/gntnotify.c @ 14535:e3a640372b6e
[gaim-migrate @ 17256]
Sean requested case-insensitive matching on command, and noted that the plus sign wasn't being unescaped to a space. Both are fixed now.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 11 Sep 2006 22:57:41 +0000 |
parents | a8a0b10be4fb |
children | 81650a27f253 |
rev | line source |
---|---|
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include <gnt.h> |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 #include <gntbox.h> |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 #include <gntbutton.h> |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 #include <gntlabel.h> |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
5 #include <gnttree.h> |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 #include <util.h> |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 #include "gntnotify.h" |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 #include "gntgaim.h" |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
12 static struct |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
13 { |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
14 GntWidget *window; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
15 GntWidget *tree; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
16 } emaildialog; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
17 |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
18 static void |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
19 notify_msg_window_destroy_cb(GntWidget *window, GaimNotifyMsgType type) |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
20 { |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
21 gaim_notify_close(type, window); |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
22 } |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
23 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 static void * |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 gg_notify_message(GaimNotifyMsgType type, const char *title, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 const char *primary, const char *secondary) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 GntWidget *window, *button; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 GntTextFormatFlags pf = 0, sf = 0; |
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 switch (type) |
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 case GAIM_NOTIFY_MSG_ERROR: |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 sf |= GNT_TEXT_FLAG_BOLD; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 case GAIM_NOTIFY_MSG_WARNING: |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 pf |= GNT_TEXT_FLAG_UNDERLINE; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 case GAIM_NOTIFY_MSG_INFO: |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 pf |= GNT_TEXT_FLAG_BOLD; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 break; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 window = gnt_box_new(FALSE, TRUE); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 gnt_box_set_title(GNT_BOX(window), title); |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
45 gnt_box_set_fill(GNT_BOX(window), FALSE); |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
46 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 if (primary) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 gnt_box_add_widget(GNT_BOX(window), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 gnt_label_new_with_format(primary, pf)); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 if (secondary) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 gnt_box_add_widget(GNT_BOX(window), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 gnt_label_new_with_format(secondary, sf)); |
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 button = gnt_button_new(_("OK")); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 gnt_box_add_widget(GNT_BOX(window), button); |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
57 g_signal_connect_swapped(G_OBJECT(button), "activate", |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
58 G_CALLBACK(gnt_widget_destroy), window); |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
59 g_signal_connect(G_OBJECT(window), "destroy", |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
60 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
|
61 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 gnt_widget_show(window); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 return window; |
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 /* handle is, in all/most occasions, a GntWidget * */ |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 static void gg_close_notify(GaimNotifyType type, void *handle) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 { |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
69 GntWidget *widget = handle; |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
70 |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
71 if (!widget) |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
72 return; |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
73 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
74 while (widget->parent) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
75 widget = widget->parent; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
76 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
77 if (type == GAIM_NOTIFY_SEARCHRESULTS) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
78 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
|
79 #if 1 |
a8a0b10be4fb
[gaim-migrate @ 16996]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14198
diff
changeset
|
80 /* This did not seem to be necessary */ |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
81 g_signal_handlers_disconnect_by_func(G_OBJECT(widget), |
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
82 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
|
83 #endif |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
84 gnt_widget_destroy(widget); |
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 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 static void *gg_notify_formatted(const char *title, const char *primary, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 const char *secondary, const char *text) |
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 /* 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
|
91 * there should be some way of parsing the makrups from GntTextView */ |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 char *unformat = gaim_markup_strip_html(text); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 char *t = g_strdup_printf("%s%s%s", |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 secondary ? secondary : "", |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 secondary ? "\n" : "", |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 unformat ? unformat : ""); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
98 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
|
99 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 g_free(t); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 g_free(unformat); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
102 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
103 return ret; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
105 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
106 static void |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
107 reset_email_dialog() |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
108 { |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
109 emaildialog.window = NULL; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
110 emaildialog.tree = NULL; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
111 } |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
112 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
113 static void |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
114 setup_email_dialog() |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
115 { |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
116 GntWidget *box, *tree, *button; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
117 if (emaildialog.window) |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
118 return; |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
119 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
120 emaildialog.window = box = gnt_vbox_new(FALSE); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
121 gnt_box_set_toplevel(GNT_BOX(box), TRUE); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
122 gnt_box_set_title(GNT_BOX(box), _("Emails")); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
123 gnt_box_set_fill(GNT_BOX(box), FALSE); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
124 gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
125 gnt_box_set_pad(GNT_BOX(box), 0); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
126 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
127 gnt_box_add_widget(GNT_BOX(box), |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
128 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
|
129 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
130 emaildialog.tree = tree = gnt_tree_new_with_columns(3); |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
131 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
|
132 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
133 gnt_tree_set_col_width(GNT_TREE(tree), 0, 15); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
134 gnt_tree_set_col_width(GNT_TREE(tree), 1, 25); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
135 gnt_tree_set_col_width(GNT_TREE(tree), 2, 25); |
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 gnt_box_add_widget(GNT_BOX(box), tree); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
138 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
139 button = gnt_button_new(_("Close")); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
140 gnt_box_add_widget(GNT_BOX(box), button); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
141 |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
142 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
|
143 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
|
144 } |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
145 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 static void * |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 gg_notify_emails(GaimConnection *gc, size_t count, gboolean detailed, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 const char **subjects, const char **froms, const char **tos, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 const char **urls) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 GaimAccount *account = gaim_connection_get_account(gc); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 GString *message = g_string_new(NULL); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
153 void *ret; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 if (!detailed) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 g_string_append_printf(message, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 ngettext("%s (%s) has %d new message.", |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
159 "%s (%s) has %d new messages.", |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 (int)count), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 tos ? *tos : gaim_account_get_username(account), |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
162 gaim_account_get_protocol_name(account), (int)count); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
163 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
164 else |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
165 { |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
166 char *to; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
167 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
168 setup_email_dialog(); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
169 |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
170 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
|
171 gaim_account_get_protocol_name(account)); |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
172 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
|
173 gnt_tree_create_row(GNT_TREE(emaildialog.tree), to, |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
174 froms ? *froms : "[Unknown sender]", |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
175 *subjects), |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
176 NULL, NULL); |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
177 g_free(to); |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
178 gnt_widget_show(emaildialog.window); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
179 return NULL; |
13952
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 |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
182 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
|
183 g_string_free(message, TRUE); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 return ret; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
186 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 static void * |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 gg_notify_email(GaimConnection *gc, const char *subject, const char *from, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 const char *to, const char *url) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 return gg_notify_emails(gc, 1, subject != NULL, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
192 subject ? &subject : NULL, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 from ? &from : NULL, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 to ? &to : NULL, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 url ? &url : NULL); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 static void * |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 gg_notify_userinfo(GaimConnection *gc, const char *who, const char *text) |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 /* Xeroxed from gtknotify.c */ |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 char *primary; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 void *ui_handle; |
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 primary = g_strdup_printf(_("Info for %s"), who); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 ui_handle = gg_notify_formatted(_("Buddy Information"), primary, NULL, text); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 g_free(primary); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 return ui_handle; |
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 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
211 static void |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
212 notify_button_activated(GntWidget *widget, GaimNotifySearchButton *b) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
213 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
214 GList *list = NULL; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
215 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
|
216 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
|
217 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
218 list = gnt_tree_get_selection_text_list(GNT_TREE(widget)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
219 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
220 b->callback(gaim_account_get_connection(account), list, data); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
221 g_list_foreach(list, (GFunc)g_free, NULL); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
222 g_list_free(list); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
223 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
224 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
225 static void |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
226 gg_notify_sr_new_rows(GaimConnection *gc, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
227 GaimNotifySearchResults *results, void *data) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
228 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
229 GntTree *tree = GNT_TREE(data); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
230 GList *o; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
231 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
232 /* XXX: Do I need to empty the tree here? */ |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
233 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
234 for (o = results->rows; o; o = o->next) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
235 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
236 gnt_tree_add_row_after(GNT_TREE(tree), o->data, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
237 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
|
238 NULL, NULL); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
239 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
240 } |
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 static void * |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
243 gg_notify_searchresults(GaimConnection *gc, const char *title, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
244 const char *primary, const char *secondary, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
245 GaimNotifySearchResults *results, gpointer data) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
246 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
247 GntWidget *window, *tree, *box, *button; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
248 GList *iter; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
249 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
250 window = gnt_vbox_new(FALSE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
251 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
252 gnt_box_set_title(GNT_BOX(window), title); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
253 gnt_box_set_fill(GNT_BOX(window), FALSE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
254 gnt_box_set_pad(GNT_BOX(window), 0); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
255 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
256 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
257 gnt_box_add_widget(GNT_BOX(window), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
258 gnt_label_new_with_format(primary, GNT_TEXT_FLAG_BOLD)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
259 gnt_box_add_widget(GNT_BOX(window), |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
260 gnt_label_new_with_format(secondary, GNT_TEXT_FLAG_NORMAL)); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
261 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
262 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
|
263 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
264 gnt_box_add_widget(GNT_BOX(window), tree); |
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 box = gnt_hbox_new(TRUE); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
267 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
268 for (iter = results->buttons; iter; iter = iter->next) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
269 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
270 GaimNotifySearchButton *b = iter->data; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
271 const char *text; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
272 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
273 switch (b->type) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
274 { |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
275 case GAIM_NOTIFY_BUTTON_LABELED: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
276 text = b->label; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
277 break; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
278 case GAIM_NOTIFY_BUTTON_CONTINUE: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
279 text = _("Continue"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
280 break; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
281 case GAIM_NOTIFY_BUTTON_ADD: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
282 text = _("Add"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
283 break; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
284 case GAIM_NOTIFY_BUTTON_INFO: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
285 text = _("Info"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
286 break; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
287 case GAIM_NOTIFY_BUTTON_IM: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
288 text = _("IM"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
289 break; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
290 case GAIM_NOTIFY_BUTTON_JOIN: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
291 text = _("Join"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
292 break; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
293 case GAIM_NOTIFY_BUTTON_INVITE: |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
294 text = _("Invite"); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
295 break; |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
296 default: |
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
297 text = _("(none)"); |
13979
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 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
300 button = gnt_button_new(text); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
301 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
|
302 g_object_set_data(G_OBJECT(button), "notify-data", data); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
303 g_signal_connect_swapped(G_OBJECT(button), "activate", |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
304 G_CALLBACK(notify_button_activated), b); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
305 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
306 gnt_box_add_widget(GNT_BOX(box), button); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
307 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
308 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
309 gnt_box_add_widget(GNT_BOX(window), box); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
310 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
311 gg_notify_sr_new_rows(gc, results, tree); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
312 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
313 gnt_widget_show(window); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
314 g_object_set_data(G_OBJECT(window), "notify-results", results); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
315 |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
316 return tree; |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
317 } |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
318 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
319 static GaimNotifyUiOps ops = |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
321 .notify_message = gg_notify_message, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
322 .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
|
323 These widgets should be destroyed from here. */ |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
324 .notify_formatted = gg_notify_formatted, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
325 .notify_email = gg_notify_email, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
326 .notify_emails = gg_notify_emails, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
327 .notify_userinfo = gg_notify_userinfo, |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
328 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
329 .notify_searchresults = gg_notify_searchresults, |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
330 .notify_searchresults_new_rows = gg_notify_sr_new_rows, |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
331 .notify_uri = NULL /* This is of low-priority to me */ |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
332 }; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
333 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
334 GaimNotifyUiOps *gg_notify_get_ui_ops() |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
335 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
336 return &ops; |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
337 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
338 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
339 void gg_notify_init() |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
340 { |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
341 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
342 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
343 void gg_notify_uninit() |
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 } |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
346 |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
347 |