| 1194 gtk_widget_show_all(ret); |
1194 gtk_widget_show_all(ret); |
| 1195 return ret; |
1195 return ret; |
| 1196 } |
1196 } |
| 1197 |
1197 |
| 1198 #ifndef _WIN32 |
1198 #ifndef _WIN32 |
| |
1199 static gboolean program_is_valid(const char *program) |
| |
1200 { |
| |
1201 GError *error = NULL; |
| |
1202 char **argv; |
| |
1203 gchar *progname; |
| |
1204 gboolean is_valid = FALSE; |
| |
1205 |
| |
1206 if (program == NULL || *program == '\0') { |
| |
1207 return FALSE; |
| |
1208 } |
| |
1209 |
| |
1210 if (!g_shell_parse_argv(program, NULL, &argv, &error)) { |
| |
1211 gaim_debug(GAIM_DEBUG_ERROR, "program_is_valid", |
| |
1212 "Could not parse program '%s': %s\n", |
| |
1213 program, error->message); |
| |
1214 g_error_free(error); |
| |
1215 return FALSE; |
| |
1216 } |
| |
1217 |
| |
1218 if (argv == NULL) { |
| |
1219 return FALSE; |
| |
1220 } |
| |
1221 |
| |
1222 progname = g_find_program_in_path(argv[0]); |
| |
1223 is_valid = (progname != NULL); |
| |
1224 |
| |
1225 g_strfreev(argv); |
| |
1226 g_free(progname); |
| |
1227 |
| |
1228 return is_valid; |
| |
1229 } |
| |
1230 |
| 1199 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { |
1231 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { |
| 1200 const char *program = gtk_entry_get_text(GTK_ENTRY(entry)); |
1232 const char *program = gtk_entry_get_text(GTK_ENTRY(entry)); |
| 1201 |
1233 |
| 1202 if (!program_is_valid(program)) { |
1234 if (!program_is_valid(program)) { |
| 1203 char *error = g_strdup_printf(_("The entered manual browser " |
1235 char *error = g_strdup_printf(_("The entered manual browser " |
| 2293 return; |
2325 return; |
| 2294 } |
2326 } |
| 2295 |
2327 |
| 2296 /* copy the preferences to tmp values... |
2328 /* copy the preferences to tmp values... |
| 2297 * I liked "take affect immediately" Oh well :-( */ |
2329 * I liked "take affect immediately" Oh well :-( */ |
| 2298 |
2330 /* (that should have been "effect," right?) */ |
| |
2331 |
| 2299 /* Back to instant-apply! I win! BU-HAHAHA! */ |
2332 /* Back to instant-apply! I win! BU-HAHAHA! */ |
| 2300 |
2333 |
| 2301 /* Create the window */ |
2334 /* Create the window */ |
| 2302 prefs = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
2335 prefs = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
| 2303 gtk_window_set_role(GTK_WINDOW(prefs), "preferences"); |
2336 gtk_window_set_role(GTK_WINDOW(prefs), "preferences"); |
| 2399 gtk_tree_view_expand_all (GTK_TREE_VIEW(tree_v)); |
2432 gtk_tree_view_expand_all (GTK_TREE_VIEW(tree_v)); |
| 2400 gtk_widget_show(prefs); |
2433 gtk_widget_show(prefs); |
| 2401 } |
2434 } |
| 2402 |
2435 |
| 2403 #if 0 |
2436 #if 0 |
| 2404 static void set_misc_option(GtkWidget *w, const char *key) |
|
| 2405 { |
|
| 2406 |
|
| 2407 if(option == OPT_MISC_USE_SERVER_ALIAS) { |
|
| 2408 /* XXX blist reset the aliases here */ |
|
| 2409 gaim_conversation_foreach(gaim_conversation_autoset_title); |
|
| 2410 } |
|
| 2411 } |
|
| 2412 |
|
| 2413 static void set_logging_option(GtkWidget *w, int option) |
2437 static void set_logging_option(GtkWidget *w, int option) |
| 2414 { |
2438 { |
| 2415 logging_options ^= option; |
2439 logging_options ^= option; |
| 2416 |
2440 |
| 2417 if (option == OPT_LOG_CONVOS || option == OPT_LOG_CHATS) |
2441 if (option == OPT_LOG_CONVOS || option == OPT_LOG_CHATS) |
| 2418 update_log_convs(); |
2442 update_log_convs(); |
| 2419 } |
2443 } |
| 2420 |
2444 |
| 2421 static void set_blist_option(GtkWidget *w, int option) |
|
| 2422 { |
|
| 2423 struct gaim_gtk_buddy_list *gtkblist; |
|
| 2424 |
|
| 2425 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); |
|
| 2426 |
|
| 2427 blist_options ^= option; |
|
| 2428 |
|
| 2429 if (!gtkblist) |
|
| 2430 return; |
|
| 2431 |
|
| 2432 if (option == OPT_BLIST_SHOW_WARN) |
|
| 2433 gaim_gtk_blist_update_columns(); |
|
| 2434 else if (option == OPT_BLIST_SHOW_IDLETIME) { |
|
| 2435 gaim_gtk_blist_update_refresh_timeout(); |
|
| 2436 gaim_gtk_blist_update_columns(); |
|
| 2437 } |
|
| 2438 else if (option == OPT_BLIST_SHOW_ICONS) { |
|
| 2439 gaim_gtk_blist_update_refresh_timeout(); |
|
| 2440 gaim_gtk_blist_refresh(gaim_get_blist()); |
|
| 2441 gaim_gtk_blist_update_columns(); |
|
| 2442 } else |
|
| 2443 gaim_gtk_blist_refresh(gaim_get_blist()); |
|
| 2444 |
|
| 2445 } |
|
| 2446 |
|
| 2447 static void set_convo_option(GtkWidget *w, int option) |
2445 static void set_convo_option(GtkWidget *w, int option) |
| 2448 { |
2446 { |
| 2449 convo_options ^= option; |
2447 convo_options ^= option; |
| 2450 |
2448 |
| 2451 if (option == OPT_CONVO_SHOW_SMILEY) |
2449 if (option == OPT_CONVO_SHOW_SMILEY) |
| 2452 gaim_gtkconv_toggle_smileys(); |
2450 gaim_gtkconv_toggle_smileys(); |
| 2453 |
2451 |
| 2454 if (option == OPT_CONVO_SHOW_TIME) |
2452 if (option == OPT_CONVO_SHOW_TIME) |
| 2455 gaim_gtkconv_toggle_timestamps(); |
2453 gaim_gtkconv_toggle_timestamps(); |
| 2456 |
|
| 2457 if (option == OPT_CONVO_CHECK_SPELLING) |
|
| 2458 gaim_gtkconv_toggle_spellchk(); |
|
| 2459 |
|
| 2460 if (option == OPT_CONVO_NO_X_ON_TAB) |
|
| 2461 gaim_gtkconv_toggle_close_buttons(); |
|
| 2462 } |
2454 } |
| 2463 |
2455 |
| 2464 static void set_im_option(GtkWidget *w, int option) |
2456 static void set_im_option(GtkWidget *w, int option) |
| 2465 { |
2457 { |
| 2466 im_options ^= option; |
2458 im_options ^= option; |
| 2467 |
2459 |
| 2468 #if 0 |
2460 #if 0 |
| 2469 if (option == OPT_IM_ONE_WINDOW) |
2461 if (option == OPT_IM_ONE_WINDOW) |
| 2470 im_tabize(); |
2462 im_tabize(); |
| 2471 #endif |
2463 #endif |
| 2472 |
|
| 2473 if (option == OPT_IM_HIDE_ICONS) |
|
| 2474 gaim_gtkconv_hide_buddy_icons(); |
|
| 2475 |
|
| 2476 if (option == OPT_IM_ALIAS_TAB) |
|
| 2477 gaim_conversation_foreach(gaim_conversation_autoset_title); |
|
| 2478 |
|
| 2479 if (option == OPT_IM_NO_ANIMATION) |
|
| 2480 gaim_gtkconv_set_anim(); |
|
| 2481 } |
2464 } |
| 2482 |
2465 |
| 2483 static void set_chat_option(GtkWidget *w, int option) |
2466 static void set_chat_option(GtkWidget *w, int option) |
| 2484 { |
2467 { |
| 2485 chat_options ^= option; |
2468 chat_options ^= option; |
| 2486 |
2469 |
| 2487 #if 0 |
2470 #if 0 |
| 2488 if (option == OPT_CHAT_ONE_WINDOW) |
2471 if (option == OPT_CHAT_ONE_WINDOW) |
| 2489 chat_tabize(); |
2472 chat_tabize(); |
| 2490 #endif |
2473 #endif |
| 2491 } |
|
| 2492 |
|
| 2493 void set_sound_option(GtkWidget *w, int option) |
|
| 2494 { |
|
| 2495 sound_options ^= option; |
|
| 2496 } |
2474 } |
| 2497 |
2475 |
| 2498 static void set_away_option(GtkWidget *w, int option) |
2476 static void set_away_option(GtkWidget *w, int option) |
| 2499 { |
2477 { |
| 2500 away_options ^= option; |
2478 away_options ^= option; |
| 2616 else if ((int)i >= length) |
2594 else if ((int)i >= length) |
| 2617 default_away = g_slist_nth_data(away_messages, length - 1); |
2595 default_away = g_slist_nth_data(away_messages, length - 1); |
| 2618 else |
2596 else |
| 2619 default_away = g_slist_nth_data(away_messages, (int)i); |
2597 default_away = g_slist_nth_data(away_messages, (int)i); |
| 2620 } |
2598 } |
| 2621 |
|
| 2622 #ifndef _WIN32 |
|
| 2623 static gboolean program_is_valid(const char *program) |
|
| 2624 { |
|
| 2625 GError *error = NULL; |
|
| 2626 char **argv; |
|
| 2627 gchar *progname; |
|
| 2628 gboolean is_valid = FALSE; |
|
| 2629 |
|
| 2630 if (program == NULL || *program == '\0') { |
|
| 2631 return FALSE; |
|
| 2632 } |
|
| 2633 |
|
| 2634 if (!g_shell_parse_argv(program, NULL, &argv, &error)) { |
|
| 2635 gaim_debug(GAIM_DEBUG_ERROR, "program_is_valid", |
|
| 2636 "Could not parse program '%s': %s\n", |
|
| 2637 program, error->message); |
|
| 2638 g_error_free(error); |
|
| 2639 return FALSE; |
|
| 2640 } |
|
| 2641 |
|
| 2642 if (argv == NULL) { |
|
| 2643 return FALSE; |
|
| 2644 } |
|
| 2645 |
|
| 2646 progname = g_find_program_in_path(argv[0]); |
|
| 2647 is_valid = (progname != NULL); |
|
| 2648 |
|
| 2649 g_strfreev(argv); |
|
| 2650 g_free(progname); |
|
| 2651 |
|
| 2652 return is_valid; |
|
| 2653 } |
|
| 2654 #endif |
|
| 2655 |
2599 |
| 2656 static GtkWidget *show_color_pref(GtkWidget *box, gboolean fgc) |
2600 static GtkWidget *show_color_pref(GtkWidget *box, gboolean fgc) |
| 2657 { |
2601 { |
| 2658 /* more stuff stolen from X-Chat */ |
2602 /* more stuff stolen from X-Chat */ |
| 2659 GtkWidget *swid; |
2603 GtkWidget *swid; |