Re: [addressbook] - Fix for bug : 260403

Srinivasa Ragavan <[email protected]>
Newsgroups gmane.comp.gnome.evolution.patches
Organization Novell Inc
Message-ID <[email protected]>
Vandana,

My comments are below.

-Srini
On Thu, 2006-04-06 at 16:40 +0530, vandana shenoy .B. wrote:
> Index: e-addressbook-view.c
> ===================================================================
> RCS
> file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-view.c,v
> retrieving revision 1.180
> diff -u -p -r1.180 e-addressbook-view.c
> --- e-addressbook-view.c        22 Feb 2006 07:41:12 -0000      1.180
> +++ e-addressbook-view.c        6 Apr 2006 11:07:55 -0000
> @@ -1892,6 +1892,13 @@ eab_view_print_preview(EABView *view)
>  #endif
>  }
>  
> +static void before_deleted_cb (EBook *book,  EBookStatus status,
> gpointer closure)
> +{
> +       if (status != E_BOOK_ERROR_OK && status !=
> E_BOOK_ERROR_CANCELLED) {
> +                       eab_error_dialog ( _("Error deleting
> contact"), status);
> +       }
Formatting needs to be corrected. no braces should be here.
> +}
> +
>  void
>  eab_view_delete_selection(EABView *view, gboolean is_delete)
>  {
> @@ -1899,6 +1906,9 @@ eab_view_delete_selection(EABView *view,
>         gboolean plural = FALSE, is_list = FALSE;
>         EContact *contact;
>         char *name = NULL;
> +       
> +       EContactDeleteCallback *look_up ;
> +       look_up = g_new ( EContactDeleteCallback , 1 );
>  
Correct the spacing. Also look_up is not freed any where. Free it up.
>         list = get_selected_contacts (view);
>         contact = list->data;
> @@ -1929,12 +1939,18 @@ eab_view_delete_selection(EABView *view,
>                         ids = g_list_prepend (ids,
> (char*)e_contact_get_const (contact, E_CONTACT_UID));
>                 }
>  
> +               look_up->book = view->book;
> +               look_up->status = E_BOOK_ERROR_OK ;
> +               look_up->closure = NULL;
> +
> +               
> +
>                 /* Remove the cards all at once. */
> -               /* XXX no callback specified... ugh */
> +               /*  callback specified */
>                 e_book_async_remove_contacts (view->book,
>                                               ids,
> -                                             NULL,
> -                                             NULL);
> +                                             before_deleted_cb,
> +                                             look_up);
>                         
>                 g_list_free (ids);
>         }
> @@ -1942,11 +1958,11 @@ eab_view_delete_selection(EABView *view,
>                 for (l=list;l;l=g_list_next(l)) {
>                         contact = l->data;
>                         /* Remove the card. */
> -                       /* XXX no callback specified... ugh */
> +                       /* no callback specified*/
>                         e_book_async_remove_contact (view->book,
>                                                      contact,
> -                                                    NULL,
> -                                                    NULL);
> +
> before_deleted_cb,
> +                                                    look_up);
>                 }
>         }
>  
> Index: e-addressbook-view.h
> ===================================================================
> RCS
> file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-view.h,v
> retrieving revision 1.40
> diff -u -p -r1.40 e-addressbook-view.h
> --- e-addressbook-view.h        30 Jan 2006 10:03:20 -0000      1.40
> +++ e-addressbook-view.h        6 Apr 2006 11:08:06 -0000
> @@ -114,6 +114,14 @@ struct _EABViewClass
>         void (*command_state_change)  (EABView *view);
>  };
>  
> +typedef struct _EContactDeleteCallback  EContactDeleteCallback ;
> +
> +struct  _EContactDeleteCallback{
> +       EBook* book;
> +       EBookStatus status;
> +       gpointer closure;
> +};
> +
This structure is not accessed outside this file. and it shouldnt be
declared here IMO.
>  GtkWidget *eab_view_new                 (void);
>  GType      eab_view_get_type            (void);
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.