2007-01-18 [wwp] 2.7.1cvs27
[claws.git] / src / addressbook.c
index 7d3ba971140a3400ee6436a8f7c9fbe981bce168..f165cc6a611af062d2a34ea22c3a76c506f826c4 100644 (file)
@@ -815,6 +815,9 @@ static gboolean addressbook_address_index_focus_evt_out(GtkWidget *widget, GdkEv
                                                                                         gpointer data)
 {
        address_index_has_focus = FALSE;
+       if (!prefs_common.addressbook_use_editaddress_dialog
+                       && !address_list_has_focus)
+               addressbook_address_list_disable_some_actions();
        return FALSE;
 }
 
@@ -829,6 +832,9 @@ static gboolean addressbook_address_list_focus_evt_out(GtkWidget *widget, GdkEve
                                                                                         gpointer data)
 {
        address_list_has_focus = FALSE;
+       if (!prefs_common.addressbook_use_editaddress_dialog
+                       && !address_index_has_focus)
+               addressbook_address_list_disable_some_actions();
        return FALSE;
 }
 
@@ -2974,10 +2980,22 @@ void addressbook_address_list_set_focus( void )
 {
        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 );
+               addressbook_list_menu_setup();
        }
 }
 
+void addressbook_address_list_disable_some_actions(void)
+{
+       /* disable address copy/pasting when editing contact's detail (embedded form) */
+       menu_set_sensitive( addrbook.menu_factory, "/Address/Cut",   FALSE );
+       menu_set_sensitive( addrbook.menu_factory, "/Address/Copy",  FALSE );
+       menu_set_sensitive( addrbook.menu_factory, "/Address/Paste", FALSE );
+
+       /* we're already editing contact's detail here */
+       menu_set_sensitive( addrbook.menu_factory, "/Address/Edit",  FALSE );
+       gtk_widget_set_sensitive( addrbook.edit_btn, FALSE );
+}
+
 static void addressbook_edit_address_cb( gpointer data, guint action, GtkWidget *widget ) {
        addressbook_edit_address(data, action, widget, TRUE);
 }