From 579c112c3fc64f41154029aa7bfaeca32d429cc4 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandresavard@msavard.(none)> Date: Wed, 8 Jun 2011 18:19:33 -0400 Subject: [PATCH] #6065: Fix runtime gtk warning when initializing searchbar without addressbook --- sflphone-client-gnome/src/contacts/calltab.c | 9 ++++++--- sflphone-client-gnome/src/contacts/calltree.c | 4 +++- sflphone-client-gnome/src/contacts/searchbar.c | 8 ++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/sflphone-client-gnome/src/contacts/calltab.c b/sflphone-client-gnome/src/contacts/calltab.c index 40a9571bfa..f2b333a3ec 100644 --- a/sflphone-client-gnome/src/contacts/calltab.c +++ b/sflphone-client-gnome/src/contacts/calltab.c @@ -94,10 +94,13 @@ calltab_get_selected_conf () void calltab_create_searchbar (calltab_t* tab) { - if (g_strcasecmp (tab->_name, HISTORY) == 0) + if (g_strcasecmp (tab->_name, HISTORY) == 0) { tab->searchbar = history_searchbar_new (); - else if (g_strcasecmp (tab->_name, CONTACTS) == 0) + } + else if (g_strcasecmp (tab->_name, CONTACTS) == 0) { tab->searchbar = contacts_searchbar_new (); - else + } + else { ERROR ("Current calls tab does not need a searchbar\n"); + } } diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 4f7bae859e..47cda43ce9 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -645,7 +645,9 @@ calltree_create (calltab_t* tab, gboolean searchbar_type) // search bar if tab is either "history" or "addressbook" if (searchbar_type) { calltab_create_searchbar (tab); - gtk_box_pack_start (GTK_BOX (tab->tree), tab->searchbar, FALSE, TRUE, 0); + if(tab->searchbar != NULL) { + gtk_box_pack_start (GTK_BOX (tab->tree), tab->searchbar, FALSE, TRUE, 0); + } } gtk_widget_show (tab->tree); diff --git a/sflphone-client-gnome/src/contacts/searchbar.c b/sflphone-client-gnome/src/contacts/searchbar.c index 3392223e26..02f65cfb62 100644 --- a/sflphone-client-gnome/src/contacts/searchbar.c +++ b/sflphone-client-gnome/src/contacts/searchbar.c @@ -161,8 +161,6 @@ void update_searchbar_addressbook_list() } } - DEBUG("OK"); - if(abookfactory_is_addressbook_loaded()) { AddrBookFactory *factory = abookfactory_get_factory(); if (activeIsSet) { @@ -175,7 +173,6 @@ void update_searchbar_addressbook_list() factory->addrbook->set_current_book(gtk_combo_box_get_active_text(GTK_COMBO_BOX(cbox))); } } - DEBUG("OK"); g_free (activeText); cboxSignalId = gtk_signal_connect (GTK_OBJECT (cbox), "changed", G_CALLBACK (cbox_changed_cb), NULL); @@ -440,13 +437,13 @@ GtkWidget* contacts_searchbar_new () book_list = dbus_get_addressbook_list(); AddrBookFactory *factory = abookfactory_get_factory(); - + factory->addrbook->init(book_list); GSList *book_list_iterator; book_data_t *book_data; GSList *books_data = factory->addrbook->get_books_data(book_list); - + // Populate menu count = 0; gboolean activeIsSet = FALSE; @@ -496,7 +493,6 @@ GtkWidget* contacts_searchbar_new () gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbox), cell, "text", 0, NULL); - #if GTK_CHECK_VERSION(2,16,0) // GdkPixbuf *pixbuf; -- GitLab