Commit bf07b976 authored by Emmanuel Milou's avatar Emmanuel Milou

[#1976] Use xml to describe toolbars - Add a naviguation toolbar

parent 2b49e4a4
......@@ -17,7 +17,6 @@ sflphone_client_gnome_SOURCES = \
sflnotify.c \
mainwindow.c \
dialpad.c \
toolbar.c \
callable_obj.c \
conference_obj.c \
actions.c \
......@@ -29,7 +28,7 @@ sflphone_client_gnome_SOURCES = \
noinst_HEADERS = actions.h sflnotify.h mainwindow.h dialpad.h codeclist.h \
reqaccount.h errors.h sflphone_const.h uimanager.h \
accountlist.h sliders.h statusicon.h callable_obj.h conference_obj.h toolbar.h
accountlist.h sliders.h statusicon.h callable_obj.h conference_obj.h
sflphone_client_gnome_LDADD = $(DEPS_LIBS) $(NOTIFY_LIBS) $(SFLPHONEGTK_LIBS) $(LIBSEXY_LIBS) $(LOG4C)
......
......@@ -22,7 +22,6 @@
#include <dbus/dbus.h>
#include <statusicon.h>
#include <contacts/searchbar.h>
#include <toolbar.h>
#include <gtk/gtk.h>
#include <string.h>
......@@ -124,7 +123,7 @@ sflphone_hold (callable_obj_t * c )
{
c->_state = CALL_STATE_HOLD;
calltree_update_call(current_calls, c, NULL);
update_menus();
update_actions();
}
void
......@@ -132,7 +131,7 @@ sflphone_ringing(callable_obj_t * c )
{
c->_state = CALL_STATE_RINGING;
calltree_update_call(current_calls, c, NULL);
update_menus();
update_actions();
}
void
......@@ -142,7 +141,7 @@ sflphone_hung_up( callable_obj_t * c)
calltree_remove_call(current_calls, c, NULL);
c->_state = CALL_STATE_DIALING;
call_remove_all_errors(c);
update_menus();
update_actions();
#if GTK_CHECK_VERSION(2,10,0)
status_tray_icon_blink( FALSE );
#endif
......@@ -258,7 +257,7 @@ sflphone_fill_account_list(gboolean toolbarInitialized)
// Prevent update being called when toolbar is not yet initialized
if(toolbarInitialized)
toolbar_update_buttons();
update_actions ();
}
gboolean sflphone_init()
......@@ -467,7 +466,7 @@ sflphone_fail( callable_obj_t * c )
{
c->_state = CALL_STATE_FAILURE;
calltree_update_call(current_calls, c, NULL);
update_menus();
update_actions();
}
void
......@@ -475,7 +474,7 @@ sflphone_busy( callable_obj_t * c )
{
c->_state = CALL_STATE_BUSY;
calltree_update_call(current_calls, c, NULL);
update_menus();
update_actions();
}
void
......@@ -485,7 +484,7 @@ sflphone_current( callable_obj_t * c )
set_timestamp (&c->_time_start);
c->_state = CALL_STATE_CURRENT;
calltree_update_call(current_calls, c, NULL);
update_menus();
update_actions();
}
void
......@@ -495,7 +494,7 @@ sflphone_record( callable_obj_t * c )
set_timestamp (&c->_time_start);
c->_state = CALL_STATE_RECORD;
calltree_update_call(current_calls, c, NULL);
update_menus();
update_actions();
}
void
......@@ -507,9 +506,9 @@ sflphone_set_transfert()
c->_state = CALL_STATE_TRANSFERT;
c->_trsft_to = g_strdup("");
calltree_update_call(current_calls, c, NULL);
update_menus();
update_actions();
}
toolbar_update_buttons();
update_actions();
}
void
......@@ -521,9 +520,9 @@ sflphone_unset_transfert()
c->_state = CALL_STATE_CURRENT;
c->_trsft_to = g_strdup("");
calltree_update_call(current_calls, c, NULL);
update_menus();
update_actions();
}
toolbar_update_buttons();
update_actions();
}
void
......@@ -539,7 +538,7 @@ sflphone_incoming_call (callable_obj_t * c)
calllist_add ( current_calls, c );
calllist_add( history, c );
calltree_add_call( current_calls, c, NULL);
update_menus();
update_actions();
calltree_display (current_calls);
}
......@@ -641,7 +640,7 @@ sflphone_new_call()
calllist_add (current_calls,c);
calltree_add_call (current_calls, c, NULL);
update_menus();
update_actions();
return c;
}
......@@ -1044,7 +1043,7 @@ sflphone_rec_call()
}
}
calltree_update_call(current_calls, selectedCall, NULL);
update_menus();
update_actions();
// gchar* codname = sflphone_get_current_codec_name();
// DEBUG("sflphone_get_current_codec_name: %s",codname);
......@@ -1225,7 +1224,7 @@ sflphone_srtp_on( callable_obj_t * c)
c->_srtp_state = SRTP_STATE_SAS_UNCONFIRMED;
calltree_update_call(current_calls, c, NULL);
update_menus();
update_actions();
}
void
......@@ -1233,7 +1232,7 @@ sflphone_srtp_off( callable_obj_t * c )
{
c->_srtp_state = SRTP_STATE_UNLOCKED;
calltree_update_call(current_calls, c, NULL);
update_menus();
update_actions();
}
void
......@@ -1249,7 +1248,7 @@ sflphone_srtp_show_sas( callable_obj_t * c, const gchar* sas, const gboolean ver
c->_srtp_state = SRTP_STATE_SAS_UNCONFIRMED;
}
calltree_update_call(current_calls, c, NULL);
update_menus();
update_actions();
}
void
......@@ -1297,5 +1296,5 @@ sflphone_call_state_changed( callable_obj_t * c, const gchar * description, cons
}
calltree_update_call(current_calls, c, NULL);
update_menus();
update_actions();
}
......@@ -26,7 +26,6 @@
#include <accountconfigdialog.h>
#include <actions.h>
#include <config.h>
#include <toolbar.h>
#include <dbus/dbus.h>
#include <mainwindow.h>
#include <audioconf.h>
......
......@@ -19,7 +19,6 @@
#include <addressbook.h>
#include <searchbar.h>
#include <toolbar.h>
#include <string.h>
#include <addressbook-config.h>
......@@ -109,7 +108,7 @@ addressbook_config_books()
}
// Update buttons
toolbar_update_buttons();
update_actions ();
}
/**
......
......@@ -24,7 +24,6 @@
#include <glib/gprintf.h>
#include <calllist.h>
#include <conferencelist.h>
#include <toolbar.h>
#include <mainwindow.h>
#include <history.h>
......@@ -145,7 +144,7 @@ call_selected_cb(GtkTreeSelection *sel, void* data UNUSED )
// sflphone_fill_conference_list();
g_value_unset(&val);
toolbar_update_buttons();
update_actions();
}
......@@ -494,7 +493,7 @@ calltree_remove_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
callable_obj_t * selectedCall = calltab_get_selected_call(tab);
if(selectedCall == c)
calltab_select_call(tab, NULL);
toolbar_update_buttons();
update_actions();
}
void
......@@ -666,7 +665,7 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
}
}
toolbar_update_buttons();
update_actions();
}
......@@ -1056,7 +1055,7 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
gtk_tree_view_expand_row(GTK_TREE_VIEW(tab->view), path, FALSE);
toolbar_update_buttons();
update_actions();
}
......@@ -1140,7 +1139,7 @@ void calltree_remove_conference (calltab_t* tab, const conference_obj_t* conf, G
// if(selectedCall == c)
// calltab_select_call(tab, NULL);
toolbar_update_buttons();
update_actions();
}
......@@ -1159,12 +1158,13 @@ void calltree_display (calltab_t *tab) {
DEBUG ("display main tab");
/*
if (active_calltree==contacts) {
gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)contactButton, FALSE);
} else {
gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)historyButton, FALSE);
}
*/
}
/* case 2: we want to display the history */
......@@ -1173,10 +1173,10 @@ void calltree_display (calltab_t *tab) {
DEBUG ("display history tab");
if (active_calltree==contacts) {
gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)contactButton, FALSE);
//gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)contactButton, FALSE);
}
gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)historyButton, TRUE);
//gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)historyButton, TRUE);
}
else if (tab==contacts) {
......@@ -1184,10 +1184,10 @@ void calltree_display (calltab_t *tab) {
DEBUG ("display contact tab");
if (active_calltree==history) {
gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)historyButton, FALSE);
//gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)historyButton, FALSE);
}
gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)contactButton, TRUE);
//gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)contactButton, TRUE);
}
else
......@@ -1201,7 +1201,7 @@ void calltree_display (calltab_t *tab) {
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_calltree->view));
DEBUG("Emit signal changed from calltree_display");
g_signal_emit_by_name(sel, "changed");
toolbar_update_buttons();
update_actions();
}
......
......@@ -212,7 +212,7 @@ call_state_cb (DBusGProxy *proxy UNUSED,
calllist_add (current_calls, new_call);
calllist_add (history, new_call);
calltree_add_call (current_calls, new_call, NULL);
update_menus ();
update_actions ();
calltree_display (current_calls);
//sflphone_incoming_call (new_call);
......
......@@ -19,7 +19,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <toolbar.h>
#include <config.h>
#include <actions.h>
#include <calltree.h>
......@@ -201,7 +200,7 @@ create_main_window ()
widget = create_menus (ui_manager);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
widget = create_toolbar();
widget = create_toolbar_actions (ui_manager);
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*/);
......@@ -214,6 +213,10 @@ create_main_window ()
gtk_box_pack_start(GTK_BOX(subvbox),
GTK_WIDGET(embedded_error_notebook), FALSE, FALSE, 0);
widget = create_toolbar_windows (ui_manager);
gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_ICONS);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
if(SHOW_VOLUME){
speaker_control = create_slider("speaker");
gtk_box_pack_end (GTK_BOX (subvbox), speaker_control, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
......
......@@ -26,14 +26,7 @@ is_inserted( GtkWidget* button )
return ( GTK_WIDGET(button)->parent == GTK_WIDGET( toolbar ) );
}
/**
* Static rec_button
*/
static void
rec_button( GtkWidget *widget UNUSED, gpointer data UNUSED)
{
sflphone_rec_call();
}
static void
call_mailbox( GtkWidget* widget UNUSED, gpointer data UNUSED)
......@@ -53,7 +46,7 @@ call_mailbox( GtkWidget* widget UNUSED, gpointer data UNUSED)
DEBUG("TO : %s" , mailbox_call->_peer_number);
calllist_add( current_calls , mailbox_call );
calltree_add_call( current_calls, mailbox_call, NULL);
update_menus();
update_actions();
sflphone_place_call( mailbox_call );
calltree_display(current_calls);
}
......@@ -96,62 +89,9 @@ call_button( GtkWidget *widget UNUSED, gpointer data UNUSED)
}
}
/**
* Hang up the line
*/
static void
hang_up( GtkWidget *widget UNUSED, gpointer data UNUSED)
{
sflphone_hang_up();
}
/**
* Hold the line
*/
static void
hold( GtkWidget *widget UNUSED, gpointer data UNUSED)
{
sflphone_on_hold();
}
/**
* Transfert the line
*/
static void
transfert (GtkToggleToolButton *toggle_tool_button,
gpointer user_data UNUSED )
{
gboolean up = gtk_toggle_tool_button_get_active(toggle_tool_button);
if(up)
{
sflphone_set_transfert();
}
else
{
sflphone_unset_transfert();
}
}
/**
* Unhold call
*/
static void
unhold( GtkWidget *widget UNUSED, gpointer data UNUSED)
{
sflphone_off_hold();
}
static void toggle_button_cb (GtkToggleToolButton *widget, gpointer user_data)
{
calltab_t * to_switch;
gboolean toggle;
to_switch = (calltab_t*) user_data;
toggle = gtk_toggle_tool_button_get_active (widget);
(toggle)? calltree_display (to_switch) : calltree_display (current_calls);
}
/*
GtkWidget *create_toolbar ()
{
GtkWidget *ret;
......@@ -269,143 +209,4 @@ GtkWidget *create_toolbar ()
return ret;
}
void
toolbar_update_buttons ()
{
gtk_widget_set_sensitive( GTK_WIDGET(callButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(holdButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(mailboxButton) , FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(unholdButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(recButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(contactButton), FALSE);
g_object_ref (contactButton);
if( is_inserted( GTK_WIDGET(contactButton) ) ) gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET (contactButton));
g_object_ref(holdButton);
g_object_ref(unholdButton);
if( is_inserted( GTK_WIDGET(holdButton) ) ) gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(holdButton));
if( is_inserted( GTK_WIDGET(unholdButton) ) ) gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(unholdButton));
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), holdButton, 3);
g_object_ref(callButton);
g_object_ref(pickupButton);
if( is_inserted( GTK_WIDGET(callButton) ) ) gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton));
if( is_inserted( GTK_WIDGET(pickupButton) ) ) gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(pickupButton));
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), callButton, 0);
// If addressbook support has been enabled and all addressbooks are loaded, display the icon
if (addressbook_is_enabled () && addressbook_is_ready()) {
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), contactButton, 5);
// Make the icon clickable only if at least one address book is active
if (addressbook_is_active ()) gtk_widget_set_sensitive( GTK_WIDGET(contactButton), TRUE);
}
gtk_signal_handler_block(GTK_OBJECT(transfertButton),transfertButtonConnId);
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transfertButton), FALSE);
gtk_signal_handler_unblock(transfertButton, transfertButtonConnId);
callable_obj_t * selectedCall = calltab_get_selected_call(active_calltree);
conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree);
if (selectedCall)
{
switch(selectedCall->_state)
{
case CALL_STATE_INCOMING:
gtk_widget_set_sensitive( GTK_WIDGET(pickupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
g_object_ref(callButton);
gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton));
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), pickupButton, 0);
break;
case CALL_STATE_HOLD:
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(unholdButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
g_object_ref(holdButton);
gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(holdButton));
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), unholdButton, 3);
break;
case CALL_STATE_RINGING:
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
break;
case CALL_STATE_DIALING:
if( active_calltree == current_calls ) gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(pickupButton), TRUE);
g_object_ref(callButton);
gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton));
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), pickupButton, 0);
break;
case CALL_STATE_CURRENT:
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(recButton), TRUE);
break;
case CALL_STATE_BUSY:
case CALL_STATE_FAILURE:
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
break;
case CALL_STATE_TRANSFERT:
gtk_signal_handler_block(GTK_OBJECT(transfertButton),transfertButtonConnId);
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transfertButton), TRUE);
gtk_signal_handler_unblock(transfertButton, transfertButtonConnId);
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE);
break;
case CALL_STATE_RECORD:
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(recButton), TRUE);
break;
default:
// Fix bug #1145
// Actually it could happen when sflphone_fill_account_list()
// call this function and no "call" is selected
// WARN("Toolbar update - Should not happen!");
break;
}
}
else if(selectedConf)
{
switch(selectedConf->_state)
{
case CONFERENCE_STATE_ACTIVE_ATACHED:
gtk_widget_set_sensitive( GTK_WIDGET(recButton), FALSE);
break;
case CONFERENCE_STATE_ACTIVE_DETACHED:
gtk_widget_set_sensitive( GTK_WIDGET(recButton), FALSE);
break;
case CONFERENCE_STATE_RECORD:
gtk_widget_set_sensitive( GTK_WIDGET(recButton), FALSE);
break;
case CONFERENCE_STATE_HOLD:
gtk_widget_set_sensitive( GTK_WIDGET(recButton), FALSE);
break;
default:
break;
}
}
else
{
if( account_list_get_size() > 0 )
{
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE );
if (account_list_current_account_has_mailbox ())
gtk_widget_set_sensitive( GTK_WIDGET(mailboxButton), TRUE );
}
else
{
gtk_widget_set_sensitive( GTK_WIDGET(callButton), FALSE);
}
}
}
*/
......@@ -6,7 +6,7 @@
<separator/>
<menuitem action="PickUp"/>
<menuitem action="HangUp"/>
<menuitem action="OnHold"/>
<menuitem name="OnHoldMenu" action="OnHold"/>
<menuitem action="Record"/>
<separator/>
<menuitem action="AccountAssistant"/>
......@@ -26,8 +26,14 @@
</menu>
<menu name="ViewMenu" action="View">
<menuitem action="Toolbar"/>
<separator/>
<menuitem action="Dialpad"/>
<menuitem action="VolumeControls"/>
<separator/>
<menuitem action="CallWindow"/>
<menuitem action="History"/>
<menuitem action="Addressbook"/>
</menu>
<menu name="HelpMenu" action="Help">
......@@ -35,5 +41,22 @@
<menuitem action="About"/>
</menu>
</menubar>
</menubar>
<toolbar name="ToolbarActions">
<toolitem action="NewCall"/>
<toolitem action="PickUp"/>
<toolitem action="HangUp"/>
<toolitem name="TransferToolbar" action="Transfer"/>
<toolitem name="OnHoldToolbar" action="OnHold"/>
<separator/>
<toolitem action="Voicemail"/>
</toolbar>
<toolbar name="ToolbarWindows">
<toolitem action="CallWindow"/>
<toolitem action="History"/>
<toolitem action="Addressbook"/>
</toolbar>
</ui>
This diff is collapsed.
......@@ -22,6 +22,9 @@
G_BEGIN_DECLS
guint transfertButtonConnId; //The button toggled signal connection ID