Merge branch 'history_addons' into stable

This commit is contained in:
Emmanuel Milou
2008-05-21 16:52:51 -04:00
24 changed files with 515 additions and 64 deletions

View File

@ -67,6 +67,18 @@ msgstr "_Assistant SFLphone"
msgid "_Accounts"
msgstr "Co_mptes"
#: sflphone-gtk/src/menus.c: 523
msgid "_Clear history"
msgstr "Effacer l'historique"
#: sflphone-gtk/src/menus.c: 523
msgid "History empty"
msgstr "L'historique est vide"
#: sflphone-gtk/src/menus.c: 523
msgid "Clear the call history?"
msgstr "Effacer l'historique des appels?"
#: sflphone-gtk/src/menus.c: 438
msgid "_Edit"
msgstr "_Options"
@ -79,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"

View File

@ -65,6 +65,10 @@ msgstr ""
msgid "_Accounts"
msgstr ""
#: sflphone-gtk/src/menus.c: 523
msgid "_Clear history"
msgstr ""
#: sflphone-gtk/src/menus.c: 438
msgid "_Edit"
msgstr ""
@ -77,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 ""

View File

@ -27,6 +27,7 @@ PKG_CHECK_MODULES(DEPS, \
libnotify >= 0.4 \
gtk+-2.0 >= 2.2 \
glib-2.0 >= 2.2 \
libsexy >= 0.1 \
)

View File

@ -1,5 +1,7 @@
icondir = $(datadir)/pixmaps
icon_DATA = sflphone.png
buttons_DATA = accept.svg current.svg transfert.svg hang_up.svg hold.svg unhold.svg refuse.svg call.svg ring.svg dial.svg mic.svg mic_25.svg mic_50.svg mic_75.svg speaker.svg speaker_25.svg speaker_50.svg speaker_75.svg fail.svg incoming.svg outgoing.svg missed.svg mailbox.svg busy.svg icon_accept.svg icon_hold.svg icon_unhold.svg icon_hangup.svg icon_call.svg icon_dialpad.svg icon_volume.svg icon_dialpad_off.svg icon_volume_off.svg history.svg history2.svg sflphone.png
buttonsdir = $(datadir)/sflphone
EXTRA_DIST = $(buttons_DATA)
EXTRA_DIST = $(buttons_DATA) $(icon_DATA)

View File

@ -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"\" \

View File

@ -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();
if(SHOW_SEARCHBAR) histfilter = create_filter(GTK_TREE_MODEL(history->store));
account_list_init ();
codec_list_init();
if(!dbus_connect ()){
@ -445,10 +447,10 @@ process_dialing(call_t * c, guint keyval, gchar * key)
{
if(c->state != CALL_STATE_TRANSFERT)
dbus_play_dtmf( key );
gchar * before = c->to;
c->to = g_strconcat(c->to, key, NULL);
g_free(before);
g_print("TO: %s\n", c->to);
gchar * before = c->to;
c->to = g_strconcat(c->to, key, NULL);
g_free(before);
g_print("TO: %s\n", c->to);
if(c->state == CALL_STATE_DIALING)
{
@ -515,11 +517,11 @@ sflphone_keypad( guint keyval, gchar * key)
dbus_play_dtmf(key);
if (keyval < 255 || (keyval >65453 && keyval < 65466))
{
gchar * temp = g_strconcat(call_get_number(c), key, NULL);
gchar * before = c->from;
c->from = g_strconcat("\"",call_get_name(c) ,"\" <", temp, ">", NULL);
g_free(before);
g_free(temp);
//gchar * temp = g_strconcat(call_get_number(c), key, NULL);
//gchar * before = c->from;
//c->from = g_strconcat("\"",call_get_name(c) ,"\" <", temp, ">", NULL);
//g_free(before);
//g_free(temp);
//update_call_tree(current_calls,c);
}
break;

View File

@ -23,6 +23,7 @@
#include <calllist.h>
#include <gtk/gtk.h>
GtkTreeModel* histfilter;
calltab_t* calltab_init();

View File

@ -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));
}
@ -486,6 +489,27 @@ create_toolbar ()
return ret;
}
static gboolean
on_key_released (GtkWidget *widget,
GdkEventKey *event,
gpointer user_data)
{
// If a modifier key is pressed, it's a shortcut, pass along
if(event->state & GDK_CONTROL_MASK ||
event->state & GDK_MOD1_MASK ||
event->keyval == 60 || // <
event->keyval == 62 || // >
event->keyval == 34 || // "
event->keyval == 65361 || // left arrow
event->keyval == 65363 || // right arrow
event->keyval >= 65470 || // F-keys
event->keyval == 32 // space
)
return FALSE;
else
sflphone_keypad(event->keyval, event->string);
return TRUE;
}
void
create_call_tree (calltab_t* tab)
@ -502,6 +526,7 @@ create_call_tree (calltab_t* tab)
sw = gtk_scrolled_window_new( NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
g_signal_connect (G_OBJECT ( sw ), "key-press-event",G_CALLBACK (on_key_released), NULL);
tab->store = gtk_list_store_new (3,
GDK_TYPE_PIXBUF,// Icon
@ -510,6 +535,7 @@ create_call_tree (calltab_t* tab)
);
tab->view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(tab->store));
gtk_tree_view_set_enable_search( GTK_TREE_VIEW(tab->view), FALSE);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(tab->view), FALSE);
g_signal_connect (G_OBJECT (tab->view), "row-activated",
G_CALLBACK (row_activated),
@ -523,6 +549,7 @@ create_call_tree (calltab_t* tab)
G_CALLBACK (button_pressed),
NULL);
rend = gtk_cell_renderer_pixbuf_new();
col = gtk_tree_view_column_new_with_attributes ("Icon",
rend,

View File

@ -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
*/

View File

@ -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)
{

View File

@ -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()
{

View File

@ -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
*/

View File

@ -0,0 +1,84 @@
/*
* 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>
GtkWidget * filter_entry;
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)
{
if( SHOW_SEARCHBAR )
{
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;
}
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();
//filter_entry = gtk_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;
}

View File

@ -0,0 +1,31 @@
/*
* 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>
GtkTreeModel* create_filter(GtkTreeModel* child);
gboolean is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data);
GtkWidget* create_filter_entry();
#endif

View File

@ -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.
@ -89,35 +93,10 @@ main_window_ask_quit(){
return TRUE;
}
static gboolean
on_key_released (GtkWidget *widget,
GdkEventKey *event,
gpointer user_data)
{
#ifdef DEBUG
g_print("KEY %s, %d\n", event->string, event->keyval);
#endif
// If a modifier key is pressed, it's a shortcut, pass along
if(event->state & GDK_CONTROL_MASK ||
event->state & GDK_MOD1_MASK ||
event->keyval == 60 || // <
event->keyval == 62 || // >
event->keyval == 34 || // "
event->keyval == 65361 || // left arrow
event->keyval == 65363 || // right arrow
event->keyval >= 65470 || // F-keys
event->keyval == 32 // space
)
return FALSE;
sflphone_keypad(event->keyval, event->string);
return TRUE;
}
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 +112,6 @@ 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);
/* Create an accel group for window's shortcuts */
accelGroup = gtk_accel_group_new ();
@ -149,23 +126,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 +166,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 +236,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 +251,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 +266,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)
{

View File

@ -37,10 +37,13 @@ GtkWidget * newCallMenu;
GtkWidget * holdMenu;
GtkWidget * copyMenu;
GtkWidget * pasteMenu;
GtkWidget * clearhistoryMenu;
guint holdConnId; //The hold_menu signal connection ID
GtkWidget * dialpadMenu;
GtkWidget * volumeMenu;
GtkWidget * searchbarMenu;
void update_menus()
@ -482,12 +485,46 @@ edit_paste ( void * foo)
update_call_tree(current_calls,selectedCall);
}
}
static void
clear_history( void* foo )
{
gchar *markup;
GtkWidget *dialog;
int response;
if( call_list_get_size( history ) == 0 ){
markup = g_markup_printf_escaped(_("History empty"));
dialog = gtk_message_dialog_new_with_markup ( GTK_WINDOW(get_main_window()),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
markup);
response = gtk_dialog_run (GTK_DIALOG(dialog));
gtk_widget_destroy (GTK_WIDGET(dialog));
}
else{
markup = g_markup_printf_escaped(_("Clear the call history?"));
dialog = gtk_message_dialog_new_with_markup ( GTK_WINDOW(get_main_window()),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_YES_NO,
markup);
response = gtk_dialog_run (GTK_DIALOG(dialog));
gtk_widget_destroy (GTK_WIDGET(dialog));
if (response == GTK_RESPONSE_YES)
{
call_list_clean_history();
}
}
}
GtkWidget *
create_edit_menu()
{
GtkWidget * menu;
GtkWidget * image;
GtkWidget * root_menu;
GtkWidget * menu_items;
@ -510,6 +547,18 @@ create_edit_menu()
menu_items = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
menu_items = gtk_image_menu_item_new_with_mnemonic(_("_Clear history"));
image = gtk_image_new_from_stock( GTK_STOCK_CLEAR , GTK_ICON_SIZE_MENU );
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( menu_items ), image );
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
G_CALLBACK (clear_history),
NULL);
gtk_widget_show (menu_items);
menu_items = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
menu_items = gtk_menu_item_new_with_mnemonic( _("_Accounts") );
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
@ -563,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()
{
@ -596,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);

View File

@ -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

View File

@ -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();

View File

@ -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>

View File

@ -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 )
{

View File

@ -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 );

View File

@ -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 )
{

View File

@ -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
*/

View File

@ -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 */