[ekiga/ds-fix-boost-leaks: 7/7] Addressbook UI: Migrated to the new framework.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/ds-fix-boost-leaks: 7/7] Addressbook UI: Migrated to the new framework.
- Date: Mon, 25 May 2015 15:45:21 +0000 (UTC)
commit 8fc9346c8bb71c7374d8adfdc14720bb2c76ee17
Author: Damien Sandras <dsandras seconix com>
Date: Mon May 25 17:43:43 2015 +0200
Addressbook UI: Migrated to the new framework.
lib/engine/gui/gtk-frontend/addressbook-window.cpp | 35 ++++++++++++--------
lib/engine/gui/gtk-frontend/book-view-gtk.cpp | 32 +-----------------
2 files changed, 22 insertions(+), 45 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/addressbook-window.cpp
b/lib/engine/gui/gtk-frontend/addressbook-window.cpp
index e762605..25ea30d 100644
--- a/lib/engine/gui/gtk-frontend/addressbook-window.cpp
+++ b/lib/engine/gui/gtk-frontend/addressbook-window.cpp
@@ -105,7 +105,6 @@ static void on_source_added (Ekiga::SourcePtr source,
* PRE : The given GtkWidget pointer must be an SearchBook GObject.
*/
static bool visit_books (Ekiga::BookPtr book,
- Ekiga::SourcePtr source,
gpointer data);
@@ -278,12 +277,26 @@ static void
on_source_added (Ekiga::SourcePtr source,
gpointer data)
{
- source->visit_books (boost::bind (&visit_books, _1, source, data));
+ AddressBookWindow *self = NULL;
+ boost::signals2::connection conn;
+
+ g_return_if_fail (IS_ADDRESSBOOK_WINDOW (data));
+ self = ADDRESSBOOK_WINDOW (data);
+
+ source->visit_books (boost::bind (&visit_books, _1, data));
+
+ conn = source->book_updated.connect (boost::bind (&on_book_updated, _1, (gpointer) self));
+ self->priv->connections.add (conn);
+
+ conn = source->book_added.connect (boost::bind (&on_book_added, _1, (gpointer) self));
+ self->priv->connections.add (conn);
+
+ conn = source->book_removed.connect (boost::bind (&on_book_removed, _1, (gpointer) self));
+ self->priv->connections.add (conn);
}
static bool visit_books (Ekiga::BookPtr book,
- G_GNUC_UNUSED Ekiga::SourcePtr source,
gpointer data)
{
on_book_added (book, data);
@@ -315,6 +328,7 @@ on_book_updated (Ekiga::BookPtr book,
addressbook_window_update_book (ADDRESSBOOK_WINDOW (data), book);
}
+
static bool
on_handle_questions (Ekiga::FormRequestPtr request,
gpointer data)
@@ -420,6 +434,7 @@ actions_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
gpointer data)
{
Ekiga::GActorMenuStore tmp;
+ GMenuModel *store_model = NULL;
GMenu *menu = NULL;
int pos = 0;
@@ -441,8 +456,9 @@ actions_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
tmp.push_back (*it);
}
- g_menu_insert_section (menu, pos, _("Contact Sources"),
- (*self->priv->sources_menu.begin ())->get_model (tmp));
+ store_model = (*self->priv->sources_menu.begin ())->get_model (tmp);
+ if (store_model)
+ g_menu_insert_section (menu, pos, _("Contact Sources"), store_model);
}
}
@@ -780,15 +796,6 @@ addressbook_window_new (GmApplication *app)
conn = contact_core->source_added.connect (boost::bind (&on_source_added, _1, (gpointer) self));
self->priv->connections.add (conn);
- conn = contact_core->book_updated.connect (boost::bind (&on_book_updated, _1, (gpointer) self));
- self->priv->connections.add (conn);
-
- conn = contact_core->book_added.connect (boost::bind (&on_book_added, _1, (gpointer) self));
- self->priv->connections.add (conn);
-
- conn = contact_core->book_removed.connect (boost::bind (&on_book_removed, _1, (gpointer) self));
- self->priv->connections.add (conn);
-
conn = contact_core->questions.connect (boost::bind (&on_handle_questions, _1, (gpointer) self));
self->priv->connections.add (conn);
diff --git a/lib/engine/gui/gtk-frontend/book-view-gtk.cpp b/lib/engine/gui/gtk-frontend/book-view-gtk.cpp
index db033b2..a604ffc 100644
--- a/lib/engine/gui/gtk-frontend/book-view-gtk.cpp
+++ b/lib/engine/gui/gtk-frontend/book-view-gtk.cpp
@@ -118,13 +118,6 @@ static void on_contact_updated (Ekiga::ContactPtr contact,
gpointer data);
-/* DESCRIPTION : Called when the Book status has been updated.
- * BEHAVIOR : Update the BookView.
- * PRE : The gpointer must point to the BookViewGtk GObject.
- */
-static void on_updated (gpointer data);
-
-
/* DESCRIPTION : Called when the a contact has been removed from a Book.
* BEHAVIOR : Update the BookView.
* PRE : The gpointer must point to the BookViewGtk GObject.
@@ -276,30 +269,8 @@ on_contact_updated (Ekiga::ContactPtr contact,
static void
-on_updated (gpointer data)
-{
- BookViewGtk *view = NULL;
-
- view = BOOK_VIEW_GTK (data);
-
- std::string status = view->priv->book->get_status ();
-
- gm_info_bar_push_message (GM_INFO_BAR (view->priv->info_bar),
- GTK_MESSAGE_INFO,
- status.c_str ());
-
- boost::shared_ptr<Ekiga::Filterable> filtered =
boost::dynamic_pointer_cast<Ekiga::Filterable>(view->priv->book);
- if (filtered) {
- gtk_entry_set_text (GTK_ENTRY (view->priv->entry),
- filtered->get_search_filter ().c_str ());
- }
-}
-
-
-
-static void
on_contact_removed (Ekiga::ContactPtr contact,
- gpointer data)
+ gpointer data)
{
BookViewGtk *view = NULL;
@@ -691,7 +662,6 @@ book_view_gtk_new (Ekiga::BookPtr book)
self->priv->connections.add (book->contact_added.connect (boost::bind (&on_contact_added, _1,
(gpointer)self)));
self->priv->connections.add (book->contact_updated.connect (boost::bind (&on_contact_updated, _1,
(gpointer)self)));
self->priv->connections.add (book->contact_removed.connect (boost::bind (&on_contact_removed, _1,
(gpointer)self)));
- self->priv->connections.add (book->updated.connect (boost::bind (&on_updated, (gpointer)self)));
/* populate */
book->visit_contacts (boost::bind (&on_visit_contacts, _1, (gpointer)self));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]