aboutsummaryrefslogtreecommitdiffstats
path: root/po/az.po
Commit message (Expand)AuthorAgeFilesLines
* 1.4.1 release.Ettore Perazzoli2003-06-261-555/+564
* 1.4.0!Ettore Perazzoli2003-06-031-321/+320
* Sync 1.3.92.Ettore Perazzoli2003-05-231-3/+3
* 1.3.91.Ettore Perazzoli2003-05-221-968/+1016
* 1.3.3.Ettore Perazzoli2003-04-301-808/+928
* The return of 1.3.2.Ettore Perazzoli2003-04-121-205/+205
* Sync for 1.3.2.Ettore Perazzoli2003-04-101-5170/+5943
* Sync for 1.1.90.Ettore Perazzoli2002-10-291-1021/+1085
* Sync for 1.1.2.Ettore Perazzoli2002-10-081-1464/+1678
* Sync for 1.1.1.Ettore Perazzoli2002-09-101-1164/+1276
* Update po files to speed up snap build.JP Rosevear2002-08-131-1752/+2236
* Update .po files.JP Rosevear2002-06-281-3743/+4434
* Update the po files to cut down on dist timeJP Rosevear2002-05-081-3965/+18552
* routine updateVasif Ismailoglu MD2001-12-201-70/+30
* updated Azeri filePablo Saratxaga2001-11-261-4299/+2208
* Sync for 0.99.2.Ettore Perazzoli2001-11-151-340/+357
* 0.99.0.Ettore Perazzoli2001-11-061-266/+277
* Syncing up for the 0.16.100 internal release.Ettore Perazzoli2001-11-011-2427/+2896
* 0.16.Ettore Perazzoli2001-10-101-718/+825
* 0.15.Ettore Perazzoli2001-10-021-950/+1152
* Sync for 0.14.Ettore Perazzoli2001-09-221-1955/+2724
* Sync for 0.13.Ettore Perazzoli2001-08-231-2403/+4406
* Sync for the release.Ettore Perazzoli2001-08-011-3688/+7421
* updated Azeri filePablo Saratxaga2001-05-261-57/+26
* updted Azeri filePablo Saratxaga2001-05-071-286/+257
* Updated Azeri file Enabled Dutch headerPablo Saratxaga2001-05-021-2927/+1769
* Do this everywhere, also fixup CLEANFILESMichael Meeks2001-04-141-1611/+2239
* Change \" to ' in translations for .oaf files, since various bugs conspireDan Winship2001-03-231-16/+16
* Updated Azeri filePablo Saratxaga2001-03-221-1609/+1485
* Added Azeri language filePablo Saratxaga2001-03-151-0/+9647
a> 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247
/*
 * e-book-shell-view-actions.c
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with the program; if not, see <http://www.gnu.org/licenses/>
 *
 *
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 *
 */

#include "e-book-shell-view-private.h"

#include <e-util/e-error.h>
#include <e-util/e-util.h>
#include <filter/e-filter-rule.h>

#include <addressbook-config.h>

static void
action_address_book_copy_cb (GtkAction *action,
                             EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    e_addressbook_view_copy_to_folder (view, TRUE);
}

static void
action_address_book_delete_cb (GtkAction *action,
                               EBookShellView *book_shell_view)
{
    EShellView *shell_view;
    EShellWindow *shell_window;
    EBookShellBackend *book_shell_backend;
    EBookShellSidebar *book_shell_sidebar;
    ESource *source;
    ESourceSelector *selector;
    ESourceGroup *source_group;
    ESourceList *source_list;
    EBook *book;
    gint response;
    GError *error = NULL;

    shell_view = E_SHELL_VIEW (book_shell_view);
    shell_window = e_shell_view_get_shell_window (shell_view);

    book_shell_backend = book_shell_view->priv->book_shell_backend;
    source_list = e_book_shell_backend_get_source_list (book_shell_backend);

    book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
    selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
    source = e_source_selector_peek_primary_selection (selector);
    g_return_if_fail (source != NULL);

    response = e_error_run (
        GTK_WINDOW (shell_window),
        "addressbook:ask-delete-addressbook",
        e_source_peek_name (source));

    if (response != GTK_RESPONSE_YES)
        return;

    book = e_book_new (source, &error);
    if (error != NULL) {
        g_warning ("Error removing addressbook: %s", error->message);
        g_error_free (error);
        return;
    }

    if (!e_book_remove (book, NULL)) {
        e_error_run (
            GTK_WINDOW (shell_window),
            "addressbook:remove-addressbook", NULL);
        g_object_unref (book);
        return;
    }

    if (e_source_selector_source_is_selected (selector, source))
        e_source_selector_unselect_source (selector, source);

    source_group = e_source_peek_group (source);
    e_source_group_remove_source (source_group, source);

    e_source_list_sync (source_list, NULL);

    g_object_unref (book);
}

static void
action_address_book_move_cb (GtkAction *action,
                             EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    e_addressbook_view_move_to_folder (view, TRUE);
}

static void
action_address_book_new_cb (GtkAction *action,
                            EBookShellView *book_shell_view)
{
    EShellView *shell_view;
    EShellWindow *shell_window;

    shell_view = E_SHELL_VIEW (book_shell_view);
    shell_window = e_shell_view_get_shell_window (shell_view);

    addressbook_config_create_new_source (GTK_WIDGET (shell_window));
}

static void
action_address_book_print_cb (GtkAction *action,
                              EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;
    GtkPrintOperationAction print_action;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
    e_addressbook_view_print (view, FALSE, print_action);
}

static void
action_address_book_print_preview_cb (GtkAction *action,
                                      EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;
    GtkPrintOperationAction print_action;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
    e_addressbook_view_print (view, FALSE, print_action);
}

static void
action_address_book_properties_cb (GtkAction *action,
                                   EBookShellView *book_shell_view)
{
    EShellView *shell_view;
    EShellWindow *shell_window;
    EBookShellSidebar *book_shell_sidebar;
    ESource *source;
    ESourceSelector *selector;
    EditorUidClosure *closure;
    GHashTable *uid_to_editor;
    const gchar *uid;

    shell_view = E_SHELL_VIEW (book_shell_view);
    shell_window = e_shell_view_get_shell_window (shell_view);

    book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
    selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
    source = e_source_selector_peek_primary_selection (selector);
    g_return_if_fail (source != NULL);

    uid = e_source_peek_uid (source);
    uid_to_editor = book_shell_view->priv->uid_to_editor;

    closure = g_hash_table_lookup (uid_to_editor, uid);
    if (closure == NULL) {
        GtkWidget *editor;

        editor = addressbook_config_edit_source (
            GTK_WIDGET (shell_window), source);

        closure = g_new (EditorUidClosure, 1);
        closure->editor = editor;
        closure->uid = g_strdup (uid);
        closure->view = book_shell_view;

        g_hash_table_insert (uid_to_editor, closure->uid, closure);

        g_object_weak_ref (
            G_OBJECT (closure->editor), (GWeakNotify)
            e_book_shell_view_editor_weak_notify, closure);
    }

    gtk_window_present (GTK_WINDOW (closure->editor));
}

static void
action_address_book_rename_cb (GtkAction *action,
                               EBookShellView *book_shell_view)
{
    EBookShellSidebar *book_shell_sidebar;
    ESourceSelector *selector;

    book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
    selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);

    e_source_selector_edit_primary_selection (selector);
}

static void
action_address_book_save_as_cb (GtkAction *action,
                                EBookShellView *book_shell_view)
{
    EShell *shell;
    EShellView *shell_view;
    EShellWindow *shell_window;
    EShellBackend *shell_backend;
    EBookShellContent *book_shell_content;
    EAddressbookModel *model;
    EAddressbookView *view;
    EActivity *activity;
    EBookQuery *query;
    EBook *book;
    GList *list = NULL;
    GFile *file;
    gchar *string;

    shell_view = E_SHELL_VIEW (book_shell_view);
    shell_window = e_shell_view_get_shell_window (shell_view);
    shell_backend = e_shell_view_get_shell_backend (shell_view);
    shell = e_shell_window_get_shell (shell_window);

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    model = e_addressbook_view_get_model (view);
    book = e_addressbook_model_get_book (model);

    query = e_book_query_any_field_contains ("");
    e_book_get_contacts (book, query, &list, NULL);
    e_book_query_unref (query);

    if (list == NULL)
        goto exit;

    string = eab_suggest_filename (list);
    file = e_shell_run_save_dialog (
        shell, _("Save as vCard"), string, NULL, NULL);
    g_free (string);

    if (file == NULL)
        goto exit;

    string = eab_contact_list_to_string (list);
    if (string == NULL) {
        g_warning ("Could not convert contact list to a string");
        g_object_unref (file);
        goto exit;
    }

    /* XXX No callback means errors are discarded.
     *
     *     There's an EError for this which I'm not using
     *     until I figure out a better way to display errors:
     *
     *     "addressbook:save-error"
     */
    activity = e_file_replace_contents_async (
        file, string, strlen (string), NULL, FALSE,
        G_FILE_CREATE_NONE, (GAsyncReadyCallback) NULL, NULL);
    e_shell_backend_add_activity (shell_backend, activity);

    /* Free the string when the activity is finalized. */
    g_object_set_data_full (
        G_OBJECT (activity),
        "file-content", string,
        (GDestroyNotify) g_free);

    g_object_unref (file);

exit:
    g_list_foreach (list, (GFunc) g_object_unref, NULL);
    g_list_free (list);
}

static void
action_address_book_stop_cb (GtkAction *action,
                             EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    e_addressbook_view_stop (view);
}

static void
action_contact_clipboard_copy_cb (GtkAction *action,
                                  EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;

    book_shell_content = book_shell_view->priv->book_shell_content;
    e_book_shell_content_clipboard_copy (book_shell_content);
}

static void
action_contact_clipboard_cut_cb (GtkAction *action,
                                 EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    e_addressbook_view_cut (view);
}

static void
action_contact_clipboard_paste_cb (GtkAction *action,
                                   EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    e_addressbook_view_paste (view);
}

static void
action_contact_copy_cb (GtkAction *action,
                        EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    e_addressbook_view_copy_to_folder (view, FALSE);
}

static void
action_contact_delete_cb (GtkAction *action,
                          EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    e_addressbook_view_delete_selection (view, TRUE);
}

static void
action_contact_forward_cb (GtkAction *action,
                           EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;
    GList *list, *iter;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    list = e_addressbook_view_get_selected (view);
    g_return_if_fail (list != NULL);

    /* Convert the list of contacts to a list of destinations. */
    for (iter = list; iter != NULL; iter = iter->next) {
        EContact *contact = iter->data;
        EDestination *destination;

        destination = e_destination_new ();
        e_destination_set_contact (destination, contact, 0);
        g_object_unref (contact);

        iter->data = destination;
    }

    eab_send_as_attachment (list);
    g_list_foreach (list, (GFunc) g_object_unref, NULL);
    g_list_free (list);
}

static void
action_contact_move_cb (GtkAction *action,
                        EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    e_addressbook_view_move_to_folder (view, FALSE);
}

static void
action_contact_new_cb (GtkAction *action,
                       EBookShellView *book_shell_view)
{
    EShell *shell;
    EShellView *shell_view;
    EShellWindow *shell_window;
    EBookShellContent *book_shell_content;
    EAddressbookView *view;
    EAddressbookModel *model;
    EContact *contact;
    EABEditor *editor;
    EBook *book;

    shell_view = E_SHELL_VIEW (book_shell_view);
    shell_window = e_shell_view_get_shell_window (shell_view);
    shell = e_shell_window_get_shell (shell_window);

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    model = e_addressbook_view_get_model (view);
    book = e_addressbook_model_get_book (model);
    g_return_if_fail (book != NULL);

    contact = e_contact_new ();
    editor = e_contact_editor_new (shell, book, contact, TRUE, TRUE);
    eab_editor_show (editor);
    g_object_unref (contact);
}

static void
action_contact_new_list_cb (GtkAction *action,
                            EBookShellView *book_shell_view)
{
    EShell *shell;
    EShellView *shell_view;
    EShellWindow *shell_window;
    EBookShellContent *book_shell_content;
    EAddressbookView *view;
    EAddressbookModel *model;
    EContact *contact;
    EABEditor *editor;
    EBook *book;

    shell_view = E_SHELL_VIEW (book_shell_view);
    shell_window = e_shell_view_get_shell_window (shell_view);
    shell = e_shell_window_get_shell (shell_window);

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    model = e_addressbook_view_get_model (view);
    book = e_addressbook_model_get_book (model);
    g_return_if_fail (book != NULL);

    contact = e_contact_new ();
    editor = e_contact_list_editor_new (shell, book, contact, TRUE, TRUE);
    eab_editor_show (editor);
    g_object_unref (contact);
}

static void
action_contact_open_cb (GtkAction *action,
                        EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    e_addressbook_view_view (view);
}

static void
action_contact_preview_cb (GtkToggleAction *action,
                           EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    gboolean visible;

    book_shell_content = book_shell_view->priv->book_shell_content;
    visible = gtk_toggle_action_get_active (action);
    e_book_shell_content_set_preview_visible (book_shell_content, visible);
}

static void
action_contact_print_cb (GtkAction *action,
                         EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;
    GtkPrintOperationAction print_action;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
    e_addressbook_view_print (view, TRUE, print_action);
}

static void
action_contact_save_as_cb (GtkAction *action,
                           EBookShellView *book_shell_view)
{
    EShell *shell;
    EShellView *shell_view;
    EShellWindow *shell_window;
    EShellBackend *shell_backend;
    EBookShellContent *book_shell_content;
    EAddressbookView *view;
    EActivity *activity;
    GList *list;
    GFile *file;
    gchar *string;

    shell_view = E_SHELL_VIEW (book_shell_view);
    shell_window = e_shell_view_get_shell_window (shell_view);
    shell_backend = e_shell_view_get_shell_backend (shell_view);
    shell = e_shell_window_get_shell (shell_window);

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    list = e_addressbook_view_get_selected (view);

    if (list == NULL)
        goto exit;

    string = eab_suggest_filename (list);
    file = e_shell_run_save_dialog (
        shell, _("Save as vCard"), string, NULL, NULL);
    g_free (string);

    if (file == NULL)
        goto exit;

    string = eab_contact_list_to_string (list);
    if (string == NULL) {
        g_warning ("Could not convert contact list to a string");
        g_object_unref (file);
        goto exit;
    }

    /* XXX No callback means errors are discarded.
     *
     *     There an EError for this which I'm not using
     *     until I figure out a better way to display errors:
     *
     *     "addressbook:save-error"
     */
    activity = e_file_replace_contents_async (
        file, string, strlen (string), NULL, FALSE,
        G_FILE_CREATE_NONE, (GAsyncReadyCallback) NULL, NULL);
    e_shell_backend_add_activity (shell_backend, activity);

    /* Free the string when the activity is finalized. */
    g_object_set_data_full (
        G_OBJECT (activity),
        "file-content", string,
        (GDestroyNotify) g_free);

    g_object_unref (file);

exit:
    g_list_foreach (list, (GFunc) g_object_unref, NULL);
    g_list_free (list);
}

static void
action_contact_search_cb (GtkRadioAction *action,
                          GtkRadioAction *current,
                          EBookShellView *book_shell_view)
{
    EShellView *shell_view;
    EShellContent *shell_content;
    const gchar *search_hint;

    /* XXX Figure out a way to handle this in EShellContent
     *     instead of every shell view having to handle it.
     *     The problem is EShellContent does not know what
     *     the search option actions are for this view.  It
     *     would have to dig up the popup menu and retrieve
     *     the action for each menu item.  Seems messy. */

    shell_view = E_SHELL_VIEW (book_shell_view);
    shell_content = e_shell_view_get_shell_content (shell_view);

    search_hint = gtk_action_get_label (GTK_ACTION (current));
    e_shell_content_set_search_hint (shell_content, search_hint);
}

static void
action_contact_select_all_cb (GtkAction *action,
                              EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    e_addressbook_view_select_all (view);
}

static void
action_contact_send_message_cb (GtkAction *action,
                                EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EAddressbookView *view;
    GList *list, *iter;

    book_shell_content = book_shell_view->priv->book_shell_content;
    view = e_book_shell_content_get_current_view (book_shell_content);
    g_return_if_fail (view != NULL);

    list = e_addressbook_view_get_selected (view);
    g_return_if_fail (list != NULL);

    /* Convert the list of contacts to a list of destinations. */
    for (iter = list; iter != NULL; iter = iter->next) {
        EContact *contact = iter->data;
        EDestination *destination;

        destination = e_destination_new ();
        e_destination_set_contact (destination, contact, 0);
        g_object_unref (contact);

        iter->data = destination;
    }

    eab_send_as_to (list);
    g_list_foreach (list, (GFunc) g_object_unref, NULL);
    g_list_free (list);
}

static void
action_contact_view_cb (GtkRadioAction *action,
                        GtkRadioAction *current,
                        EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    GtkOrientable *orientable;
    GtkOrientation orientation;

    book_shell_content = book_shell_view->priv->book_shell_content;
    orientable = GTK_ORIENTABLE (book_shell_content);

    switch (gtk_radio_action_get_current_value (action)) {
        case 0:
            orientation = GTK_ORIENTATION_VERTICAL;
            break;
        case 1:
            orientation = GTK_ORIENTATION_HORIZONTAL;
            break;
        default:
            g_return_if_reached ();
    }

    gtk_orientable_set_orientation (orientable, orientation);
}

static void
action_gal_save_custom_view_cb (GtkAction *action,
                                EBookShellView *book_shell_view)
{
    EBookShellContent *book_shell_content;
    EShellView *shell_view;
    EAddressbookView *address_view;
    GalViewInstance *view_instance;

    /* All shell views respond to the activation of this action,
     * which is defined by EShellWindow.  But only the currently
     * active shell view proceeds with saving the custom view. */
    shell_view = E_SHELL_VIEW (book_shell_view);
    if (!e_shell_view_is_active (shell_view))
        return;

    book_shell_content = book_shell_view->priv->book_shell_content;
    address_view = e_book_shell_content_get_current_view (book_shell_content);
    view_instance = e_addressbook_view_get_view_instance (address_view);
    gal_view_instance_save_as (view_instance);
}

static void
action_search_filter_cb (GtkRadioAction *action,
                         GtkRadioAction *current,
                         EShellView *shell_view)
{
    e_shell_view_execute_search (shell_view);
}

static GtkActionEntry contact_entries[] = {

    { "address-book-copy",
      GTK_STOCK_COPY,
      N_("Co_py All Contacts To..."),
      NULL,
      N_("Copy the contacts of the selected address book to another"),
      G_CALLBACK (action_address_book_copy_cb) },

    { "address-book-delete",
      GTK_STOCK_DELETE,
      N_("Del_ete Address Book"),
      NULL,
      N_("Delete the selected address book"),
      G_CALLBACK (action_address_book_delete_cb) },

    { "address-book-move",
      "folder-move",
      N_("Mo_ve All Contacts To..."),
      NULL,
      N_("Move the contacts of the selected address book to another"),
      G_CALLBACK (action_address_book_move_cb) },

    { "address-book-new",
      "address-book-new",
      N_("_New Address Book"),
      NULL,
      N_("Create a new address book"),
      G_CALLBACK (action_address_book_new_cb) },

    { "address-book-properties",
      GTK_STOCK_PROPERTIES,
      N_("Address _Book Properties"),
      NULL,
      N_("Show properties of the selected address book"),
      G_CALLBACK (action_address_book_properties_cb) },

    { "address-book-rename",
      NULL,
      N_("_Rename..."),
      "F2",
      N_("Rename the selected address book"),
      G_CALLBACK (action_address_book_rename_cb) },

    { "address-book-save-as",
      GTK_STOCK_SAVE_AS,
      N_("S_ave Address Book as vCard"),
      NULL,
      N_("Save the contacts of the selected address book as a vCard"),
      G_CALLBACK (action_address_book_save_as_cb) },

    { "address-book-stop",
      GTK_STOCK_STOP,
      NULL,
      NULL,
      N_("Stop loading"),
      G_CALLBACK (action_address_book_stop_cb) },

    { "contact-clipboard-copy",
      GTK_STOCK_COPY,
      NULL,
      NULL,
      N_("Copy the selection"),
      G_CALLBACK (action_contact_clipboard_copy_cb) },

    { "contact-clipboard-cut",
      GTK_STOCK_CUT,
      NULL,
      NULL,
      N_("Cut the selection"),
      G_CALLBACK (action_contact_clipboard_cut_cb) },

    { "contact-clipboard-paste",
      GTK_STOCK_PASTE,
      NULL,
      NULL,
      N_("Paste the clipboard"),
      G_CALLBACK (action_contact_clipboard_paste_cb) },

    { "contact-copy",
      NULL,
      N_("_Copy Contact To..."),
      "<Control><Shift>y",
      N_("Copy selected contacts to another address book"),
      G_CALLBACK (action_contact_copy_cb) },

    { "contact-delete",
      GTK_STOCK_DELETE,
      N_("_Delete Contact"),
      "<Control>d",
      N_("Delete selected contacts"),
      G_CALLBACK (action_contact_delete_cb) },

    { "contact-forward",
      "mail-forward",
      N_("_Forward Contact..."),
      NULL,
      N_("Send selected contacts to another person"),
      G_CALLBACK (action_contact_forward_cb) },

    { "contact-move",
      NULL,
      N_("_Move Contact To..."),
      "<Control><Shift>v",
      N_("Move selected contacts to another address book"),
      G_CALLBACK (action_contact_move_cb) },

    { "contact-new",
      "contact-new",
      N_("_New Contact..."),
      NULL,
      N_("Create a new contact"),
      G_CALLBACK (action_contact_new_cb) },

    { "contact-new-list",
      "stock_contact-list",
      N_("New Contact _List..."),
      NULL,
      N_("Create a new contact list"),
      G_CALLBACK (action_contact_new_list_cb) },

    { "contact-open",
      NULL,
      N_("_Open Contact"),
      "<Control>o",
      N_("View the current contact"),
      G_CALLBACK (action_contact_open_cb) },

    { "contact-select-all",
      GTK_STOCK_SELECT_ALL,
      NULL,
      NULL,
      N_("Select all contacts"),
      G_CALLBACK (action_contact_select_all_cb) },

    { "contact-send-message",
      "mail-message-new",
      N_("_Send Message to Contact..."),
      NULL,
      N_("Send a message to the selected contacts"),
      G_CALLBACK (action_contact_send_message_cb) },

    /*** Menus ***/

    { "contact-actions-menu",
      NULL,
      N_("_Actions"),
      NULL,
      NULL,
      NULL },

    { "contact-preview-menu",
      NULL,
      N_("_Preview"),
      NULL,
      NULL,
      NULL }
};

static EPopupActionEntry contact_popup_entries[] = {

    { "address-book-popup-delete",
      N_("_Delete"),
      "address-book-delete" },

    { "address-book-popup-properties",
      N_("_Properties"),
      "address-book-properties" },

    { "address-book-popup-rename",
      NULL,
      "address-book-rename" },

    { "address-book-popup-save-as",
      N_("_Save as vCard..."),
      "address-book-save-as" },

    { "contact-popup-clipboard-copy",
      NULL,
      "contact-clipboard-copy" },

    { "contact-popup-clipboard-cut",
      NULL,
      "contact-clipboard-cut" },

    { "contact-popup-clipboard-paste",
      NULL,
      "contact-clipboard-paste" },

    { "contact-popup-copy",
      NULL,
      "contact-copy" },

    { "contact-popup-delete",
      NULL,
      "contact-delete" },

    { "contact-popup-forward",
      NULL,
      "contact-forward" },

    { "contact-popup-move",
      NULL,
      "contact-move" },

    { "contact-popup-open",
      NULL,
      "contact-open" },

    { "contact-popup-send-message",
      NULL,
      "contact-send-message" },
};

static GtkToggleActionEntry contact_toggle_entries[] = {

    { "contact-preview",
      NULL,
      N_("Contact _Preview"),
      "<Control>m",
      N_("Show contact preview window"),
      G_CALLBACK (action_contact_preview_cb),
      TRUE }
};

static GtkRadioActionEntry contact_view_entries[] = {

    /* This action represents the initial active contact view.
     * It should not be visible in the UI, nor should it be
     * possible to switch to it from another shell view. */
    { "contact-view-initial",
      NULL,
      NULL,
      NULL,
      NULL,
      -1 },

    { "contact-view-classic",
      NULL,
      N_("_Classic View"),
      NULL,
      N_("Show contact preview below the contact list"),
      0 },

    { "contact-view-vertical",
      NULL,
      N_("_Vertical View"),
      NULL,
      N_("Show contact preview alongside the contact list"),
      1 }
};

static GtkRadioActionEntry contact_filter_entries[] = {

    { "contact-filter-any-category",
      NULL,
      N_("Any Category"),
      NULL,
      NULL,
      CONTACT_FILTER_ANY_CATEGORY },

    { "contact-filter-unmatched",
      NULL,
      N_("Unmatched"),
      NULL,
      NULL,
      CONTACT_FILTER_UNMATCHED }
};

static GtkRadioActionEntry contact_search_entries[] = {

    { "contact-search-any-field-contains",
      NULL,
      N_("Any field contains"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      CONTACT_SEARCH_ANY_FIELD_CONTAINS },

    { "contact-search-email-begins-with",
      NULL,
      N_("Email begins with"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      CONTACT_SEARCH_EMAIL_BEGINS_WITH },

    { "contact-search-name-contains",
      NULL,
      N_("Name contains"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      CONTACT_SEARCH_NAME_CONTAINS }
};

static GtkActionEntry lockdown_printing_entries[] = {

    { "address-book-print",
      GTK_STOCK_PRINT,
      NULL,
      "<Control>p",
      N_("Print all shown contacts"),
      G_CALLBACK (action_address_book_print_cb) },

    { "address-book-print-preview",
      GTK_STOCK_PRINT_PREVIEW,
      NULL,
      NULL,
      N_("Preview the contacts to be printed"),
      G_CALLBACK (action_address_book_print_preview_cb) },

    { "contact-print",
      GTK_STOCK_PRINT,
      NULL,
      NULL,
      N_("Print selected contacts"),
      G_CALLBACK (action_contact_print_cb) }
};

static EPopupActionEntry lockdown_printing_popup_entries[] = {

    { "contact-popup-print",
      NULL,
      "contact-print" }
};

static GtkActionEntry lockdown_save_to_disk_entries[] = {

    { "contact-save-as",
      GTK_STOCK_SAVE_AS,
      N_("Save as vCard..."),
      NULL,
      N_("Save selected contacts as a vCard"),
      G_CALLBACK (action_contact_save_as_cb) }
};

static EPopupActionEntry lockdown_save_to_disk_popup_entries[] = {

    { "contact-popup-save-as",
      NULL,
      "contact-save-as" }
};

void
e_book_shell_view_actions_init (EBookShellView *book_shell_view)
{
    EShellView *shell_view;
    EShellWindow *shell_window;
    EBookShellContent *book_shell_content;
    EABContactDisplay *contact_preview;
    GtkActionGroup *action_group;
    GConfBridge *bridge;
    GtkAction *action;
    GObject *object;
    const gchar *key;

    shell_view = E_SHELL_VIEW (book_shell_view);
    shell_window = e_shell_view_get_shell_window (shell_view);

    book_shell_content = book_shell_view->priv->book_shell_content;
    contact_preview = e_book_shell_content_get_preview (book_shell_content);

    /* Contact Actions */
    action_group = ACTION_GROUP (CONTACTS);
    gtk_action_group_add_actions (
        action_group, contact_entries,
        G_N_ELEMENTS (contact_entries), book_shell_view);
    e_action_group_add_popup_actions (
        action_group, contact_popup_entries,
        G_N_ELEMENTS (contact_popup_entries));
    gtk_action_group_add_toggle_actions (
        action_group, contact_toggle_entries,
        G_N_ELEMENTS (contact_toggle_entries), book_shell_view);
    gtk_action_group_add_radio_actions (
        action_group, contact_view_entries,
        G_N_ELEMENTS (contact_view_entries), -1,
        G_CALLBACK (action_contact_view_cb), book_shell_view);
    gtk_action_group_add_radio_actions (
        action_group, contact_search_entries,
        G_N_ELEMENTS (contact_search_entries),
        CONTACT_SEARCH_NAME_CONTAINS,
        G_CALLBACK (action_contact_search_cb), book_shell_view);

    /* Lockdown Printing Actions */
    action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
    gtk_action_group_add_actions (
        action_group, lockdown_printing_entries,
        G_N_ELEMENTS (lockdown_printing_entries),
        book_shell_view);
    e_action_group_add_popup_actions (
        action_group, lockdown_printing_popup_entries,
        G_N_ELEMENTS (lockdown_printing_popup_entries));

    /* Lockdown Save-to-Disk Actions */
    action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK);
    gtk_action_group_add_actions (
        action_group, lockdown_save_to_disk_entries,
        G_N_ELEMENTS (lockdown_save_to_disk_entries),
        book_shell_view);
    e_action_group_add_popup_actions (
        action_group, lockdown_save_to_disk_popup_entries,
        G_N_ELEMENTS (lockdown_save_to_disk_popup_entries));

    /* Bind GObject properties to GConf keys. */

    bridge = gconf_bridge_get ();

    object = G_OBJECT (ACTION (CONTACT_PREVIEW));
    key = "/apps/evolution/addressbook/display/show_preview";
    gconf_bridge_bind_property (bridge, key, object, "active");

    object = G_OBJECT (ACTION (CONTACT_VIEW_VERTICAL));
    key = "/apps/evolution/addressbook/display/layout";
    gconf_bridge_bind_property (bridge, key, object, "current-value");

    /* Fine tuning. */

    action = ACTION (CONTACT_DELETE);
    g_object_set (action, "short-label", _("Delete"), NULL);

    g_signal_connect (
        ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
        G_CALLBACK (action_gal_save_custom_view_cb), book_shell_view);

    e_binding_new (
        ACTION (CONTACT_PREVIEW), "active",
        ACTION (CONTACT_VIEW_CLASSIC), "sensitive");

    e_binding_new (
        ACTION (CONTACT_PREVIEW), "active",
        ACTION (CONTACT_VIEW_VERTICAL), "sensitive");

    e_web_view_set_open_proxy (
        E_WEB_VIEW (contact_preview), ACTION (CONTACT_OPEN));

    e_web_view_set_print_proxy (
        E_WEB_VIEW (contact_preview), ACTION (CONTACT_PRINT));

    e_web_view_set_save_as_proxy (
        E_WEB_VIEW (contact_preview), ACTION (CONTACT_SAVE_AS));
}

void
e_book_shell_view_update_search_filter (EBookShellView *book_shell_view)
{
    EShellView *shell_view;
    EShellContent *shell_content;
    EShellWindow *shell_window;
    GtkActionGroup *action_group;
    GtkRadioAction *radio_action;
    GList *list, *iter;
    GSList *group;
    gint ii;

    shell_view = E_SHELL_VIEW (book_shell_view);
    shell_content = e_shell_view_get_shell_content (shell_view);
    shell_window = e_shell_view_get_shell_window (shell_view);

    action_group = ACTION_GROUP (CONTACTS_FILTER);
    e_action_group_remove_all_actions (action_group);

    /* Add the standard filter actions. */
    gtk_action_group_add_radio_actions (
        action_group, contact_filter_entries,
        G_N_ELEMENTS (contact_filter_entries),
        CONTACT_FILTER_ANY_CATEGORY,
        G_CALLBACK (action_search_filter_cb),
        book_shell_view);

    /* Retrieve the radio group from an action we just added. */
    list = gtk_action_group_list_actions (action_group);
    radio_action = GTK_RADIO_ACTION (list->data);
    group = gtk_radio_action_get_group (radio_action);
    g_list_free (list);

    /* Build the category actions. */

    list = e_categories_get_list ();
    for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
        const gchar *category_name = iter->data;
        const gchar *filename;
        GtkAction *action;
        gchar *action_name;

        action_name = g_strdup_printf (
            "contact-filter-category-%d", ii);
        radio_action = gtk_radio_action_new (
            action_name, category_name, NULL, NULL, ii);
        g_free (action_name);

        /* Convert the category icon file to a themed icon name. */
        filename = e_categories_get_icon_file_for (category_name);
        if (filename != NULL && *filename != '\0') {
            gchar *basename;
            gchar *cp;

            basename = g_path_get_basename (filename);

            /* Lose the file extension. */
            if ((cp = strrchr (basename, '.')) != NULL)
                *cp = '\0';

            g_object_set (
                radio_action, "icon-name", basename, NULL);

            g_free (basename);
        }

        gtk_radio_action_set_group (radio_action, group);
        group = gtk_radio_action_get_group (radio_action);

        /* The action group takes ownership of the action. */
        action = GTK_ACTION (radio_action);
        gtk_action_group_add_action (action_group, action);
        g_object_unref (radio_action);
    }
    g_list_free (list);

    /* Use any action in the group; doesn't matter which. */
    e_shell_content_set_filter_action (shell_content, radio_action);

    ii = CONTACT_FILTER_UNMATCHED;
    e_shell_content_add_filter_separator_after (shell_content, ii);
}