Skip to content
Snippets Groups Projects
Commit b40f86ec authored by Julien Bonjean's avatar Julien Bonjean
Browse files

Fixed bug #1139

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