Mercurial > pidgin
comparison src/prefs.c @ 3374:3cd2fbddf95a
[gaim-migrate @ 3393]
I had terrible days today and yesterday--a really terrible weekend.
No cool stuff from me--the prefs away message page works a bit better.
Ari and Chip both sent some patches to make things work a bit better in
GTK 2, and Etan rewrote the notify plugin so it's really cool now!
Thanks, guys!
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 05 Aug 2002 07:33:09 +0000 |
parents | 0e79bf1d79ea |
children | 783e982a56da |
comparison
equal
deleted
inserted
replaced
3373:0e79bf1d79ea | 3374:3cd2fbddf95a |
---|---|
841 frame = gtk_frame_new ("Browser Selection"); | 841 frame = gtk_frame_new ("Browser Selection"); |
842 gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); | 842 gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); |
843 gtk_widget_show (frame); | 843 gtk_widget_show (frame); |
844 vbox = gtk_vbox_new(FALSE, 5); | 844 vbox = gtk_vbox_new(FALSE, 5); |
845 gtk_container_add (GTK_CONTAINER (frame), vbox); | 845 gtk_container_add (GTK_CONTAINER (frame), vbox); |
846 gaim_dropdown(vbox, "Broswer", &web_browser_new, -1, | 846 gaim_dropdown(vbox, "Browser", &web_browser_new, -1, |
847 "Netscape", BROWSER_NETSCAPE, | 847 "Netscape", BROWSER_NETSCAPE, |
848 "Konqueror", BROWSER_KONQ, | 848 "Konqueror", BROWSER_KONQ, |
849 "Mozilla", BROWSER_MOZILLA, | 849 "Mozilla", BROWSER_MOZILLA, |
850 "Manual", BROWSER_MANUAL, | 850 "Manual", BROWSER_MANUAL, |
851 #ifdef USE_GNOME | 851 #ifdef USE_GNOME |
1033 vbox = gtk_vbox_new(FALSE, 5); | 1033 vbox = gtk_vbox_new(FALSE, 5); |
1034 gtk_container_add (GTK_CONTAINER (frame), vbox); | 1034 gtk_container_add (GTK_CONTAINER (frame), vbox); |
1035 gaim_button(_("Sending messages removes away status"), &away_options_new, OPT_AWAY_BACK_ON_IM, vbox); | 1035 gaim_button(_("Sending messages removes away status"), &away_options_new, OPT_AWAY_BACK_ON_IM, vbox); |
1036 gaim_button(_("Queue new messages when away"), &away_options_new, OPT_AWAY_QUEUE, vbox); | 1036 gaim_button(_("Queue new messages when away"), &away_options_new, OPT_AWAY_QUEUE, vbox); |
1037 gaim_button(_("Ignore new conversations when away"), &away_options_new, OPT_AWAY_DISCARD, vbox); | 1037 gaim_button(_("Ignore new conversations when away"), &away_options_new, OPT_AWAY_DISCARD, vbox); |
1038 gaim_button(_("Sounds while away"), &sound_options_new, OPT_SOUND_WHEN_AWAY, vbox); | |
1039 gtk_widget_show (vbox); | 1038 gtk_widget_show (vbox); |
1040 | 1039 |
1041 | 1040 |
1042 frame = gtk_frame_new ("Auto-response"); | 1041 frame = gtk_frame_new ("Auto-response"); |
1043 gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); | 1042 gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); |
1219 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | 1218 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
1220 return; | 1219 return; |
1221 gtk_tree_model_get_value (model, &iter, 2, &val); | 1220 gtk_tree_model_get_value (model, &iter, 2, &val); |
1222 sound_row_sel = g_value_get_uint(&val); | 1221 sound_row_sel = g_value_get_uint(&val); |
1223 if (sound_entry) | 1222 if (sound_entry) |
1224 gtk_entry_set_text(sound_entry, sound_file_new[sound_row_sel] ? sound_file_new[sound_row_sel] : "(default)"); | 1223 gtk_entry_set_text(GTK_ENTRY(sound_entry), sound_file_new[sound_row_sel] ? sound_file_new[sound_row_sel] : "(default)"); |
1225 g_value_unset (&val); | 1224 g_value_unset (&val); |
1226 if (sounddialog) | 1225 if (sounddialog) |
1227 gtk_widget_destroy(sounddialog); | 1226 gtk_widget_destroy(sounddialog); |
1228 } | 1227 } |
1229 #endif | 1228 #endif |
1361 GtkTreeIter iter; | 1360 GtkTreeIter iter; |
1362 GValue val = { 0, }; | 1361 GValue val = { 0, }; |
1363 gchar *message; | 1362 gchar *message; |
1364 gchar buffer[BUF_LONG]; | 1363 gchar buffer[BUF_LONG]; |
1365 char *tmp; | 1364 char *tmp; |
1365 struct away_message *am; | |
1366 | 1366 |
1367 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | 1367 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
1368 return; | 1368 return; |
1369 gtk_tree_model_get_value (model, &iter, 1, &val); | 1369 gtk_tree_model_get_value (model, &iter, 1, &val); |
1370 message = g_value_get_string(&val); | 1370 am = g_value_get_pointer(&val); |
1371 gtk_imhtml_clear(GTK_IMHTML(away_text)); | 1371 gtk_imhtml_clear(GTK_IMHTML(away_text)); |
1372 strcpy(buffer, message); | 1372 strncpy(buffer, am->message, BUF_LONG); |
1373 tmp = stylize(buffer, BUF_LONG); | 1373 tmp = stylize(buffer, BUF_LONG); |
1374 gtk_imhtml_append_text(GTK_IMHTML(away_text), tmp, -1, GTK_IMHTML_NO_TITLE | | 1374 gtk_imhtml_append_text(GTK_IMHTML(away_text), tmp, -1, GTK_IMHTML_NO_TITLE | |
1375 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); | 1375 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
1376 gtk_imhtml_append_text(GTK_IMHTML(away_text), "<BR>", -1, GTK_IMHTML_NO_TITLE | | 1376 gtk_imhtml_append_text(GTK_IMHTML(away_text), "<BR>", -1, GTK_IMHTML_NO_TITLE | |
1377 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); | 1377 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
1388 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv); | 1388 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv); |
1389 GValue val = { 0, }; | 1389 GValue val = { 0, }; |
1390 | 1390 |
1391 if (! gtk_tree_selection_get_selected (sel, &prefs_away_store, &iter)) | 1391 if (! gtk_tree_selection_get_selected (sel, &prefs_away_store, &iter)) |
1392 return; | 1392 return; |
1393 gtk_tree_model_get_value (prefs_away_store, &iter, 2, &val); | 1393 gtk_tree_model_get_value (prefs_away_store, &iter, 1, &val); |
1394 am = g_value_get_pointer (&val); | 1394 am = g_value_get_pointer (&val); |
1395 gtk_imhtml_clear(GTK_IMHTML(away_text)); | 1395 gtk_imhtml_clear(GTK_IMHTML(away_text)); |
1396 rem_away_mess(NULL, am); | 1396 rem_away_mess(NULL, am); |
1397 gtk_list_store_remove(ts, &iter); | 1397 gtk_list_store_remove(ts, &iter); |
1398 path = gtk_tree_path_new_first(); | 1398 path = gtk_tree_path_new_first(); |
1399 gtk_tree_selection_select_path(sel, path); | 1399 gtk_tree_selection_select_path(sel, path); |
1400 } | 1400 } |
1401 | 1401 |
1402 #else | 1402 #else |
1403 void away_message_sel(GtkWidget *w, GtkWidget *list) {} | 1403 static struct away_message *cur_message; |
1404 void remove_away_message(GtkWidget *widget, GtkWidget *list) {} | 1404 void away_message_sel(GtkWidget *w, struct away_message *a) { |
1405 gchar buffer[BUF_LONG]; | |
1406 char *tmp; | |
1407 | |
1408 cur_message = a; | |
1409 | |
1410 /* Clear the Box */ | |
1411 gtk_imhtml_clear(GTK_IMHTML(away_text)); | |
1412 | |
1413 /* Fill the text box with new message */ | |
1414 strncpy(buffer, a->message, BUF_LONG); | |
1415 tmp = stylize(buffer, BUF_LONG); | |
1416 | |
1417 debug_printf("FSD: %s\n", tmp); | |
1418 gtk_imhtml_append_text(GTK_IMHTML(away_text), tmp, -1, GTK_IMHTML_NO_TITLE | | |
1419 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); | |
1420 gtk_imhtml_append_text(GTK_IMHTML(away_text), "<BR>", -1, GTK_IMHTML_NO_TITLE | | |
1421 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); | |
1422 g_free(tmp); | |
1423 } | |
1424 void remove_away_message(GtkWidget *widget, GtkWidget *list) { | |
1425 GList *i; | |
1426 struct away_message *a; | |
1427 | |
1428 i = GTK_LIST(prefs_away_list)->selection; | |
1429 | |
1430 if (!i) | |
1431 return; | |
1432 if (!i->next) { | |
1433 gtk_imhtml_clear(GTK_IMHTML(away_text)); | |
1434 } | |
1435 a = gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
1436 rem_away_mess(NULL, a); | |
1437 } | |
1405 #endif | 1438 #endif |
1406 | 1439 |
1407 GtkWidget *away_message_page() { | 1440 GtkWidget *away_message_page() { |
1408 GtkWidget *ret; | 1441 GtkWidget *ret; |
1409 GtkWidget *frame; | 1442 GtkWidget *frame; |
1416 GtkWidget *event_view; | 1449 GtkWidget *event_view; |
1417 GtkCellRenderer *rend; | 1450 GtkCellRenderer *rend; |
1418 GtkTreeViewColumn *col; | 1451 GtkTreeViewColumn *col; |
1419 GtkTreeSelection *sel; | 1452 GtkTreeSelection *sel; |
1420 GtkTreePath *path; | 1453 GtkTreePath *path; |
1421 #else | |
1422 GtkWidget *list; | |
1423 #endif | 1454 #endif |
1424 GSList *awy = away_messages; | 1455 GSList *awy = away_messages; |
1425 struct away_message *a; | 1456 struct away_message *a; |
1426 GtkWidget *sw2; | 1457 GtkWidget *sw2; |
1427 | 1458 |
1437 away_text = gtk_imhtml_new(NULL, NULL); | 1468 away_text = gtk_imhtml_new(NULL, NULL); |
1438 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | 1469 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
1439 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | 1470 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
1440 | 1471 |
1441 #if GTK_CHECK_VERSION(1,3,0) | 1472 #if GTK_CHECK_VERSION(1,3,0) |
1442 prefs_away_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); | 1473 prefs_away_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); |
1443 while (awy) { | 1474 while (awy) { |
1444 a = (struct away_message *)awy->data; | 1475 a = (struct away_message *)awy->data; |
1445 gtk_list_store_append (prefs_away_store, &iter); | 1476 gtk_list_store_append (prefs_away_store, &iter); |
1446 gtk_list_store_set(prefs_away_store, &iter, | 1477 gtk_list_store_set(prefs_away_store, &iter, |
1447 0, a->name, | 1478 0, a->name, |
1448 1, a->message, | 1479 1, a, -1); |
1449 2, a, -1); | |
1450 awy = awy->next; | 1480 awy = awy->next; |
1451 } | 1481 } |
1452 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(prefs_away_store)); | 1482 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(prefs_away_store)); |
1453 | 1483 |
1454 | 1484 |
1460 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | 1490 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); |
1461 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(event_view), FALSE); | 1491 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(event_view), FALSE); |
1462 gtk_widget_show(event_view); | 1492 gtk_widget_show(event_view); |
1463 gtk_container_add(GTK_CONTAINER(sw), event_view); | 1493 gtk_container_add(GTK_CONTAINER(sw), event_view); |
1464 #else | 1494 #else |
1465 list = gtk_clist_new(1); | 1495 prefs_away_list = gtk_list_new(); |
1466 while (awy) { | 1496 while (awy) { |
1467 char *msg; | 1497 GtkWidget *ambox = gtk_hbox_new(FALSE, 5); |
1498 GtkWidget *list_item =gtk_list_item_new(); | |
1499 GtkWidget *label; | |
1468 a = (struct away_message *)awy->data; | 1500 a = (struct away_message *)awy->data; |
1469 msg = a->name; | 1501 gtk_container_add(GTK_CONTAINER(prefs_away_list), list_item); |
1470 gtk_clist_append(GTK_CLIST(list), &msg); | 1502 gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(away_message_sel), |
1503 a); | |
1504 gtk_object_set_user_data(GTK_OBJECT(list_item), a); | |
1505 | |
1506 gtk_widget_show(list_item); | |
1507 | |
1508 ambox = gtk_hbox_new(FALSE, 5); | |
1509 gtk_container_add(GTK_CONTAINER(list_item), ambox); | |
1510 gtk_widget_show(ambox); | |
1511 | |
1512 label = gtk_label_new(a->name); | |
1513 gtk_box_pack_start(GTK_BOX(ambox), label, FALSE, FALSE, 5); | |
1514 gtk_widget_show(label); | |
1515 | |
1471 awy = awy->next; | 1516 awy = awy->next; |
1517 | |
1472 } | 1518 } |
1473 gtk_widget_show(list); | 1519 gtk_widget_show(prefs_away_list); |
1474 gtk_container_add(GTK_CONTAINER(sw), list); | 1520 gtk_container_add(GTK_CONTAINER(sw), prefs_away_list); |
1475 #endif | 1521 #endif |
1476 | 1522 |
1477 gtk_widget_show (vbox); | 1523 gtk_widget_show (vbox); |
1478 gtk_widget_show (sw); | 1524 gtk_widget_show (sw); |
1479 | 1525 |
1502 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | 1548 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); |
1503 path = gtk_tree_path_new_first(); | 1549 path = gtk_tree_path_new_first(); |
1504 g_signal_connect (G_OBJECT (sel), "changed", | 1550 g_signal_connect (G_OBJECT (sel), "changed", |
1505 G_CALLBACK (away_message_sel), | 1551 G_CALLBACK (away_message_sel), |
1506 NULL); | 1552 NULL); |
1507 #else | |
1508 gtk_signal_connect(GTK_OBJECT(list), "changed", GTK_SIGNAL_FUNC(away_message_sel), NULL); | |
1509 #endif | 1553 #endif |
1510 hbox = gtk_hbox_new(TRUE, 5); | 1554 hbox = gtk_hbox_new(TRUE, 5); |
1511 gtk_widget_show(hbox); | 1555 gtk_widget_show(hbox); |
1512 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 1556 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1513 #if GTK_CHECK_VERSION (1,3,0) | 1557 #if GTK_CHECK_VERSION (1,3,0) |
1524 #if GTK_CHECK_VERSION (1,3,0) | 1568 #if GTK_CHECK_VERSION (1,3,0) |
1525 button = gtk_button_new_from_stock (GTK_STOCK_REMOVE); | 1569 button = gtk_button_new_from_stock (GTK_STOCK_REMOVE); |
1526 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(remove_away_message), event_view); | 1570 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(remove_away_message), event_view); |
1527 #else | 1571 #else |
1528 button = picture_button(prefs, _("Remove"), gnome_remove_xpm); | 1572 button = picture_button(prefs, _("Remove"), gnome_remove_xpm); |
1529 //gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), event_view); | 1573 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(remove_away_message), prefs_away_list); |
1530 #endif | 1574 #endif |
1531 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | 1575 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1532 if (misc_options & OPT_MISC_COOL_LOOK) | 1576 if (misc_options & OPT_MISC_COOL_LOOK) |
1533 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | 1577 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
1534 gtk_widget_show(button); | 1578 gtk_widget_show(button); |
1535 | 1579 |
1536 #if GTK_CHECK_VERSION (1,3,0) | 1580 #if GTK_CHECK_VERSION (1,3,0) |
1537 button = pixbuf_button(_("_Edit"), "edit.png"); | 1581 button = pixbuf_button(_("_Edit"), "edit.png"); |
1582 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), event_view); | |
1538 #else | 1583 #else |
1539 button = picture_button(prefs, _("Edit"), save_xpm); | 1584 button = picture_button(prefs, _("Edit"), save_xpm); |
1540 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), button); | 1585 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), button); |
1541 #endif | 1586 #endif |
1542 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | 1587 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |