From 5485ba72d9139b45de2b5dff8bc619c62250ecbf Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Tue, 11 Apr 2000 00:21:08 +0000 Subject: Changed some incorrect gtk_object_refs and gtk_object_unrefs into 2000-04-10 Christopher James Lahey * addressbook/backend/ebook/e-book-view.c, addressbook/backend/ebook/e-book.c: Changed some incorrect gtk_object_refs and gtk_object_unrefs into bonobo_object_refs and bonobo_object_unrefs. * addressbook/backend/pas/pas-card-cursor.c: Changed a gtk_object_destroy to a gtk_object_unref. * addressbook/gui/minicard/e-minicard-view.c, addressbook/gui/minicard/e-minicard-view.h: Set a list pointer to NULL after freeing its contents. Added e_minicard_view_remove_selection function. * addressbook/gui/minicard/e-reflow.c: Set a list pointer to NULL after freeing its contents. svn path=/trunk/; revision=2386 --- addressbook/backend/ebook/e-book-view.c | 4 ++-- addressbook/backend/ebook/e-book.c | 4 ++-- addressbook/backend/pas/pas-card-cursor.c | 2 +- addressbook/gui/minicard/e-minicard-view.c | 28 ++++++++++++++++++++++++++++ addressbook/gui/minicard/e-minicard-view.h | 3 +++ addressbook/gui/minicard/e-reflow.c | 1 + addressbook/gui/widgets/e-minicard-view.c | 28 ++++++++++++++++++++++++++++ addressbook/gui/widgets/e-minicard-view.h | 3 +++ 8 files changed, 68 insertions(+), 5 deletions(-) (limited to 'addressbook') diff --git a/addressbook/backend/ebook/e-book-view.c b/addressbook/backend/ebook/e-book-view.c index 2931a9347d..a0626ed0a2 100644 --- a/addressbook/backend/ebook/e-book-view.c +++ b/addressbook/backend/ebook/e-book-view.c @@ -141,7 +141,7 @@ e_book_view_construct (EBookView *book_view, Evolution_BookView corba_book_view, */ book_view->priv->listener = listener; - gtk_object_ref(GTK_OBJECT(book_view->priv->listener)); + bonobo_object_ref(BONOBO_OBJECT(book_view->priv->listener)); book_view->priv->responses_queued_id = gtk_signal_connect (GTK_OBJECT (book_view->priv->listener), "responses_queued", e_book_view_check_listener_queue, book_view); @@ -204,7 +204,7 @@ e_book_view_destroy (GtkObject *object) if (book_view->priv->responses_queued_id) gtk_signal_disconnect(GTK_OBJECT(book_view->priv->listener), book_view->priv->responses_queued_id); - gtk_object_unref (GTK_OBJECT(book_view->priv->listener)); + bonobo_object_unref (BONOBO_OBJECT(book_view->priv->listener)); } g_free (book_view->priv); diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c index dd4c4bc110..5cdbb4fbb2 100644 --- a/addressbook/backend/ebook/e-book.c +++ b/addressbook/backend/ebook/e-book.c @@ -226,7 +226,7 @@ e_book_do_response_get_view (EBook *book, CORBA_exception_free (&ev); gtk_object_unref(GTK_OBJECT(book_view)); - gtk_object_unref(GTK_OBJECT(op->listener)); + bonobo_object_unref(BONOBO_OBJECT(op->listener)); g_free (op); } @@ -410,7 +410,7 @@ e_book_unload_uri (EBook *book) CORBA_exception_free (&ev); - gtk_object_unref (GTK_OBJECT (book->priv->listener)); + bonobo_object_unref (BONOBO_OBJECT (book->priv->listener)); book->priv->listener = NULL; book->priv->load_state = URINotLoaded; diff --git a/addressbook/backend/pas/pas-card-cursor.c b/addressbook/backend/pas/pas-card-cursor.c index 7def4b436e..c2bbe1c9b0 100644 --- a/addressbook/backend/pas/pas-card-cursor.c +++ b/addressbook/backend/pas/pas-card-cursor.c @@ -215,7 +215,7 @@ pas_card_cursor_new (PASCardCursorLengthFunc get_length, corba_cursor = create_cursor (BONOBO_OBJECT (cursor)); if (corba_cursor == CORBA_OBJECT_NIL){ - gtk_object_destroy (GTK_OBJECT (cursor)); + gtk_object_unref (GTK_OBJECT (cursor)); return NULL; } diff --git a/addressbook/gui/minicard/e-minicard-view.c b/addressbook/gui/minicard/e-minicard-view.c index 0672983f05..4cd3606876 100644 --- a/addressbook/gui/minicard/e-minicard-view.c +++ b/addressbook/gui/minicard/e-minicard-view.c @@ -168,6 +168,8 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe view); g_list_foreach(E_REFLOW(view)->items, (GFunc) gtk_object_destroy, NULL); g_list_free(E_REFLOW(view)->items); + E_REFLOW(view)->items = NULL; + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(view)); } static gboolean @@ -251,3 +253,29 @@ e_minicard_view_destroy (GtkObject *object) if (view->book_view) gtk_object_unref(GTK_OBJECT(view->book_view)); } + +void +e_minicard_remove_selection(EMinicardView *view, + EBookCallback cb, + gpointer closure) +{ + if (view->book) { + EReflow *reflow = E_REFLOW(view); + GList *list; + for (list = reflow->items; list; list = g_list_next(list)) { + GnomeCanvasItem *item = list->data; + gboolean has_focus; + gtk_object_get(item, + "has_focus", &has_focus, + NULL); + if (has_focus) { + ECard *card; + gtk_object_get(GTK_OBJECT(item), + "card", &card, + NULL); + e_book_remove_card(view->book, card, cb, closure); + return; + } + } + } +} diff --git a/addressbook/gui/minicard/e-minicard-view.h b/addressbook/gui/minicard/e-minicard-view.h index 520bf31a19..bb50aa99c1 100644 --- a/addressbook/gui/minicard/e-minicard-view.h +++ b/addressbook/gui/minicard/e-minicard-view.h @@ -79,6 +79,9 @@ struct _EMinicardViewClass }; GtkType e_minicard_view_get_type (void); +void e_minicard_view_remove_selection (EMinicardView *view, + EBookCallback cb, + gpointer closure); #ifdef __cplusplus } diff --git a/addressbook/gui/minicard/e-reflow.c b/addressbook/gui/minicard/e-reflow.c index 0ff8c0f4ea..004183727a 100644 --- a/addressbook/gui/minicard/e-reflow.c +++ b/addressbook/gui/minicard/e-reflow.c @@ -189,6 +189,7 @@ e_reflow_destroy (GtkObject *object) EReflow *reflow = E_REFLOW(object); g_list_free(reflow->items); + reflow->items = NULL; } static void diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c index 0672983f05..4cd3606876 100644 --- a/addressbook/gui/widgets/e-minicard-view.c +++ b/addressbook/gui/widgets/e-minicard-view.c @@ -168,6 +168,8 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe view); g_list_foreach(E_REFLOW(view)->items, (GFunc) gtk_object_destroy, NULL); g_list_free(E_REFLOW(view)->items); + E_REFLOW(view)->items = NULL; + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(view)); } static gboolean @@ -251,3 +253,29 @@ e_minicard_view_destroy (GtkObject *object) if (view->book_view) gtk_object_unref(GTK_OBJECT(view->book_view)); } + +void +e_minicard_remove_selection(EMinicardView *view, + EBookCallback cb, + gpointer closure) +{ + if (view->book) { + EReflow *reflow = E_REFLOW(view); + GList *list; + for (list = reflow->items; list; list = g_list_next(list)) { + GnomeCanvasItem *item = list->data; + gboolean has_focus; + gtk_object_get(item, + "has_focus", &has_focus, + NULL); + if (has_focus) { + ECard *card; + gtk_object_get(GTK_OBJECT(item), + "card", &card, + NULL); + e_book_remove_card(view->book, card, cb, closure); + return; + } + } + } +} diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h index 520bf31a19..bb50aa99c1 100644 --- a/addressbook/gui/widgets/e-minicard-view.h +++ b/addressbook/gui/widgets/e-minicard-view.h @@ -79,6 +79,9 @@ struct _EMinicardViewClass }; GtkType e_minicard_view_get_type (void); +void e_minicard_view_remove_selection (EMinicardView *view, + EBookCallback cb, + gpointer closure); #ifdef __cplusplus } -- cgit v1.2.3