diff --git a/po/fr.po b/po/fr.po index c79d4c5f8116fe2afe4f11851db9564e8368856f..028443697b82f49685e41c70ad74798e3a2a82b1 100644 --- a/po/fr.po +++ b/po/fr.po @@ -91,6 +91,10 @@ msgstr "_Clavier" msgid "_Volume controls" msgstr "_ContrĂ´le du volume" +#: sflphone-gtk/src/menus.c: 610 +msgid "_Search history" +msgstr "Recherche dans l'historique" + #: sflphone-gtk/src/menus.c: 479 msgid "_Toolbar" msgstr "_Barre d'outils" diff --git a/po/sflphone.pot b/po/sflphone.pot index e8c3ba7b8cd87cf41f70d51cb2fee0ab8f21a62d..f19b29aef80cbdb1365c58db281f8bf4e81e04ee 100644 --- a/po/sflphone.pot +++ b/po/sflphone.pot @@ -81,6 +81,10 @@ msgstr "" msgid "_Volume controls" msgstr "" +#: sflphone-gtk/src/menus.c: 610 +msgid "_Search history" +msgstr "" + #: sflphone-gtk/src/menus.c: 479 msgid "_Toolbar" msgstr "" diff --git a/sflphone-gtk/configure.ac b/sflphone-gtk/configure.ac index f1baaa4301bcbfd0cb7d9254761e8a1d7c8ead22..3a95fb913f9e0b1ecfe3216eaedee0ce60348f39 100644 --- a/sflphone-gtk/configure.ac +++ b/sflphone-gtk/configure.ac @@ -27,6 +27,7 @@ PKG_CHECK_MODULES(DEPS, \ libnotify >= 0.4 \ gtk+-2.0 >= 2.2 \ glib-2.0 >= 2.2 \ + libsexy >= 0.1 \ ) diff --git a/sflphone-gtk/src/Makefile.am b/sflphone-gtk/src/Makefile.am index 677c6b4052648e9e56e9fa4079329f90e10d32c3..ea575c81dc33a7f0e284eb2108253942378d97af 100644 --- a/sflphone-gtk/src/Makefile.am +++ b/sflphone-gtk/src/Makefile.am @@ -1,5 +1,8 @@ bin_PROGRAMS = sflphone-gtk +NOFIFY_LIBS=-lnotify +SEXY_LIBS=-lsexy + #if GTK_CHECK_VERSION(2,10,0) STATUSICON_HEADER = statusicon.h STATUSICON_SOURCE = statusicon.c @@ -20,6 +23,7 @@ sflphone_gtk_SOURCES = \ menus.c \ calltab.c \ calltree.c \ + historyfilter.c \ actions.c \ configwindow.c \ accountlist.c \ @@ -33,9 +37,10 @@ sflphone_gtk_SOURCES = \ noinst_HEADERS = actions.h dbus.h sflnotify.h mainwindow.h calllist.h dialpad.h codeclist.h assistant.h\ callmanager-glue.h errors.h sflphone_const.h configurationmanager-glue.h instance-glue.h menus.h calltab.h calltree.h configwindow.h \ - accountlist.h accountwindow.h marshaller.h sliders.h $(STATUSICON_HEADER) timestamp.h + accountlist.h accountwindow.h marshaller.h sliders.h $(STATUSICON_HEADER) timestamp.h historyfilter.c + EXTRA_DIST = marshaller.list -sflphone_gtk_LDADD = $(DEPS_LIBS) -lnotify +sflphone_gtk_LDADD = $(DEPS_LIBS) $(NOTIFY_LIBS) $(SEXY_LIBS) AM_CPPFLAGS = $(DEPS_CFLAGS) \ -DICONS_DIR=\""$(datadir)/sflphone"\" \ diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index 9909edd23387945a4c98c3e9121e382515cbf97f..58fddae09971482d5116e6e2e3fb05daab2613c9 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -25,6 +25,7 @@ #include <menus.h> #include <statusicon.h> #include <calltab.h> +#include <historyfilter.h> #include <gtk/gtk.h> #include <string.h> @@ -196,6 +197,7 @@ sflphone_init() int i; current_calls = calltab_init(); history = calltab_init(); + histfilter = create_filter(GTK_TREE_MODEL(history->store)); account_list_init (); codec_list_init(); if(!dbus_connect ()){ diff --git a/sflphone-gtk/src/calltab.h b/sflphone-gtk/src/calltab.h index cbeab8f43466e92d6d1726a2dff1993fa1fad03d..dcc47b2605551556b6085ca6b67fab3021697d65 100644 --- a/sflphone-gtk/src/calltab.h +++ b/sflphone-gtk/src/calltab.h @@ -23,6 +23,7 @@ #include <calllist.h> #include <gtk/gtk.h> +GtkTreeModel* histfilter; calltab_t* calltab_init(); diff --git a/sflphone-gtk/src/calltree.c b/sflphone-gtk/src/calltree.c index e409efe7497e0a9b2830819bf603e936b03faf5f..3c0b0260b078f33ef28ccca22af2543f42f74e2c 100644 --- a/sflphone-gtk/src/calltree.c +++ b/sflphone-gtk/src/calltree.c @@ -43,7 +43,9 @@ gboolean history_shown; void switch_tab() { - (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(historyButton)))? gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), FALSE):gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), TRUE); + (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(historyButton)))? + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), FALSE): + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), TRUE); } /** @@ -173,21 +175,22 @@ unhold( GtkWidget *widget, gpointer data ) toggle_history(GtkToggleToolButton *toggle_tool_button, gpointer user_data) { - GtkTreeSelection *sel; - if(history_shown){ - active_calltree = current_calls; - gtk_widget_hide(history->tree); - gtk_widget_show(current_calls->tree); - history_shown = FALSE; - }else{ - active_calltree = history; - gtk_widget_hide(current_calls->tree); - gtk_widget_show(history->tree); - history_shown = TRUE; - } - sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_calltree->view)); - g_signal_emit_by_name(sel, "changed"); - toolbar_update_buttons(); + GtkTreeSelection *sel; + if(history_shown){ + active_calltree = current_calls; + gtk_widget_hide(history->tree); + gtk_widget_show(current_calls->tree); + history_shown = FALSE; + }else{ + active_calltree = history; + gtk_widget_hide(current_calls->tree); + gtk_widget_show(history->tree); + history_shown = TRUE; + } + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_calltree->view)); + g_signal_emit_by_name(sel, "changed"); + toolbar_update_buttons(); + gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(histfilter)); } diff --git a/sflphone-gtk/src/calltree.h b/sflphone-gtk/src/calltree.h index 8639d0bb1031bdcdefb1accb99ec486deb0457d3..5b2f5ca079b368463be7dbcdb09b462adf7e0c78 100644 --- a/sflphone-gtk/src/calltree.h +++ b/sflphone-gtk/src/calltree.h @@ -31,6 +31,8 @@ * @brief The GtkTreeView that list calls in the main window. */ +GtkToolItem * historyButton; + calltab_t* active_calltree; /** * Create a new widget calltree @@ -49,7 +51,8 @@ static void toggle_history(GtkToggleToolButton *toggle_tool_button, gpointer use * @param c The call to add */ void update_call_tree_add (calltab_t* ct, call_t * c); -/** + +/* * Update the call tree if the call state changes * @param c The call to update */ diff --git a/sflphone-gtk/src/configurationmanager-glue.h b/sflphone-gtk/src/configurationmanager-glue.h index 00e4b3126cfd690f479d579eb0e4f903159cfddf..3cad16502d2542ae60116274d3b1af6c3e56b8f2 100644 --- a/sflphone-gtk/src/configurationmanager-glue.h +++ b/sflphone-gtk/src/configurationmanager-glue.h @@ -1406,6 +1406,81 @@ static inline #endif gboolean +org_sflphone_SFLphone_ConfigurationManager_get_searchbar (DBusGProxy *proxy, gint* OUT_state, GError **error) + +{ + return dbus_g_proxy_call (proxy, "getSearchbar", error, G_TYPE_INVALID, G_TYPE_INT, OUT_state, G_TYPE_INVALID); +} + +typedef void (*org_sflphone_SFLphone_ConfigurationManager_get_searchbar_reply) (DBusGProxy *proxy, gint OUT_state, GError *error, gpointer userdata); + +static void +org_sflphone_SFLphone_ConfigurationManager_get_searchbar_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + gint OUT_state; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INT, &OUT_state, G_TYPE_INVALID); + (*(org_sflphone_SFLphone_ConfigurationManager_get_searchbar_reply)data->cb) (proxy, OUT_state, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +org_sflphone_SFLphone_ConfigurationManager_get_searchbar_async (DBusGProxy *proxy, org_sflphone_SFLphone_ConfigurationManager_get_searchbar_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "getSearchbar", org_sflphone_SFLphone_ConfigurationManager_get_searchbar_async_callback, stuff, g_free, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +org_sflphone_SFLphone_ConfigurationManager_set_searchbar (DBusGProxy *proxy, GError **error) + +{ + return dbus_g_proxy_call (proxy, "setSearchbar", error, G_TYPE_INVALID, G_TYPE_INVALID); +} + +typedef void (*org_sflphone_SFLphone_ConfigurationManager_set_searchbar_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); + +static void +org_sflphone_SFLphone_ConfigurationManager_set_searchbar_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); + (*(org_sflphone_SFLphone_ConfigurationManager_set_searchbar_reply)data->cb) (proxy, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +org_sflphone_SFLphone_ConfigurationManager_set_searchbar_async (DBusGProxy *proxy, org_sflphone_SFLphone_ConfigurationManager_set_searchbar_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "setSearchbar", org_sflphone_SFLphone_ConfigurationManager_set_searchbar_async_callback, stuff, g_free, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean org_sflphone_SFLphone_ConfigurationManager_get_volume_controls (DBusGProxy *proxy, gint* OUT_state, GError **error) { diff --git a/sflphone-gtk/src/dbus.c b/sflphone-gtk/src/dbus.c index 2d5f4fe1187842a2695503de1cae85d6e5e820d5..c5f10b1b7d0aa86dea9f834434f189d3fb7c40a5 100644 --- a/sflphone-gtk/src/dbus.c +++ b/sflphone-gtk/src/dbus.c @@ -1181,6 +1181,41 @@ dbus_set_dialpad( ) g_print("DBus called set_dialpad on ConfigurationManager\n"); } +int +dbus_get_searchbar() +{ + int state; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_searchbar( + configurationManagerProxy, + &state, + &error); + g_print("After"); + if(error) + { + g_error_free(error); + } + else + g_print("DBus called get_searchbar on ConfigurationManager\n"); + return state; +} + +void +dbus_set_searchbar( ) +{ + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_searchbar( + configurationManagerProxy, + &error); + g_print("After"); + if(error) + { + g_error_free(error); + } + else + g_print("DBus called set_searchbar on ConfigurationManager\n"); +} + int dbus_get_volume_controls() { diff --git a/sflphone-gtk/src/dbus.h b/sflphone-gtk/src/dbus.h index d902bd17ebd4273b7bf94bc1af6c9e1df2e9f7ed..d54165f3f7a472b01cbd96d8ec3be3673fb18d95 100644 --- a/sflphone-gtk/src/dbus.h +++ b/sflphone-gtk/src/dbus.h @@ -291,6 +291,18 @@ void dbus_set_dialpad( ); */ int dbus_get_dialpad( void ); +/** + * ConfigurationManager - Set the searchbar visible or not + */ +void dbus_set_searchbar( ); + +/** + * ConfigurationManager - Tells if the user wants to display the search bar or not + * @return int 1 if the search bar has to be displayed + * 0 otherwise + */ +int dbus_get_searchbar( void ); + /** * ConfigurationManager - Set the volume controls visible or not */ diff --git a/sflphone-gtk/src/historyfilter.c b/sflphone-gtk/src/historyfilter.c new file mode 100644 index 0000000000000000000000000000000000000000..86aa6f4111931a7e59f3cbf3f639fbacbc5df7e9 --- /dev/null +++ b/sflphone-gtk/src/historyfilter.c @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2008 Savoir-Faire Linux inc. + * Author: Antoine Reversat <antoine.reversat@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <historyfilter.h> +#include <calltree.h> + +GtkTreeModel* +create_filter(GtkTreeModel* child) +{ + GtkTreeModel* ret = gtk_tree_model_filter_new(child, NULL); + gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(ret), is_visible, NULL, NULL); + return GTK_TREE_MODEL(ret); +} + +gboolean +is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data) +{ + GValue val = {0, }; + gchar* text; + gchar* search = (gchar*)gtk_entry_get_text(GTK_ENTRY(filter_entry)); + gtk_tree_model_get_value(GTK_TREE_MODEL(model), iter, 1, &val); + if(G_VALUE_HOLDS_STRING(&val)){ + text = (gchar *)g_value_get_string(&val); + } + if(text != NULL && g_ascii_strncasecmp(search, "Search", 6) != 0){ + return g_regex_match_simple(search, text, G_REGEX_CASELESS, 0); + } + return TRUE; +} + +void +filter_entry_changed(GtkEntry* entry, gchar* arg1, gpointer data) +{ + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), TRUE); + gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(histfilter)); +} + +void +clear_filter_entry_if_default(GtkWidget* widget, gpointer user_data) +{ + if(g_ascii_strncasecmp(gtk_entry_get_text(GTK_ENTRY(filter_entry)), "Search", 6) == 0) + gtk_entry_set_text(GTK_ENTRY(filter_entry), ""); + +} + +GtkWidget* +create_filter_entry() +{ + GtkWidget* image; + GtkWidget* ret = gtk_hbox_new(FALSE, 0); + + filter_entry = sexy_icon_entry_new(); + image = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_SMALL_TOOLBAR); + sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(filter_entry), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); + sexy_icon_entry_add_clear_button( SEXY_ICON_ENTRY(filter_entry) ); + gtk_entry_set_text(GTK_ENTRY(filter_entry), "Search"); + g_signal_connect(GTK_ENTRY(filter_entry), "changed", G_CALLBACK(filter_entry_changed), NULL); + g_signal_connect(GTK_ENTRY(filter_entry), "grab-focus", G_CALLBACK(clear_filter_entry_if_default), NULL); + + gtk_box_pack_start(GTK_BOX(ret), filter_entry, TRUE, TRUE, 0); + return ret; +} diff --git a/sflphone-gtk/src/historyfilter.h b/sflphone-gtk/src/historyfilter.h new file mode 100644 index 0000000000000000000000000000000000000000..2fd81ea25f136cae6b119186acc9dbae332e790f --- /dev/null +++ b/sflphone-gtk/src/historyfilter.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2007 Savoir-Faire Linux inc. + * Author: Antoine Reversat <antoine.reversat@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __HFILTER_H__ +#define __HFILTER_H__ + +#include <calllist.h> +#include <gtk/gtk.h> +#include <libsexy/sexy-icon-entry.h> + + + +GtkWidget * filter_entry; + +GtkTreeModel* create_filter(GtkTreeModel* child); + +gboolean is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data); +GtkWidget* create_filter_entry(); +#endif diff --git a/sflphone-gtk/src/mainwindow.c b/sflphone-gtk/src/mainwindow.c index 11a2d796da96831083b436cb74c5dec4f208c236..78bd04bbffc310801e1135f4855fcdf3d52f30a0 100644 --- a/sflphone-gtk/src/mainwindow.c +++ b/sflphone-gtk/src/mainwindow.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 Savoir-Faire Linux inc. + * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -27,6 +28,7 @@ #include <mainwindow.h> #include <menus.h> #include <sliders.h> +#include <historyfilter.h> #include <gtk/gtk.h> @@ -34,10 +36,12 @@ GtkAccelGroup * accelGroup = NULL; GtkWidget * window = NULL; GtkWidget * subvbox = NULL; +GtkWidget * vbox = NULL; GtkWidget * dialpad = NULL; GtkWidget * speaker_control = NULL; GtkWidget * mic_control = NULL; GtkWidget * statusBar = NULL; +GtkWidget * filterEntry = NULL; /** * Minimize the main window. @@ -109,6 +113,7 @@ on_key_released (GtkWidget *widget, event->keyval == 32 // space ) return FALSE; + g_print("search bar active : %s\n", gtk_widget_is_focus(GTK_WIDGET( filterEntry ))); sflphone_keypad(event->keyval, event->string); return TRUE; } @@ -117,7 +122,6 @@ void create_main_window () { GtkWidget *widget; - GtkWidget *vbox; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 0); @@ -133,8 +137,8 @@ create_main_window () */ g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (on_delete), NULL); - g_signal_connect (G_OBJECT (window), "key-press-event", - G_CALLBACK (on_key_released), NULL); + //g_signal_connect (G_OBJECT (window), "key-press-event", + // G_CALLBACK (on_key_released), NULL); /* Create an accel group for window's shortcuts */ accelGroup = gtk_accel_group_new (); @@ -149,23 +153,31 @@ create_main_window () widget = create_toolbar(); gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); + + gtk_box_pack_start (GTK_BOX (vbox), current_calls->tree, TRUE /*expand*/, TRUE /*fill*/, 0 /*padding*/); gtk_box_pack_start (GTK_BOX (vbox), history->tree, TRUE /*expand*/, TRUE /*fill*/, 0 /*padding*/); gtk_box_pack_start (GTK_BOX (vbox), subvbox, FALSE /*expand*/, FALSE /*fill*/, 0 /*padding*/); + + if( SHOW_SEARCHBAR ){ + filterEntry = create_filter_entry(); + gtk_box_pack_start (GTK_BOX (subvbox), filterEntry, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); + gtk_widget_show_all ( filterEntry ); + } - if( SHOW_VOLUME ){ + if( SHOW_VOLUME ){ speaker_control = create_slider("speaker"); - gtk_box_pack_start (GTK_BOX (subvbox), speaker_control, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); + gtk_box_pack_end (GTK_BOX (subvbox), speaker_control, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); gtk_widget_show_all (speaker_control); mic_control = create_slider("mic"); - gtk_box_pack_start (GTK_BOX (subvbox), mic_control, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); + gtk_box_pack_end (GTK_BOX (subvbox), mic_control, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); gtk_widget_show_all (mic_control); } + if( SHOW_DIALPAD ){ dialpad = create_dialpad(); gtk_box_pack_end (GTK_BOX (subvbox), dialpad, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); - gtk_box_reorder_child(GTK_BOX (subvbox), dialpad, 1); gtk_widget_show_all (dialpad); } @@ -181,6 +193,7 @@ create_main_window () gtk_widget_hide(history->tree); //gtk_widget_show(current_calls->tree); + gtk_tree_view_set_model(GTK_TREE_VIEW(history->view), GTK_TREE_MODEL(histfilter)); // Configuration wizard if (account_list_get_size() == 0) { @@ -250,7 +263,6 @@ main_window_dialpad( gboolean *state ){ { dialpad = create_dialpad(); gtk_box_pack_end (GTK_BOX (subvbox), dialpad, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); - gtk_box_reorder_child(GTK_BOX (subvbox), dialpad, 1); gtk_widget_show_all (dialpad); *state = TRUE; } @@ -266,10 +278,10 @@ main_window_volume_controls( gboolean *state ){ if( !SHOW_VOLUME ) { speaker_control = create_slider("speaker"); - gtk_box_pack_start (GTK_BOX (subvbox), speaker_control, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); + gtk_box_pack_end (GTK_BOX (subvbox), speaker_control, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); gtk_widget_show_all (speaker_control); mic_control = create_slider("mic"); - gtk_box_pack_start (GTK_BOX (subvbox), mic_control, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); + gtk_box_pack_end (GTK_BOX (subvbox), mic_control, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); gtk_widget_show_all (mic_control); *state = TRUE; } @@ -281,6 +293,22 @@ main_window_volume_controls( gboolean *state ){ } } +void +main_window_searchbar( gboolean *state ){ + if( !SHOW_SEARCHBAR ) + { + filterEntry = create_filter_entry(); + gtk_box_pack_start (GTK_BOX (subvbox), filterEntry, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); + gtk_widget_show_all (filterEntry); + *state = TRUE; + } + else + { + gtk_container_remove( GTK_CONTAINER(subvbox) , filterEntry ); + *state = FALSE; + } +} + void statusbar_push_message(const gchar * message, guint id) { diff --git a/sflphone-gtk/src/menus.c b/sflphone-gtk/src/menus.c index bb24a9b2b814484ceeff968b1651dce9e37f3e99..764a9f28bcc31a59ebd4a64e46fd8ba87b03e646 100644 --- a/sflphone-gtk/src/menus.c +++ b/sflphone-gtk/src/menus.c @@ -43,6 +43,7 @@ guint holdConnId; //The hold_menu signal connection ID GtkWidget * dialpadMenu; GtkWidget * volumeMenu; +GtkWidget * searchbarMenu; void update_menus() @@ -611,6 +612,15 @@ view_volume_controls (GtkImageMenuItem *imagemenuitem, dbus_set_volume_controls( state ); } + static void +view_searchbar (GtkImageMenuItem *imagemenuitem, + void* foo) +{ + gboolean state; + main_window_searchbar( &state ); + dbus_set_searchbar( state ); +} + GtkWidget * create_view_menu() { @@ -644,6 +654,15 @@ create_view_menu() NULL); gtk_widget_show (volumeMenu); + image = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_MENU ); + searchbarMenu = gtk_image_menu_item_new_with_mnemonic (_("_Search history")); + gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( searchbarMenu ), image ); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), searchbarMenu); + g_signal_connect(G_OBJECT (searchbarMenu), "activate", + G_CALLBACK (view_searchbar), + NULL); + gtk_widget_show (searchbarMenu); + root_menu = gtk_menu_item_new_with_mnemonic (_("_View")); gtk_menu_item_set_submenu (GTK_MENU_ITEM (root_menu), menu); diff --git a/sflphone-gtk/src/sflphone_const.h b/sflphone-gtk/src/sflphone_const.h index d9aef1abfeba38d1595eea64df3170f291cecc29..ff4c90ba4363aa01d72320776af373e39e96b14d 100644 --- a/sflphone-gtk/src/sflphone_const.h +++ b/sflphone-gtk/src/sflphone_const.h @@ -74,6 +74,9 @@ #define SHOW_DIALPAD ( dbus_get_dialpad() ) /** Show/Hide the volume controls */ #define SHOW_VOLUME ( dbus_get_volume_controls() ) +/** Show/Hide the dialpad */ +#define SHOW_SEARCHBAR ( dbus_get_searchbar() ) + /** Notification levels */ #define __NOTIF_LEVEL_MIN 0 #define __NOTIF_LEVEL_MED 1 diff --git a/src/dbus/configurationmanager-glue.h b/src/dbus/configurationmanager-glue.h index 4b70708af32545f659ec019073a6d478fe67cf55..dfd7f8920481f3600b7983cc7df41f29a2bdc9fc 100644 --- a/src/dbus/configurationmanager-glue.h +++ b/src/dbus/configurationmanager-glue.h @@ -57,6 +57,8 @@ public: register_method(ConfigurationManager, getMailNotify, _getMailNotify_stub); register_method(ConfigurationManager, getDialpad, _getDialpad_stub); register_method(ConfigurationManager, setDialpad, _setDialpad_stub); + register_method(ConfigurationManager, getSearchbar, _getSearchbar_stub); + register_method(ConfigurationManager, setSearchbar, _setSearchbar_stub); register_method(ConfigurationManager, getVolumeControls, _getVolumeControls_stub); register_method(ConfigurationManager, setVolumeControls, _setVolumeControls_stub); register_method(ConfigurationManager, getMaxCalls, _getMaxCalls_stub); @@ -255,6 +257,15 @@ public: { { 0, 0, 0 } }; + static ::DBus::IntrospectedArgument getSearchbar_args[] = + { + { "state", "i", false }, + { 0, 0, 0 } + }; + static ::DBus::IntrospectedArgument setSearchbar_args[] = + { + { 0, 0, 0 } + }; static ::DBus::IntrospectedArgument getVolumeControls_args[] = { { "state", "i", false }, @@ -345,6 +356,8 @@ public: { "getMailNotify", getMailNotify_args }, { "getDialpad", getDialpad_args }, { "setDialpad", setDialpad_args }, + { "getSearchbar", getSearchbar_args }, + { "setSearchbar", setSearchbar_args }, { "getVolumeControls", getVolumeControls_args }, { "setVolumeControls", setVolumeControls_args }, { "getMaxCalls", getMaxCalls_args }, @@ -424,6 +437,8 @@ public: virtual ::DBus::Int32 getMailNotify( ) = 0; virtual ::DBus::Int32 getDialpad( ) = 0; virtual void setDialpad( ) = 0; + virtual ::DBus::Int32 getSearchbar( ) = 0; + virtual void setSearchbar( ) = 0; virtual ::DBus::Int32 getVolumeControls( ) = 0; virtual void setVolumeControls( ) = 0; virtual ::DBus::Int32 getMaxCalls( ) = 0; @@ -818,6 +833,24 @@ private: ::DBus::ReturnMessage reply(call); return reply; } + ::DBus::Message _getSearchbar_stub( const ::DBus::CallMessage& call ) + { + ::DBus::MessageIter ri = call.reader(); + + ::DBus::Int32 argout1 = getSearchbar(); + ::DBus::ReturnMessage reply(call); + ::DBus::MessageIter wi = reply.writer(); + wi << argout1; + return reply; + } + ::DBus::Message _setSearchbar_stub( const ::DBus::CallMessage& call ) + { + ::DBus::MessageIter ri = call.reader(); + + setSearchbar(); + ::DBus::ReturnMessage reply(call); + return reply; + } ::DBus::Message _getVolumeControls_stub( const ::DBus::CallMessage& call ) { ::DBus::MessageIter ri = call.reader(); diff --git a/src/dbus/configurationmanager-introspec.xml b/src/dbus/configurationmanager-introspec.xml index 59c96a1e6ae6c3613c7219aec1a93af2f12e6dcb..0b785ff3d80e452f66b7e836d47c64a32d264bb1 100644 --- a/src/dbus/configurationmanager-introspec.xml +++ b/src/dbus/configurationmanager-introspec.xml @@ -159,6 +159,13 @@ <method name="setDialpad"> </method> + <method name="getSearchbar"> + <arg type="i" name="state" direction="out"/> + </method> + + <method name="setSearchbar"> + </method> + <method name="getVolumeControls"> <arg type="i" name="state" direction="out"/> </method> diff --git a/src/dbus/configurationmanager.cpp b/src/dbus/configurationmanager.cpp index b4d488d67fa19c1972d32c8ed3a9c75b8ee9bf07..77e35d2c2d809d1a9578c94fde47f6b5a8dd8eb5 100644 --- a/src/dbus/configurationmanager.cpp +++ b/src/dbus/configurationmanager.cpp @@ -261,6 +261,18 @@ ConfigurationManager::setDialpad( void ) Manager::instance().setDialpad( ); } +::DBus::Int32 +ConfigurationManager::getSearchbar( void ) +{ + return Manager::instance().getSearchbar( ); +} + +void +ConfigurationManager::setSearchbar( void ) +{ + Manager::instance().setSearchbar( ); +} + ::DBus::Int32 ConfigurationManager::getVolumeControls( void ) { diff --git a/src/dbus/configurationmanager.h b/src/dbus/configurationmanager.h index 067dea7fec08d1d180820f6fa131e1ba08447bfd..da0c82efb3c0cf9f9a30faab7538b9708a7c5a6c 100644 --- a/src/dbus/configurationmanager.h +++ b/src/dbus/configurationmanager.h @@ -77,6 +77,8 @@ public: void setRingtoneChoice( const ::DBus::String& tone ); ::DBus::Int32 getDialpad( void ); void setDialpad( void ); + ::DBus::Int32 getSearchbar( void ); + void setSearchbar( void ); void setMaxCalls( const ::DBus::Int32& calls); ::DBus::Int32 getMaxCalls( void ); ::DBus::Int32 getVolumeControls( void ); diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 26f4dc9852f31a4ff0dc6182f680a3c7ba3aea26..a5fc52eadf2894796ce21b3bec1fa60058d5d330 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -975,6 +975,7 @@ ManagerImpl::initConfigFile (void) fill_config_int(CONFIG_ZEROCONF, CONFIG_ZEROCONF_DEFAULT_STR); fill_config_int(CONFIG_RINGTONE, YES_STR); fill_config_int(CONFIG_DIALPAD, YES_STR); + fill_config_int(CONFIG_SEARCHBAR, YES_STR); fill_config_int(CONFIG_START, NO_STR); fill_config_int(CONFIG_POPUP, YES_STR); fill_config_int(CONFIG_NOTIFY , YES_STR); @@ -1369,6 +1370,18 @@ ManagerImpl::getMaxCalls( void ) return getConfigInt( PREFERENCES , CONFIG_HISTORY ); } +int +ManagerImpl::getSearchbar( void ) +{ + return getConfigInt( PREFERENCES , CONFIG_SEARCHBAR ); +} + +void +ManagerImpl::setSearchbar( void ) +{ + ( getConfigInt( PREFERENCES , CONFIG_SEARCHBAR ) == 1)? setConfig(PREFERENCES , CONFIG_SEARCHBAR , NO_STR ) : setConfig( PREFERENCES , CONFIG_SEARCHBAR , YES_STR ); +} + int ManagerImpl::popupMode( void ) { diff --git a/src/managerimpl.h b/src/managerimpl.h index 5fa813b9061597a4a26c99ca63f99cab681ff783..d6aa83be7703f96cadd40daea25e2d1473afb0c7 100644 --- a/src/managerimpl.h +++ b/src/managerimpl.h @@ -506,7 +506,7 @@ class ManagerImpl { void startHidden( void ); /** - Configure the popup behaviour + * Configure the popup behaviour * @return int 1 if it should popup on incoming calls * 0 if it should never popups */ @@ -519,6 +519,16 @@ class ManagerImpl { */ void switchPopupMode( void ); + /** + * Determine whether or not the search bar (history) should be displayed + */ + int getSearchbar( void ); + + /** + * Configure the search bar behaviour + */ + void setSearchbar( void ); + /** * Set the desktop notification level */ diff --git a/src/user_cfg.h b/src/user_cfg.h index 173a6693374e0b055ba54f245610993f8e52bb22..e01e0615fc7f3baf6b352c4f5aa8b67896d3086e 100644 --- a/src/user_cfg.h +++ b/src/user_cfg.h @@ -48,6 +48,7 @@ #define PREFERENCES "Preferences" /** Section Preferences */ #define CONFIG_DIALPAD "Dialpad.display" /** Display dialpad preferences */ +#define CONFIG_SEARCHBAR "Searchbar.display" /** Whether or nor display the search bar */ #define CONFIG_HISTORY "History.maxCalls" /** Set the maximum number of calls kept */ #define CONFIG_NOTIFY "Notify.all" /** Desktop notification level */ #define CONFIG_MAIL_NOTIFY "Notify.mails" /** Desktop mail notification level */