From 6a0501611846eaa104e897e7fd777a3c008a9397 Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Date: Fri, 2 Jul 2010 12:38:18 -0400 Subject: [PATCH] [#2833] gconf: history enabled --- .../src/config/preferencesdialog.c | 6 ++--- sflphone-client-gnome/src/contacts/calllist.c | 2 +- sflphone-client-gnome/src/contacts/calltree.c | 2 +- sflphone-client-gnome/src/dbus/dbus.c | 26 ------------------- sflphone-client-gnome/src/dbus/dbus.h | 4 --- sflphone-client-gnome/src/sflphone_const.h | 1 + sflphone-client-gnome/src/uimanager.c | 12 +++++++++ 7 files changed, 17 insertions(+), 36 deletions(-) diff --git a/sflphone-client-gnome/src/config/preferencesdialog.c b/sflphone-client-gnome/src/config/preferencesdialog.c index 5ab5e71a5e..ff68a31c7a 100644 --- a/sflphone-client-gnome/src/config/preferencesdialog.c +++ b/sflphone-client-gnome/src/config/preferencesdialog.c @@ -115,7 +115,7 @@ history_enabled_cb (GtkWidget *widget) gtk_widget_set_sensitive (GTK_WIDGET (history_value), history_enabled); // Toggle it through D-Bus - dbus_set_history_enabled (); + eel_gconf_set_integer (HISTORY_ENABLED, !eel_gconf_get_integer (HISTORY_ENABLED)); } void @@ -265,9 +265,7 @@ void history_load_configuration () { history_limit = dbus_get_history_limit (); - history_enabled = TRUE; - if (g_strcasecmp (dbus_get_history_enabled (), "false") == 0) - history_enabled = FALSE; + history_enabled = eel_gconf_get_integer (HISTORY_ENABLED); } /** diff --git a/sflphone-client-gnome/src/contacts/calllist.c b/sflphone-client-gnome/src/contacts/calllist.c index c5566261be..10744e58ff 100644 --- a/sflphone-client-gnome/src/contacts/calllist.c +++ b/sflphone-client-gnome/src/contacts/calllist.c @@ -91,7 +91,7 @@ calllist_reset (calltab_t* tab) void calllist_add_history_entry (callable_obj_t *obj) { - if ( g_strcasecmp (dbus_get_history_enabled (), "true") == 0) + if (eel_gconf_get_integer (HISTORY_ENABLED)) { g_queue_push_tail (history->callQueue, (gpointer *) obj); calltree_add_call (history, obj, NULL); diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index dde1cae4c5..6417d628fb 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -989,7 +989,7 @@ void calltree_add_history_entry (callable_obj_t * c) DEBUG("calltree_add_history_entry %s", c->_callID); - if ( g_strcasecmp (dbus_get_history_enabled (), "false") == 0) + if (!eel_gconf_get_integer (HISTORY_ENABLED)) return; GdkPixbuf *pixbuf=NULL; diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index 7871ab44dd..9a3cc87dea 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -1874,32 +1874,6 @@ dbus_set_history_limit(const guint days) } } -void -dbus_set_history_enabled() -{ - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_history_enabled( - configurationManagerProxy, &error); - if (error) - { - g_error_free(error); - } -} - -gchar* -dbus_get_history_enabled() -{ - gchar* state; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_history_enabled( - configurationManagerProxy, &state, &error); - if (error) - { - g_error_free(error); - } - return state; -} - guint dbus_get_history_limit(void) { diff --git a/sflphone-client-gnome/src/dbus/dbus.h b/sflphone-client-gnome/src/dbus/dbus.h index 04b9543542..d028b66ae4 100644 --- a/sflphone-client-gnome/src/dbus/dbus.h +++ b/sflphone-client-gnome/src/dbus/dbus.h @@ -425,10 +425,6 @@ guint dbus_get_history_limit( void ); */ void dbus_set_history_limit (const guint days); -void dbus_set_history_enabled (void); - -gchar* dbus_get_history_enabled (void); - /** * ConfigurationManager - Returns the selected audio manager * @return int 0 ALSA diff --git a/sflphone-client-gnome/src/sflphone_const.h b/sflphone-client-gnome/src/sflphone_const.h index cd041400cd..250a8c5673 100644 --- a/sflphone-client-gnome/src/sflphone_const.h +++ b/sflphone-client-gnome/src/sflphone_const.h @@ -192,5 +192,6 @@ log4c_category_t* log4c_sfl_gtk_category; #define NOTIFY_ALL CONF_PREFIX "/state/notify_all" #define START_HIDDEN CONF_PREFIX "/state/start_hidden" #define POPUP_ON_CALL CONF_PREFIX "/state/popup" +#define HISTORY_ENABLED CONF_PREFIX "/state/history" #endif diff --git a/sflphone-client-gnome/src/uimanager.c b/sflphone-client-gnome/src/uimanager.c index 1b185e2d80..8f3a41ca1e 100644 --- a/sflphone-client-gnome/src/uimanager.c +++ b/sflphone-client-gnome/src/uimanager.c @@ -92,6 +92,7 @@ update_actions() g_object_ref(holdToolbar); g_object_ref(offHoldToolbar); g_object_ref(contactButton); + g_object_ref(historyButton); g_object_ref(transferToolbar); g_object_ref(voicemailToolbar); @@ -111,6 +112,11 @@ update_actions() GTK_WIDGET (transferToolbar)); } + if (is_inserted(GTK_WIDGET(historyButton), GTK_WIDGET (toolbar))) + { + gtk_container_remove(GTK_CONTAINER (toolbar), GTK_WIDGET (historyButton)); + } + if (is_inserted(GTK_WIDGET(contactButton), GTK_WIDGET (toolbar))) { gtk_container_remove(GTK_CONTAINER (toolbar), GTK_WIDGET (contactButton)); @@ -129,6 +135,7 @@ update_actions() gtk_widget_set_sensitive(GTK_WIDGET (recordWidget), FALSE); gtk_action_set_sensitive(GTK_ACTION (copyAction), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(contactButton), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(historyButton), FALSE); gtk_widget_set_tooltip_text(GTK_WIDGET (contactButton), _("No address book selected")); @@ -143,6 +150,11 @@ update_actions() gtk_container_remove(GTK_CONTAINER (toolbar), GTK_WIDGET (pickUpWidget)); gtk_toolbar_insert(GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (newCallWidget), 0); + + if (eel_gconf_get_integer (HISTORY_ENABLED)) { + gtk_toolbar_insert(GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (historyButton), -1); + gtk_widget_set_sensitive(GTK_WIDGET(historyButton), TRUE); + } // If addressbook support has been enabled and all addressbooks are loaded, display the icon if (addressbook_is_enabled() && addressbook_is_ready()) { -- GitLab