Commit b40f86ec authored by Julien Bonjean's avatar Julien Bonjean

Fixed bug #1139

Added toolbar button deactivation and cleaning
parent a199a0a3
......@@ -158,8 +158,6 @@ addressbook_config_book_active_toggled(
// Toggle active value
active = !active;
printf("-> change active to : %d for %s\n", active, uid);
// Store value
gtk_list_store_set(GTK_LIST_STORE(model), &iter, COLUMN_BOOK_ACTIVE, active, -1);
......
......@@ -19,6 +19,7 @@
#include <addressbook.h>
#include <searchbar.h>
#include <toolbar.h>
#include <string.h>
#include <addressbook-config.h>
......@@ -45,6 +46,15 @@ addressbook_search(GtkEntry* entry)
addressbook_config);
}
/**
* Return addressbook state
*/
gboolean
addressbook_is_ready()
{
return books_ready();
}
/**
* Asynchronous open callback.
* Used to handle activation of books.
......@@ -69,12 +79,14 @@ addressbook_config_books()
// If book_data exists
if (book_data != NULL)
{
printf("activating %s\n", *config_book_uid);
book_data->active = TRUE;
}
}
g_strfreev(list);
}
// Update buttons
toolbar_update_buttons();
}
/**
......
......@@ -29,6 +29,12 @@
#include <gtk/gtk.h>
#include <addressbook/eds.h>
/**
* Return addressbook state
*/
gboolean
addressbook_is_ready();
/**
* Perform a search in addressbook
*/
......
......@@ -88,7 +88,7 @@ free_hit(Hit *h)
gboolean
books_ready()
{
return (g_slist_length(books_data) == 0);
return (g_slist_length(books_data) > 0);
}
/**
......@@ -258,8 +258,6 @@ eds_async_open_callback(EBook *book, EBookStatus status, gpointer closure)
remaining_books_to_open--;
printf("async open !\n");
if (status == E_BOOK_ERROR_OK)
{
book_data_t *book_data = g_new(book_data_t, 1);
......
......@@ -18,6 +18,7 @@
*/
#include <toolbar.h>
#include <contacts/addressbook.h>
static gboolean
is_inserted( GtkWidget* button )
......@@ -251,6 +252,7 @@ GtkWidget *create_toolbar ()
gtk_widget_set_tooltip_text(GTK_WIDGET(contactButton), _("Address book"));
#endif
gtk_tool_button_set_label (GTK_TOOL_BUTTON (contactButton), _("Address book"));
gtk_widget_set_state( GTK_WIDGET(contactButton), GTK_STATE_INSENSITIVE);
g_signal_connect (G_OBJECT (contactButton), "toggled", G_CALLBACK (toggle_button_cb), contacts);
gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(contactButton), -1);
......@@ -383,4 +385,11 @@ toolbar_update_buttons ()
gtk_widget_set_sensitive( GTK_WIDGET(callButton), FALSE);
}
}
// Activate addressbook button if needed
// TODO : should be moved in a better place
if(addressbook_is_ready())
gtk_widget_set_sensitive( GTK_WIDGET(contactButton), TRUE);
else
gtk_widget_set_sensitive( GTK_WIDGET(contactButton), FALSE);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment