4 * Copyright (C) 1998-2002, Mark Spencer <markster@marko.net>
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.
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.
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
28 #include <sys/types.h>
37 #include "gtkimhtml.h"
46 GtkWidget
*tree_v
= NULL
;
47 GtkWidget
*prefs_away_list
= NULL
;
48 GtkWidget
*prefs_away_menu
= NULL
;
49 GtkWidget
*preftree
= NULL
;
50 GtkWidget
*fontseld
= NULL
;
52 GtkListStore
*prefs_away_store
= NULL
;
54 static int sound_row_sel
= 0;
55 static char *last_sound_dir
= NULL
;
57 static GtkWidget
*sounddialog
= NULL
;
58 static GtkWidget
*browser_entry
= NULL
;
59 static GtkWidget
*sound_entry
= NULL
;
60 static GtkWidget
*away_text
= NULL
;
61 static GtkListStore
*smiley_theme_store
= NULL
;
62 GtkCTreeNode
*general_node
= NULL
;
63 GtkCTreeNode
*deny_node
= NULL
;
64 GtkWidget
*prefs_proxy_frame
= NULL
;
65 GtkWidget
*gaim_button(const char *, guint
*, int, GtkWidget
*);
66 GtkWidget
*gaim_labeled_spin_button(GtkWidget
*, const gchar
*, int*, int, int, GtkSizeGroup
*);
67 static GtkWidget
*gaim_dropdown(GtkWidget
*, const gchar
*, int *, int, ...);
68 static GtkWidget
*gaim_dropdown_from_list(GtkWidget
*, const gchar
*, int *, int, GList
*);
69 static GtkWidget
*show_color_pref(GtkWidget
*, gboolean
);
70 static void delete_prefs(GtkWidget
*, void *);
71 void set_default_away(GtkWidget
*, gpointer
);
72 static gboolean
program_is_valid(const char *);
74 struct debug_window
*dw
= NULL
;
75 GtkWidget
*prefs
= NULL
;
76 GtkWidget
*debugbutton
= NULL
;
77 static int notebook_page
= 0;
78 static GtkTreeIter plugin_iter
;
83 GtkTreeIter
*prefs_notebook_add_page(char*, GdkPixbuf
*, GtkWidget
*, GtkTreeIter
*, GtkTreeIter
*, int);
85 void delete_prefs(GtkWidget
*asdf
, void *gdsa
) {
87 struct gaim_plugin
*plug
;
95 prefs_away_menu
= NULL
;
97 smiley_theme_store
= NULL
;
99 gtk_widget_destroy(sounddialog
);
100 g_object_unref(G_OBJECT(prefs_away_store
));
111 GtkWidget
*preflabel
;
112 GtkWidget
*prefsnotebook
;
113 GtkTreeStore
*prefstree
;
115 static void set_misc_option();
116 static void set_logging_option();
117 static void set_blist_option();
118 static void set_convo_option();
119 static void set_im_option();
120 static void set_chat_option();
121 static void set_font_option();
122 static void set_sound_option();
123 static void set_away_option();
130 static void proxy_print_option(GtkEntry
*entry
, int entrynum
)
132 if (entrynum
== PROXYHOST
)
133 g_snprintf(proxyhost
, sizeof(proxyhost
), "%s", gtk_entry_get_text(entry
));
134 else if (entrynum
== PROXYPORT
)
135 proxyport
= atoi(gtk_entry_get_text(entry
));
136 else if (entrynum
== PROXYUSER
)
137 g_snprintf(proxyuser
, sizeof(proxyuser
), "%s", gtk_entry_get_text(entry
));
138 else if (entrynum
== PROXYPASS
)
139 g_snprintf(proxypass
, sizeof(proxypass
), "%s", gtk_entry_get_text(entry
));
140 proxy_info_is_from_gaimrc
= 1; /* If the user specifies it, we want
145 GtkWidget
*make_frame(GtkWidget
*ret
, char *text
) {
146 GtkWidget
*vbox
, *label
, *hbox
;
149 vbox
= gtk_vbox_new(FALSE
, 6);
150 gtk_box_pack_start(GTK_BOX(ret
), vbox
, FALSE
, FALSE
, 0);
151 label
= gtk_label_new(NULL
);
152 g_snprintf(labeltext
, sizeof(labeltext
), "<span weight=\"bold\">%s</span>", text
);
153 gtk_label_set_markup(GTK_LABEL(label
), labeltext
);
154 gtk_misc_set_alignment(GTK_MISC(label
), 0, 0);
155 gtk_box_pack_start(GTK_BOX(vbox
), label
, FALSE
, FALSE
, 0);
156 hbox
= gtk_hbox_new(FALSE
, 6);
157 gtk_box_pack_start (GTK_BOX (vbox
), hbox
, FALSE
, FALSE
, 0);
158 label
= gtk_label_new(" ");
159 gtk_box_pack_start(GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
160 vbox
= gtk_vbox_new(FALSE
, 6);
161 gtk_box_pack_start(GTK_BOX(hbox
), vbox
, FALSE
, FALSE
, 0);
165 /* OK, Apply and Cancel */
168 static void pref_nb_select(GtkTreeSelection
*sel
, GtkNotebook
*nb
) {
172 GtkTreeModel
*model
= GTK_TREE_MODEL(prefstree
);
174 if (! gtk_tree_selection_get_selected (sel
, &model
, &iter
))
176 gtk_tree_model_get_value (model
, &iter
, 1, &val
);
177 g_snprintf(text
, sizeof(text
), "<span weight=\"bold\" size=\"larger\">%s</span>",
178 g_value_get_string(&val
));
179 gtk_label_set_markup (GTK_LABEL(preflabel
), text
);
180 g_value_unset (&val
);
181 gtk_tree_model_get_value (model
, &iter
, 2, &val
);
182 gtk_notebook_set_current_page (GTK_NOTEBOOK (prefsnotebook
), g_value_get_int (&val
));
186 /* These are the pages in the preferences notebook */
187 GtkWidget
*interface_page() {
190 ret
= gtk_vbox_new(FALSE
, 18);
191 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
193 vbox
= make_frame(ret
, _("Interface Options"));
194 /* This shouldn't have to wait for user to click OK or APPLY or whatnot */
195 /* This really shouldn't be in preferences at all */
196 debugbutton
= gaim_button(_("Show _debug window"), &misc_options
, OPT_MISC_DEBUG
, vbox
);
198 gaim_button(_("D_isplay remote nicknames if no alias is set"), &misc_options
, OPT_MISC_USE_SERVER_ALIAS
, vbox
);
201 gtk_widget_show_all(ret
);
205 static void smiley_sel (GtkTreeSelection
*sel
, GtkTreeModel
*model
) {
207 const char *filename
;
210 if (! gtk_tree_selection_get_selected (sel
, &model
, &iter
))
212 gtk_tree_model_get_value (model
, &iter
, 2, &val
);
213 filename
= g_value_get_string(&val
);
214 load_smiley_theme(filename
, TRUE
);
215 g_value_unset (&val
);
219 GtkTreePath
*theme_refresh_theme_list()
224 GtkTreePath
*path
= NULL
;
228 smiley_theme_probe();
233 themes
= smiley_themes
;
235 gtk_list_store_clear(smiley_theme_store
);
238 struct smiley_theme
*theme
= themes
->data
;
239 char *description
= g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n"
240 "<span size='smaller' foreground='gray'>%s</span>",
241 theme
->name
, theme
->author
, theme
->desc
);;
242 gtk_list_store_append (smiley_theme_store
, &iter
);
243 pixbuf
= gdk_pixbuf_new_from_file(theme
->icon
, NULL
);
245 gtk_list_store_set(smiley_theme_store
, &iter
,
251 themes
= themes
->next
;
252 if (current_smiley_theme
&& !strcmp(theme
->path
, current_smiley_theme
->path
)) {
253 /* path = gtk_tree_path_new_from_indices(ind); */
254 char *iwishihadgtk2_2
= g_strdup_printf("%d", ind
);
255 path
= gtk_tree_path_new_from_string(iwishihadgtk2_2
);
256 g_free(iwishihadgtk2_2
);
264 void theme_install_theme(char *path
, char *extn
) {
269 /* Just to be safe */
272 /* I dont know what you are, get out of here */
275 else if ((tail
= strrchr(path
, '.')) == NULL
)
278 destdir
= g_strconcat(gaim_user_dir(), G_DIR_SEPARATOR_S
"smileys", NULL
);
280 /* We'll check this just to make sure. This also lets us do something different on
281 * other platforms, if need be */
282 if (!g_strcasecmp(tail
, ".gz") || !g_strcasecmp(tail
, ".tgz"))
283 command
= g_strdup_printf("tar > /dev/null xzf \"%s\" -C %s", path
, destdir
);
295 theme_refresh_theme_list();
298 static void theme_got_url(gpointer data
, char *themedata
, unsigned long len
) {
302 f
= gaim_mkstemp(&path
);
303 fwrite(themedata
, len
, 1, f
);
306 theme_install_theme(path
, data
);
312 void theme_dnd_recv(GtkWidget
*widget
, GdkDragContext
*dc
, guint x
, guint y
, GtkSelectionData
*sd
,
313 guint info
, guint t
, gpointer data
) {
314 gchar
*name
= sd
->data
;
316 if ((sd
->length
>= 0) && (sd
->format
== 8)) {
317 /* Well, it looks like the drag event was cool.
318 * Let's do something with it */
320 if (!g_strncasecmp(name
, "file://", 7)) {
321 /* It looks like we're dealing with a local file. Let's
322 * just untar it in the right place */
323 theme_install_theme(name
+ 7, NULL
);
324 } else if (!g_strncasecmp(name
, "http://", 7)) {
325 /* Oo, a web drag and drop. This is where things
326 * will start to get interesting */
329 if ((tail
= strrchr(name
, '.')) == NULL
)
332 /* We'll check this just to make sure. This also lets us do something different on
333 * other platforms, if need be */
334 grab_url(name
, TRUE
, theme_got_url
, ".tgz");
337 gtk_drag_finish(dc
, TRUE
, FALSE
, t
);
340 gtk_drag_finish(dc
, FALSE
, FALSE
, t
);
343 GtkWidget
*theme_page() {
347 GtkCellRenderer
*rend
;
348 GtkTreeViewColumn
*col
;
349 GtkTreeSelection
*sel
;
350 GtkTreePath
*path
= NULL
;
352 GtkTargetEntry te
[3] = {{"text/plain", 0, 0},{"text/uri-list", 1, 0},{"STRING", 2, 0}};
354 ret
= gtk_vbox_new(FALSE
, 18);
355 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
357 label
= gtk_label_new(_("Select a smiley theme that you would like to use from the list below. New themes can be installed by dragging and dropping them onto the theme list."));
359 gtk_label_set_line_wrap(GTK_LABEL(label
), TRUE
);
360 gtk_misc_set_alignment(GTK_MISC(label
), 0, 0.5);
361 gtk_label_set_justify(GTK_LABEL(label
), GTK_JUSTIFY_LEFT
);
363 gtk_box_pack_start(GTK_BOX(ret
), label
, FALSE
, TRUE
, 0);
364 gtk_widget_show(label
);
366 sw
= gtk_scrolled_window_new(NULL
,NULL
);
367 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw
), GTK_POLICY_NEVER
, GTK_POLICY_AUTOMATIC
);
368 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw
), GTK_SHADOW_IN
);
370 gtk_box_pack_start(GTK_BOX(ret
), sw
, TRUE
, TRUE
, 0);
371 smiley_theme_store
= gtk_list_store_new (3, GDK_TYPE_PIXBUF
, G_TYPE_STRING
, G_TYPE_STRING
);
373 path
= theme_refresh_theme_list();
375 view
= gtk_tree_view_new_with_model (GTK_TREE_MODEL(smiley_theme_store
));
377 gtk_drag_dest_set(view
, GTK_DEST_DEFAULT_MOTION
| GTK_DEST_DEFAULT_HIGHLIGHT
| GTK_DEST_DEFAULT_DROP
, te
,
378 sizeof(te
) / sizeof(GtkTargetEntry
) , GDK_ACTION_COPY
| GDK_ACTION_MOVE
);
380 g_signal_connect(G_OBJECT(view
), "drag_data_received", G_CALLBACK(theme_dnd_recv
), smiley_theme_store
);
382 rend
= gtk_cell_renderer_pixbuf_new();
383 sel
= gtk_tree_view_get_selection (GTK_TREE_VIEW (view
));
386 gtk_tree_selection_select_path(sel
, path
);
387 gtk_tree_path_free(path
);
390 col
= gtk_tree_view_column_new_with_attributes ("Icon",
394 gtk_tree_view_append_column (GTK_TREE_VIEW(view
), col
);
396 rend
= gtk_cell_renderer_text_new();
397 col
= gtk_tree_view_column_new_with_attributes ("Description",
401 gtk_tree_view_append_column (GTK_TREE_VIEW(view
), col
);
402 g_object_unref(G_OBJECT(smiley_theme_store
));
403 gtk_container_add(GTK_CONTAINER(sw
), view
);
405 g_signal_connect (G_OBJECT (sel
), "changed",
406 G_CALLBACK (smiley_sel
),
410 gtk_widget_show_all(ret
);
414 GtkWidget
*font_page() {
417 GtkWidget
*vbox
, *hbox
;
418 GtkWidget
*select
= NULL
;
419 GtkSizeGroup
*sg
= gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL
);
421 ret
= gtk_vbox_new(FALSE
, 18);
422 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
424 vbox
= make_frame(ret
, _("Style"));
425 gaim_button(_("_Bold"), &font_options
, OPT_FONT_BOLD
, vbox
);
426 gaim_button(_("_Italics"), &font_options
, OPT_FONT_ITALIC
, vbox
);
427 gaim_button(_("_Underline"), &font_options
, OPT_FONT_UNDERLINE
, vbox
);
428 gaim_button(_("_Strikethough"), &font_options
, OPT_FONT_STRIKE
, vbox
);
430 vbox
= make_frame(ret
, _("Face"));
431 hbox
= gtk_hbox_new(FALSE
, 6);
432 gtk_container_add(GTK_CONTAINER(vbox
), hbox
);
433 button
= gaim_button(_("Use custo_m face"), &font_options
, OPT_FONT_FACE
, hbox
);
434 gtk_size_group_add_widget(sg
, button
);
435 select
= gtk_button_new_from_stock(GTK_STOCK_SELECT_FONT
);
437 if (!(font_options
& OPT_FONT_FACE
))
438 gtk_widget_set_sensitive(GTK_WIDGET(select
), FALSE
);
439 g_signal_connect(GTK_OBJECT(button
), "clicked",
440 G_CALLBACK(gaim_gtk_toggle_sensitive
), select
);
441 g_signal_connect(GTK_OBJECT(select
), "clicked",
442 G_CALLBACK(show_font_dialog
), NULL
);
443 gtk_box_pack_start(GTK_BOX(hbox
), select
, FALSE
, FALSE
, 0);
445 hbox
= gtk_hbox_new(FALSE
, 5);
446 gtk_container_add(GTK_CONTAINER(vbox
), hbox
);
447 button
= gaim_button(_("Use custom si_ze"), &font_options
, OPT_FONT_SIZE
, hbox
);
448 gtk_size_group_add_widget(sg
, button
);
449 select
= gaim_labeled_spin_button(hbox
, NULL
, &fontsize
, 1, 7, NULL
);
450 if (!(font_options
& OPT_FONT_SIZE
))
451 gtk_widget_set_sensitive(GTK_WIDGET(select
), FALSE
);
452 g_signal_connect(GTK_OBJECT(button
), "clicked",
453 G_CALLBACK(gaim_gtk_toggle_sensitive
), select
);
455 vbox
= make_frame(ret
, _("Color"));
456 hbox
= gtk_hbox_new(FALSE
, 5);
457 gtk_container_add(GTK_CONTAINER(vbox
), hbox
);
460 button
= gaim_button(_("_Text color"), &font_options
, OPT_FONT_FGCOL
, hbox
);
461 gtk_size_group_add_widget(sg
, button
);
463 select
= gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR
);
464 gtk_box_pack_start(GTK_BOX(hbox
), select
, FALSE
, FALSE
, 0);
465 pref_fg_picture
= show_color_pref(hbox
, TRUE
);
466 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(update_color
),
469 if (!(font_options
& OPT_FONT_FGCOL
))
470 gtk_widget_set_sensitive(GTK_WIDGET(select
), FALSE
);
471 g_signal_connect(GTK_OBJECT(button
), "clicked",
472 G_CALLBACK(gaim_gtk_toggle_sensitive
), select
);
473 g_signal_connect(GTK_OBJECT(select
), "clicked", G_CALLBACK(show_fgcolor_dialog
), NULL
);
474 hbox
= gtk_hbox_new(FALSE
, 5);
475 gtk_container_add(GTK_CONTAINER(vbox
), hbox
);
477 button
= gaim_button(_("Bac_kground color"), &font_options
, OPT_FONT_BGCOL
, hbox
);
478 gtk_size_group_add_widget(sg
, button
);
479 select
= gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR
);
480 gtk_box_pack_start(GTK_BOX(hbox
), select
, FALSE
, FALSE
, 0);
481 pref_bg_picture
= show_color_pref(hbox
, FALSE
);
482 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(update_color
),
485 if (!(font_options
& OPT_FONT_BGCOL
))
486 gtk_widget_set_sensitive(GTK_WIDGET(select
), FALSE
);
487 g_signal_connect(GTK_OBJECT(select
), "clicked", G_CALLBACK(show_bgcolor_dialog
), NULL
);
488 g_signal_connect(GTK_OBJECT(button
), "clicked",
489 G_CALLBACK(gaim_gtk_toggle_sensitive
), select
);
491 gtk_widget_show_all(ret
);
496 GtkWidget
*messages_page() {
499 ret
= gtk_vbox_new(FALSE
, 18);
500 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
502 vbox
= make_frame (ret
, _("Display"));
503 gaim_button(_("Show graphical _smileys"), &convo_options
, OPT_CONVO_SHOW_SMILEY
, vbox
);
504 gaim_button(_("Show _timestamp on messages"), &convo_options
, OPT_CONVO_SHOW_TIME
, vbox
);
505 gaim_button(_("Show _URLs as links"), &convo_options
, OPT_CONVO_SEND_LINKS
, vbox
);
507 gaim_button(_("_Highlight misspelled words"), &convo_options
, OPT_CONVO_CHECK_SPELLING
, vbox
);
509 vbox
= make_frame (ret
, _("Ignore"));
510 gaim_button(_("Ignore c_olors"), &convo_options
, OPT_CONVO_IGNORE_COLOUR
, vbox
);
511 gaim_button(_("Ignore font _faces"), &convo_options
, OPT_CONVO_IGNORE_FONTS
, vbox
);
512 gaim_button(_("Ignore font si_zes"), &convo_options
, OPT_CONVO_IGNORE_SIZES
, vbox
);
513 /* gaim_button(_("Ignore Ti_K Automated Messages"), &away_options, OPT_AWAY_TIK_HACK, vbox); */
515 gtk_widget_show_all(ret
);
519 GtkWidget
*hotkeys_page() {
522 ret
= gtk_vbox_new(FALSE
, 18);
523 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
525 vbox
= make_frame(ret
, _("Send Message"));
526 gaim_button(_("_Enter sends message"), &convo_options
, OPT_CONVO_ENTER_SENDS
, vbox
);
527 gaim_button(_("C_ontrol-Enter sends message"), &convo_options
, OPT_CONVO_CTL_ENTER
, vbox
);
529 vbox
= make_frame (ret
, _("Window Closing"));
530 gaim_button(_("E_scape closes window"), &convo_options
, OPT_CONVO_ESC_CAN_CLOSE
, vbox
);
531 gaim_button(_("Control-_W closes window"), &convo_options
, OPT_CONVO_CTL_W_CLOSES
, vbox
);
533 vbox
= make_frame(ret
, "Insertions");
534 gaim_button(_("Control-{B/I/U/S} inserts _HTML tags"), &convo_options
, OPT_CONVO_CTL_CHARS
, vbox
);
535 gaim_button(_("Control-(number) inserts _smileys"), &convo_options
, OPT_CONVO_CTL_SMILEYS
, vbox
);
537 gtk_widget_show_all(ret
);
541 GtkWidget
*list_page() {
544 ret
= gtk_vbox_new(FALSE
, 18);
545 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
547 vbox
= make_frame (ret
, _("Buttons"));
548 gaim_button(_("_Hide IM/Info/Chat buttons"), &blist_options
, OPT_BLIST_NO_BUTTONS
, vbox
);
549 gaim_button(_("Show _pictures on buttons"), &blist_options
, OPT_BLIST_SHOW_BUTTON_XPM
, vbox
);
551 vbox
= make_frame (ret
, _("Buddy List Window"));
552 gaim_button(_("_Save window size/position"), &blist_options
, OPT_BLIST_SAVED_WINDOWS
, vbox
);
553 gaim_button(_("_Raise window on events"), &blist_options
, OPT_BLIST_POPUP
, vbox
);
555 vbox
= make_frame (ret
, _("Group Display"));
556 gaim_button(_("Hide _groups with no online buddies"), &blist_options
, OPT_BLIST_NO_MT_GRP
, vbox
);
557 gaim_button(_("Show _numbers in groups"), &blist_options
, OPT_BLIST_SHOW_GRPNUM
, vbox
);
559 vbox
= make_frame (ret
, _("Buddy Display"));
560 gaim_button(_("Show buddy type _icons"), &blist_options
, OPT_BLIST_SHOW_PIXMAPS
, vbox
);
561 gaim_button(_("Show _warning levels"), &blist_options
, OPT_BLIST_SHOW_WARN
, vbox
);
562 gaim_button(_("Show idle _times"), &blist_options
, OPT_BLIST_SHOW_IDLETIME
, vbox
);
563 gaim_button(_("Grey i_dle buddies"), &blist_options
, OPT_BLIST_GREY_IDLERS
, vbox
);
565 gtk_widget_show_all(ret
);
569 GtkWidget
*im_page() {
572 GtkWidget
*typingbutton
, *widge
;
575 ret
= gtk_vbox_new(FALSE
, 18);
576 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
578 sg
= gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL
);
580 vbox
= make_frame (ret
, _("Window"));
581 widge
= gaim_dropdown(vbox
, _("Show _buttons as:"), &im_options
, OPT_IM_BUTTON_TEXT
| OPT_IM_BUTTON_XPM
,
582 _("Pictures"), OPT_IM_BUTTON_XPM
,
583 _("Text"), OPT_IM_BUTTON_TEXT
,
584 _("Pictures and text"), OPT_IM_BUTTON_XPM
| OPT_IM_BUTTON_TEXT
, NULL
);
585 gtk_size_group_add_widget(sg
, widge
);
586 gtk_misc_set_alignment(GTK_MISC(widge
), 0, 0);
587 gaim_labeled_spin_button(vbox
, _("New window _width:"), &conv_size
.width
, 25, 9999, sg
);
588 gaim_labeled_spin_button(vbox
, _("New window _height:"), &conv_size
.height
, 25, 9999, sg
);
589 gaim_labeled_spin_button(vbox
, _("_Entry widget height:"), &conv_size
.entry_height
, 25, 9999, sg
);
590 gaim_button(_("_Raise windows on events"), &im_options
, OPT_IM_POPUP
, vbox
);
591 gaim_button(_("Hide window on _send"), &im_options
, OPT_IM_POPDOWN
, vbox
);
592 gtk_widget_show (vbox
);
594 vbox
= make_frame (ret
, _("Buddy Icons"));
595 gaim_button(_("Hide buddy _icons"), &im_options
, OPT_IM_HIDE_ICONS
, vbox
);
596 gaim_button(_("Disable buddy icon a_nimation"), &im_options
, OPT_IM_NO_ANIMATION
, vbox
);
598 vbox
= make_frame (ret
, _("Display"));
599 gaim_button(_("Show _logins in window"), &im_options
, OPT_IM_LOGON
, vbox
);
601 vbox
= make_frame (ret
, _("Typing Notification"));
602 typingbutton
= gaim_button(_("Notify buddies that you are _typing to them"), &misc_options
,
603 OPT_MISC_STEALTH_TYPING
, vbox
);
604 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(typingbutton
), !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(typingbutton
)));
605 misc_options
^= OPT_MISC_STEALTH_TYPING
;
607 gtk_widget_show_all(ret
);
611 GtkWidget
*chat_page() {
617 ret
= gtk_vbox_new(FALSE
, 18);
618 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
620 sg
= gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL
);
622 vbox
= make_frame (ret
, _("Window"));
623 dd
= gaim_dropdown(vbox
, _("Show _buttons as:"), &chat_options
, OPT_CHAT_BUTTON_TEXT
| OPT_CHAT_BUTTON_XPM
,
624 _("Pictures"), OPT_CHAT_BUTTON_XPM
,
625 _("Text"), OPT_CHAT_BUTTON_TEXT
,
626 _("Pictures and text"), OPT_CHAT_BUTTON_XPM
| OPT_CHAT_BUTTON_TEXT
, NULL
);
627 gtk_size_group_add_widget(sg
, dd
);
628 gtk_misc_set_alignment(GTK_MISC(dd
), 0, 0);
629 gaim_labeled_spin_button(vbox
, _("New window _width:"), &buddy_chat_size
.width
, 25, 9999, sg
);
630 gaim_labeled_spin_button(vbox
, _("New window _height:"), &buddy_chat_size
.height
, 25, 9999, sg
);
631 gaim_labeled_spin_button(vbox
, _("_Entry widget height:"), &buddy_chat_size
.entry_height
, 25, 9999, sg
);
632 gaim_button(_("_Raise windows on events"), &chat_options
, OPT_CHAT_POPUP
, vbox
);
634 vbox
= make_frame (ret
, _("Tab Completion"));
635 gaim_button(_("_Tab-complete nicks"), &chat_options
, OPT_CHAT_TAB_COMPLETE
, vbox
);
636 gaim_button(_("_Old-style tab completion"), &chat_options
, OPT_CHAT_OLD_STYLE_TAB
, vbox
);
638 vbox
= make_frame (ret
, _("Display"));
639 gaim_button(_("_Show people joining/leaving in window"), &chat_options
, OPT_CHAT_LOGON
, vbox
);
640 gaim_button(_("Co_lorize screennames"), &chat_options
, OPT_CHAT_COLORIZE
, vbox
);
642 gtk_widget_show_all(ret
);
646 GtkWidget
*tab_page() {
652 ret
= gtk_vbox_new(FALSE
, 18);
653 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
655 sg
= gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL
);
657 vbox
= make_frame (ret
, _("IM Tabs"));
658 dd
= gaim_dropdown(vbox
, _("Tab _placement:"), &im_options
, OPT_IM_SIDE_TAB
| OPT_IM_BR_TAB
,
660 _("Bottom"), OPT_IM_BR_TAB
,
661 _("Left"), OPT_IM_SIDE_TAB
,
662 _("Right"), OPT_IM_BR_TAB
| OPT_IM_SIDE_TAB
, NULL
);
663 gtk_size_group_add_widget(sg
, dd
);
664 gaim_button(_("Show all _instant messages in one tabbed\nwindow"), &im_options
, OPT_IM_ONE_WINDOW
, vbox
);
665 gaim_button(_("Show a_liases in tabs/titles"), &im_options
, OPT_IM_ALIAS_TAB
, vbox
);
667 vbox
= make_frame (ret
, _("Chat Tabs"));
668 dd
= gaim_dropdown(vbox
, _("Tab _placement:"), &chat_options
, OPT_CHAT_SIDE_TAB
| OPT_CHAT_BR_TAB
,
670 _("Bottom"), OPT_CHAT_BR_TAB
,
671 _("Left"), OPT_CHAT_SIDE_TAB
,
672 _("Right"), OPT_CHAT_SIDE_TAB
| OPT_CHAT_BR_TAB
, NULL
);
673 gtk_size_group_add_widget(sg
, dd
);
674 gaim_button(_("Show all c_hats in one tabbed window"), &chat_options
, OPT_CHAT_ONE_WINDOW
,
677 vbox
= make_frame (ret
, _("Buddy List Tabs"));
678 dd
= gaim_dropdown(vbox
, _("Tab _placement:"), &blist_options
, OPT_BLIST_BOTTOM_TAB
,
680 _("Bottom"), OPT_BLIST_BOTTOM_TAB
, NULL
);
681 gtk_size_group_add_widget(sg
, dd
);
683 vbox
= make_frame (ret
, _("Tab Options"));
684 gaim_button(_("Show IMs and chats in _same tabbed window."), &convo_options
, OPT_CONVO_COMBINE
, vbox
);
685 button
= gaim_button(_("Show _close button on tabs."), &convo_options
, OPT_CONVO_NO_X_ON_TAB
, vbox
);
686 convo_options
^= OPT_CONVO_NO_X_ON_TAB
;
687 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button
), !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button
)));
690 gtk_widget_show_all(ret
);
694 GtkWidget
*proxy_page() {
702 ret
= gtk_vbox_new(FALSE
, 18);
703 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
705 vbox
= make_frame (ret
, _("Proxy Type"));
706 gaim_dropdown(vbox
, _("Proxy _type:"), (int*)&proxytype
, -1,
707 _("No proxy"), PROXY_NONE
,
708 "SOCKS 4", PROXY_SOCKS4
,
709 "SOCKS 5", PROXY_SOCKS5
,
710 "HTTP", PROXY_HTTP
, NULL
);
712 table
= gtk_table_new(2, 2, FALSE
);
713 gtk_container_set_border_width(GTK_CONTAINER(table
), 5);
714 gtk_table_set_col_spacings(GTK_TABLE(table
), 5);
715 gtk_table_set_row_spacings(GTK_TABLE(table
), 5);
717 vbox
= make_frame(ret
, _("Proxy Server"));
718 prefs_proxy_frame
= vbox
;
720 if (proxytype
== PROXY_NONE
)
721 gtk_widget_set_sensitive(GTK_WIDGET(vbox
), FALSE
);
723 table
= gtk_table_new(2, 4, FALSE
);
724 gtk_container_set_border_width(GTK_CONTAINER(table
), 5);
725 gtk_table_set_col_spacings(GTK_TABLE(table
), 5);
726 gtk_table_set_row_spacings(GTK_TABLE(table
), 10);
727 gtk_container_add(GTK_CONTAINER(vbox
), table
);
730 label
= gtk_label_new_with_mnemonic(_("_Host"));
731 gtk_misc_set_alignment(GTK_MISC(label
), 1.0, 0.5);
732 gtk_table_attach(GTK_TABLE(table
), label
, 0, 1, 0, 1, GTK_FILL
, 0, 0, 0);
734 entry
= gtk_entry_new();
735 gtk_label_set_mnemonic_widget(GTK_LABEL(label
), entry
);
736 gtk_table_attach(GTK_TABLE(table
), entry
, 1, 2, 0, 1, GTK_FILL
, 0, 0, 0);
737 g_signal_connect(GTK_OBJECT(entry
), "changed",
738 G_CALLBACK(proxy_print_option
), (void *)PROXYHOST
);
739 gtk_entry_set_text(GTK_ENTRY(entry
), proxyhost
);
741 hbox
= gtk_hbox_new(TRUE
, 5);
742 gtk_box_pack_start(GTK_BOX(vbox
), hbox
, FALSE
, FALSE
, 0);
744 label
= gtk_label_new_with_mnemonic(_("Port"));
745 gtk_misc_set_alignment(GTK_MISC(label
), 1.0, 0.5);
746 gtk_table_attach(GTK_TABLE(table
), label
, 0, 1, 1, 2, GTK_FILL
, 0, 0, 0);
748 entry
= gtk_entry_new();
749 gtk_label_set_mnemonic_widget(GTK_LABEL(label
), entry
);
750 gtk_table_attach(GTK_TABLE(table
), entry
, 1, 2, 1, 2, GTK_FILL
, 0, 0, 0);
751 g_signal_connect(GTK_OBJECT(entry
), "changed",
752 G_CALLBACK(proxy_print_option
), (void *)PROXYPORT
);
756 g_snprintf(buf
, sizeof(buf
), "%d", proxyport
);
757 gtk_entry_set_text(GTK_ENTRY(entry
), buf
);
760 label
= gtk_label_new_with_mnemonic(_("_User"));
761 gtk_misc_set_alignment(GTK_MISC(label
), 1.0, 0.5);
762 gtk_table_attach(GTK_TABLE(table
), label
, 0, 1, 2, 3, GTK_FILL
, 0, 0, 0);
764 entry
= gtk_entry_new();
765 gtk_label_set_mnemonic_widget(GTK_LABEL(label
), entry
);
766 gtk_table_attach(GTK_TABLE(table
), entry
, 1, 2, 2, 3, GTK_FILL
, 0, 0, 0);
767 g_signal_connect(GTK_OBJECT(entry
), "changed",
768 G_CALLBACK(proxy_print_option
), (void *)PROXYUSER
);
769 gtk_entry_set_text(GTK_ENTRY(entry
), proxyuser
);
771 hbox
= gtk_hbox_new(TRUE
, 5);
772 gtk_box_pack_start(GTK_BOX(vbox
), hbox
, FALSE
, FALSE
, 0);
774 label
= gtk_label_new_with_mnemonic(_("Pa_ssword"));
775 gtk_misc_set_alignment(GTK_MISC(label
), 1.0, 0.5);
776 gtk_table_attach(GTK_TABLE(table
), label
, 0, 1, 3, 4, GTK_FILL
, 0, 0, 0);
778 entry
= gtk_entry_new();
779 gtk_label_set_mnemonic_widget(GTK_LABEL(label
), entry
);
780 gtk_table_attach(GTK_TABLE(table
), entry
, 1, 2, 3, 4, GTK_FILL
, 0, 0, 0);
781 gtk_entry_set_visibility(GTK_ENTRY(entry
), FALSE
);
782 g_signal_connect(GTK_OBJECT(entry
), "changed",
783 G_CALLBACK(proxy_print_option
), (void *)PROXYPASS
);
784 gtk_entry_set_text(GTK_ENTRY(entry
), proxypass
);
786 gtk_widget_show_all(ret
);
791 static void manual_browser_set(GtkButton
*button
, GtkEntry
*entry
) {
793 const char *program
= gtk_entry_get_text(entry
);
794 if (!program_is_valid(program
)) {
795 char *error
= g_strdup_printf(_("The entered manual browser "
796 "'%s' is not valid. Hyperlinks will "
797 "not work."), program
);
798 do_error_dialog(error
, NULL
, GAIM_WARNING
);
801 g_strlcpy(web_command
, program
, sizeof(web_command
));
804 static void manual_browser_reset(GtkButton
*button
, GtkEntry
*entry
) {
805 gtk_entry_set_text(entry
, web_command
);
808 static GList
*get_available_browsers()
816 static struct browser possible_browsers
[] = {
817 {N_("Konqueror"), "kfmclient", BROWSER_KONQ
},
818 {N_("Opera"), "opera", BROWSER_OPERA
},
819 {N_("Galeon"), "galeon", BROWSER_GALEON
},
820 {N_("Netscape"), "netscape", BROWSER_NETSCAPE
},
821 {N_("Mozilla"), "mozilla", BROWSER_MOZILLA
},
823 static const int num_possible_browsers
= 5;
825 GList
*browsers
= NULL
;
828 browsers
= g_list_prepend(browsers
, GINT_TO_POINTER(BROWSER_MANUAL
));
829 browsers
= g_list_prepend(browsers
, _("Manual"));
830 for (i
= 0; i
< num_possible_browsers
; i
++) {
831 if (program_is_valid(possible_browsers
[i
].command
)) {
832 browsers
= g_list_prepend(browsers
,
833 GINT_TO_POINTER(possible_browsers
[i
].id
));
834 browsers
= g_list_prepend(browsers
, possible_browsers
[i
].name
);
841 GtkWidget
*browser_page() {
847 GList
*browsers
= NULL
;
849 ret
= gtk_vbox_new(FALSE
, 18);
850 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
852 sg
= gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL
);
853 vbox
= make_frame (ret
, _("Browser Selection"));
855 browsers
= get_available_browsers();
856 if (browsers
!= NULL
) {
857 label
= gaim_dropdown_from_list(vbox
,_("_Browser"), &web_browser
, -1,
859 gtk_misc_set_alignment(GTK_MISC(label
), 0, 0);
860 gtk_size_group_add_widget(sg
, label
);
863 hbox
= gtk_hbox_new(FALSE
, 5);
864 gtk_box_pack_start(GTK_BOX(vbox
), hbox
, FALSE
, FALSE
, 0);
865 label
= gtk_label_new_with_mnemonic(_("_Manual: "));
866 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
867 gtk_misc_set_alignment(GTK_MISC(label
), 0, 0);
868 gtk_size_group_add_widget(sg
, label
);
869 browser_entry
= gtk_entry_new();
870 gtk_label_set_mnemonic_widget(GTK_LABEL(label
), browser_entry
);
871 if (web_browser
!= BROWSER_MANUAL
)
872 gtk_widget_set_sensitive(hbox
, FALSE
);
873 gtk_box_pack_start (GTK_BOX (hbox
), browser_entry
, FALSE
, FALSE
, 0);
875 gtk_entry_set_text(GTK_ENTRY(browser_entry
), web_command
);
876 g_signal_connect_swapped(GTK_OBJECT(browser_entry
), "activate",
877 G_CALLBACK(manual_browser_set
), NULL
);
878 label
= gtk_button_new_with_label(_("Set"));
879 gtk_box_pack_start(GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
880 g_signal_connect(GTK_OBJECT(label
), "clicked",
881 G_CALLBACK(manual_browser_set
), browser_entry
);
882 label
= gtk_button_new_with_label(_("Reset"));
883 gtk_box_pack_start(GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
884 g_signal_connect(GTK_OBJECT(label
), "clicked",
885 G_CALLBACK(manual_browser_reset
), browser_entry
);
887 if (browsers
!= NULL
) {
888 vbox
= make_frame (ret
, _("Browser Options"));
889 label
= gaim_button(_("Open new _window by default"), &misc_options
, OPT_MISC_BROWSER_POPUP
, vbox
);
892 gtk_widget_show_all(ret
);
897 GtkWidget
*logging_page() {
900 ret
= gtk_vbox_new(FALSE
, 18);
901 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
903 vbox
= make_frame (ret
, _("Message Logs"));
904 gaim_button(_("_Log all instant messages"), &logging_options
, OPT_LOG_CONVOS
, vbox
);
905 gaim_button(_("Log all c_hats"), &logging_options
, OPT_LOG_CHATS
, vbox
);
906 gaim_button(_("Strip _HTML from logs"), &logging_options
, OPT_LOG_STRIP_HTML
, vbox
);
908 vbox
= make_frame (ret
, _("System Logs"));
909 gaim_button(_("Log when buddies _sign on/sign off"), &logging_options
, OPT_LOG_BUDDY_SIGNON
,
911 gaim_button(_("Log when buddies become _idle/un-idle"), &logging_options
, OPT_LOG_BUDDY_IDLE
,
913 gaim_button(_("Log when buddies go away/come _back"), &logging_options
, OPT_LOG_BUDDY_AWAY
, vbox
);
914 gaim_button(_("Log your _own signons/idleness/awayness"), &logging_options
, OPT_LOG_MY_SIGNON
,
916 gaim_button(_("I_ndividual log file for each buddy's signons"), &logging_options
,
917 OPT_LOG_INDIVIDUAL
, vbox
);
919 gtk_widget_show_all(ret
);
923 static GtkWidget
*sndcmd
= NULL
;
926 static gint
sound_cmd_yeah(GtkEntry
*entry
, gpointer d
)
928 g_snprintf(sound_cmd
, sizeof(sound_cmd
), "%s", gtk_entry_get_text(GTK_ENTRY(sndcmd
)));
933 GtkWidget
*sound_page() {
943 ret
= gtk_vbox_new(FALSE
, 18);
944 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
946 sg
= gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL
);
948 vbox
= make_frame (ret
, _("Sound Options"));
949 gaim_button(_("_No sounds when you log in"), &sound_options
, OPT_SOUND_SILENT_SIGNON
, vbox
);
950 gaim_button(_("_Sounds while away"), &sound_options
, OPT_SOUND_WHEN_AWAY
, vbox
);
953 vbox
= make_frame (ret
, _("Sound Method"));
954 dd
= gaim_dropdown(vbox
, _("_Method"), &sound_options
, OPT_SOUND_BEEP
|
955 OPT_SOUND_ESD
| OPT_SOUND_ARTSC
| OPT_SOUND_NAS
| OPT_SOUND_NORMAL
|
957 _("Console beep"), OPT_SOUND_BEEP
,
959 "ESD", OPT_SOUND_ESD
,
962 "ArtsC", OPT_SOUND_ARTSC
,
965 "NAS", OPT_SOUND_NAS
,
967 _("Internal"), OPT_SOUND_NORMAL
,
968 _("Command"), OPT_SOUND_CMD
, NULL
);
969 gtk_size_group_add_widget(sg
, dd
);
970 gtk_misc_set_alignment(GTK_MISC(dd
), 0, 0);
972 hbox
= gtk_hbox_new(FALSE
, 5);
973 gtk_box_pack_start(GTK_BOX(vbox
), hbox
, FALSE
, FALSE
, 5);
975 hbox
= gtk_hbox_new(FALSE
, 5);
976 gtk_container_add(GTK_CONTAINER(vbox
), hbox
);
977 label
= gtk_label_new_with_mnemonic(_("Sound c_ommand\n(%s for filename)"));
978 gtk_size_group_add_widget(sg
, label
);
979 gtk_misc_set_alignment(GTK_MISC(label
), 0, 0);
980 gtk_box_pack_start(GTK_BOX(hbox
), label
, FALSE
, FALSE
, 5);
982 sndcmd
= gtk_entry_new();
983 gtk_label_set_mnemonic_widget(GTK_LABEL(label
), sndcmd
);
985 gtk_entry_set_editable(GTK_ENTRY(sndcmd
), TRUE
);
986 gtk_entry_set_text(GTK_ENTRY(sndcmd
), sound_cmd
);
987 gtk_widget_set_size_request(sndcmd
, 75, -1);
989 gtk_widget_set_sensitive(sndcmd
, (sound_options
& OPT_SOUND_CMD
));
990 gtk_box_pack_start(GTK_BOX(hbox
), sndcmd
, TRUE
, TRUE
, 5);
991 g_signal_connect(GTK_OBJECT(sndcmd
), "changed", G_CALLBACK(sound_cmd_yeah
), NULL
);
993 gtk_widget_show_all(ret
);
997 GtkWidget
*away_page() {
1007 ret
= gtk_vbox_new(FALSE
, 18);
1008 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
1010 sg
= gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL
);
1012 vbox
= make_frame (ret
, _("Away"));
1013 gaim_button(_("_Sending messages removes away status"), &away_options
, OPT_AWAY_BACK_ON_IM
, vbox
);
1014 gaim_button(_("_Queue new messages when away"), &away_options
, OPT_AWAY_QUEUE
, vbox
);
1015 gaim_button(_("_Ignore new conversations when away"), &away_options
, OPT_AWAY_DISCARD
, vbox
);
1017 vbox
= make_frame (ret
, _("Auto-response"));
1018 hbox
= gtk_hbox_new(FALSE
, 0);
1019 gtk_container_add(GTK_CONTAINER(vbox
), hbox
);
1020 gaim_labeled_spin_button(hbox
, _("Seconds before _resending:"),
1021 &away_resend
, 1, 24 * 60 * 60, sg
);
1022 gaim_button(_("_Don't send auto-response"), &away_options
, OPT_AWAY_NO_AUTO_RESP
, vbox
);
1023 gaim_button(_("_Only send auto-response when idle"), &away_options
, OPT_AWAY_IDLE_RESP
, vbox
);
1024 gaim_button(_("Do_n't send auto-response in active conversations"), &away_options
, OPT_AWAY_DELAY_IN_USE
, vbox
);
1026 if (away_options
& OPT_AWAY_NO_AUTO_RESP
)
1027 gtk_widget_set_sensitive(hbox
, FALSE
);
1029 vbox
= make_frame (ret
, _("Idle"));
1030 dd
= gaim_dropdown(vbox
, _("Idle _time reporting:"), &report_idle
, -1,
1031 _("None"), IDLE_NONE
,
1032 _("Gaim usage"), IDLE_GAIM
,
1033 #ifdef USE_SCREENSAVER
1035 _("X usage"), IDLE_SCREENSAVER
,
1037 _("Windows usage"), IDLE_SCREENSAVER
,
1041 gtk_size_group_add_widget(sg
, dd
);
1042 gtk_misc_set_alignment(GTK_MISC(dd
), 0, 0);
1044 vbox
= make_frame (ret
, _("Auto-away"));
1045 button
= gaim_button(_("Set away _when idle"), &away_options
, OPT_AWAY_AUTO
, vbox
);
1046 select
= gaim_labeled_spin_button(vbox
, _("_Minutes before setting away:"), &auto_away
, 1, 24 * 60, sg
);
1047 if (!(away_options
& OPT_AWAY_AUTO
))
1048 gtk_widget_set_sensitive(GTK_WIDGET(select
), FALSE
);
1049 g_signal_connect(GTK_OBJECT(button
), "clicked",
1050 G_CALLBACK(gaim_gtk_toggle_sensitive
), select
);
1052 label
= gtk_label_new_with_mnemonic(_("Away m_essage:"));
1053 gtk_size_group_add_widget(sg
, label
);
1054 gtk_misc_set_alignment(GTK_MISC(label
), 0, 0);
1055 hbox
= gtk_hbox_new(FALSE
, 0);
1056 gtk_container_add(GTK_CONTAINER(vbox
), hbox
);
1057 gtk_box_pack_start(GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
1058 prefs_away_menu
= gtk_option_menu_new();
1059 gtk_label_set_mnemonic_widget(GTK_LABEL(label
), prefs_away_menu
);
1060 if (!(away_options
& OPT_AWAY_AUTO
))
1061 gtk_widget_set_sensitive(GTK_WIDGET(prefs_away_menu
), FALSE
);
1062 g_signal_connect(GTK_OBJECT(button
), "clicked",
1063 G_CALLBACK(gaim_gtk_toggle_sensitive
), prefs_away_menu
);
1064 default_away_menu_init(prefs_away_menu
);
1065 gtk_widget_show(prefs_away_menu
);
1066 gtk_box_pack_start(GTK_BOX(hbox
), prefs_away_menu
, FALSE
, FALSE
, 0);
1068 gtk_widget_show_all(ret
);
1073 GtkWidget
*plugin_description
=NULL
, *plugin_details
=NULL
;
1074 static void prefs_plugin_sel (GtkTreeSelection
*sel
, GtkTreeModel
*model
)
1078 GValue val
= { 0, };
1079 struct gaim_plugin
*plug
;
1081 if (! gtk_tree_selection_get_selected (sel
, &model
, &iter
))
1083 gtk_tree_model_get_value (model
, &iter
, 2, &val
);
1084 plug
= g_value_get_pointer(&val
);
1087 g_snprintf(buf
, sizeof(buf
), "<span size=\"larger\">%s %s</span>\n\n"
1088 "<span weight=\"bold\" color=\"red\">%s</span>\n\n"
1089 "%s", plug
->desc
.name
, plug
->desc
.version
, plug
->error
, plug
->desc
.description
);
1091 g_snprintf(buf
, sizeof(buf
), "<span size=\"larger\">%s %s</span>\n\n"
1092 "%s", plug
->desc
.name
, plug
->desc
.version
, plug
->desc
.description
);
1093 gtk_label_set_markup(GTK_LABEL(plugin_description
), buf
);
1094 g_snprintf(buf
, sizeof(buf
),
1096 _("<span size=\"larger\">%s %s</span>\n\n"
1097 "<span weight=\"bold\">Written by:</span>\t%s\n"
1098 "<span weight=\"bold\">URL:</span>\t%s\n"
1099 "<span weight=\"bold\">File name:</span>\t%s"),
1101 _("<span size=\"larger\">%s %s</span>\n\n"
1102 "<span weight=\"bold\">Written by:</span> %s\n"
1103 "<span weight=\"bold\">URL:</span> %s\n"
1104 "<span weight=\"bold\">File name:</span> %s"),
1106 plug
->desc
.name
, plug
->desc
.version
, plug
->desc
.authors
, plug
->desc
.url
, plug
->path
);
1107 gtk_label_set_markup(GTK_LABEL(plugin_details
), buf
);
1108 g_value_unset (&val
);
1111 static void plugin_load (GtkCellRendererToggle
*cell
, gchar
*pth
, gpointer data
)
1113 GtkTreeModel
*model
= (GtkTreeModel
*)data
;
1115 GtkTreePath
*path
= gtk_tree_path_new_from_string(pth
);
1116 struct gaim_plugin
*plug
;
1118 GtkWidget
*(*config
)();
1120 GdkCursor
*wait
= gdk_cursor_new (GDK_WATCH
);
1121 gdk_window_set_cursor(prefs
->window
, wait
);
1122 gdk_cursor_unref(wait
);
1124 gtk_tree_model_get_iter (model
, &iter
, path
);
1125 gtk_tree_model_get (model
, &iter
, 2, &plug
, -1);
1129 if (plug
->type
== plugin
)
1132 load_plugin(plug
->path
);
1133 if (g_module_symbol(plug
->handle
, "gaim_plugin_config_gtk", (gpointer
*)&config
)) {
1134 plug
->iter
= g_new0(GtkTreeIter
, 1);
1135 prefs_notebook_add_page(plug
->desc
.name
, NULL
, config(), plug
->iter
, &plugin_iter
, notebook_page
++);
1136 if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(prefstree
), &plugin_iter
) == 1) {
1137 /* Expand the tree for the first plugin added */
1138 GtkTreePath
*path2
= gtk_tree_model_get_path(GTK_TREE_MODEL(prefstree
), &plugin_iter
);
1139 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_v
), path2
, TRUE
);
1140 gtk_tree_path_free (path2
);
1149 perl_load_file(plug
->path
);
1154 if (plug
->type
== plugin
)
1157 unload_plugin(plug
);
1159 gtk_tree_store_remove(GTK_TREE_STORE(prefstree
), plug
->iter
);
1169 perl_unload_file(plug
);
1173 gdk_window_set_cursor(prefs
->window
, NULL
);
1175 g_snprintf(buf
, sizeof(buf
), "<span size=\"larger\">%s %s</span>\n\n"
1176 "<span weight=\"bold\" color=\"red\">%s</span>\n\n"
1177 "%s", plug
->desc
.name
, plug
->desc
.version
, plug
->error
, plug
->desc
.description
);
1179 g_snprintf(buf
, sizeof(buf
), "<span size=\"larger\">%s %s</span>\n\n"
1180 "%s", plug
->desc
.name
, plug
->desc
.version
, plug
->desc
.description
);
1181 gtk_label_set_markup(GTK_LABEL(plugin_description
), buf
);
1182 gtk_list_store_set (GTK_LIST_STORE (model
), &iter
, 0, plug
->handle
, -1);
1184 gtk_label_set_markup(GTK_LABEL(plugin_description
), buf
);
1185 gtk_tree_path_free(path
);
1188 static GtkWidget
*plugin_page ()
1194 GtkWidget
*event_view
;
1196 GtkCellRenderer
*rend
, *rendt
;
1197 GtkTreeViewColumn
*col
;
1198 GtkTreeSelection
*sel
;
1203 GList
*probes
= probed_plugins
;
1204 struct gaim_plugin
*plug
;
1206 ret
= gtk_vbox_new(FALSE
, 18);
1207 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
1209 sw
= gtk_scrolled_window_new(NULL
,NULL
);
1210 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw
), GTK_POLICY_NEVER
, GTK_POLICY_ALWAYS
);
1211 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw
), GTK_SHADOW_IN
);
1213 gtk_box_pack_start(GTK_BOX(ret
), sw
, TRUE
, TRUE
, 0);
1215 ls
= gtk_list_store_new (3, G_TYPE_BOOLEAN
, G_TYPE_STRING
, G_TYPE_POINTER
);
1217 plug
= probes
->data
;
1218 gtk_list_store_append (ls
, &iter
);
1219 gtk_list_store_set(ls
, &iter
,
1221 1, plug
->desc
.name
? plug
->desc
.name
: plug
->path
,
1223 probes
= probes
->next
;
1226 event_view
= gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls
));
1228 rend
= gtk_cell_renderer_toggle_new();
1229 sel
= gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view
));
1232 col
= gtk_tree_view_column_new_with_attributes (_("Load"),
1236 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view
), col
);
1238 rendt
= gtk_cell_renderer_text_new();
1239 col
= gtk_tree_view_column_new_with_attributes (_("Name"),
1243 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view
), col
);
1244 g_object_unref(G_OBJECT(ls
));
1245 gtk_container_add(GTK_CONTAINER(sw
), event_view
);
1248 nb
= gtk_notebook_new();
1249 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(nb
), GTK_POS_BOTTOM
);
1250 gtk_notebook_popup_disable(GTK_NOTEBOOK(nb
));
1253 sw
= gtk_scrolled_window_new(NULL
, NULL
);
1254 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw
), GTK_POLICY_AUTOMATIC
, GTK_POLICY_AUTOMATIC
);
1255 plugin_description
= gtk_label_new(NULL
);
1257 vp
= gtk_viewport_new(NULL
, NULL
);
1258 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp
), GTK_SHADOW_NONE
);
1259 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw
), GTK_SHADOW_NONE
);
1261 gtk_container_add(GTK_CONTAINER(vp
), plugin_description
);
1262 gtk_container_add(GTK_CONTAINER(sw
), vp
);
1264 gtk_label_set_selectable(GTK_LABEL(plugin_description
), TRUE
);
1265 gtk_label_set_line_wrap(GTK_LABEL(plugin_description
), TRUE
);
1266 gtk_misc_set_alignment(GTK_MISC(plugin_description
), 0, 0);
1267 gtk_misc_set_padding(GTK_MISC(plugin_description
), 6, 6);
1268 gtk_notebook_append_page(GTK_NOTEBOOK(nb
), sw
, gtk_label_new(_("Description")));
1271 sw
= gtk_scrolled_window_new(NULL
, NULL
);
1272 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw
), GTK_POLICY_AUTOMATIC
, GTK_POLICY_AUTOMATIC
);
1273 plugin_details
= gtk_label_new(NULL
);
1275 vp
= gtk_viewport_new(NULL
, NULL
);
1276 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp
), GTK_SHADOW_NONE
);
1277 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw
), GTK_SHADOW_NONE
);
1279 gtk_container_add(GTK_CONTAINER(vp
), plugin_details
);
1280 gtk_container_add(GTK_CONTAINER(sw
), vp
);
1282 gtk_label_set_selectable(GTK_LABEL(plugin_details
), TRUE
);
1283 gtk_label_set_line_wrap(GTK_LABEL(plugin_details
), TRUE
);
1284 gtk_misc_set_alignment(GTK_MISC(plugin_details
), 0, 0);
1285 gtk_misc_set_padding(GTK_MISC(plugin_details
), 6, 6);
1286 gtk_notebook_append_page(GTK_NOTEBOOK(nb
), sw
, gtk_label_new(_("Details")));
1287 gtk_box_pack_start(GTK_BOX(ret
), nb
, TRUE
, TRUE
, 0);
1289 g_signal_connect (G_OBJECT (sel
), "changed",
1290 G_CALLBACK (prefs_plugin_sel
),
1292 g_signal_connect (G_OBJECT(rend
), "toggled",
1293 G_CALLBACK(plugin_load
), ls
);
1295 path
= gtk_tree_path_new_first();
1296 gtk_tree_selection_select_path(sel
, path
);
1297 gtk_tree_path_free(path
);
1299 gtk_widget_show_all(ret
);
1304 static void event_toggled (GtkCellRendererToggle
*cell
, gchar
*pth
, gpointer data
)
1306 GtkTreeModel
*model
= (GtkTreeModel
*)data
;
1308 GtkTreePath
*path
= gtk_tree_path_new_from_string(pth
);
1311 gtk_tree_model_get_iter (model
, &iter
, path
);
1312 gtk_tree_model_get (model
, &iter
, 2, &soundnum
, -1);
1314 sound_options
^= sounds
[soundnum
].opt
;
1315 gtk_list_store_set (GTK_LIST_STORE (model
), &iter
, 0, sound_options
& sounds
[soundnum
].opt
, -1);
1317 gtk_tree_path_free(path
);
1320 static void test_sound(GtkWidget
*button
, gpointer i_am_NULL
)
1322 guint32 tmp_sound
= sound_options
;
1323 if (!(sound_options
& OPT_SOUND_WHEN_AWAY
))
1324 sound_options
^= OPT_SOUND_WHEN_AWAY
;
1325 if (!(sound_options
& sounds
[sound_row_sel
].opt
))
1326 sound_options
^= sounds
[sound_row_sel
].opt
;
1327 play_sound(sound_row_sel
);
1329 sound_options
= tmp_sound
;
1332 static void reset_sound(GtkWidget
*button
, gpointer i_am_also_NULL
)
1334 /* This just resets a sound file back to default */
1335 if (sound_file
[sound_row_sel
]) {
1336 g_free(sound_file
[sound_row_sel
]);
1337 sound_file
[sound_row_sel
] = NULL
;
1340 gtk_entry_set_text(GTK_ENTRY(sound_entry
), "(default)");
1343 void close_sounddialog(GtkWidget
*w
, GtkWidget
*w2
)
1348 if (!GTK_IS_WIDGET(w2
))
1355 gtk_widget_destroy(dest
);
1358 void do_select_sound(GtkWidget
*w
, int snd
)
1362 file
= gtk_file_selection_get_filename(GTK_FILE_SELECTION(sounddialog
));
1364 /* If they type in a directory, change there */
1365 if (file_is_dir(file
, sounddialog
))
1368 /* Let's just be safe */
1369 if (sound_file
[snd
])
1370 g_free(sound_file
[snd
]);
1372 /* Set it -- and forget it */
1373 sound_file
[snd
] = g_strdup(file
);
1375 /* Set our text entry */
1376 gtk_entry_set_text(GTK_ENTRY(sound_entry
), sound_file
[snd
]);
1378 /* Close the window! It's getting cold in here! */
1379 close_sounddialog(NULL
, sounddialog
);
1382 g_free(last_sound_dir
);
1383 last_sound_dir
= g_dirname(sound_file
[snd
]);
1386 static void sel_sound(GtkWidget
*button
, gpointer being_NULL_is_fun
)
1388 char *buf
= g_malloc(BUF_LEN
);
1391 sounddialog
= gtk_file_selection_new(_("Gaim - Sound Configuration"));
1393 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(sounddialog
));
1395 g_snprintf(buf
, BUF_LEN
- 1, "%s" G_DIR_SEPARATOR_S
, last_sound_dir
? last_sound_dir
: gaim_home_dir());
1397 gtk_file_selection_set_filename(GTK_FILE_SELECTION(sounddialog
), buf
);
1399 g_signal_connect(GTK_OBJECT(sounddialog
), "destroy",
1400 G_CALLBACK(close_sounddialog
), sounddialog
);
1402 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(sounddialog
)->ok_button
),
1403 "clicked", G_CALLBACK(do_select_sound
), (int *)sound_row_sel
);
1405 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(sounddialog
)->cancel_button
),
1406 "clicked", G_CALLBACK(close_sounddialog
), sounddialog
);
1410 gtk_widget_show(sounddialog
);
1411 gdk_window_raise(sounddialog
->window
);
1415 static void prefs_sound_sel (GtkTreeSelection
*sel
, GtkTreeModel
*model
) {
1417 GValue val
= { 0, };
1419 if (! gtk_tree_selection_get_selected (sel
, &model
, &iter
))
1421 gtk_tree_model_get_value (model
, &iter
, 2, &val
);
1422 sound_row_sel
= g_value_get_uint(&val
);
1424 gtk_entry_set_text(GTK_ENTRY(sound_entry
), sound_file
[sound_row_sel
] ? sound_file
[sound_row_sel
] : "(default)");
1425 g_value_unset (&val
);
1427 gtk_widget_destroy(sounddialog
);
1430 GtkWidget
*sound_events_page() {
1434 GtkWidget
*button
, *hbox
;
1436 GtkWidget
*event_view
;
1437 GtkListStore
*event_store
;
1438 GtkCellRenderer
*rend
;
1439 GtkTreeViewColumn
*col
;
1440 GtkTreeSelection
*sel
;
1444 ret
= gtk_vbox_new(FALSE
, 18);
1445 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
1447 sw
= gtk_scrolled_window_new(NULL
,NULL
);
1448 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw
), GTK_POLICY_NEVER
, GTK_POLICY_AUTOMATIC
);
1449 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw
), GTK_SHADOW_IN
);
1451 gtk_box_pack_start(GTK_BOX(ret
), sw
, TRUE
, TRUE
, 0);
1452 event_store
= gtk_list_store_new (3, G_TYPE_BOOLEAN
, G_TYPE_STRING
, G_TYPE_UINT
);
1454 for (j
=0; j
< NUM_SOUNDS
; j
++) {
1455 if (sounds
[j
].opt
== 0)
1458 gtk_list_store_append (event_store
, &iter
);
1459 gtk_list_store_set(event_store
, &iter
,
1460 0, sound_options
& sounds
[j
].opt
,
1461 1, gettext(sounds
[j
].label
),
1465 event_view
= gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store
));
1467 rend
= gtk_cell_renderer_toggle_new();
1468 sel
= gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view
));
1469 g_signal_connect (G_OBJECT (sel
), "changed",
1470 G_CALLBACK (prefs_sound_sel
),
1472 g_signal_connect (G_OBJECT(rend
), "toggled",
1473 G_CALLBACK(event_toggled
), event_store
);
1474 path
= gtk_tree_path_new_first();
1475 gtk_tree_selection_select_path(sel
, path
);
1476 gtk_tree_path_free(path
);
1478 col
= gtk_tree_view_column_new_with_attributes (_("Play"),
1482 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view
), col
);
1484 rend
= gtk_cell_renderer_text_new();
1485 col
= gtk_tree_view_column_new_with_attributes (_("Event"),
1489 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view
), col
);
1490 g_object_unref(G_OBJECT(event_store
));
1491 gtk_container_add(GTK_CONTAINER(sw
), event_view
);
1493 hbox
= gtk_hbox_new(FALSE
, 6);
1494 gtk_box_pack_start(GTK_BOX(ret
), hbox
, FALSE
, FALSE
, 0);
1495 sound_entry
= gtk_entry_new();
1496 gtk_entry_set_text(GTK_ENTRY(sound_entry
), sound_file
[0] ? sound_file
[0] : "(default)");
1497 gtk_entry_set_editable(GTK_ENTRY(sound_entry
), FALSE
);
1498 gtk_box_pack_start(GTK_BOX(hbox
), sound_entry
, FALSE
, FALSE
, 5);
1500 button
= gtk_button_new_with_label(_("Test"));
1501 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(test_sound
), NULL
);
1502 gtk_box_pack_start(GTK_BOX(hbox
), button
, FALSE
, FALSE
, 1);
1504 button
= gtk_button_new_with_label(_("Reset"));
1505 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(reset_sound
), NULL
);
1506 gtk_box_pack_start(GTK_BOX(hbox
), button
, FALSE
, FALSE
, 1);
1508 button
= gtk_button_new_with_label(_("Choose..."));
1509 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(sel_sound
), NULL
);
1510 gtk_box_pack_start(GTK_BOX(hbox
), button
, FALSE
, FALSE
, 1);
1512 gtk_widget_show_all (ret
);
1517 void away_message_sel(GtkTreeSelection
*sel
, GtkTreeModel
*model
)
1520 GValue val
= { 0, };
1521 gchar buffer
[BUF_LONG
];
1523 struct away_message
*am
;
1525 if (! gtk_tree_selection_get_selected (sel
, &model
, &iter
))
1527 gtk_tree_model_get_value (model
, &iter
, 1, &val
);
1528 am
= g_value_get_pointer(&val
);
1529 gtk_imhtml_clear(GTK_IMHTML(away_text
));
1530 strncpy(buffer
, am
->message
, BUF_LONG
);
1531 tmp
= stylize(buffer
, BUF_LONG
);
1532 gtk_imhtml_append_text(GTK_IMHTML(away_text
), tmp
, -1, GTK_IMHTML_NO_TITLE
|
1533 GTK_IMHTML_NO_COMMENTS
| GTK_IMHTML_NO_SCROLL
);
1534 gtk_imhtml_append_text(GTK_IMHTML(away_text
), "<BR>", -1, GTK_IMHTML_NO_TITLE
|
1535 GTK_IMHTML_NO_COMMENTS
| GTK_IMHTML_NO_SCROLL
);
1537 g_value_unset (&val
);
1541 void remove_away_message(GtkWidget
*widget
, GtkTreeView
*tv
) {
1542 struct away_message
*am
;
1545 GtkTreeStore
*ts
= GTK_TREE_STORE(gtk_tree_view_get_model(tv
));
1546 GtkTreeSelection
*sel
= gtk_tree_view_get_selection(tv
);
1547 GtkTreeModel
*model
= GTK_TREE_MODEL(prefs_away_store
);
1548 GValue val
= { 0, };
1550 if (! gtk_tree_selection_get_selected (sel
, &model
, &iter
))
1552 gtk_tree_model_get_value (GTK_TREE_MODEL(prefs_away_store
), &iter
, 1, &val
);
1553 am
= g_value_get_pointer (&val
);
1554 gtk_imhtml_clear(GTK_IMHTML(away_text
));
1555 rem_away_mess(NULL
, am
);
1556 gtk_list_store_remove(GTK_LIST_STORE(ts
), &iter
);
1557 path
= gtk_tree_path_new_first();
1558 gtk_tree_selection_select_path(sel
, path
);
1559 gtk_tree_path_free(path
);
1562 GtkWidget
*away_message_page() {
1568 GtkWidget
*event_view
;
1569 GtkCellRenderer
*rend
;
1570 GtkTreeViewColumn
*col
;
1571 GtkTreeSelection
*sel
;
1572 GSList
*awy
= away_messages
;
1573 struct away_message
*a
;
1577 ret
= gtk_vbox_new(FALSE
, 18);
1578 gtk_container_set_border_width (GTK_CONTAINER (ret
), 12);
1580 sg
= gtk_size_group_new(GTK_SIZE_GROUP_BOTH
);
1582 sw
= gtk_scrolled_window_new(NULL
,NULL
);
1583 away_text
= gtk_imhtml_new(NULL
, NULL
);
1584 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw
), GTK_POLICY_NEVER
, GTK_POLICY_ALWAYS
);
1586 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
1588 gtk_box_pack_start(GTK_BOX(ret
), sw
, TRUE
, TRUE
, 0);
1590 prefs_away_store
= gtk_list_store_new (2, G_TYPE_STRING
, G_TYPE_POINTER
);
1592 a
= (struct away_message
*)awy
->data
;
1593 gtk_list_store_append (prefs_away_store
, &iter
);
1594 gtk_list_store_set(prefs_away_store
, &iter
,
1599 event_view
= gtk_tree_view_new_with_model (GTK_TREE_MODEL(prefs_away_store
));
1602 rend
= gtk_cell_renderer_text_new();
1603 col
= gtk_tree_view_column_new_with_attributes ("NULL",
1607 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view
), col
);
1608 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(event_view
), FALSE
);
1609 gtk_widget_show(event_view
);
1610 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw
), event_view
);
1612 sw2
= gtk_scrolled_window_new(NULL
, NULL
);
1613 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2
),
1614 GTK_POLICY_AUTOMATIC
, GTK_POLICY_ALWAYS
);
1615 gtk_box_pack_start(GTK_BOX(ret
), sw2
, TRUE
, TRUE
, 0);
1617 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2
), away_text
);
1618 gaim_setup_imhtml(away_text
);
1619 sel
= gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view
));
1620 g_signal_connect (G_OBJECT (sel
), "changed",
1621 G_CALLBACK (away_message_sel
),
1623 hbox
= gtk_hbox_new(TRUE
, 5);
1624 gtk_box_pack_start(GTK_BOX(ret
), hbox
, FALSE
, FALSE
, 0);
1625 button
= gtk_button_new_from_stock (GTK_STOCK_ADD
);
1626 gtk_box_pack_start(GTK_BOX(hbox
), button
, FALSE
, FALSE
, 0);
1627 gtk_size_group_add_widget(sg
, button
);
1628 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(create_away_mess
), NULL
);
1630 button
= gtk_button_new_from_stock (GTK_STOCK_REMOVE
);
1631 gtk_size_group_add_widget(sg
, button
);
1632 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(remove_away_message
), event_view
);
1634 gtk_box_pack_start(GTK_BOX(hbox
), button
, FALSE
, FALSE
, 0);
1636 button
= gaim_pixbuf_button(_("_Edit"), "edit.png", GAIM_BUTTON_HORIZONTAL
);
1637 gtk_size_group_add_widget(sg
, button
);
1638 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(create_away_mess
), event_view
);
1639 gtk_box_pack_start(GTK_BOX(hbox
), button
, FALSE
, FALSE
, 0);
1641 gtk_widget_show_all(ret
);
1645 GtkTreeIter
*prefs_notebook_add_page(char *text
,
1649 GtkTreeIter
*parent
,
1651 GdkPixbuf
*icon
= NULL
;
1654 icon
= gdk_pixbuf_scale_simple (pixbuf
, 18, 18, GDK_INTERP_BILINEAR
);
1656 gtk_tree_store_append (prefstree
, iter
, parent
);
1657 gtk_tree_store_set (prefstree
, iter
, 0, icon
, 1, text
, 2, ind
, -1);
1660 g_object_unref(pixbuf
);
1662 g_object_unref(icon
);
1663 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook
), page
, gtk_label_new(text
));
1667 void prefs_notebook_init() {
1670 GtkWidget
*(*config
)();
1672 struct gaim_plugin
*plug
;
1674 prefs_notebook_add_page(_("Interface"), NULL
, interface_page(), &p
, NULL
, notebook_page
++);
1675 prefs_notebook_add_page(_("Themes"), NULL
, theme_page(), &c
, &p
, notebook_page
++);
1676 prefs_notebook_add_page(_("Fonts"), NULL
, font_page(), &c
, &p
, notebook_page
++);
1677 prefs_notebook_add_page(_("Message Text"), NULL
, messages_page(), &c
, &p
, notebook_page
++);
1678 prefs_notebook_add_page(_("Shortcuts"), NULL
, hotkeys_page(), &c
, &p
, notebook_page
++);
1679 prefs_notebook_add_page(_("Buddy List"), NULL
, list_page(), &c
, &p
, notebook_page
++);
1680 prefs_notebook_add_page(_("IM Window"), NULL
, im_page(), &c
, &p
, notebook_page
++);
1681 prefs_notebook_add_page(_("Chat Window"), NULL
, chat_page(), &c
, &p
, notebook_page
++);
1682 prefs_notebook_add_page(_("Tabs"), NULL
, tab_page(), &c
, &p
, notebook_page
++);
1683 prefs_notebook_add_page(_("Proxy"), NULL
, proxy_page(), &p
, NULL
, notebook_page
++);
1685 /* We use the registered default browser in windows */
1686 prefs_notebook_add_page(_("Browser"), NULL
, browser_page(), &p
, NULL
, notebook_page
++);
1688 prefs_notebook_add_page(_("Logging"), NULL
, logging_page(), &p
, NULL
, notebook_page
++);
1689 prefs_notebook_add_page(_("Sounds"), NULL
, sound_page(), &p
, NULL
, notebook_page
++);
1690 prefs_notebook_add_page(_("Sound Events"), NULL
, sound_events_page(), &c
, &p
, notebook_page
++);
1691 prefs_notebook_add_page(_("Away / Idle"), NULL
, away_page(), &p
, NULL
, notebook_page
++);
1692 prefs_notebook_add_page(_("Away Messages"), NULL
, away_message_page(), &c
, &p
, notebook_page
++);
1694 prefs_notebook_add_page(_("Plugins"), NULL
, plugin_page(), &plugin_iter
, NULL
, notebook_page
++);
1697 if (plug
->type
== plugin
&& g_module_symbol(plug
->handle
, "gaim_plugin_config_gtk", (gpointer
*)&config
)) {
1698 plug
->iter
= g_new0(GtkTreeIter
, 1);
1699 prefs_notebook_add_page(plug
->desc
.name
, NULL
, config(), plug
->iter
, &plugin_iter
, notebook_page
++);
1708 GtkWidget
*vbox
, *vbox2
;
1711 GtkTreeViewColumn
*column
;
1712 GtkCellRenderer
*cell
;
1713 GtkTreeSelection
*sel
;
1714 GtkWidget
*notebook
;
1717 GtkSizeGroup
*sg
= gtk_size_group_new(GTK_SIZE_GROUP_BOTH
);
1720 gtk_window_present(GTK_WINDOW(prefs
));
1724 /* copy the preferences to tmp values...
1725 * I liked "take affect immediately" Oh well :-( */
1727 /* Back to instant-apply! I win! BU-HAHAHA! */
1729 /* Create the window */
1730 prefs
= gtk_window_new(GTK_WINDOW_TOPLEVEL
);
1731 gtk_window_set_role(GTK_WINDOW(prefs
), "preferences");
1732 gtk_widget_realize(prefs
);
1733 gtk_window_set_title(GTK_WINDOW(prefs
), _("Gaim - Preferences"));
1734 gtk_window_set_policy (GTK_WINDOW(prefs
), FALSE
, FALSE
, TRUE
);
1735 g_signal_connect(GTK_OBJECT(prefs
), "destroy", G_CALLBACK(delete_prefs
), NULL
);
1737 vbox
= gtk_vbox_new(FALSE
, 5);
1738 gtk_container_border_width(GTK_CONTAINER(vbox
), 5);
1739 gtk_container_add(GTK_CONTAINER(prefs
), vbox
);
1740 gtk_widget_show(vbox
);
1742 hbox
= gtk_hbox_new (FALSE
, 6);
1743 gtk_container_set_border_width (GTK_CONTAINER (hbox
), 6);
1744 gtk_container_add (GTK_CONTAINER(vbox
), hbox
);
1745 gtk_widget_show (hbox
);
1747 frame
= gtk_frame_new (NULL
);
1748 gtk_frame_set_shadow_type (GTK_FRAME (frame
), GTK_SHADOW_IN
);
1749 gtk_box_pack_start (GTK_BOX (hbox
), frame
, FALSE
, FALSE
, 0);
1750 gtk_widget_show (frame
);
1752 /* The tree -- much inspired by the Gimp */
1753 prefstree
= gtk_tree_store_new (3, GDK_TYPE_PIXBUF
, G_TYPE_STRING
, G_TYPE_INT
);
1754 tree_v
= gtk_tree_view_new_with_model (GTK_TREE_MODEL (prefstree
));
1755 gtk_container_add (GTK_CONTAINER (frame
), tree_v
);
1757 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_v
), FALSE
);
1758 gtk_widget_show(tree_v
);
1760 cell
= gtk_cell_renderer_pixbuf_new ();
1761 column
= gtk_tree_view_column_new_with_attributes ("icons", cell
, "pixbuf", 0, NULL
);
1764 cell
= gtk_cell_renderer_text_new ();
1765 column
= gtk_tree_view_column_new_with_attributes ("text", cell
, "text", 1, NULL
);
1767 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_v
), column
);
1769 /* The right side */
1770 frame
= gtk_frame_new (NULL
);
1771 gtk_frame_set_shadow_type (GTK_FRAME (frame
), GTK_SHADOW_IN
);
1772 gtk_box_pack_start (GTK_BOX (hbox
), frame
, TRUE
, TRUE
, 0);
1773 gtk_widget_show (frame
);
1775 vbox2
= gtk_vbox_new (FALSE
, 4);
1776 gtk_container_add (GTK_CONTAINER (frame
), vbox2
);
1777 gtk_widget_show (vbox2
);
1779 frame
= gtk_frame_new (NULL
);
1780 gtk_frame_set_shadow_type (GTK_FRAME (frame
), GTK_SHADOW_OUT
);
1781 gtk_box_pack_start (GTK_BOX (vbox2
), frame
, FALSE
, TRUE
, 0);
1782 gtk_widget_show (frame
);
1784 hbox
= gtk_hbox_new (FALSE
, 4);
1785 gtk_container_set_border_width (GTK_CONTAINER (hbox
), 4);
1786 gtk_container_add (GTK_CONTAINER (frame
), hbox
);
1787 gtk_widget_show (hbox
);
1789 preflabel
= gtk_label_new(NULL
);
1790 gtk_box_pack_end (GTK_BOX (hbox
), preflabel
, FALSE
, FALSE
, 0);
1791 gtk_widget_show (preflabel
);
1794 prefsnotebook
= notebook
= gtk_notebook_new ();
1795 gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook
), FALSE
);
1796 gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook
), FALSE
);
1797 gtk_box_pack_start (GTK_BOX (vbox2
), notebook
, FALSE
, FALSE
, 0);
1799 sel
= gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_v
));
1800 g_signal_connect (G_OBJECT (sel
), "changed",
1801 G_CALLBACK (pref_nb_select
),
1803 gtk_widget_show(notebook
);
1804 sep
= gtk_hseparator_new();
1805 gtk_widget_show(sep
);
1806 gtk_box_pack_start (GTK_BOX (vbox
), sep
, FALSE
, FALSE
, 0);
1808 /* The buttons^H to press! */
1809 hbox
= gtk_hbox_new (FALSE
, 6);
1810 gtk_container_set_border_width (GTK_CONTAINER (hbox
), 6);
1811 gtk_container_add (GTK_CONTAINER(vbox
), hbox
);
1812 gtk_widget_show (hbox
);
1814 button
= gtk_button_new_from_stock (GTK_STOCK_CLOSE
);
1815 gtk_size_group_add_widget(sg
, button
);
1816 g_signal_connect_swapped(GTK_OBJECT(button
), "clicked", G_CALLBACK(gtk_widget_destroy
), prefs
);
1817 gtk_box_pack_end(GTK_BOX(hbox
), button
, FALSE
, FALSE
, 0);
1818 gtk_widget_show(button
);
1820 prefs_notebook_init();
1822 gtk_tree_view_expand_all (GTK_TREE_VIEW(tree_v
));
1823 gtk_widget_show(prefs
);
1826 static gint
debug_delete(GtkWidget
*w
, GdkEvent
*event
, void *dummy
)
1829 gtk_button_clicked(GTK_BUTTON(debugbutton
));
1830 if (misc_options
& OPT_MISC_DEBUG
) {
1831 misc_options
^= OPT_MISC_DEBUG
;
1839 static void build_debug()
1842 GtkTextBuffer
*buffer
;
1846 dw
= g_new0(struct debug_window
, 1);
1848 GAIM_DIALOG(dw
->window
);
1849 gtk_window_set_default_size(GTK_WINDOW(dw
->window
), 500, 200);
1850 gtk_window_set_role(GTK_WINDOW(dw
->window
), "debug");
1851 gtk_window_set_title(GTK_WINDOW(dw
->window
), _("Gaim - Debug Window"));
1852 g_signal_connect(G_OBJECT(dw
->window
), "delete_event", G_CALLBACK(debug_delete
), NULL
);
1854 sw
= gtk_scrolled_window_new(NULL
, NULL
);
1855 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw
),
1859 dw
->entry
= gtk_text_view_new();
1860 gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(dw
->entry
), FALSE
);
1861 gtk_text_view_set_editable(GTK_TEXT_VIEW(dw
->entry
), FALSE
);
1862 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(dw
->entry
), GTK_WRAP_WORD
);
1864 buffer
= gtk_text_view_get_buffer(GTK_TEXT_VIEW(dw
->entry
));
1865 gtk_text_buffer_get_end_iter(buffer
, &end
);
1866 gtk_text_buffer_create_mark(buffer
, "end", &end
, FALSE
);
1868 gtk_container_add(GTK_CONTAINER(sw
), dw
->entry
);
1869 gtk_container_add(GTK_CONTAINER(dw
->window
), sw
);
1870 gtk_widget_show_all(dw
->window
);
1875 if ((misc_options
& OPT_MISC_DEBUG
)) {
1876 if (!dw
|| !dw
->window
)
1878 gtk_widget_show(dw
->window
);
1882 gtk_widget_destroy(dw
->window
);
1887 void debug_printf(char *fmt
, ...)
1893 s
= g_strdup_vprintf(fmt
, ap
);
1896 if (misc_options
& OPT_MISC_DEBUG
&& dw
) {
1897 GtkTextBuffer
*buffer
;
1898 GtkTextMark
*endmark
;
1901 buffer
= gtk_text_view_get_buffer(GTK_TEXT_VIEW(dw
->entry
));
1902 endmark
= gtk_text_buffer_get_mark(buffer
, "end");
1903 gtk_text_buffer_get_iter_at_mark(buffer
, &end
, endmark
);
1904 gtk_text_buffer_insert(buffer
, &end
, s
, -1);
1905 gtk_text_view_scroll_mark_onscreen(GTK_TEXT_VIEW(dw
->entry
), endmark
);
1912 void set_option(GtkWidget
*w
, int *option
)
1914 *option
= !(*option
);
1917 static void set_misc_option(GtkWidget
*w
, int option
)
1919 misc_options
^= option
;
1921 if (option
== OPT_MISC_DEBUG
)
1923 else if(option
== OPT_MISC_USE_SERVER_ALIAS
) {
1926 gaim_conversation_foreach(gaim_conversation_autoset_title
);
1930 static void set_logging_option(GtkWidget
*w
, int option
)
1932 logging_options
^= option
;
1934 if (option
== OPT_LOG_CONVOS
|| option
== OPT_LOG_CHATS
)
1938 static void set_blist_option(GtkWidget
*w
, int option
)
1940 blist_options
^= option
;
1945 if (option
== OPT_BLIST_NO_BUTTONS
)
1946 build_imchat_box(!(blist_options
& OPT_BLIST_NO_BUTTONS
));
1948 if (option
== OPT_BLIST_SHOW_GRPNUM
)
1949 update_num_groups();
1951 if (option
== OPT_BLIST_NO_MT_GRP
)
1952 toggle_show_empty_groups();
1954 if ((option
== OPT_BLIST_SHOW_BUTTON_XPM
) || (option
== OPT_BLIST_NO_BUTTONS
))
1955 update_button_pix();
1957 if (option
== OPT_BLIST_SHOW_PIXMAPS
)
1958 toggle_buddy_pixmaps();
1960 if ((option
== OPT_BLIST_GREY_IDLERS
) || (option
== OPT_BLIST_SHOW_IDLETIME
))
1961 update_idle_times();
1965 static void set_convo_option(GtkWidget
*w
, int option
)
1967 convo_options
^= option
;
1969 if (option
== OPT_CONVO_SHOW_SMILEY
)
1970 gaim_gtkconv_toggle_smileys();
1972 if (option
== OPT_CONVO_SHOW_TIME
)
1973 gaim_gtkconv_toggle_timestamps();
1975 if (option
== OPT_CONVO_CHECK_SPELLING
)
1976 gaim_gtkconv_toggle_spellchk();
1978 if (option
== OPT_CONVO_NO_X_ON_TAB
)
1979 gaim_gtkconv_toggle_close_buttons();
1982 static void set_im_option(GtkWidget
*w
, int option
)
1984 im_options
^= option
;
1987 if (option
== OPT_IM_ONE_WINDOW
)
1991 if (option
== OPT_IM_HIDE_ICONS
)
1992 gaim_gtkconv_hide_buddy_icons();
1994 if (option
== OPT_IM_ALIAS_TAB
)
1995 gaim_conversation_foreach(gaim_conversation_autoset_title
);
1997 if (option
== OPT_IM_NO_ANIMATION
)
1998 gaim_gtkconv_set_anim();
2001 static void set_chat_option(GtkWidget
*w
, int option
)
2003 chat_options
^= option
;
2006 if (option
== OPT_CHAT_ONE_WINDOW
)
2011 void set_sound_option(GtkWidget
*w
, int option
)
2013 sound_options
^= option
;
2016 static void set_font_option(GtkWidget
*w
, int option
)
2018 font_options
^= option
;
2020 gaim_gtkconv_update_font_buttons();
2023 static void set_away_option(GtkWidget
*w
, int option
)
2025 away_options
^= option
;
2027 if (option
== OPT_AWAY_QUEUE
)
2028 toggle_away_queue();
2031 GtkWidget
*gaim_button(const char *text
, guint
*options
, int option
, GtkWidget
*page
)
2034 button
= gtk_check_button_new_with_mnemonic(text
);
2035 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button
), (*options
& option
));
2036 gtk_box_pack_start(GTK_BOX(page
), button
, FALSE
, FALSE
, 0);
2037 gtk_object_set_user_data(GTK_OBJECT(button
), options
);
2039 if (options
== &misc_options
) {
2040 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(set_misc_option
),
2042 } else if (options
== &logging_options
) {
2043 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(set_logging_option
),
2045 } else if (options
== &blist_options
) {
2046 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(set_blist_option
),
2048 } else if (options
== &convo_options
) {
2049 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(set_convo_option
),
2051 } else if (options
== &im_options
) {
2052 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(set_im_option
),
2054 } else if (options
== &chat_options
) {
2055 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(set_chat_option
),
2057 } else if (options
== &font_options
) {
2058 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(set_font_option
),
2060 } else if (options
== &sound_options
) {
2061 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(set_sound_option
),
2063 } else if (options
== &away_options
) {
2064 g_signal_connect(GTK_OBJECT(button
), "clicked", G_CALLBACK(set_away_option
),
2067 debug_printf("gaim_button: \"%s\" has no signal handler attached to it!\n", text
);
2069 gtk_widget_show(button
);
2074 void away_list_clicked(GtkWidget
*widget
, struct away_message
*a
)
2076 void default_away_menu_init(GtkWidget
*omenu
)
2078 GtkWidget
*menu
, *opt
;
2080 GSList
*awy
= away_messages
;
2081 struct away_message
*a
;
2083 menu
= gtk_menu_new();
2086 a
= (struct away_message
*)awy
->data
;
2087 opt
= gtk_menu_item_new_with_label(a
->name
);
2088 g_signal_connect(GTK_OBJECT(opt
), "activate", G_CALLBACK(set_default_away
),
2090 gtk_widget_show(opt
);
2091 gtk_menu_append(GTK_MENU(menu
), opt
);
2097 gtk_option_menu_remove_menu(GTK_OPTION_MENU(omenu
));
2098 gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu
), menu
);
2099 gtk_option_menu_set_history(GTK_OPTION_MENU(omenu
), g_slist_index(away_messages
, default_away
));
2102 GtkWidget
*pref_fg_picture
= NULL
;
2103 GtkWidget
*pref_bg_picture
= NULL
;
2105 void destroy_colorsel(GtkWidget
*w
, gpointer d
)
2108 gtk_widget_destroy(fgcseld
);
2111 gtk_widget_destroy(bgcseld
);
2116 void apply_color_dlg(GtkWidget
*w
, gpointer d
)
2119 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION
2120 (GTK_COLOR_SELECTION_DIALOG(fgcseld
)->colorsel
),
2122 destroy_colorsel(NULL
, (void *)1);
2123 update_color(NULL
, pref_fg_picture
);
2125 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION
2126 (GTK_COLOR_SELECTION_DIALOG(bgcseld
)->colorsel
),
2128 destroy_colorsel(NULL
, (void *)0);
2129 update_color(NULL
, pref_bg_picture
);
2131 gaim_conversation_foreach(gaim_gtkconv_update_font_colors
);
2134 void update_color(GtkWidget
*w
, GtkWidget
*pic
)
2140 if (pic
== pref_fg_picture
) {
2141 if (font_options
& OPT_FONT_FGCOL
) {
2142 c
.red
= fgcolor
.red
;
2143 c
.blue
= fgcolor
.blue
;
2144 c
.green
= fgcolor
.green
;
2151 if (font_options
& OPT_FONT_BGCOL
) {
2152 c
.red
= bgcolor
.red
;
2153 c
.blue
= bgcolor
.blue
;
2154 c
.green
= bgcolor
.green
;
2162 style
= gtk_style_new();
2164 gtk_widget_set_style(pic
, style
);
2165 g_object_unref(style
);
2168 void set_default_away(GtkWidget
*w
, gpointer i
)
2171 int length
= g_slist_length(away_messages
);
2173 if (away_messages
== NULL
)
2174 default_away
= NULL
;
2175 else if ((int)i
>= length
)
2176 default_away
= g_slist_nth_data(away_messages
, length
- 1);
2178 default_away
= g_slist_nth_data(away_messages
, (int)i
);
2181 static gboolean
program_is_valid(const char *program
)
2183 GError
*error
= NULL
;
2185 gboolean is_valid
= FALSE
;
2187 if (program
== NULL
|| *program
== '\0') {
2191 if (!g_shell_parse_argv(program
, NULL
, &argv
, &error
)) {
2192 debug_printf("Could not parse program '%s': ", error
->message
);
2200 is_valid
= g_find_program_in_path(argv
[0]) != NULL
;
2207 static void update_spin_value(GtkWidget
*w
, GtkWidget
*spin
)
2209 int *value
= gtk_object_get_user_data(GTK_OBJECT(spin
));
2210 *value
= gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin
));
2213 GtkWidget
*gaim_labeled_spin_button(GtkWidget
*box
, const gchar
*title
, int *val
, int min
, int max
, GtkSizeGroup
*sg
)
2220 hbox
= gtk_hbox_new(FALSE
, 5);
2221 gtk_box_pack_start(GTK_BOX(box
), hbox
, FALSE
, FALSE
, 5);
2222 gtk_widget_show(hbox
);
2224 label
= gtk_label_new_with_mnemonic(title
);
2225 gtk_box_pack_start(GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
2226 gtk_widget_show(label
);
2228 adjust
= gtk_adjustment_new(*val
, min
, max
, 1, 1, 1);
2229 spin
= gtk_spin_button_new(GTK_ADJUSTMENT(adjust
), 1, 0);
2230 gtk_object_set_user_data(GTK_OBJECT(spin
), val
);
2231 gtk_widget_set_usize(spin
, 50, -1);
2232 gtk_box_pack_start(GTK_BOX(hbox
), spin
, FALSE
, FALSE
, 0);
2233 g_signal_connect(GTK_OBJECT(adjust
), "value-changed",
2234 G_CALLBACK(update_spin_value
), GTK_WIDGET(spin
));
2235 gtk_widget_show(spin
);
2237 gtk_label_set_mnemonic_widget(GTK_LABEL(label
), spin
);
2240 gtk_size_group_add_widget(sg
, label
);
2241 gtk_misc_set_alignment(GTK_MISC(label
), 0, 0);
2247 void dropdown_set(GtkObject
*w
, int *option
)
2249 int opt
= (int)gtk_object_get_user_data(w
);
2250 int clear
= (int)gtk_object_get_data(w
, "clear");
2253 *option
= *option
& ~clear
;
2254 *option
= *option
| opt
;
2256 debug_printf("HELLO %d\n", opt
);
2260 if (option
== (int*)&proxytype
) {
2261 if (opt
== PROXY_NONE
)
2262 gtk_widget_set_sensitive(prefs_proxy_frame
, FALSE
);
2264 gtk_widget_set_sensitive(prefs_proxy_frame
, TRUE
);
2265 } else if (option
== &web_browser
) {
2266 if (opt
== BROWSER_MANUAL
)
2267 gtk_widget_set_sensitive(gtk_widget_get_parent(browser_entry
), TRUE
);
2269 gtk_widget_set_sensitive(gtk_widget_get_parent(browser_entry
), FALSE
);
2270 } else if (option
== (int*)&sound_options
) {
2271 if (opt
== OPT_SOUND_CMD
)
2272 gtk_widget_set_sensitive(sndcmd
, TRUE
);
2274 gtk_widget_set_sensitive(sndcmd
, FALSE
);
2275 } else if (option
== (int*)&im_options
) {
2276 if (clear
== (OPT_IM_SIDE_TAB
| OPT_IM_BR_TAB
))
2277 gaim_gtkconv_update_tabs();
2278 /* CONV XXX update_im_tabs(); */
2279 else if (clear
== (OPT_IM_BUTTON_TEXT
| OPT_IM_BUTTON_XPM
))
2280 gaim_gtkconv_update_im_button_style();
2281 } else if (option
== (int*)&chat_options
) {
2282 if (clear
== (OPT_CHAT_SIDE_TAB
| OPT_CHAT_BR_TAB
))
2283 gaim_gtkconv_update_tabs();
2284 /* CONV XXX update_chat_tabs(); */
2285 else if (clear
== (OPT_CHAT_BUTTON_TEXT
| OPT_CHAT_BUTTON_XPM
))
2286 gaim_gtkconv_update_chat_button_style();
2287 } else if (option
== (int*)&blist_options
) {
2292 static GtkWidget
*gaim_dropdown(GtkWidget
*box
, const gchar
*title
, int *option
, int clear
, ...)
2295 GList
*menuitems
= NULL
;
2296 GtkWidget
*dropdown
= NULL
;
2300 va_start(ap
, clear
);
2301 while ((name
= va_arg(ap
, char *)) != NULL
) {
2302 id
= va_arg(ap
, int);
2304 menuitems
= g_list_prepend(menuitems
, name
);
2305 menuitems
= g_list_prepend(menuitems
, GINT_TO_POINTER(id
));
2309 g_return_val_if_fail(menuitems
!= NULL
, NULL
);
2311 menuitems
= g_list_reverse(menuitems
);
2313 dropdown
= gaim_dropdown_from_list(box
, title
, option
, clear
, menuitems
);
2315 g_list_free(menuitems
);
2320 static GtkWidget
*gaim_dropdown_from_list(GtkWidget
*box
, const gchar
*title
, int *option
, int clear
, GList
*menuitems
)
2322 GtkWidget
*dropdown
, *opt
, *menu
;
2329 g_return_val_if_fail(menuitems
!= NULL
, NULL
);
2331 hbox
= gtk_hbox_new(FALSE
, 5);
2332 gtk_container_add (GTK_CONTAINER (box
), hbox
);
2333 gtk_widget_show(hbox
);
2335 label
= gtk_label_new_with_mnemonic(title
);
2336 gtk_box_pack_start(GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
2337 gtk_widget_show(label
);
2339 dropdown
= gtk_option_menu_new();
2340 menu
= gtk_menu_new();
2342 gtk_label_set_mnemonic_widget(GTK_LABEL(label
), dropdown
);
2344 while (menuitems
!= NULL
&& (text
= (char *) menuitems
->data
) != NULL
) {
2345 menuitems
= g_list_next(menuitems
);
2346 g_return_val_if_fail(menuitems
!= NULL
, NULL
);
2347 value
= GPOINTER_TO_INT(menuitems
->data
);
2348 menuitems
= g_list_next(menuitems
);
2350 opt
= gtk_menu_item_new_with_label(text
);
2351 gtk_object_set_user_data(GTK_OBJECT(opt
), (void *)value
);
2352 gtk_object_set_data(GTK_OBJECT(opt
), "clear", (void *)clear
);
2353 g_signal_connect(GTK_OBJECT(opt
), "activate",
2354 G_CALLBACK(dropdown_set
), (void *)option
);
2355 gtk_widget_show(opt
);
2356 gtk_menu_shell_append(GTK_MENU_SHELL(menu
), opt
);
2358 if (((clear
> -1) && ((*option
& value
) == value
)) || *option
== value
) {
2359 gtk_menu_set_active(GTK_MENU(menu
), o
);
2365 gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown
), menu
);
2366 gtk_box_pack_start(GTK_BOX(hbox
), dropdown
, FALSE
, FALSE
, 0);
2367 gtk_widget_show(dropdown
);
2371 static GtkWidget
*show_color_pref(GtkWidget
*box
, gboolean fgc
)
2373 /* more stuff stolen from X-Chat */
2379 if (font_options
& OPT_FONT_FGCOL
) {
2380 c
.red
= fgcolor
.red
;
2381 c
.blue
= fgcolor
.blue
;
2382 c
.green
= fgcolor
.green
;
2389 if (font_options
& OPT_FONT_BGCOL
) {
2390 c
.red
= bgcolor
.red
;
2391 c
.blue
= bgcolor
.blue
;
2392 c
.green
= bgcolor
.green
;
2400 style
= gtk_style_new();
2403 swid
= gtk_event_box_new();
2404 gtk_widget_set_style(GTK_WIDGET(swid
), style
);
2405 g_object_unref(style
);
2406 gtk_widget_set_usize(GTK_WIDGET(swid
), 40, -1);
2407 gtk_box_pack_start(GTK_BOX(box
), swid
, FALSE
, FALSE
, 5);
2408 gtk_widget_show(swid
);
2412 void apply_font_dlg(GtkWidget
*w
, GtkWidget
*f
)
2417 fontname
= g_strdup(gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(f
)));
2418 destroy_fontsel(0, 0);
2420 while(fontname
[i
] && !isdigit(fontname
[i
]) && i
< sizeof(fontface
)) {
2421 fontface
[i
] = fontname
[i
];
2428 gaim_conversation_foreach(gaim_gtkconv_update_font_face
);