Mercurial > pidgin
comparison src/gtkdialogs.c @ 9753:60705fd4f411
[gaim-migrate @ 10620]
Move show_about to gtkdialogs.c and namespace it
Remove about.c
A few other minor touchups in gtkdialogs.c
Make serv_warn pass a gboolean instead of an int
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 15 Aug 2004 17:05:51 +0000 |
parents | c9ac1976ef01 |
children | 4f2b50a06224 |
comparison
equal
deleted
inserted
replaced
9752:8793c7127c80 | 9753:60705fd4f411 |
---|---|
21 */ | 21 */ |
22 #include "gtkinternal.h" | 22 #include "gtkinternal.h" |
23 | 23 |
24 #include "debug.h" | 24 #include "debug.h" |
25 #include "notify.h" | 25 #include "notify.h" |
26 #include "prefs.h" | |
27 #include "prpl.h" | 26 #include "prpl.h" |
28 #include "request.h" | 27 #include "request.h" |
29 #include "status.h" | |
30 #include "util.h" | 28 #include "util.h" |
31 | 29 |
32 #include "away.h" | |
33 #include "gtkdialogs.h" | 30 #include "gtkdialogs.h" |
34 #include "gtkimhtml.h" | 31 #include "gtkimhtml.h" |
35 #include "gtkimhtmltoolbar.h" | 32 #include "gtkimhtmltoolbar.h" |
36 #include "gtklog.h" | 33 #include "gtklog.h" |
37 #include "gtkutils.h" | 34 #include "gtkutils.h" |
38 #include "stock.h" | 35 #include "stock.h" |
39 | 36 |
40 /* XXX */ | |
41 #include "gaim.h" | |
42 | |
43 static GList *dialogwindows = NULL; | 37 static GList *dialogwindows = NULL; |
38 | |
39 static GtkWidget *about = NULL; | |
44 | 40 |
45 struct warning { | 41 struct warning { |
46 GtkWidget *window; | 42 GtkWidget *window; |
47 GtkWidget *anon; | 43 GtkWidget *anon; |
48 char *who; | 44 char *who; |
49 GaimConnection *gc; | 45 GaimConnection *gc; |
50 }; | 46 }; |
51 | 47 |
52 /*------------------------------------------------------------------------*/ | |
53 /* Destroys */ | |
54 /*------------------------------------------------------------------------*/ | |
55 | |
56 static void | |
57 destroy_dialog(GtkWidget *w, GtkWidget *w2) | |
58 { | |
59 GtkWidget *dest; | |
60 | |
61 if (!GTK_IS_WIDGET(w2)) | |
62 dest = w; | |
63 else | |
64 dest = w2; | |
65 | |
66 dialogwindows = g_list_remove(dialogwindows, dest); | |
67 gtk_widget_destroy(dest); | |
68 } | |
69 | |
70 void | 48 void |
71 gaim_gtkdialogs_destroy_all() | 49 gaim_gtkdialogs_destroy_all() |
72 { | 50 { |
73 while (dialogwindows) | 51 while (dialogwindows) { |
74 destroy_dialog(NULL, dialogwindows->data); | 52 gtk_widget_destroy(dialogwindows->data); |
75 | 53 dialogwindows = g_list_remove(dialogwindows, dialogwindows->data); |
76 /* STATUS */ | 54 } |
77 if (awaymessage) | 55 } |
78 do_im_back(NULL, NULL); | 56 |
57 static void destroy_about() | |
58 { | |
59 if (about != NULL) | |
60 gtk_widget_destroy(about); | |
61 about = NULL; | |
62 } | |
63 | |
64 void gaim_gtkdialogs_about(GtkWidget *w, void *data) | |
65 { | |
66 GtkWidget *hbox; | |
67 GtkWidget *vbox; | |
68 GtkWidget *logo; | |
69 GtkWidget *label; | |
70 GtkWidget *sw; | |
71 GtkWidget *text; | |
72 GtkWidget *bbox; | |
73 GtkWidget *button; | |
74 GtkTextIter iter; | |
75 gchar *str, *labeltext; | |
76 | |
77 if (about != NULL) { | |
78 gtk_window_present(GTK_WINDOW(about)); | |
79 return; | |
80 } | |
81 | |
82 GAIM_DIALOG(about); | |
83 gtk_window_set_default_size(GTK_WINDOW(about), 450, -1); | |
84 gtk_window_set_title(GTK_WINDOW(about), _("About Gaim")); | |
85 gtk_window_set_role(GTK_WINDOW(about), "about"); | |
86 gtk_window_set_resizable(GTK_WINDOW(about), TRUE); | |
87 | |
88 hbox = gtk_hbox_new(FALSE, 12); | |
89 gtk_container_set_border_width(GTK_CONTAINER(hbox), 12); | |
90 gtk_container_add(GTK_CONTAINER(about), hbox); | |
91 | |
92 vbox = gtk_vbox_new(FALSE, 12); | |
93 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
94 | |
95 logo = gtk_image_new_from_stock(GAIM_STOCK_LOGO, gtk_icon_size_from_name(GAIM_ICON_SIZE_LOGO)); | |
96 gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); | |
97 | |
98 labeltext = g_strdup_printf(_("<span weight=\"bold\" size=\"larger\">Gaim v%s</span>"), VERSION); | |
99 label = gtk_label_new(NULL); | |
100 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
101 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
102 gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0); | |
103 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
104 g_free(labeltext); | |
105 | |
106 sw = gtk_scrolled_window_new(NULL, NULL); | |
107 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
108 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
109 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
110 gtk_widget_set_size_request(sw, -1, 350); | |
111 gtk_box_pack_start(GTK_BOX(vbox), sw, FALSE, FALSE, 0); | |
112 | |
113 text = gtk_imhtml_new(NULL, NULL); | |
114 gtk_container_add(GTK_CONTAINER(sw), text); | |
115 gaim_setup_imhtml(text); | |
116 | |
117 gtk_imhtml_append_text(GTK_IMHTML(text), | |
118 _("Gaim is a modular messaging client capable of using " | |
119 "AIM, MSN, Yahoo!, Jabber, ICQ, IRC, SILC, " | |
120 "Novell GroupWise, Napster, Zephyr, and Gadu-Gadu " | |
121 "all at once. It is written using " | |
122 "Gtk+ and is licensed under the GPL.<BR><BR>"), GTK_IMHTML_NO_SCROLL); | |
123 | |
124 gtk_imhtml_append_text(GTK_IMHTML(text), | |
125 "<FONT SIZE=\"4\">URL:</FONT> <A HREF=\"" GAIM_WEBSITE "\">" | |
126 GAIM_WEBSITE "</A><BR><BR>", GTK_IMHTML_NO_SCROLL); | |
127 | |
128 gtk_imhtml_append_text(GTK_IMHTML(text), | |
129 _("<FONT SIZE=\"4\">IRC:</FONT> #gaim on irc.freenode.net" | |
130 "<BR><BR>"), GTK_IMHTML_NO_SCROLL); | |
131 | |
132 /* Active Developers */ | |
133 str = g_strconcat( | |
134 "<FONT SIZE=\"4\">", _("Active Developers"), ":</FONT><BR>" | |
135 " Rob Flynn (", _("maintainer"), ") " | |
136 "<<A HREF=\"mailto:gaim@robflynn.com\">gaim@robflynn.com</A>><BR>" | |
137 " Sean Egan (", _("lead developer"), ") " | |
138 "<<A HREF=\"mailto:sean.egan@binghamton.edu\">" | |
139 "bj91704@binghamton.edu</A>><BR>" | |
140 " Christian 'ChipX86' Hammond (", _("developer & webmaster"), ")<BR>" | |
141 " Herman Bloggs (", _("win32 port"), ") " | |
142 "<<A HREF=\"mailto:hermanator12002@yahoo.com\">" | |
143 "hermanator12002@yahoo.com</A>><BR>" | |
144 " Nathan 'faceprint' Walp (", _("developer"), ")<BR>" | |
145 " Mark 'KingAnt' Doliner (", _("developer"), ")<BR>" | |
146 " Ethan 'Paco-Paco' Blanton (", _("developer"), ")<br>" | |
147 " Tim 'marv' Ringenbach (", _("developer"), ")<br>" | |
148 " Luke 'LSchiere' Schierer (", _("support"), ")<BR>" | |
149 "<BR>", NULL); | |
150 gtk_imhtml_append_text(GTK_IMHTML(text), str, GTK_IMHTML_NO_SCROLL); | |
151 g_free(str); | |
152 | |
153 /* Crazy Patch Writers */ | |
154 str = g_strconcat( | |
155 "<FONT SIZE=\"4\">", _("Crazy Patch Writers"), ":</FONT><BR>" | |
156 " Daniel 'datallah' Atallah<br>" | |
157 " Ka-Hing 'javabsp' Cheung<br>" | |
158 " Decklin Foster<BR>" | |
159 " Gary 'grim' Kramlich<br>" | |
160 " Robert 'Robot101' McQueen<BR>" | |
161 " Benjamin Miller<BR>" | |
162 " Etan 'deryni' Reisner<BR>" | |
163 " Kevin 'SimGuy' Stange<br>" | |
164 " Stu 'nosnilmot' Tomlinson<br>" | |
165 "<BR>", NULL); | |
166 gtk_imhtml_append_text(GTK_IMHTML(text), str, GTK_IMHTML_NO_SCROLL); | |
167 g_free(str); | |
168 | |
169 /* Retired Developers */ | |
170 str = g_strconcat( | |
171 "<FONT SIZE=\"4\">", _("Retired Developers"), ":</FONT><BR>" | |
172 " Adam Fritzler (", _("former libfaim maintainer"), ")<BR>" | |
173 " Eric Warmenhoven (", _("former lead developer"), ") " | |
174 "<<A HREF=\"mailto:warmenhoven@yahoo.com\">" | |
175 "warmenhoven@yahoo.com</A>><BR>" | |
176 " Jim Duchek (", _("former maintainer"), ")<BR>" | |
177 " Jim Seymour (", _("former Jabber developer"), ")<BR>" | |
178 " Mark Spencer (", _("original author"), ") " | |
179 "<<A HREF=\"mailto:markster@marko.net\">" | |
180 "markster@marko.net</A>><BR>" | |
181 " Syd Logan (", _("hacker and designated driver [lazy bum]"), | |
182 ")<BR>" | |
183 "<BR>", NULL); | |
184 gtk_imhtml_append_text(GTK_IMHTML(text), str, GTK_IMHTML_NO_SCROLL); | |
185 g_free(str); | |
186 | |
187 /* Current Translators */ | |
188 str = g_strconcat( | |
189 "<FONT SIZE=\"4\">", _("Current Translators"), ":</FONT><BR>" | |
190 " <b>", _("Bulgarian"), " (bg)</b> - Alexander Shopov <<a href=\"mailto: al_shopov@users.sf.net\">al_shopov@users.sf.net</a>><br>" | |
191 " <b>", _("Catalan"), " (ca)</b> - Robert Millan <<a href=\"mailto: zeratul2@wanadoo.es\">zeratul2@wanadoo.es</a>><br>" | |
192 " <b>", _("Czech"), " (cs)</b> - Miloslav Trmac <<a href=\"mailto: mitr@volny.cz\">mitr@volny.cz</a>><br>" | |
193 " <b>", _("Danish"), " (da)</b> - Morten Brix Pedersen <<a href=\"mailto: morten@wtf.dk\">morten@wtf.dk</a>><br>" | |
194 " <b>", _("British English"), " (en_GB)</b> - Luke Ross <<a href=\"mailto: lukeross@sys3175.co.uk\">lukeross@sys3175.co.uk</a>><br>" | |
195 " <b>", _("Canadian English"), " (en_CA)</b> - Adam Weinberger <<a href=\"mailto: adamw@gnome.org\">adamw@gnome.org</a>><br>" | |
196 " <b>", _("German"), " (de)</b> - Björn Voigt <<a href=\"mailto: bjoern@cs.tu-berlin.de\">bjoern@cs.tu-berlin.de</a>><br>" | |
197 " <b>", _("Spanish"), " (es)</b> - Javier Fernández-Sanguino Peña <<a href=\"mailto: jfs@debian.org\">jfs@debian.org</a>><br>" | |
198 " <b>", _("Finnish"), " (fi)</b> - Arto Alakulju <<a href=\"mailto: arto@alakulju.net\">arto@alakulju.net</a>><br>" | |
199 " <b>", _("French"), " (fr)</b> - Éric Boumaour <<a href=\"mailto: zongo_fr@users.sourceforge.net\">zongo_fr@users.sourceforge.net</a>><br>" | |
200 " <b>", _("Hebrew"), " (he)</b> - Pavel Bibergal <<a href=\"mailto:cyberkm203@hotmail.com\">cyberkm203@hotmail.com</a>><br>" | |
201 " <b>", _("Hindi"), " (hi)</b> - Ravishankar Shrivastava <<a href=\"mailto: raviratlami@yahoo.com\">raviratlami@yahoo.com</a>><br>" | |
202 " <b>", _("Hungarian"), " (hu)</b> - Zoltan Sutto <<a href=\"mailto: suttozoltan@chello.hu\">suttozoltan@chello.hu</a>><br>" | |
203 " <b>", _("Italian"), " (it)</b> - Claudio Satriano <<a href=\"mailto: satriano@na.infn.it\">satriano@na.infn.it</a>><br>" | |
204 " <b>", _("Japanese"), " (ja)</b> - Takashi Aihana <<a href=\"mailto: aihana@gnome.gr.jp\">aihana@gnome.gr.jp</a>><br>" | |
205 " <b>", _("Lithuanian"), " (lt)</b> - Gediminas Čičinskas <<a href=\"mailto: gediminas@parok.lt\">gediminas@parok.lt</a>><br>" | |
206 " <b>", _("Korean"), " (ko)</b> - Kyung-uk Son <<a href=\"mailto: vvs740@chol.com\">vvs740@chol.com</a>><br>" | |
207 " <b>", _("Dutch; Flemish"), " (nl)</b> - Vincent van Adrighem <<a href=\"mailto: V.vanAdrighem@dirck.mine.nu\">V.vanAdrighem@dirck.mine.nu</a>><br>" | |
208 " <b>", _("Macedonian"), " (mk)</b> - Tomislav Markovski <<a href=\"mailto: herrera@users.sf.net\">herrera@users.sf.net</a>><br>" | |
209 " <b>", _("Norwegian"), " (no)</b> - Petter Johan Olsen <<a href=\"mailto:petter.olsen@cc.uit.no\">petter.olsen@cc.uit.no</a>><br>" | |
210 " <b>", _("Polish"), " (pl)</b> - Krzysztof Foltman <<a href=\"mailto:krzysztof@foltman.com\">krzysztof@foltman.com</a>>, Emil Nowak <<a href=\"mailto:emil5@go2.pl\">emil5@go2.pl</a>><br>" | |
211 " <b>", _("Portuguese"), " (pt)</b> - Duarte Henriques <<a href=\"mailto:duarte_henriques@myrealbox.com\">duarte_henriques@myrealbox.com</a>><br>" | |
212 " <b>", _("Portuguese-Brazil"), " (pt_BR)</b> - Maurício de Lemos Rodrigues Collares Neto <<a href=\"mailto: mauricioc@gmail.com\">mauricioc@gmail.com</a>><br>" | |
213 " <b>", _("Romanian"), " (ro)</b> - Mişu Moldovan <<a href=\"mailto: dumol@go.ro\">dumol@go.ro</a>><br>" | |
214 " <b>", _("Russian"), " (ru)</b> - Dmitry Beloglazov <<a href=\"mailto: dmaa@users.sf.net\">dmaa@users.sf.net</a>><br>" | |
215 " <b>", _("Serbian"), " (sr)</b> - Danilo Šegan <<a href=\"mailto: dsegan@gmx.net\">dsegan@gmx.net</a>>, Aleksandar Urosevic <<a href=\"mailto: urke@users.sourceforge.net\">urke@users.sourceforge.net</a>><br>" | |
216 " <b>", _("Slovenian"), " (sl)</b> - Matjaz Horvat <<a href=\"mailto: matjaz@owca.info\">matjaz@owca.info</a>><br>" | |
217 " <b>", _("Swedish"), " (sv)</b> - Tore Lundqvist <<a href=\"mailto: tlt@mima.x.se\">tlt@mima.x.se</a>><br>" | |
218 " <b>", _("Vietnamese"), " (vi)</b> - T.M.Thanh ", _("and the Gnome-Vi Team"), " <<a href=\"mailto: gnomevi-list@lists.sf.net\">gnomevi-list@lists.sf.net</a>><br>" | |
219 " <b>", _("Simplified Chinese"), " (zh_CN)</b> - Funda Wang <<a href=\"mailto: fundawang@linux.net.cn\">fundawang@linux.net.cn</a>><br>" | |
220 " <b>", _("Traditional Chinese"), " (zh_TW)</b> - Ambrose C. Li <<a href=\"mailto: acli@ada.dhs.org\">acli@ada.dhs.org</a>>, Paladin R. Liu <<a href=\"mailto: paladin@ms1.hinet.net\">paladin@ms1.hinet.net</a>><br>" | |
221 "<BR>", NULL); | |
222 gtk_imhtml_append_text(GTK_IMHTML(text), str, GTK_IMHTML_NO_SCROLL); | |
223 g_free(str); | |
224 | |
225 /* Past Translators */ | |
226 str = g_strconcat( | |
227 "<FONT SIZE=\"4\">", _("Past Translators"), ":</FONT><BR>" | |
228 " <b>", _("Amharic"), " (am)</b> - Daniel Yacob<br>" | |
229 " <b>", _("Bulgarian"), " (bg)</b> - Hristo Todorov<br>" | |
230 " <b>", _("Catalan"), " (ca)</b> - JM Pérez Cáncer<br>" | |
231 " <b>", _("Czech"), " (cs)</b> - Honza Král<br>" | |
232 " <b>", _("German"), " (de)</b> - Daniel Seifert, Karsten Weiss<br>" | |
233 " <b>", _("Spanish"), " (es)</b> - Amaya Rodrigo, Alejandro G Villar, Nicolás Lichtmaier, JM Pérez Cáncer<br>" | |
234 " <b>", _("Finnish"), " (fi)</b> - Tero Kuusela<br>" | |
235 " <b>", _("French"), " (fr)</b> - Sébastien François, Stéphane Pontier, Stéphane Wirtel, Loïc Jeannin<br>" | |
236 " <b>", _("Italian"), " (it)</b> - Salvatore di Maggio<br>" | |
237 " <b>", _("Japanese"), " (ja)</b> - Ryosuke Kutsuna, Taku Yasui, Junichi Uekawa<br>" | |
238 " <b>", _("Korean"), " (ko)</b> - Sang-hyun S, A Ho-seok Lee<br>" | |
239 " <b>", _("Polish"), " (pl)</b> - Przemysław Sułek<br>" | |
240 " <b>", _("Russian"), " (ru)</b> - Sergey Volozhanin<br>" | |
241 " <b>", _("Russian"), "(ru)</b> - Alexandre Prokoudine<br>" | |
242 " <b>", _("Slovak"), " (sk)</b> - Daniel Režný<br>" | |
243 " <b>", _("Swedish"), " (sv)</b> - Christian Rose<br>" | |
244 " <b>", _("Chinese"), " (zh_CN, zh_TW)</b> - Hashao, Rocky S. Lee<br>" | |
245 "<BR>", NULL); | |
246 gtk_imhtml_append_text(GTK_IMHTML(text), str, GTK_IMHTML_NO_SCROLL); | |
247 g_free(str); | |
248 | |
249 gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw)), 0); | |
250 gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); | |
251 gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); | |
252 | |
253 /* Close Button */ | |
254 bbox = gtk_hbutton_box_new(); | |
255 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
256 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
257 | |
258 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
259 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
260 | |
261 g_signal_connect_swapped(G_OBJECT(button), "clicked", | |
262 G_CALLBACK(destroy_about), G_OBJECT(about)); | |
263 g_signal_connect(G_OBJECT(about), "destroy", | |
264 G_CALLBACK(destroy_about), G_OBJECT(about)); | |
265 | |
266 /* this makes the sizes not work? */ | |
267 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); | |
268 gtk_widget_grab_default(button); | |
269 | |
270 /* Let's give'em something to talk about -- woah woah woah */ | |
271 gtk_widget_show_all(about); | |
272 gtk_window_present(GTK_WINDOW(about)); | |
79 } | 273 } |
80 | 274 |
81 static void | 275 static void |
82 gaim_gtkdialogs_im_cb(gpointer data, GaimRequestFields *fields) | 276 gaim_gtkdialogs_im_cb(gpointer data, GaimRequestFields *fields) |
83 { | 277 { |
129 gaim_gtkdialogs_im_with_user(GaimAccount *account, const char *username) | 323 gaim_gtkdialogs_im_with_user(GaimAccount *account, const char *username) |
130 { | 324 { |
131 GaimConversation *conv; | 325 GaimConversation *conv; |
132 GaimConvWindow *win; | 326 GaimConvWindow *win; |
133 GaimGtkWindow *gtkwin; | 327 GaimGtkWindow *gtkwin; |
328 | |
329 g_return_if_fail(account != NULL); | |
330 g_return_if_fail(username != NULL); | |
134 | 331 |
135 conv = gaim_find_conversation_with_account(username, account); | 332 conv = gaim_find_conversation_with_account(username, account); |
136 | 333 |
137 if (conv == NULL) | 334 if (conv == NULL) |
138 conv = gaim_conversation_new(GAIM_CONV_IM, account, username); | 335 conv = gaim_conversation_new(GAIM_CONV_IM, account, username); |
319 | 516 |
320 static void | 517 static void |
321 gaim_gtkdialogs_warn_cb(GtkWidget *widget, gint resp, struct warning *w) | 518 gaim_gtkdialogs_warn_cb(GtkWidget *widget, gint resp, struct warning *w) |
322 { | 519 { |
323 if (resp == GTK_RESPONSE_OK) | 520 if (resp == GTK_RESPONSE_OK) |
324 serv_warn(w->gc, w->who, (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->anon))) ? 1 : 0); | 521 serv_warn(w->gc, w->who, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->anon))); |
325 | 522 |
326 destroy_dialog(NULL, w->window); | 523 dialogwindows = g_list_remove(dialogwindows, w->window); |
524 gtk_widget_destroy(w->window); | |
525 | |
327 g_free(w->who); | 526 g_free(w->who); |
328 g_free(w); | 527 g_free(w); |
329 } | 528 } |
330 | 529 |
530 /* | |
531 * XXX - Make this use the request API, if possible. | |
532 */ | |
331 void | 533 void |
332 gaim_gtkdialogs_warn(GaimConnection *gc, const char *who) | 534 gaim_gtkdialogs_warn(GaimConnection *gc, const char *who) |
333 { | 535 { |
334 char *labeltext; | 536 gchar *labeltext; |
335 GtkWidget *hbox, *vbox; | 537 GtkWidget *hbox, *vbox; |
336 GtkWidget *label; | 538 GtkWidget *label; |
337 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); | 539 GtkWidget *img; |
338 GaimConversation *c = gaim_find_conversation_with_account(who, gc->account); | 540 struct warning *w; |
339 | 541 |
340 struct warning *w = g_new0(struct warning, 1); | 542 g_return_if_fail(gc != NULL); |
543 g_return_if_fail(who != NULL); | |
544 | |
545 w = g_new0(struct warning, 1); | |
341 w->who = g_strdup(who); | 546 w->who = g_strdup(who); |
342 w->gc = gc; | 547 w->gc = gc; |
343 | 548 |
344 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | 549 w->window = gtk_dialog_new_with_buttons(_("Warn User"), NULL, 0, |
345 | |
346 w->window = gtk_dialog_new_with_buttons(_("Warn User"), | |
347 GTK_WINDOW(GAIM_GTK_WINDOW(c->window)->window), 0, | |
348 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | 550 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
349 GAIM_STOCK_WARN, GTK_RESPONSE_OK, NULL); | 551 GAIM_STOCK_WARN, GTK_RESPONSE_OK, NULL); |
350 gtk_dialog_set_default_response (GTK_DIALOG(w->window), GTK_RESPONSE_OK); | 552 gtk_dialog_set_default_response (GTK_DIALOG(w->window), GTK_RESPONSE_OK); |
351 g_signal_connect(G_OBJECT(w->window), "response", G_CALLBACK(gaim_gtkdialogs_warn_cb), w); | 553 g_signal_connect(G_OBJECT(w->window), "response", G_CALLBACK(gaim_gtkdialogs_warn_cb), w); |
352 | 554 |
356 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(w->window)->vbox), 12); | 558 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(w->window)->vbox), 12); |
357 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), 6); | 559 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), 6); |
358 | 560 |
359 hbox = gtk_hbox_new(FALSE, 12); | 561 hbox = gtk_hbox_new(FALSE, 12); |
360 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), hbox); | 562 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), hbox); |
563 | |
564 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); | |
565 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
361 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | 566 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
362 | 567 |
363 vbox = gtk_vbox_new(FALSE, 0); | 568 vbox = gtk_vbox_new(FALSE, 0); |
364 gtk_container_add(GTK_CONTAINER(hbox), vbox); | 569 gtk_container_add(GTK_CONTAINER(hbox), vbox); |
365 labeltext = g_strdup_printf(_("<span weight=\"bold\" size=\"larger\">Warn %s?</span>\n\n" | 570 labeltext = g_strdup_printf(_("<span weight=\"bold\" size=\"larger\">Warn %s?</span>\n\n" |
395 } | 600 } |
396 | 601 |
397 void | 602 void |
398 gaim_gtkdialogs_alias_contact(GaimContact *contact) | 603 gaim_gtkdialogs_alias_contact(GaimContact *contact) |
399 { | 604 { |
605 g_return_if_fail(contact != NULL); | |
606 | |
400 gaim_request_input(NULL, _("Alias Contact"), NULL, | 607 gaim_request_input(NULL, _("Alias Contact"), NULL, |
401 _("Enter an alias for this contact."), | 608 _("Enter an alias for this contact."), |
402 contact->alias, FALSE, FALSE, NULL, | 609 contact->alias, FALSE, FALSE, NULL, |
403 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_contact_cb), | 610 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_contact_cb), |
404 _("Cancel"), NULL, contact); | 611 _("Cancel"), NULL, contact); |
410 gaim_blist_alias_buddy(buddy, new_alias); | 617 gaim_blist_alias_buddy(buddy, new_alias); |
411 serv_alias_buddy(buddy); | 618 serv_alias_buddy(buddy); |
412 } | 619 } |
413 | 620 |
414 void | 621 void |
415 gaim_gtkdialogs_alias_buddy(GaimBuddy *b) | 622 gaim_gtkdialogs_alias_buddy(GaimBuddy *buddy) |
416 { | 623 { |
417 char *secondary = g_strdup_printf(_("Enter an alias for %s."), b->name); | 624 gchar *secondary; |
625 | |
626 g_return_if_fail(buddy != NULL); | |
627 | |
628 secondary = g_strdup_printf(_("Enter an alias for %s."), buddy->name); | |
418 | 629 |
419 gaim_request_input(NULL, _("Alias Buddy"), NULL, | 630 gaim_request_input(NULL, _("Alias Buddy"), NULL, |
420 secondary, b->alias, FALSE, FALSE, NULL, | 631 secondary, buddy->alias, FALSE, FALSE, NULL, |
421 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_buddy_cb), | 632 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_buddy_cb), |
422 _("Cancel"), NULL, b); | 633 _("Cancel"), NULL, buddy); |
423 | 634 |
424 g_free(secondary); | 635 g_free(secondary); |
425 } | 636 } |
426 | 637 |
427 static void | 638 static void |
431 } | 642 } |
432 | 643 |
433 void | 644 void |
434 gaim_gtkdialogs_alias_chat(GaimChat *chat) | 645 gaim_gtkdialogs_alias_chat(GaimChat *chat) |
435 { | 646 { |
647 g_return_if_fail(chat != NULL); | |
648 | |
436 gaim_request_input(NULL, _("Alias Chat"), NULL, | 649 gaim_request_input(NULL, _("Alias Chat"), NULL, |
437 _("Enter an alias for this chat."), | 650 _("Enter an alias for this chat."), |
438 chat->alias, FALSE, FALSE, NULL, | 651 chat->alias, FALSE, FALSE, NULL, |
439 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_chat_cb), | 652 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_chat_cb), |
440 _("Cancel"), NULL, chat); | 653 _("Cancel"), NULL, chat); |
441 } | 654 } |
442 | 655 |
443 static void | 656 static void |
444 do_remove_contact(GaimContact *contact) | 657 gaim_gtkdialogs_remove_contact_cb(GaimContact *contact) |
445 { | 658 { |
446 GaimBlistNode *bnode, *cnode; | 659 GaimBlistNode *bnode, *cnode; |
447 GaimGroup *group; | 660 GaimGroup *group; |
448 | |
449 if (!contact) | |
450 return; | |
451 | 661 |
452 cnode = (GaimBlistNode *)contact; | 662 cnode = (GaimBlistNode *)contact; |
453 group = (GaimGroup*)cnode->parent; | 663 group = (GaimGroup*)cnode->parent; |
454 for (bnode = cnode->child; bnode; bnode = bnode->next) { | 664 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
455 GaimBuddy *buddy = (GaimBuddy*)bnode; | 665 GaimBuddy *buddy = (GaimBuddy*)bnode; |
462 void | 672 void |
463 gaim_gtkdialogs_remove_contact(GaimContact *contact) | 673 gaim_gtkdialogs_remove_contact(GaimContact *contact) |
464 { | 674 { |
465 GaimBuddy *buddy = gaim_contact_get_priority_buddy(contact); | 675 GaimBuddy *buddy = gaim_contact_get_priority_buddy(contact); |
466 | 676 |
467 if (!buddy) | 677 g_return_if_fail(contact != NULL); |
468 return; | 678 g_return_if_fail(buddy != NULL); |
469 | 679 |
470 if (((GaimBlistNode*)contact)->child == (GaimBlistNode*)buddy && | 680 if (((GaimBlistNode*)contact)->child == (GaimBlistNode*)buddy && |
471 !((GaimBlistNode*)buddy)->next) { | 681 !((GaimBlistNode*)buddy)->next) { |
472 gaim_gtkdialogs_remove_buddy(buddy); | 682 gaim_gtkdialogs_remove_buddy(buddy); |
473 } else { | 683 } else { |
474 char *text = g_strdup_printf(_("You are about to remove the contact containing %s and %d other buddies from your buddy list. Do you want to continue?"), | 684 gchar *text = g_strdup_printf(_("You are about to remove the contact containing %s and %d other buddies from your buddy list. Do you want to continue?"), |
475 buddy->name, contact->totalsize - 1); | 685 buddy->name, contact->totalsize - 1); |
476 | 686 |
477 gaim_request_action(NULL, NULL, _("Remove Contact"), text, -1, contact, 2, | 687 gaim_request_action(NULL, NULL, _("Remove Contact"), text, -1, contact, 2, |
478 _("Remove Contact"), G_CALLBACK(do_remove_contact), | 688 _("Remove Contact"), G_CALLBACK(gaim_gtkdialogs_remove_contact_cb), |
479 _("Cancel"), NULL); | 689 _("Cancel"), NULL); |
480 | 690 |
481 g_free(text); | 691 g_free(text); |
482 } | 692 } |
483 } | 693 } |
484 | 694 |
485 void | 695 void |
486 do_remove_group(GaimGroup *group) | 696 gaim_gtkdialogs_remove_group_cb(GaimGroup *group) |
487 { | 697 { |
488 GaimBlistNode *cnode, *bnode; | 698 GaimBlistNode *cnode, *bnode; |
489 | 699 |
490 cnode = ((GaimBlistNode*)group)->child; | 700 cnode = ((GaimBlistNode*)group)->child; |
491 | 701 |
525 } | 735 } |
526 | 736 |
527 void | 737 void |
528 gaim_gtkdialogs_remove_group(GaimGroup *group) | 738 gaim_gtkdialogs_remove_group(GaimGroup *group) |
529 { | 739 { |
530 char *text = g_strdup_printf(_("You are about to remove the group %s and all its members from your buddy list. Do you want to continue?"), | 740 gchar *text; |
531 group->name); | 741 |
742 g_return_if_fail(group != NULL); | |
743 | |
744 text = g_strdup_printf(_("You are about to remove the group %s and all its members from your buddy list. Do you want to continue?"), | |
745 group->name); | |
532 | 746 |
533 gaim_request_action(NULL, NULL, _("Remove Group"), text, -1, group, 2, | 747 gaim_request_action(NULL, NULL, _("Remove Group"), text, -1, group, 2, |
534 _("Remove Group"), G_CALLBACK(do_remove_group), | 748 _("Remove Group"), G_CALLBACK(gaim_gtkdialogs_remove_group_cb), |
535 _("Cancel"), NULL); | 749 _("Cancel"), NULL); |
536 | 750 |
537 g_free(text); | 751 g_free(text); |
538 } | 752 } |
539 | 753 |
540 static void | 754 static void |
541 do_remove_buddy(GaimBuddy *buddy) | 755 gaim_gtkdialogs_remove_buddy_cb(GaimBuddy *buddy) |
542 { | 756 { |
543 GaimGroup *group; | 757 GaimGroup *group; |
544 GaimConversation *conv; | 758 GaimConversation *conv; |
545 gchar *name; | 759 gchar *name; |
546 GaimAccount *account; | 760 GaimAccount *account; |
547 | 761 |
548 if (!buddy) | |
549 return; | |
550 | |
551 group = gaim_find_buddys_group(buddy); | 762 group = gaim_find_buddys_group(buddy); |
552 name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */ | 763 name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */ |
553 account = buddy->account; | 764 account = buddy->account; |
554 | 765 |
555 gaim_debug(GAIM_DEBUG_INFO, "blist", | 766 gaim_debug_info("blist", "Removing '%s' from buddy list.\n", buddy->name); |
556 "Removing '%s' from buddy list.\n", buddy->name); | |
557 /* XXX - Should remove from blist first... then call serv_remove_buddy()? */ | 767 /* XXX - Should remove from blist first... then call serv_remove_buddy()? */ |
558 serv_remove_buddy(buddy->account->gc, buddy, group); | 768 serv_remove_buddy(buddy->account->gc, buddy, group); |
559 gaim_blist_remove_buddy(buddy); | 769 gaim_blist_remove_buddy(buddy); |
560 | 770 |
561 conv = gaim_find_conversation_with_account(name, account); | 771 conv = gaim_find_conversation_with_account(name, account); |
567 } | 777 } |
568 | 778 |
569 void | 779 void |
570 gaim_gtkdialogs_remove_buddy(GaimBuddy *buddy) | 780 gaim_gtkdialogs_remove_buddy(GaimBuddy *buddy) |
571 { | 781 { |
572 char *text; | 782 gchar *text; |
573 | 783 |
574 if (!buddy) | 784 g_return_if_fail(buddy != NULL); |
575 return; | 785 |
576 | 786 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), |
577 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), buddy->name); | 787 buddy->name); |
578 | 788 |
579 gaim_request_action(NULL, NULL, _("Remove Buddy"), text, -1, buddy, 2, | 789 gaim_request_action(NULL, NULL, _("Remove Buddy"), text, -1, buddy, 2, |
580 _("Remove Buddy"), G_CALLBACK(do_remove_buddy), | 790 _("Remove Buddy"), G_CALLBACK(gaim_gtkdialogs_remove_buddy_cb), |
581 _("Cancel"), NULL); | 791 _("Cancel"), NULL); |
582 | 792 |
583 g_free(text); | 793 g_free(text); |
584 } | 794 } |
585 | 795 |
586 static void | 796 static void |
587 do_remove_chat(GaimChat *chat) | 797 gaim_gtkdialogs_remove_chat_cb(GaimChat *chat) |
588 { | 798 { |
589 gaim_blist_remove_chat(chat); | 799 gaim_blist_remove_chat(chat); |
590 } | 800 } |
591 | 801 |
592 void | 802 void |
593 gaim_gtkdialogs_remove_chat(GaimChat *chat) | 803 gaim_gtkdialogs_remove_chat(GaimChat *chat) |
594 { | 804 { |
595 char *name = gaim_chat_get_display_name(chat); | 805 gchar *name = gaim_chat_get_display_name(chat); |
596 char *text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list. Do you want to continue?"), name); | 806 gchar *text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list. Do you want to continue?"), name); |
807 | |
808 g_return_if_fail(chat != NULL); | |
597 | 809 |
598 gaim_request_action(NULL, NULL, _("Remove Chat"), text, -1, chat, 2, | 810 gaim_request_action(NULL, NULL, _("Remove Chat"), text, -1, chat, 2, |
599 _("Remove Chat"), G_CALLBACK(do_remove_chat), | 811 _("Remove Chat"), G_CALLBACK(gaim_gtkdialogs_remove_chat_cb), |
600 _("Cancel"), NULL); | 812 _("Cancel"), NULL); |
601 | 813 |
602 g_free(name); | 814 g_free(name); |
603 g_free(text); | 815 g_free(text); |
604 } | 816 } |