2006-12-01 [wwp] 2.6.0cvs77
authorTristan Chabredier <wwp@claws-mail.org>
Fri, 1 Dec 2006 14:24:50 +0000 (14:24 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Fri, 1 Dec 2006 14:24:50 +0000 (14:24 +0000)
* manual/advanced.xml
* manual/fr/advanced.xml
* src/addressbook.c
* src/addressbook.h
* src/addressitem.h
* src/editaddress.c
* src/editaddress.h
* src/prefs_common.c
* src/prefs_common.h
* src/gtk/gtkutils.c
* src/gtk/gtkutils.h
add a hidden option to allow embedding the editaddress (edit contact details)
dialog into the addressbook's window. This doesn't change the default
behaviour.

14 files changed:
ChangeLog
PATCHSETS
configure.ac
manual/advanced.xml
manual/fr/advanced.xml
src/addressbook.c
src/addressbook.h
src/addressitem.h
src/editaddress.c
src/editaddress.h
src/gtk/gtkutils.c
src/gtk/gtkutils.h
src/prefs_common.c
src/prefs_common.h

index 85a04ed..5e95049 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2006-12-01 [wwp]       2.6.0cvs77
+
+       * manual/advanced.xml
+       * manual/fr/advanced.xml
+       * src/addressbook.c
+       * src/addressbook.h
+       * src/addressitem.h
+       * src/editaddress.c
+       * src/editaddress.h
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * src/gtk/gtkutils.c
+       * src/gtk/gtkutils.h
+               add a hidden option to allow embedding the editaddress (edit contact details)
+               dialog into the addressbook's window. This doesn't change the default
+               behaviour.
+
 2006-12-01 [wwp]       2.6.0cvs76
 
        * src/message_search.c
index 3f8cf8d..2e44bda 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.2.2.8 -r 1.2.2.9 tools/kdeservicemenu/README;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 tools/kdeservicemenu/claws-mail-kdeservicemenu.pl;  cvs diff -u -r 1.2.2.4 -r 1.2.2.5 tools/kdeservicemenu/install.sh;  cvs diff -u -r 1.1.2.1 -r 1.1.2.2 tools/kdeservicemenu/template_claws-mail-attach-files.desktop;  cvs diff -u -r -1.1.2.1 -r -1.1.2.2 tools/kdeservicemenu/template_claws-mail-compress-attach.desktop;  ) > 2.6.0cvs74.patchset
 ( cvs diff -u -r 1.1.2.54 -r 1.1.2.55 src/gtk/quicksearch.c;  ) > 2.6.0cvs75.patchset
 ( cvs diff -u -r 1.3.12.19 -r 1.3.12.20 src/message_search.c;  cvs diff -u -r 1.15.2.37 -r 1.15.2.38 src/summary_search.c;  ) > 2.6.0cvs76.patchset
+( cvs diff -u -r 1.1.2.34 -r 1.1.2.35 manual/advanced.xml;  cvs diff -u -r 1.1.2.14 -r 1.1.2.15 manual/fr/advanced.xml;  cvs diff -u -r 1.60.2.70 -r 1.60.2.71 src/addressbook.c;  cvs diff -u -r 1.18.2.4 -r 1.18.2.5 src/addressbook.h;  cvs diff -u -r 1.5.2.5 -r 1.5.2.6 src/addressitem.h;  cvs diff -u -r 1.14.2.17 -r 1.14.2.18 src/editaddress.c;  cvs diff -u -r 1.3.2.3 -r 1.3.2.4 src/editaddress.h;  cvs diff -u -r 1.204.2.110 -r 1.204.2.111 src/prefs_common.c;  cvs diff -u -r 1.103.2.68 -r 1.103.2.69 src/prefs_common.h;  cvs diff -u -r 1.5.2.44 -r 1.5.2.45 src/gtk/gtkutils.c;  cvs diff -u -r 1.4.2.26 -r 1.4.2.27 src/gtk/gtkutils.h;  ) > 2.6.0cvs77.patchset
index 449ca3e..c2d95fb 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=6
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=76
+EXTRA_VERSION=77
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index b0856d9..af3e66d 100644 (file)
        <filename>~/.claws-mail/clawsrc</filename>.
     </para>
     <variablelist>
+      <varlistentry>
+       <term><literal>addressbook_use_editaddress_dialog</literal></term>
+       <listitem>
+         <para>
+       Use a dialog to edit person details. '0': use an form embedded in
+       the addressbook's main window. '1' (default): use a separate dialog.
+         </para>
+       </listitem>
+      </varlistentry>
       <varlistentry>
        <term><literal>bold_unread</literal></term>
        <listitem>
index df60999..03e9830 100644 (file)
          Il existe un certain nombre de préférences cachées dans Claws Mail dont certains utilisateurs, auxquels nous voulions faire plaisir, ne pouvaient pas se passer mais qui n'avaient pas leur place, selon nous, dans l'interface graphique. Vous pouvez changer les options suivantes pendant que Claws Mail ne s'exécute pas dans le fichier ~/.claws-mail/sylpheedrc.
     </para>
     <variablelist>
+       <varlistentry>
+                       <term><literal>addressbook_use_editaddress_dialog</literal></term>
+               <listitem><para>Utilise un dialogue pour l'édition des coordonnées des contacts. '0': utilise un formulaire intégré à la fenêtre principale du carnet d'adresses. '1' (par defaut): utilise un dialogue séparé.
+         </para></listitem>
+        </varlistentry>
            <varlistentry><term>bold_unread</term>
                    <listitem><para>Montre les messages non lus en gras dans la liste de messages.</para></listitem>
             </varlistentry>
index d44806e..415a642 100644 (file)
@@ -187,6 +187,9 @@ static void addressbook_create                      (void);
 static gint addressbook_close                  (void);
 static void addressbook_button_set_sensitive   (void);
 
+static gboolean address_index_has_focus = FALSE;
+static gboolean address_list_has_focus = FALSE;
+
 /* callback functions */
 static void addressbook_del_clicked            (GtkButton      *button,
                                                 gpointer        data);
@@ -602,6 +605,7 @@ void addressbook_show_buttons(gboolean add_and_delete, gboolean lookup, gboolean
 
 void addressbook_open(Compose *target)
 {
+fprintf(stderr, "addressbook_open: %p\n", target);
        /* Initialize all static members */
        if( _clipBoard_ == NULL ) {
                _clipBoard_ = addrclip_create();
@@ -624,6 +628,9 @@ void addressbook_open(Compose *target)
        }
 
        gtk_widget_show_all(addrbook.window);
+       if (!prefs_common.addressbook_use_editaddress_dialog)
+               addressbook_edit_person_widgetset_hide();
+
        address_completion_start(addrbook.window);
 
        addressbook_show_buttons(target == NULL, lastCanLookup, target != NULL);
@@ -682,10 +689,14 @@ void addressbook_refresh( void )
 
 static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
 {
+fprintf(stderr, "key_pressed\n");
        if (event && event->keyval == GDK_Escape)
                addressbook_close();
-       else if (event && event->keyval == GDK_Delete)
-               addressbook_del_clicked(NULL, NULL);
+       else if (event && event->keyval == GDK_Delete) {
+               /* TODO: enable deletion when focus is in ctree (needs implementation in _del_clicked() */
+               if ( /* address_index_has_focus || */ address_list_has_focus )
+                       addressbook_del_clicked(NULL, NULL);
+       }
        return FALSE;
 }
 
@@ -792,6 +803,30 @@ static void addressbook_remarks_clicked(GtkWidget *button, GtkCList *clist)
        addressbook_sort_list(clist, COL_REMARKS, sort_type);
 }
 
+static void addressbook_address_index_focus_evt_in(GtkWidget *widget, GdkEventFocus *event,
+                                                                                        gpointer data)
+{
+       address_index_has_focus = TRUE;
+}
+
+static void addressbook_address_index_focus_evt_out(GtkWidget *widget, GdkEventFocus *event,
+                                                                                        gpointer data)
+{
+       address_index_has_focus = FALSE;
+}
+
+static void addressbook_address_list_focus_evt_in(GtkWidget *widget, GdkEventFocus *event,
+                                                                                        gpointer data)
+{
+       address_list_has_focus = TRUE;
+}
+
+static void addressbook_address_list_focus_evt_out(GtkWidget *widget, GdkEventFocus *event,
+                                                                                        gpointer data)
+{
+       address_list_has_focus = FALSE;
+}
+
 /*
 * Create the address book widgets. The address book contains two CTree widgets: the
 * address index tree on the left and the address list on the right.
@@ -815,10 +850,12 @@ static void addressbook_create(void)
        GtkWidget *vbox2;
        GtkWidget *ctree_swin;
        GtkWidget *ctree;
+       GtkWidget *editaddress_vbox;
        GtkWidget *clist_vbox;
        GtkWidget *clist_swin;
        GtkWidget *clist;
-       GtkWidget *paned;
+       GtkWidget *hpaned;
+       GtkWidget *vpaned;
        GtkWidget *hbox;
        GtkWidget *label;
        GtkWidget *entry;
@@ -848,6 +885,7 @@ static void addressbook_create(void)
 
        static GdkGeometry geometry;
 
+fprintf(stderr, "addressbook_create\n");
        debug_print("Creating addressbook window...\n");
 
        index_titles[COL_SOURCES] = _("Sources");
@@ -885,7 +923,7 @@ static void addressbook_create(void)
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ctree_swin),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
-       gtk_widget_set_size_request(ctree_swin, COL_FOLDER_WIDTH + 40, -1);
+       gtk_widget_set_size_request(ctree_swin, COL_FOLDER_WIDTH + 20, -1);
 
        /* Address index */
        ctree = gtk_sctree_new_with_titles(N_INDEX_COLS, 0, index_titles);
@@ -923,6 +961,10 @@ static void addressbook_create(void)
        g_signal_connect(G_OBJECT(ctree), "drag_data_received",
                         G_CALLBACK(addressbook_drag_received_cb),
                         ctree);
+       g_signal_connect(G_OBJECT(ctree), "focus_in_event",
+               G_CALLBACK(addressbook_address_index_focus_evt_in), NULL);
+       g_signal_connect(G_OBJECT(ctree), "focus_out_event",
+               G_CALLBACK(addressbook_address_index_focus_evt_out), NULL);
 
        clist_vbox = gtk_vbox_new(FALSE, 4);
 
@@ -943,6 +985,7 @@ static void addressbook_create(void)
                                   COL_NAME_WIDTH);
        gtk_clist_set_column_width(GTK_CLIST(clist), COL_ADDRESS,
                                   COL_ADDRESS_WIDTH);
+       gtk_widget_set_size_request(clist, -1, 80);
 
        addressbook_sort_list(GTK_CLIST(clist), COL_NAME, GTK_SORT_ASCENDING);
        g_signal_connect(G_OBJECT(GTK_CLIST(clist)->column[COL_NAME].button),
@@ -951,7 +994,11 @@ static void addressbook_create(void)
                "clicked", G_CALLBACK(addressbook_address_clicked), clist);
        g_signal_connect(G_OBJECT(GTK_CLIST(clist)->column[COL_REMARKS].button),
                "clicked", G_CALLBACK(addressbook_remarks_clicked), clist);
-       
+       g_signal_connect(G_OBJECT(clist), "focus_in_event",
+               G_CALLBACK(addressbook_address_list_focus_evt_in), NULL);
+       g_signal_connect(G_OBJECT(clist), "focus_out_event",
+               G_CALLBACK(addressbook_address_list_focus_evt_out), NULL);
+
        for (i = 0; i < N_LIST_COLS; i++)
                GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(clist)->column[i].button,
                                       GTK_CAN_FOCUS);
@@ -988,10 +1035,23 @@ static void addressbook_create(void)
        g_signal_connect(G_OBJECT(entry), "key_press_event",
                         G_CALLBACK(addressbook_entry_key_pressed),
                         NULL);
-       paned = gtk_hpaned_new();
-       gtk_box_pack_start(GTK_BOX(vbox2), paned, TRUE, TRUE, 0);
-       gtk_paned_add1(GTK_PANED(paned), ctree_swin);
-       gtk_paned_add2(GTK_PANED(paned), clist_vbox);
+
+       if (!prefs_common.addressbook_use_editaddress_dialog) {
+               editaddress_vbox = gtk_vbox_new(FALSE, 4);
+               vpaned = gtk_vpaned_new();
+               gtk_paned_pack1(GTK_PANED(vpaned), clist_vbox, FALSE, FALSE);
+               gtk_paned_pack2(GTK_PANED(vpaned), editaddress_vbox, TRUE, FALSE);
+       } else {
+               vpaned = NULL;
+               editaddress_vbox = NULL;
+       }
+       hpaned = gtk_hpaned_new();
+       gtk_box_pack_start(GTK_BOX(vbox2), hpaned, TRUE, TRUE, 0);
+       gtk_paned_pack1(GTK_PANED(hpaned), ctree_swin, FALSE, FALSE);
+       if (prefs_common.addressbook_use_editaddress_dialog)
+               gtk_paned_pack2(GTK_PANED(hpaned), clist_vbox, TRUE, FALSE);
+       else
+               gtk_paned_pack2(GTK_PANED(hpaned), vpaned, TRUE, FALSE);
 
        /* Status bar */
        hsbox = gtk_hbox_new(FALSE, 0);
@@ -1118,6 +1178,7 @@ static void addressbook_create(void)
        addrbook.ctree   = ctree;
        addrbook.ctree_swin
                         = ctree_swin;
+       addrbook.editaddress_vbox = editaddress_vbox;
        addrbook.clist   = clist;
        addrbook.label   = label;
        addrbook.entry   = entry;
@@ -1159,7 +1220,10 @@ static void addressbook_create(void)
  * Close address book window and save to file(s).
  */
 static gint addressbook_close( void ) {
+fprintf(stderr, "addressbook_close\n");
        address_completion_end(addrbook.window);
+       if (!prefs_common.addressbook_use_editaddress_dialog)
+               addressbook_edit_person_invalidate(NULL, NULL, NULL);
        gtk_widget_hide(addrbook.window);
        addressbook_export_to_file();
        return TRUE;
@@ -1266,6 +1330,7 @@ static void addressbook_del_clicked(GtkButton *button, gpointer data)
        GList *list, *node;
        gboolean refreshList = FALSE;
        
+fprintf(stderr, "addressbook_del_clicked: %p %p\n", button, data);
        pobj = gtk_ctree_node_get_row_data(ctree, addrbook.opened );
        g_return_if_fail(pobj != NULL);
 
@@ -1666,6 +1731,7 @@ static void addressbook_tree_selected(GtkCTree *ctree, GtkCTreeNode *node,
        ItemFolder *rootFolder = NULL;
        AddressObjectType aot;
 
+fprintf(stderr, "addressbook_tree_selected\n");
        addrbook.treeSelected = node;
        addrbook.listSelected = NULL;
        addressbook_status_show( "" );
@@ -1729,6 +1795,8 @@ static void addressbook_tree_selected(GtkCTree *ctree, GtkCTreeNode *node,
        g_signal_handlers_unblock_by_func
                (G_OBJECT(ctree),
                 G_CALLBACK(addressbook_tree_selected), NULL);
+       if (!prefs_common.addressbook_use_editaddress_dialog)
+               addressbook_edit_person_invalidate(NULL, NULL, NULL);
 
        /* Setup main menu selections */
        addressbook_menubar_set_sensitive( FALSE );
@@ -1891,6 +1959,7 @@ static void addressbook_treenode_add_list(
 }
 
 static void addressbook_select_all_cb( void ) {
+fprintf(stderr, "addressbook_select_all_cb\n");
        gtk_clist_select_all(GTK_CLIST(addrbook.clist));
 }
 
@@ -2121,6 +2190,7 @@ static void addressbook_list_row_selected( GtkCTree *clist,
        AdapterDSource *ads = NULL;
        AddressDataSource *ds = NULL;
 
+fprintf(stderr, "addressbook_list_row_selected\n");
        gtk_entry_set_text( entry, "" );
        addrbook.listSelected = node;
 
@@ -2142,6 +2212,9 @@ static void addressbook_list_row_selected( GtkCTree *clist,
        }
 
        addressbook_list_menu_setup();
+
+       if (!addrbook.target_compose && !prefs_common.addressbook_use_editaddress_dialog)
+               addressbook_edit_address_cb(NULL, 0, NULL);
 }
 
 static void addressbook_list_row_unselected( GtkCTree *ctree,
@@ -2151,11 +2224,15 @@ static void addressbook_list_row_unselected( GtkCTree *ctree,
 {
        AddrItemObject *aio;
 
+fprintf(stderr, "addressbook_list_row_unselected\n");
        aio = gtk_ctree_node_get_row_data( ctree, node );
        if( aio != NULL ) {
                /* printf( "list unselect: %d : '%s'\n", aio->type, aio->name ); */
                addressbook_list_select_remove( aio );
        }
+
+       if (!prefs_common.addressbook_use_editaddress_dialog)
+               addressbook_edit_person_invalidate(NULL, NULL, NULL);
 }
 
 /* from gdkevents.c */
@@ -2179,6 +2256,7 @@ static gboolean addressbook_list_button_pressed(GtkWidget *widget,
                            addrbook.target_compose)
                                addressbook_to_clicked(NULL, GINT_TO_POINTER(COMPOSE_TO));
                        else
+                               if (prefs_common.addressbook_use_editaddress_dialog)
                                addressbook_edit_address_cb(NULL, 0, NULL);
 
                        lasttime = 0;
@@ -2733,6 +2811,30 @@ static void addressbook_treenode_delete_cb(
        }
 }
 
+void addressbook_new_address_from_book_post_cb( ItemPerson *person )
+{
+fprintf(stderr, "addressbook_new_address_from_book_post_cb\n");
+       if( person && addrbook.treeSelected == addrbook.opened ) {
+               gtk_clist_unselect_all( GTK_CLIST(addrbook.clist) );
+               addressbook_folder_refresh_one_person(
+                       GTK_CTREE(addrbook.clist), person );
+       }
+       addressbook_address_list_set_focus();
+}
+
+void addressbook_new_address_from_folder_post_cb( ItemPerson *person )
+{
+fprintf(stderr, "addressbook_new_address_from_folder_post_cb\n");
+       if( person && addrbook.treeSelected == addrbook.opened) {
+               gtk_sctree_select( GTK_SCTREE(addrbook.ctree), addrbook.opened );
+               addressbook_set_clist(
+                       gtk_ctree_node_get_row_data(GTK_CTREE(addrbook.ctree),
+                               addrbook.opened),
+                       TRUE);
+       }
+       addressbook_address_list_set_focus();
+}
+
 static void addressbook_new_address_cb( gpointer data, guint action, GtkWidget *widget ) {
        AddressObject *pobj = NULL;
        AddressDataSource *ds = NULL;
@@ -2749,27 +2851,23 @@ static void addressbook_new_address_cb( gpointer data, guint action, GtkWidget *
        if( pobj->type == ADDR_DATASOURCE ) {
                if( ADAPTER_DSOURCE(pobj)->subType == ADDR_BOOK ) {
                        /* New address */
-                       ItemPerson *person = addressbook_edit_person( abf, NULL, NULL, FALSE );
-                       if( person && addrbook.treeSelected == addrbook.opened ) {
-                               gtk_clist_unselect_all( GTK_CLIST(addrbook.clist) );
-                               addressbook_folder_refresh_one_person(
-                                       GTK_CTREE(addrbook.clist), person );
-                       }
+                       ItemPerson *person = addressbook_edit_person( abf, NULL, NULL, FALSE,
+                                                                                                                 addrbook.editaddress_vbox,
+                                                                                                                 addressbook_new_address_from_book_post_cb,
+                                                                                                                 TRUE );
+                       if (prefs_common.addressbook_use_editaddress_dialog)
+                               addressbook_new_address_from_book_post_cb( person );
                }
        }
        else if( pobj->type == ADDR_ITEM_FOLDER ) {
                /* New address */
                ItemFolder *folder = ADAPTER_FOLDER(pobj)->itemFolder;
-               ItemPerson *person = addressbook_edit_person( abf, folder, NULL, FALSE );
-               if( person ) {
-                       if (addrbook.treeSelected == addrbook.opened) {
-                               gtk_sctree_select( GTK_SCTREE(addrbook.ctree), addrbook.opened );
-                               addressbook_set_clist(
-                                       gtk_ctree_node_get_row_data(GTK_CTREE(addrbook.ctree),
-                                               addrbook.opened),
-                                       TRUE);
-                       }
-               }
+               ItemPerson *person = addressbook_edit_person( abf, folder, NULL, FALSE,
+                                                                                                         addrbook.editaddress_vbox,
+                                                                                                         addressbook_new_address_from_folder_post_cb,
+                                                                                                         TRUE );
+               if (prefs_common.addressbook_use_editaddress_dialog)
+                       addressbook_new_address_from_folder_post_cb( person );
        }
        else if( pobj->type == ADDR_ITEM_GROUP ) {
                /* New address in group */
@@ -2850,6 +2948,22 @@ static void addressbook_move_nodes_up( GtkCTree *ctree, GtkCTreeNode *node ) {
        }
 }
 
+void addressbook_edit_address_post_cb( ItemPerson *person )
+{
+fprintf(stderr, "addressbook_edit_address_post_cb\n");
+       if( person ) {
+               addressbook_folder_refresh_one_person( GTK_CTREE(addrbook.clist), person );
+               invalidate_address_completion();
+       }
+       addressbook_address_list_set_focus();
+}
+
+void addressbook_address_list_set_focus( void )
+{
+       if (!prefs_common.addressbook_use_editaddress_dialog)
+               gtk_window_set_focus(GTK_WINDOW(addrbook.window), addrbook.clist);
+}
+
 static void addressbook_edit_address_cb( gpointer data, guint action, GtkWidget *widget ) {
        GtkCTree *clist = GTK_CTREE(addrbook.clist);
        GtkCTree *ctree;
@@ -2889,18 +3003,26 @@ static void addressbook_edit_address_cb( gpointer data, guint action, GtkWidget
                        /* Edit person - email page */
                        ItemPerson *person;
                        person = ( ItemPerson * ) ADDRITEM_PARENT(email);
-                       if( addressbook_edit_person( abf, NULL, person, TRUE ) == NULL ) return;
-                       addressbook_folder_refresh_one_person( clist, person );
-                       invalidate_address_completion();
+                       if  ( addressbook_edit_person( abf, NULL, person, TRUE, addrbook.editaddress_vbox,
+                                                                                  addressbook_edit_address_post_cb,
+                                                                                  prefs_common.addressbook_use_editaddress_dialog?TRUE:FALSE )
+                                 != NULL ) {
+                               if (prefs_common.addressbook_use_editaddress_dialog)
+                                       addressbook_edit_address_post_cb( person );
+                       }
                        return;
                }
        }
        else if( obj->type == ADDR_ITEM_PERSON ) {
                /* Edit person - basic page */
                ItemPerson *person = ( ItemPerson * ) obj;
-               if( addressbook_edit_person( abf, NULL, person, FALSE ) == NULL ) return;
-               addressbook_folder_refresh_one_person( clist, person );
-               invalidate_address_completion();
+               if( addressbook_edit_person( abf, NULL, person, FALSE, addrbook.editaddress_vbox,
+                                                                         addressbook_edit_address_post_cb,
+                                                                         prefs_common.addressbook_use_editaddress_dialog?TRUE:FALSE )
+                       != NULL ) {
+                       if (prefs_common.addressbook_use_editaddress_dialog)
+                               addressbook_edit_address_post_cb( person );
+               }
                return;
        }
        else if( obj->type == ADDR_ITEM_GROUP ) {
@@ -3740,6 +3862,7 @@ void addressbook_export_to_file( void ) {
 
 static gboolean addressbook_entry_key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
 {
+fprintf(stderr, "addressbook_entry_key_pressed\n");
        if (event && event->keyval == GDK_Return)
                addressbook_lup_clicked(NULL, NULL);
        return FALSE;
index 237f13a..601a1c7 100644 (file)
@@ -58,6 +58,10 @@ void addressbook_harvest             ( FolderItem *folderItem,
                                          GList *msgList);
 
 void addressbook_read_all              ( void );
+void addressbook_new_address_from_book_post_cb( ItemPerson *person );
+void addressbook_new_address_from_folder_post_cb( ItemPerson *person );
+void addressbook_edit_address_post_cb( ItemPerson *person );
+void addressbook_address_list_set_focus( void );
 
 #endif /* __ADDRESSBOOK_H__ */
 
index 14e90aa..3284f4e 100644 (file)
@@ -63,6 +63,7 @@ struct _AddressBook_win
        GtkWidget *menubar;
        GtkWidget *ctree;
        GtkWidget *ctree_swin;
+       GtkWidget *editaddress_vbox;
        GtkWidget *clist;
        GtkWidget *entry;
        GtkWidget *label;
index dc1abdc..e18f072 100644 (file)
 #include "manage_window.h"
 #include "gtkutils.h"
 #include "codeconv.h"
+#include "editaddress.h"
 
 #include "prefs_common.h"
 
 static struct _PersonEdit_dlg {
-       GtkWidget *window;
+       GtkWidget *container;
        GtkWidget *notebook;
        GtkWidget *ok_btn;
        GtkWidget *cancel_btn;
-       GtkWidget *statusbar;
+       GtkWidget *statusbar;   /* used when prefs_common.addressbook_use_editaddress_dialog is TRUE */
+       GtkWidget *title;       /* used when prefs_common.addressbook_use_editaddress_dialog is FALSE */
        gint status_cid;
 
        /* User data tab */
@@ -81,9 +83,14 @@ static struct _PersonEdit_dlg {
        gint rowIndAttrib;
        gboolean editNew;
        gboolean read_only;
-
 } personeditdlg;
 
+/* transient data */
+static AddressBookFile *current_abf = NULL;
+static ItemPerson *current_person = NULL;
+static ItemFolder *current_parent_folder = NULL;
+static EditAddressPostUpdateCallback edit_person_close_post_update_cb = NULL;
+
 typedef enum {
        EMAIL_COL_EMAIL   = 0,
        EMAIL_COL_ALIAS   = 1,
@@ -96,7 +103,7 @@ typedef enum {
 } PersonEditAttribColumnPos;
 
 #define EDITPERSON_WIDTH      520
-#define EDITPERSON_HEIGHT     340
+#define EDITPERSON_HEIGHT     320
 
 #define EMAIL_N_COLS          3
 #define EMAIL_COL_WIDTH_EMAIL 180
@@ -121,31 +128,57 @@ static void edit_person_status_show( gchar *msg ) {
 
 static void edit_person_ok(GtkWidget *widget, gboolean *cancelled) {
        *cancelled = FALSE;
+fprintf(stderr, "edit_person_ok\n");
+       if (prefs_common.addressbook_use_editaddress_dialog)
        gtk_main_quit();
+       else
+               addressbook_edit_person_close( *cancelled );
 }
 
 static void edit_person_cancel(GtkWidget *widget, gboolean *cancelled) {
        *cancelled = TRUE;
+fprintf(stderr, "edit_person_cancel\n");
+       if (prefs_common.addressbook_use_editaddress_dialog)
        gtk_main_quit();
+       else
+               addressbook_edit_person_close( *cancelled );
 }
 
 static gint edit_person_delete_event(GtkWidget *widget, GdkEventAny *event, gboolean *cancelled) {
        *cancelled = TRUE;
+fprintf(stderr, "edit_person_delete_event\n");
+       if (prefs_common.addressbook_use_editaddress_dialog)
        gtk_main_quit();
+       else
+               addressbook_edit_person_close( *cancelled );
        return TRUE;
 }
 
 static gboolean edit_person_key_pressed(GtkWidget *widget, GdkEventKey *event, gboolean *cancelled) {
+       if (prefs_common.addressbook_use_editaddress_dialog) {
        if (event && event->keyval == GDK_Escape) {
                *cancelled = TRUE;
                gtk_main_quit();
        }
+       }
        return FALSE;
 }
 
 static gchar *_title_new_ = NULL;
 static gchar *_title_edit_ = NULL;
 
+static void edit_person_set_widgets_title( gchar *text )
+{
+       gchar *label = NULL;
+
+       g_return_if_fail( text != NULL );
+
+       gtk_label_set_text(GTK_LABEL(personeditdlg.title), "");
+       label = g_markup_printf_escaped("<b>%s</b>", text);
+       gtk_label_set_markup(GTK_LABEL(personeditdlg.title), label);
+       g_free(label);
+}
+
 static void edit_person_set_window_title( gint pageNum ) {
        gchar *sTitle;
 
@@ -156,10 +189,16 @@ static void edit_person_set_window_title( gint pageNum ) {
 
        if( pageNum == PAGE_BASIC ) {
                if( personeditdlg.editNew ) {
-                       gtk_window_set_title( GTK_WINDOW(personeditdlg.window), _title_new_ );
+                       if (prefs_common.addressbook_use_editaddress_dialog)
+                               gtk_window_set_title( GTK_WINDOW(personeditdlg.container), _title_new_ );
+                       else
+                               edit_person_set_widgets_title( _title_new_ );
                }
                else {
-                       gtk_window_set_title( GTK_WINDOW(personeditdlg.window), _title_edit_ );
+                       if (prefs_common.addressbook_use_editaddress_dialog)
+                               gtk_window_set_title( GTK_WINDOW(personeditdlg.container), _title_edit_ );
+                       else
+                               edit_person_set_widgets_title( _title_edit_ );
                }
        }
        else {
@@ -172,7 +211,10 @@ static void edit_person_set_window_title( gint pageNum ) {
                        sTitle = g_strdup_printf( "%s - %s", _title_edit_, name );
                        g_free( name );
                }
-               gtk_window_set_title( GTK_WINDOW(personeditdlg.window), sTitle );
+               if (prefs_common.addressbook_use_editaddress_dialog)
+                       gtk_window_set_title( GTK_WINDOW(personeditdlg.container), sTitle );
+               else
+                       edit_person_set_widgets_title( sTitle );
                g_free( sTitle );
        }
 }
@@ -543,37 +585,20 @@ static void edit_person_size_allocate_cb(GtkWidget *widget,
        prefs_common.addressbookeditpersonwin_height = allocation->height;
 }
 
-static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
-       GtkWidget *window;
+/* build edit person widgets, return a pointer to the main container of the widgetset (a vbox) */
+static GtkWidget* addressbook_edit_person_widgets_create( GtkWidget* container, gboolean *cancelled )
+{
        GtkWidget *vbox;
        GtkWidget *vnbox;
        GtkWidget *notebook;
        GtkWidget *hbbox;
        GtkWidget *ok_btn;
        GtkWidget *cancel_btn;
-       GtkWidget *hsbox;
-       GtkWidget *statusbar;
-       static GdkGeometry geometry;
-
-       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-       /* gtk_container_set_border_width(GTK_CONTAINER(window), 0); */
-       gtk_window_set_title(GTK_WINDOW(window), _("Edit Person Data"));
-       gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
-       gtk_window_set_modal(GTK_WINDOW(window), TRUE); 
-       g_signal_connect(G_OBJECT(window), "delete_event",
-                        G_CALLBACK(edit_person_delete_event),
-                        cancelled);
-       g_signal_connect(G_OBJECT(window), "size_allocate",
-                        G_CALLBACK(edit_person_size_allocate_cb),
-                       cancelled);
-       g_signal_connect(G_OBJECT(window), "key_press_event",
-                        G_CALLBACK(edit_person_key_pressed),
-                        cancelled);
 
        vbox = gtk_vbox_new(FALSE, 4);
        /* gtk_container_set_border_width(GTK_CONTAINER(vbox), BORDER_WIDTH); */
        gtk_widget_show(vbox);
-       gtk_container_add(GTK_CONTAINER(window), vbox);
+       gtk_container_add(GTK_CONTAINER(container), vbox);
 
        vnbox = gtk_vbox_new(FALSE, 4);
        gtk_container_set_border_width(GTK_CONTAINER(vnbox), 4);
@@ -586,16 +611,16 @@ static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
        gtk_box_pack_start(GTK_BOX(vnbox), notebook, TRUE, TRUE, 0);
        gtk_container_set_border_width(GTK_CONTAINER(notebook), 6);
 
-       /* Status line */
-       hsbox = gtk_hbox_new(FALSE, 0);
-       gtk_box_pack_end(GTK_BOX(vbox), hsbox, FALSE, FALSE, BORDER_WIDTH);
-       statusbar = gtk_statusbar_new();
-       gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH);
-
        /* Button panel */
+       if (prefs_common.addressbook_use_editaddress_dialog)
        gtkut_stock_button_set_create(&hbbox, &cancel_btn, GTK_STOCK_CANCEL,
                                      &ok_btn, GTK_STOCK_OK,
                                      NULL, NULL);
+       else
+               gtkut_stock_with_text_button_set_create(&hbbox,
+                                         &cancel_btn, GTK_STOCK_CANCEL, _("Discard"),
+                                     &ok_btn, GTK_STOCK_OK, _("Apply"),
+                                     NULL, NULL, NULL);
        gtk_box_pack_end(GTK_BOX(vnbox), hbbox, FALSE, FALSE, 0);
        gtk_widget_grab_default(ok_btn);
 
@@ -608,6 +633,43 @@ static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
 
        gtk_widget_show_all(vbox);
 
+       personeditdlg.notebook   = notebook;
+       personeditdlg.ok_btn     = ok_btn;
+       personeditdlg.cancel_btn = cancel_btn;
+
+       return vbox;
+}
+
+static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
+       GtkWidget *window;
+       GtkWidget *hsbox;
+       GtkWidget *vbox;
+       GtkWidget *statusbar;
+       static GdkGeometry geometry;
+
+       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       /* gtk_container_set_border_width(GTK_CONTAINER(window), 0); */
+       gtk_window_set_title(GTK_WINDOW(window), _("Edit Person Data"));
+       gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+       gtk_window_set_modal(GTK_WINDOW(window), TRUE); 
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(edit_person_delete_event),
+                        cancelled);
+       g_signal_connect(G_OBJECT(window), "size_allocate",
+                        G_CALLBACK(edit_person_size_allocate_cb),
+                       cancelled);
+       g_signal_connect(G_OBJECT(window), "key_press_event",
+                        G_CALLBACK(edit_person_key_pressed),
+                        cancelled);
+
+       vbox = addressbook_edit_person_widgets_create(window, cancelled);
+
+       /* Status line */
+       hsbox = gtk_hbox_new(FALSE, 0);
+       gtk_box_pack_end(GTK_BOX(vbox), hsbox, FALSE, FALSE, BORDER_WIDTH);
+       statusbar = gtk_statusbar_new();
+       gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH);
+
        if (!geometry.min_height) {
                geometry.min_width = EDITPERSON_WIDTH;
                geometry.min_height = EDITPERSON_HEIGHT;
@@ -618,15 +680,44 @@ static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
        gtk_widget_set_size_request(window, prefs_common.addressbookeditpersonwin_width,
                                    prefs_common.addressbookeditpersonwin_height);
 
-       personeditdlg.window     = window;
-       personeditdlg.notebook   = notebook;
-       personeditdlg.ok_btn     = ok_btn;
-       personeditdlg.cancel_btn = cancel_btn;
+       personeditdlg.container  = window;
        personeditdlg.statusbar  = statusbar;
        personeditdlg.status_cid = gtk_statusbar_get_context_id( GTK_STATUSBAR(statusbar), "Edit Person Dialog" );
 
 }
 
+/* parent must be a box */
+static void addressbook_edit_person_widgetset_create( GtkWidget *parent, gboolean *cancelled )
+{
+       GtkWidget *vbox;
+       GtkWidget *label;
+
+       if ( parent == NULL )
+               g_warning("addressbook_edit_person_widgetset_create: parent is NULL");
+
+       vbox = gtk_vbox_new(FALSE, 0);
+       gtk_box_pack_end(GTK_BOX(parent), vbox, TRUE, TRUE, 0);
+
+       label = gtk_label_new(_("Edit Person Data"));
+       gtk_label_set_justify( GTK_LABEL(label), GTK_JUSTIFY_CENTER);
+       gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+
+       addressbook_edit_person_widgets_create(vbox, cancelled);
+
+       gtk_widget_set_size_request(vbox, EDITPERSON_WIDTH, EDITPERSON_HEIGHT);
+
+       personeditdlg.container = vbox;
+       personeditdlg.title = label;
+       personeditdlg.statusbar  = NULL;
+       personeditdlg.status_cid = 0;
+}
+
+void addressbook_edit_person_widgetset_hide( void )
+{
+       if ( personeditdlg.container )
+               gtk_widget_hide( personeditdlg.container );
+}
+
 static void addressbook_edit_person_page_basic( gint pageNum, gchar *pageLbl ) {
        GtkWidget *vbox;
        GtkWidget *table;
@@ -1065,12 +1156,15 @@ static void addressbook_edit_person_page_attrib( gint pageNum, gchar *pageLbl )
        personeditdlg.attrib_mod = buttonMod;
 }
 
-static void addressbook_edit_person_create( gboolean *cancelled ) {
+static void addressbook_edit_person_create( GtkWidget *parent, gboolean *cancelled ) {
+       if (prefs_common.addressbook_use_editaddress_dialog)
        addressbook_edit_person_dialog_create( cancelled );
+       else
+               addressbook_edit_person_widgetset_create( parent, cancelled );
        addressbook_edit_person_page_basic( PAGE_BASIC, _( "_User Data" ) );
        addressbook_edit_person_page_email( PAGE_EMAIL, _( "_Email Addresses" ) );
        addressbook_edit_person_page_attrib( PAGE_ATTRIBUTES, _( "O_ther Attributes" ) );
-       gtk_widget_show_all( personeditdlg.window );
+       gtk_widget_show_all( personeditdlg.container );
 }
 
 /*
@@ -1124,6 +1218,118 @@ static void update_sensitivity(void)
        gtk_widget_set_sensitive(personeditdlg.attrib_mod,    !personeditdlg.read_only);
 }
 
+static void addressbook_edit_person_flush_transient( void )
+{
+       ItemPerson *person = current_person;
+       EditAddressPostUpdateCallback callback = edit_person_close_post_update_cb;
+
+fprintf(stderr, "addressbook_edit_person_flush_transient\n");
+       /* reset transient data */
+       current_abf = NULL;
+       current_person = NULL;
+       current_parent_folder = NULL;
+       edit_person_close_post_update_cb = NULL;
+
+       /* post action to perform on addressbook side */
+       if (callback) {
+fprintf(stderr, "-> callback %p\n", callback);
+               callback( person );
+       }
+}
+
+void addressbook_edit_person_invalidate( AddressBookFile *abf, ItemFolder *parent_folder,
+                                                                                ItemPerson *person )
+{
+fprintf(stderr, "addressbook_edit_person_invalidate (arg: %p %p %p) (cur: %p %p %p)\n",
+abf, parent_folder, person, current_abf, current_parent_folder, current_person);
+       if (current_abf == NULL &&
+               current_person == NULL &&
+               current_parent_folder == NULL)
+               /* edit address form is already hidden */
+               return;
+
+       /* unconditional invalidation or invalidating the currently edited item */
+       if ( ( abf == NULL && person == NULL && parent_folder == NULL )
+               || (current_abf == abf ||
+                       current_person == person ||
+                       current_parent_folder == parent_folder))
+               addressbook_edit_person_close( TRUE );
+}
+
+gboolean addressbook_edit_person_close( gboolean cancelled )
+{
+       GList *listEMail = NULL;
+       GList *listAttrib = NULL;
+       gchar *cn = NULL;
+
+fprintf(stderr, "addressbook_edit_person_close\n");
+       listEMail = edit_person_build_email_list();
+       listAttrib = edit_person_build_attrib_list();
+       if( cancelled ) {
+               addritem_free_list_email( listEMail );
+               addritem_free_list_attribute( listAttrib );
+               gtk_clist_clear( GTK_CLIST(personeditdlg.clist_email) );
+               gtk_clist_clear( GTK_CLIST(personeditdlg.clist_attrib) );
+
+               if (!prefs_common.addressbook_use_editaddress_dialog)
+                       gtk_widget_hide( personeditdlg.container );
+
+               /* no callback, as we're discarding the form */
+               edit_person_close_post_update_cb = NULL;
+               addressbook_edit_person_flush_transient();
+
+               /* set focus to the address list (this is done by the post_update_cb usually) */
+               addressbook_address_list_set_focus();
+               return FALSE;
+       }
+
+       cn = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_name), 0, -1 );
+       if( current_person && current_abf ) {
+               /* Update email/attribute list for existing current_person */
+               addrbook_update_address_list( current_abf, current_person, listEMail );
+               addrbook_update_attrib_list( current_abf, current_person, listAttrib );
+       }
+       else {
+               /* Create new current_person and email/attribute list */
+               if( cn == NULL || *cn == '\0' ) {
+                       /* Wasting our time */
+                       if( listEMail == NULL && listAttrib == NULL ) cancelled = TRUE;
+               }
+               if( ! cancelled && current_abf ) {
+                       current_person = addrbook_add_address_list( current_abf, current_parent_folder, listEMail );
+                       addrbook_add_attrib_list( current_abf, current_person, listAttrib );
+               }
+       }
+       listEMail = NULL;
+       listAttrib = NULL;
+
+       if( ! cancelled ) {
+               /* Set current_person stuff */
+               gchar *name;
+               addritem_person_set_common_name( current_person, cn );
+               name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_first), 0, -1 );
+               addritem_person_set_first_name( current_person, name );
+               g_free( name );
+               name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_last), 0, -1 );
+               addritem_person_set_last_name( current_person, name );
+               g_free( name );
+               name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_nick), 0, -1 );
+               addritem_person_set_nick_name( current_person, name );
+               g_free( name );
+       }
+       g_free( cn );
+
+       gtk_clist_clear( GTK_CLIST(personeditdlg.clist_email) );
+       gtk_clist_clear( GTK_CLIST(personeditdlg.clist_attrib) );
+
+       if (!prefs_common.addressbook_use_editaddress_dialog)
+               gtk_widget_hide( personeditdlg.container );
+
+       addressbook_edit_person_flush_transient();
+
+       return TRUE;
+}
 /*
 * Edit person.
 * Enter: abf    Address book.
@@ -1133,22 +1339,34 @@ static void update_sensitivity(void)
 *        pgMail If TRUE, E-Mail page will be activated.
 * Return: Edited object, or NULL if cancelled.
 */
-ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent, ItemPerson *person, gboolean pgMail ) {
+ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent_folder, ItemPerson *person,
+                                                                        gboolean pgMail, GtkWidget *parent_container,
+                                                                        void (*post_update_cb) (ItemPerson *person),
+                                                                        gboolean get_focus) {
        static gboolean cancelled;
-       GList *listEMail = NULL;
-       GList *listAttrib = NULL;
-       gchar *cn = NULL;
 
-       if (!personeditdlg.window)
-               addressbook_edit_person_create(&cancelled);
-       gtk_widget_grab_focus(personeditdlg.ok_btn);
-       gtk_widget_grab_focus(personeditdlg.entry_name);
+fprintf(stderr, "addressbook_edit_person: start\n");
+       /* set transient data */
+       current_abf = abf;
+       current_person = person;
+       current_parent_folder = parent_folder;
+       edit_person_close_post_update_cb = post_update_cb;
+
+       if( !personeditdlg.container )
+               addressbook_edit_person_create(parent_container, &cancelled);
+
+       /* typically, get focus when dialog mode is enabled, or when editing a new address */
+       if( get_focus ) {
+               gtk_widget_grab_focus(personeditdlg.ok_btn);
+               gtk_widget_grab_focus(personeditdlg.entry_name);
+       }
        
-       personeditdlg.read_only = (abf == NULL);
+       personeditdlg.read_only = (current_abf == NULL);
        update_sensitivity();
 
-       gtk_widget_show(personeditdlg.window);
-       manage_window_set_transient(GTK_WINDOW(personeditdlg.window));
+       gtk_widget_show(personeditdlg.container);
+       if (prefs_common.addressbook_use_editaddress_dialog)
+               manage_window_set_transient(GTK_WINDOW(personeditdlg.container));
 
        /* Clear all fields */
        personeditdlg.rowIndEMail = -1;
@@ -1194,57 +1412,16 @@ ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent, I
 
        edit_person_attrib_clear( NULL );
 
+       if (prefs_common.addressbook_use_editaddress_dialog) {
+
        gtk_main();
-       gtk_widget_hide( personeditdlg.window );
+               gtk_widget_hide( personeditdlg.container );
 
-       listEMail = edit_person_build_email_list();
-       listAttrib = edit_person_build_attrib_list();
-       if( cancelled ) {
-               addritem_free_list_email( listEMail );
-               addritem_free_list_attribute( listAttrib );
-               gtk_clist_clear( GTK_CLIST(personeditdlg.clist_email) );
-               gtk_clist_clear( GTK_CLIST(personeditdlg.clist_attrib) );
+fprintf(stderr, "addressbook_edit_person: sync end\n");
+               if (!addressbook_edit_person_close( cancelled ))
                return NULL;
        }
-
-       cn = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_name), 0, -1 );
-       if( person && abf ) {
-               /* Update email/attribute list for existing person */
-               addrbook_update_address_list( abf, person, listEMail );
-               addrbook_update_attrib_list( abf, person, listAttrib );
-       }
-       else {
-               /* Create new person and email/attribute list */
-               if( cn == NULL || *cn == '\0' ) {
-                       /* Wasting our time */
-                       if( listEMail == NULL && listAttrib == NULL ) cancelled = TRUE;
-               }
-               if( ! cancelled && abf ) {
-                       person = addrbook_add_address_list( abf, parent, listEMail );
-                       addrbook_add_attrib_list( abf, person, listAttrib );
-               }
-       }
-       listEMail = NULL;
-       listAttrib = NULL;
-
-       if( ! cancelled ) {
-               /* Set person stuff */
-               gchar *name;
-               addritem_person_set_common_name( person, cn );
-               name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_first), 0, -1 );
-               addritem_person_set_first_name( person, name );
-               g_free( name );
-               name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_last), 0, -1 );
-               addritem_person_set_last_name( person, name );
-               g_free( name );
-               name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_nick), 0, -1 );
-               addritem_person_set_nick_name( person, name );
-               g_free( name );
-       }
-       g_free( cn );
-
-       gtk_clist_clear( GTK_CLIST(personeditdlg.clist_email) );
-       gtk_clist_clear( GTK_CLIST(personeditdlg.clist_attrib) );
+fprintf(stderr, "addressbook_edit_person: async end\n");
 
        return person;
 }
index eae95f4..62870bb 100644 (file)
 #ifndef __EDITADDRESS_H__
 #define __EDITADDRESS_H__
 
-ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent, ItemPerson *person, gboolean pgMail );
+typedef void (*EditAddressPostUpdateCallback) (ItemPerson *person);
+
+ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent, ItemPerson *person,
+                                                                        gboolean pgMail, GtkWidget *parent_container,
+                                                                        EditAddressPostUpdateCallback,
+                                                                        gboolean get_focus );
+void addressbook_edit_person_invalidate( AddressBookFile *abf, ItemFolder *parent_folder,
+                                                                                ItemPerson *person );
+void addressbook_edit_person_widgetset_hide( void );
+gboolean addressbook_edit_person_close( gboolean cancelled );
 
 #endif /* __EDITADDRESS_H__ */
index c72996d..85c6372 100644 (file)
@@ -167,6 +167,42 @@ void gtkut_stock_button_set_create(GtkWidget **bbox,
        }
 }
 
+void gtkut_stock_with_text_button_set_create(GtkWidget **bbox,
+                                  GtkWidget **button1, const gchar *label1, const gchar *text1,
+                                  GtkWidget **button2, const gchar *label2, const gchar *text2,
+                                  GtkWidget **button3, const gchar *label3, const gchar *text3)
+{
+       g_return_if_fail(bbox != NULL);
+       g_return_if_fail(button1 != NULL);
+
+       *bbox = gtk_hbutton_box_new();
+       gtk_button_box_set_layout(GTK_BUTTON_BOX(*bbox), GTK_BUTTONBOX_END);
+       gtk_box_set_spacing(GTK_BOX(*bbox), 5);
+
+       *button1 = gtk_button_new_with_mnemonic(text1);
+       gtk_button_set_image(GTK_BUTTON(*button1),
+               gtk_image_new_from_stock(label1, GTK_ICON_SIZE_BUTTON));
+       GTK_WIDGET_SET_FLAGS(*button1, GTK_CAN_DEFAULT);
+       gtk_box_pack_start(GTK_BOX(*bbox), *button1, TRUE, TRUE, 0);
+       gtk_widget_show(*button1);
+
+       if (button2) {
+               *button2 = gtk_button_new_with_mnemonic(text2);
+       gtk_button_set_image(GTK_BUTTON(*button2),
+               gtk_image_new_from_stock(label2, GTK_ICON_SIZE_BUTTON));
+               gtk_box_pack_start(GTK_BOX(*bbox), *button2, TRUE, TRUE, 0);
+               gtk_widget_show(*button2);
+       }
+
+       if (button3) {
+               *button3 = gtk_button_new_with_mnemonic(text3);
+       gtk_button_set_image(GTK_BUTTON(*button3),
+               gtk_image_new_from_stock(label3, GTK_ICON_SIZE_BUTTON));
+               gtk_box_pack_start(GTK_BOX(*bbox), *button3, TRUE, TRUE, 0);
+               gtk_widget_show(*button3);
+       }
+}
+
 static void combo_button_size_request(GtkWidget *widget,
                                      GtkRequisition *requisition,
                                      gpointer data)
index c21caeb..3523b1a 100644 (file)
@@ -112,6 +112,11 @@ void gtkut_stock_button_set_create (GtkWidget      **bbox,
                                         GtkWidget      **button3,
                                         const gchar     *label3);
 
+void gtkut_stock_with_text_button_set_create(GtkWidget **bbox,
+                                  GtkWidget **button1, const gchar *label1, const gchar *text1,
+                                  GtkWidget **button2, const gchar *label2, const gchar *text2,
+                                  GtkWidget **button3, const gchar *label3, const gchar *text3);
+
 ComboButton *gtkut_combo_button_create (GtkWidget              *button,
                                         GtkItemFactoryEntry    *entries,
                                         gint                    n_entries,
index 95eedfa..a82e113 100644 (file)
@@ -637,6 +637,10 @@ static PrefParam param[] = {
        {"apply_per_account_filtering_rules", "0", &prefs_common.apply_per_account_filtering_rules, P_ENUM,
         NULL, NULL, NULL},
 
+       /* Addressbook */
+       {"addressbook_use_editaddress_dialog", "TRUE", &prefs_common.addressbook_use_editaddress_dialog,
+        P_BOOL, NULL, NULL, NULL},
+
        /* Other */
        {"uri_open_command", DEFAULT_BROWSER_CMD,
         &SPECIFIC_PREFS.uri_cmd, P_STRING, NULL, NULL, NULL},
@@ -644,7 +648,6 @@ static PrefParam param[] = {
         &SPECIFIC_PREFS.print_cmd, P_STRING, NULL, NULL, NULL},
        {"ext_editor_command", DEFAULT_EDITOR_CMD,
         &SPECIFIC_PREFS.ext_editor_cmd, P_STRING, NULL, NULL, NULL},
-
        {"add_address_by_click", "FALSE", &prefs_common.add_address_by_click,
         P_BOOL, NULL, NULL, NULL},
        {"confirm_on_exit", "FALSE", &prefs_common.confirm_on_exit, P_BOOL,
@@ -719,7 +722,7 @@ static PrefParam param[] = {
 
        {"addressbookeditpersonwin_width", "640", &prefs_common.addressbookeditpersonwin_width, P_INT,
         NULL, NULL, NULL},
-       {"addressbookeditpersonwin_height", "-1", &prefs_common.addressbookeditpersonwin_height, P_INT,
+       {"addressbookeditpersonwin_height", "320", &prefs_common.addressbookeditpersonwin_height, P_INT,
         NULL, NULL, NULL},
 
        {"addressbookeditgroupwin_width", "580", &prefs_common.addressbookeditgroupwin_width, P_INT,
index 03b06cc..ba818eb 100644 (file)
@@ -306,6 +306,9 @@ struct _PrefsCommon
        gboolean gpg_warning;
 #endif /* USE_GPGME */
 
+       /* Addressbook */
+       gboolean addressbook_use_editaddress_dialog;
+
        /* Interface */
        gboolean sep_folder;
        gboolean sep_msg;