Mercurial > pidgin
annotate src/gtkutils.c @ 5544:0028381fa874
[gaim-migrate @ 5945]
Claudio Satriano noticed one more string
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 29 May 2003 17:35:28 +0000 |
parents | 2c4c975620f0 |
children | 80e4ba770f97 |
rev | line source |
---|---|
4359 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 #ifdef HAVE_CONFIG_H | |
22 #include <config.h> | |
23 #endif | |
24 #include <string.h> | |
25 #ifndef _WIN32 | |
26 #include <sys/time.h> | |
27 #include <unistd.h> | |
28 #include <gdk/gdkx.h> | |
29 #include <X11/Xlib.h> | |
30 #else | |
31 #ifdef small | |
32 #undef small | |
33 #endif | |
34 #endif /*_WIN32*/ | |
35 #include <sys/types.h> | |
36 #include <sys/stat.h> | |
37 #include <stdio.h> | |
38 #include <stdlib.h> | |
39 #include <errno.h> | |
40 #include <ctype.h> | |
41 #include <gtk/gtk.h> | |
42 #ifdef USE_GTKSPELL | |
43 #include <gtkspell/gtkspell.h> | |
44 #endif | |
45 #include "gtkimhtml.h" | |
46 #include <gdk/gdkkeysyms.h> | |
47 #include "prpl.h" | |
48 #include "ui.h" | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
49 #include "notify.h" |
4359 | 50 |
4859
a9a831508b43
[gaim-migrate @ 5186]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4793
diff
changeset
|
51 #ifdef _WIN32 |
a9a831508b43
[gaim-migrate @ 5186]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4793
diff
changeset
|
52 #include "wspell.h" |
a9a831508b43
[gaim-migrate @ 5186]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4793
diff
changeset
|
53 #endif |
4359 | 54 |
55 void | |
56 gaim_setup_imhtml(GtkWidget *imhtml) | |
57 { | |
58 g_return_if_fail(imhtml != NULL); | |
59 g_return_if_fail(GTK_IS_IMHTML(imhtml)); | |
60 | |
61 if (!(convo_options & OPT_CONVO_SHOW_SMILEY)) | |
62 gtk_imhtml_show_smileys(GTK_IMHTML(imhtml), FALSE); | |
63 | |
64 g_signal_connect(G_OBJECT(imhtml), "url_clicked", | |
65 G_CALLBACK(open_url), NULL); | |
66 | |
67 smiley_themeize(imhtml); | |
68 } | |
69 | |
70 void | |
71 toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle) | |
72 { | |
73 gboolean sensitivity = GTK_WIDGET_IS_SENSITIVE(to_toggle); | |
74 | |
75 gtk_widget_set_sensitive(to_toggle, !sensitivity); | |
76 } | |
77 | |
78 static void | |
79 gaim_gtk_remove_tags(struct gaim_gtk_conversation *gtkconv, const char *tag) | |
80 { | |
81 GtkTextIter start, end, m_start, m_end; | |
82 | |
83 if (gtkconv == NULL || tag == NULL) | |
84 return; | |
85 | |
86 if (!gtk_text_buffer_get_selection_bounds(gtkconv->entry_buffer, | |
87 &start, &end)) | |
88 return; | |
89 | |
90 /* FIXMEif (strstr(tag, "<FONT SIZE=")) { | |
91 while ((t = strstr(t, "<FONT SIZE="))) { | |
92 if (((t - s) < finish) && ((t - s) >= start)) { | |
93 gtk_editable_delete_text(GTK_EDITABLE(entry), (t - s), | |
94 (t - s) + strlen(tag)); | |
95 g_free(s); | |
96 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
97 t = s; | |
98 } else | |
99 t++; | |
100 } | |
101 } else*/ { | |
102 while (gtk_text_iter_forward_search(&start, tag, 0, &m_start, | |
103 &m_end, &end)) { | |
104 | |
105 gtk_text_buffer_delete(gtkconv->entry_buffer, &m_start, &m_end); | |
106 gtk_text_buffer_get_selection_bounds(gtkconv->entry_buffer, | |
107 &start, &end); | |
108 } | |
109 } | |
110 } | |
111 | |
112 void | |
113 gaim_gtk_surround(struct gaim_gtk_conversation *gtkconv, | |
114 const char *pre, const char *post) | |
115 { | |
116 GtkTextIter start, end; | |
117 GtkTextMark *mark_start, *mark_end; | |
118 GtkTextBuffer *entry_buffer; | |
119 | |
120 if (gtkconv == NULL || pre == NULL || post == NULL) | |
121 return; | |
122 | |
123 entry_buffer = gtkconv->entry_buffer; | |
124 | |
125 if (gtk_text_buffer_get_selection_bounds(entry_buffer, | |
126 &start, &end)) { | |
127 gaim_gtk_remove_tags(gtkconv, pre); | |
128 gaim_gtk_remove_tags(gtkconv, post); | |
129 | |
130 mark_start = gtk_text_buffer_create_mark(entry_buffer, "m1", | |
131 &start, TRUE); | |
132 mark_end = gtk_text_buffer_create_mark(entry_buffer, "m2", | |
133 &end, FALSE); | |
134 gtk_text_buffer_insert(entry_buffer, &start, pre, -1); | |
135 gtk_text_buffer_get_selection_bounds(entry_buffer, &start, &end); | |
136 gtk_text_buffer_insert(entry_buffer, &end, post, -1); | |
137 gtk_text_buffer_get_iter_at_mark(entry_buffer, &start, mark_start); | |
138 gtk_text_buffer_move_mark_by_name(entry_buffer, "selection_bound", | |
139 &start); | |
140 } else { | |
141 gtk_text_buffer_insert(entry_buffer, &start, pre, -1); | |
142 gtk_text_buffer_insert(entry_buffer, &start, post, -1); | |
143 mark_start = gtk_text_buffer_get_insert(entry_buffer); | |
144 gtk_text_buffer_get_iter_at_mark(entry_buffer, &start, mark_start); | |
145 gtk_text_iter_backward_chars(&start, strlen(post)); | |
146 gtk_text_buffer_place_cursor(entry_buffer, &start); | |
147 } | |
148 | |
149 gtk_widget_grab_focus(gtkconv->entry); | |
150 } | |
151 | |
152 static gboolean | |
153 invert_tags(GtkTextBuffer *buffer, const char *s1, const char *s2, | |
154 gboolean really) | |
155 { | |
156 GtkTextIter start1, start2, end1, end2; | |
157 char *b1, *b2; | |
158 | |
159 if (gtk_text_buffer_get_selection_bounds(buffer, &start1, &end2)) { | |
160 start2 = start1; | |
161 end1 = end2; | |
162 | |
163 if (!gtk_text_iter_forward_chars(&start2, strlen(s1))) | |
164 return FALSE; | |
165 | |
166 if (!gtk_text_iter_backward_chars(&end1, strlen(s2))) | |
167 return FALSE; | |
168 | |
169 b1 = gtk_text_buffer_get_text(buffer, &start1, &start2, FALSE); | |
170 b2 = gtk_text_buffer_get_text(buffer, &end1, &end2, FALSE); | |
171 | |
4793 | 172 if (!g_ascii_strncasecmp(b1, s1, strlen(s1)) && |
173 !g_ascii_strncasecmp(b2, s2, strlen(s2))) { | |
4359 | 174 |
175 if (really) { | |
176 GtkTextMark *m_end1, *m_end2; | |
177 | |
178 m_end1= gtk_text_buffer_create_mark(buffer, "m1", &end1, TRUE); | |
179 m_end2= gtk_text_buffer_create_mark(buffer, "m2", &end2, TRUE); | |
180 | |
181 gtk_text_buffer_delete(buffer, &start1, &start2); | |
182 gtk_text_buffer_get_iter_at_mark(buffer, &end1, m_end1); | |
183 gtk_text_buffer_get_iter_at_mark(buffer, &end2, m_end2); | |
184 gtk_text_buffer_delete(buffer, &end1, &end2); | |
185 gtk_text_buffer_delete_mark(buffer, m_end1); | |
186 gtk_text_buffer_delete_mark(buffer, m_end2); | |
187 } | |
188 | |
189 g_free(b1); | |
190 g_free(b2); | |
191 | |
192 return TRUE; | |
193 } | |
194 | |
195 g_free(b1); | |
196 g_free(b2); | |
197 } | |
198 | |
199 return FALSE; | |
200 } | |
201 | |
202 void | |
203 gaim_gtk_advance_past(struct gaim_gtk_conversation *gtkconv, | |
204 const char *pre, const char *post) | |
205 { | |
206 GtkTextIter current_pos, start, end; | |
207 | |
208 if (invert_tags(gtkconv->entry_buffer, pre, post, TRUE)) | |
209 return; | |
210 | |
211 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, ¤t_pos, | |
212 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
213 | |
214 if (gtk_text_iter_forward_search(¤t_pos, post, 0, | |
215 &start, &end, NULL)) | |
216 gtk_text_buffer_place_cursor(gtkconv->entry_buffer, &end); | |
217 else | |
218 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, post, -1); | |
219 | |
220 gtk_widget_grab_focus(gtkconv->entry); | |
221 } | |
222 | |
223 void | |
224 gaim_gtk_set_font_face(struct gaim_gtk_conversation *gtkconv, | |
225 const char *font) | |
226 { | |
227 char *pre_fontface; | |
228 | |
229 if (gtkconv == NULL || font == NULL) | |
230 return; | |
231 | |
232 strncpy(gtkconv->fontface, | |
233 (font && *font ? font : DEFAULT_FONT_FACE), | |
234 sizeof(gtkconv->fontface)); | |
235 | |
236 gtkconv->has_font = TRUE; | |
237 | |
238 pre_fontface = g_strconcat("<FONT FACE=\"", | |
239 gtkconv->fontface, "\">", NULL); | |
240 gaim_gtk_surround(gtkconv, pre_fontface, "</FONT>"); | |
241 | |
242 gtk_widget_grab_focus(gtkconv->entry); | |
243 | |
244 g_free(pre_fontface); | |
245 } | |
246 | |
247 static int | |
248 des_save_icon(GtkObject *obj, GdkEvent *e, | |
249 struct gaim_gtk_conversation *gtkconv) | |
250 { | |
251 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
252 gtkconv->u.im->save_icon = NULL; | |
253 | |
254 return TRUE; | |
255 } | |
256 | |
257 static void | |
258 do_save_icon(GtkObject *obj, struct gaim_conversation *c) | |
259 { | |
260 struct gaim_gtk_conversation *gtkconv; | |
261 FILE *file; | |
262 const char *f; | |
263 | |
264 gtkconv = GAIM_GTK_CONVERSATION(c); | |
265 | |
266 f = gtk_file_selection_get_filename( | |
267 GTK_FILE_SELECTION(gtkconv->u.im->save_icon)); | |
268 | |
269 if (file_is_dir(f, gtkconv->u.im->save_icon)) | |
270 return; | |
271 | |
272 if ((file = fopen(f, "w")) != NULL) { | |
273 int len; | |
274 void *data = get_icon_data(gaim_conversation_get_gc(c), | |
275 normalize(gaim_conversation_get_name(c)), | |
276 &len); | |
277 | |
278 if (data) | |
279 fwrite(data, 1, len, file); | |
280 | |
281 fclose(file); | |
282 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
283 gaim_notify_error(NULL, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
284 _("Can't save icon file to disk."), NULL); |
4359 | 285 } |
286 | |
287 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
288 gtkconv->u.im->save_icon = NULL; | |
289 } | |
290 | |
291 static void | |
292 cancel_save_icon(GtkObject *obj, struct gaim_gtk_conversation *gtkconv) | |
293 { | |
294 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
295 gtkconv->u.im->save_icon = NULL; | |
296 } | |
297 | |
298 | |
299 void | |
300 gaim_gtk_save_icon_dialog(GtkObject *obj, struct gaim_conversation *conv) | |
301 { | |
302 struct gaim_gtk_conversation *gtkconv; | |
303 char buf[BUF_LEN]; | |
304 | |
305 if (conv == NULL || gaim_conversation_get_type(conv) != GAIM_CONV_IM) | |
306 return; | |
307 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
308 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 309 return; |
310 | |
311 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
312 | |
313 if (gtkconv->u.im->save_icon != NULL) | |
314 { | |
315 gdk_window_raise(gtkconv->u.im->save_icon->window); | |
316 return; | |
317 } | |
318 | |
319 gtkconv->u.im->save_icon = gtk_file_selection_new(_("Gaim - Save Icon")); | |
320 | |
321 gtk_file_selection_hide_fileop_buttons( | |
322 GTK_FILE_SELECTION(gtkconv->u.im->save_icon)); | |
323 | |
324 g_snprintf(buf, BUF_LEN - 1, | |
325 "%s" G_DIR_SEPARATOR_S "%s.icon", | |
326 gaim_home_dir(), gaim_conversation_get_name(conv)); | |
327 | |
328 gtk_file_selection_set_filename( | |
329 GTK_FILE_SELECTION(gtkconv->u.im->save_icon), buf); | |
330 | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
331 g_signal_connect(G_OBJECT(gtkconv->u.im->save_icon), "delete_event", |
4359 | 332 G_CALLBACK(des_save_icon), gtkconv); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
333 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(gtkconv->u.im->save_icon)->ok_button), "clicked", |
4359 | 334 G_CALLBACK(do_save_icon), conv); |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
335 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(gtkconv->u.im->save_icon)->cancel_button), "clicked", |
4359 | 336 G_CALLBACK(cancel_save_icon), gtkconv); |
337 | |
338 gtk_widget_show(gtkconv->u.im->save_icon); | |
339 } | |
340 | |
341 int | |
342 gaim_gtk_get_dispstyle(GaimConversationType type) | |
343 { | |
344 int dispstyle = 2; | |
345 | |
346 if (type == GAIM_CONV_CHAT) { | |
347 switch (chat_options & (OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM)) { | |
348 | |
349 case OPT_CHAT_BUTTON_TEXT: dispstyle = 1; break; | |
350 case OPT_CHAT_BUTTON_XPM: dispstyle = 0; break; | |
351 default: dispstyle = 2; break; /* both/neither */ | |
352 } | |
353 } | |
354 else if (type == GAIM_CONV_IM) { | |
355 switch (im_options & (OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM)) { | |
356 | |
357 case OPT_IM_BUTTON_TEXT: dispstyle = 1; break; | |
358 case OPT_IM_BUTTON_XPM: dispstyle = 0; break; | |
359 default: dispstyle = 2; break; /* both/neither */ | |
360 } | |
361 } | |
362 | |
363 return dispstyle; | |
364 } | |
365 | |
366 GtkWidget * | |
367 gaim_gtk_change_text(const char *text, GtkWidget *button, | |
368 const char *stock, GaimConversationType type) | |
369 { | |
370 int dispstyle = gaim_gtk_get_dispstyle(type); | |
371 | |
372 if (button != NULL) | |
373 gtk_widget_destroy(button); | |
374 | |
375 button = gaim_pixbuf_button_from_stock((dispstyle == 0 ? NULL : text), | |
376 (dispstyle == 1 ? NULL : stock), | |
377 GAIM_BUTTON_VERTICAL); | |
378 | |
379 gtk_widget_show(button); | |
380 | |
381 return button; | |
382 } | |
383 | |
384 void | |
385 gaim_gtk_toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle) | |
386 { | |
387 gboolean sensitivity; | |
388 | |
389 if (to_toggle == NULL) | |
390 return; | |
391 | |
392 sensitivity = GTK_WIDGET_IS_SENSITIVE(to_toggle); | |
393 | |
394 gtk_widget_set_sensitive(to_toggle, !sensitivity); | |
395 } | |
396 | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
397 void |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
398 gtk_toggle_sensitive_array(GtkWidget *w, GPtrArray *data) |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
399 { |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
400 gboolean sensitivity; |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
401 gpointer element; |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
402 int i; |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
403 |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
404 for (i=0; i < data->len; i++) { |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
405 element = g_ptr_array_index(data,i); |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
406 if (element == NULL) |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
407 continue; |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
408 |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
409 sensitivity = GTK_WIDGET_IS_SENSITIVE(element); |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
410 |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
411 gtk_widget_set_sensitive(element, !sensitivity); |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
412 } |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
413 } |
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
414 |
4687 | 415 void gaim_separator(GtkWidget *menu) |
416 { | |
417 GtkWidget *menuitem; | |
418 | |
419 menuitem = gtk_separator_menu_item_new(); | |
420 gtk_widget_show(menuitem); | |
421 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
422 } | |
5160 | 423 |
5162 | 424 GtkWidget *gaim_new_item(GtkWidget *menu, const char *str) |
425 { | |
426 GtkWidget *menuitem; | |
427 GtkWidget *label; | |
428 | |
429 menuitem = gtk_menu_item_new(); | |
430 if (menu) | |
431 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
432 gtk_widget_show(menuitem); | |
433 | |
434 label = gtk_label_new(str); | |
435 gtk_label_set_pattern(GTK_LABEL(label), "_"); | |
436 gtk_container_add(GTK_CONTAINER(menuitem), label); | |
437 gtk_widget_show(label); | |
438 /* FIXME: Go back and fix this | |
439 gtk_widget_add_accelerator(menuitem, "activate", accel, str[0], | |
440 GDK_MOD1_MASK, GTK_ACCEL_LOCKED); | |
441 */ | |
442 return menuitem; | |
443 } | |
444 | |
5160 | 445 GtkWidget *gaim_new_item_from_stock(GtkWidget *menu, const char *str, const char *icon, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod) |
446 { | |
447 GtkWidget *menuitem; | |
448 /* | |
449 GtkWidget *hbox; | |
450 GtkWidget *label; | |
451 */ | |
452 GtkWidget *image; | |
453 | |
454 if (icon == NULL) | |
455 menuitem = gtk_menu_item_new_with_mnemonic(str); | |
456 else | |
457 menuitem = gtk_image_menu_item_new_with_mnemonic(str); | |
458 | |
459 if (menu) | |
460 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
461 | |
462 if (sf) | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
463 g_signal_connect(G_OBJECT(menuitem), "activate", sf, data); |
5160 | 464 |
465 if (icon != NULL) { | |
466 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU); | |
467 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); | |
468 } | |
469 /* FIXME: this isn't right | |
470 if (mod) { | |
471 label = gtk_label_new(mod); | |
472 gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 2); | |
473 gtk_widget_show(label); | |
474 } | |
475 */ | |
476 /* | |
477 if (accel_key) { | |
478 gtk_widget_add_accelerator(menuitem, "activate", accel, accel_key, | |
479 accel_mods, GTK_ACCEL_LOCKED); | |
480 } | |
481 */ | |
482 | |
483 gtk_widget_show_all(menuitem); | |
484 | |
485 return menuitem; | |
486 } | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
487 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
488 GtkWidget * |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
489 gaim_gtk_make_frame(GtkWidget *parent, const char *title) |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
490 { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
491 GtkWidget *vbox, *label, *hbox; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
492 char labeltitle[256]; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
493 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
494 vbox = gtk_vbox_new(FALSE, 6); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
495 gtk_box_pack_start(GTK_BOX(parent), vbox, FALSE, FALSE, 0); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
496 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
497 label = gtk_label_new(NULL); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
498 g_snprintf(labeltitle, sizeof(labeltitle), |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
499 "<span weight=\"bold\">%s</span>", title); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
500 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
501 gtk_label_set_markup(GTK_LABEL(label), labeltitle); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
502 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
503 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
504 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
505 hbox = gtk_hbox_new(FALSE, 6); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
506 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
507 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
508 label = gtk_label_new(" "); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
509 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
510 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
511 vbox = gtk_vbox_new(FALSE, 6); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
512 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
513 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
514 return vbox; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
515 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
516 |