2007-01-18 [wwp] 2.7.1cvs23
authorTristan Chabredier <wwp@claws-mail.org>
Thu, 18 Jan 2007 13:21:58 +0000 (13:21 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Thu, 18 Jan 2007 13:21:58 +0000 (13:21 +0000)
* src/addressbook.c
fix potential crashes in address book's focus_in/out signal handlers,
force focus to the edit-person form when clicked the Edit menu entry or
button (this only matters if the edit-person form is embedded to the
AB window, in that case, focus is not set when browsing the contacts
list w/ keys or mouse clicks).

ChangeLog
PATCHSETS
configure.ac
src/addressbook.c

index 2c19a2587d9d7a74638f6f5493e40b59f62f6b97..ffdfa1da4dd23d5b88ee7603bcd1b158488915be 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-01-18 [wwp]       2.7.1cvs23
+
+       * src/addressbook.c
+               fix potential crashes in address book's focus_in/out signal handlers,
+               force focus to the edit-person form when clicked the Edit menu entry or
+               button (this only matters if the edit-person form is embedded to the
+               AB window, in that case, focus is not set when browsing the contacts
+               list w/ keys or mouse clicks).
+
 2007-01-18 [paul]      2.7.1cvs22
 
        * src/main.c
index b61e9164430611c6e192128c4404c410178ff7b0..656839f64cf3453e1a4d848f65fa510cc33a1091 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.274.2.164 -r 1.274.2.165 src/mainwindow.c;  ) > 2.7.1cvs20.patchset
 ( cvs diff -u -r 1.17.2.13 -r 1.17.2.14 po/ru.po;  ) > 2.7.1cvs21.patchset
 ( cvs diff -u -r 1.115.2.124 -r 1.115.2.125 src/main.c;  ) > 2.7.1cvs22.patchset
+( cvs diff -u -r 1.60.2.75 -r 1.60.2.76 src/addressbook.c;  ) > 2.7.1cvs23.patchset
index df36adca0c84c3677c51a749186c87820bf2401b..c827afefb9d7afaed9b6e17d10ad86dcc9635e9c 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=7
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=22
+EXTRA_VERSION=23
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 6c98b333b7249ca9fbd7a5cf6c2244c9e0581911..7d3ba971140a3400ee6436a8f7c9fbe981bce168 100644 (file)
@@ -337,6 +337,9 @@ static void addressbook_folder_remove_one_person(GtkCTree *clist,
 static void addressbook_folder_remove_node     (GtkCTree *clist, 
                                                 GtkCTreeNode *node);
 
+static void addressbook_edit_address( gpointer data, guint action, GtkWidget *widget,
+                                                                         gboolean force_focus );
+
 /* LUT's and IF stuff */
 static void addressbook_free_treenode          ( gpointer data );
 AddressTypeControlItem *addrbookctl_lookup     (gint            ot);
@@ -801,28 +804,32 @@ 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,
+static gboolean addressbook_address_index_focus_evt_in(GtkWidget *widget, GdkEventFocus *event,
                                                                                         gpointer data)
 {
        address_index_has_focus = TRUE;
+       return FALSE;
 }
 
-static void addressbook_address_index_focus_evt_out(GtkWidget *widget, GdkEventFocus *event,
+static gboolean addressbook_address_index_focus_evt_out(GtkWidget *widget, GdkEventFocus *event,
                                                                                         gpointer data)
 {
        address_index_has_focus = FALSE;
+       return FALSE;
 }
 
-static void addressbook_address_list_focus_evt_in(GtkWidget *widget, GdkEventFocus *event,
+static gboolean addressbook_address_list_focus_evt_in(GtkWidget *widget, GdkEventFocus *event,
                                                                                         gpointer data)
 {
        address_list_has_focus = TRUE;
+       return FALSE;
 }
 
-static void addressbook_address_list_focus_evt_out(GtkWidget *widget, GdkEventFocus *event,
+static gboolean addressbook_address_list_focus_evt_out(GtkWidget *widget, GdkEventFocus *event,
                                                                                         gpointer data)
 {
        address_list_has_focus = FALSE;
+       return FALSE;
 }
 
 /* save hpane and vpane's handle position when it moves */
@@ -2223,7 +2230,7 @@ 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);
+               addressbook_edit_address(NULL, 0, NULL, FALSE);
 }
 
 static void addressbook_list_row_unselected( GtkCTree *ctree,
@@ -2965,11 +2972,18 @@ void addressbook_edit_address_post_cb( ItemPerson *person )
 
 void addressbook_address_list_set_focus( void )
 {
-       if (!prefs_common.addressbook_use_editaddress_dialog)
+       if (!prefs_common.addressbook_use_editaddress_dialog) {
                gtk_window_set_focus(GTK_WINDOW(addrbook.window), addrbook.clist);
+fprintf(stderr, "addressbook_address_list_set_focus: %p\n", addrbook.listSelected );
+       }
 }
 
 static void addressbook_edit_address_cb( gpointer data, guint action, GtkWidget *widget ) {
+       addressbook_edit_address(data, action, widget, TRUE);
+}
+       
+static void addressbook_edit_address( gpointer data, guint action, GtkWidget *widget,
+                                                                         gboolean force_focus ) {
        GtkCTree *clist = GTK_CTREE(addrbook.clist);
        GtkCTree *ctree;
        AddressObject *obj = NULL, *pobj = NULL;
@@ -3010,7 +3024,7 @@ static void addressbook_edit_address_cb( gpointer data, guint action, GtkWidget
                        person = ( ItemPerson * ) ADDRITEM_PARENT(email);
                        if  ( addressbook_edit_person( abf, NULL, person, TRUE, addrbook.editaddress_vbox,
                                                                                   addressbook_edit_address_post_cb,
-                                                                                  prefs_common.addressbook_use_editaddress_dialog?TRUE:FALSE )
+                                                                                  (prefs_common.addressbook_use_editaddress_dialog||force_focus) )
                                  != NULL ) {
                                if (prefs_common.addressbook_use_editaddress_dialog)
                                        addressbook_edit_address_post_cb( person );
@@ -3023,7 +3037,7 @@ static void addressbook_edit_address_cb( gpointer data, guint action, GtkWidget
                ItemPerson *person = ( ItemPerson * ) obj;
                if( addressbook_edit_person( abf, NULL, person, FALSE, addrbook.editaddress_vbox,
                                                                          addressbook_edit_address_post_cb,
-                                                                         prefs_common.addressbook_use_editaddress_dialog?TRUE:FALSE )
+                                                                         (prefs_common.addressbook_use_editaddress_dialog||force_focus) )
                        != NULL ) {
                        if (prefs_common.addressbook_use_editaddress_dialog)
                                addressbook_edit_address_post_cb( person );