197
209
switch (selectedCall->_state) {
198
210
case CALL_STATE_INCOMING:
199
DEBUG("UIManager: Call State Incoming");
200
// Make the button toolbar clickable
201
gtk_action_set_sensitive(pickUpAction_, TRUE);
202
gtk_action_set_sensitive(hangUpAction_, TRUE);
203
// Replace the dial button with the hangup button
204
g_object_ref(newCallWidget_);
205
remove_from_toolbar(newCallWidget_);
206
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(pickUpWidget_),
208
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(hangUpWidget_),
212
DEBUG("UIManager: Call State Incoming");
213
// Make the button toolbar clickable
214
gtk_action_set_sensitive(pickUpAction_, TRUE);
215
gtk_action_set_sensitive(hangUpAction_, TRUE);
216
// Replace the dial button with the hangup button
217
g_object_ref(newCallWidget_);
218
remove_from_toolbar(newCallWidget_);
220
add_to_toolbar(toolbar_, pickUpWidget_, pos++);
221
add_to_toolbar(toolbar_, hangUpWidget_, pos);
211
224
case CALL_STATE_HOLD:
212
DEBUG("UIManager: Call State Hold");
213
gtk_action_set_sensitive(hangUpAction_, TRUE);
214
gtk_widget_set_sensitive(holdMenu_, TRUE);
215
gtk_widget_set_sensitive(offHoldToolbar_, TRUE);
216
gtk_widget_set_sensitive(newCallWidget_, TRUE);
218
// Replace the hold button with the off-hold button
219
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(hangUpWidget_), 1);
220
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(offHoldToolbar_), 2);
222
if (instant_messaging_enabled) {
223
gtk_action_set_sensitive(imAction_, TRUE);
224
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(imToolbar_), 3);
226
DEBUG("UIManager: Call State Hold");
227
gtk_action_set_sensitive(hangUpAction_, TRUE);
228
gtk_widget_set_sensitive(holdMenu_, TRUE);
229
gtk_widget_set_sensitive(offHoldToolbar_, TRUE);
230
gtk_widget_set_sensitive(newCallWidget_, TRUE);
232
// Replace the hold button with the off-hold button
234
add_to_toolbar(toolbar_, hangUpWidget_, pos++);
235
add_to_toolbar(toolbar_, offHoldToolbar_, pos++);
237
if (instant_messaging_enabled) {
238
gtk_action_set_sensitive(imAction_, TRUE);
239
add_to_toolbar(toolbar_, imToolbar_, pos);
228
244
case CALL_STATE_RINGING:
229
DEBUG("UIManager: Call State Ringing");
230
gtk_action_set_sensitive(pickUpAction_, TRUE);
231
gtk_action_set_sensitive(hangUpAction_, TRUE);
232
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(hangUpWidget_), 1);
246
DEBUG("UIManager: Call State Ringing");
247
gtk_action_set_sensitive(pickUpAction_, TRUE);
248
gtk_action_set_sensitive(hangUpAction_, TRUE);
250
add_to_toolbar(toolbar_, hangUpWidget_, pos);
234
253
case CALL_STATE_DIALING:
235
DEBUG("UIManager: Call State Dialing");
236
gtk_action_set_sensitive(pickUpAction_, TRUE);
238
if (active_calltree_tab == current_calls_tab)
239
gtk_action_set_sensitive(hangUpAction_, TRUE);
241
g_object_ref(newCallWidget_);
242
remove_from_toolbar(newCallWidget_);
243
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(pickUpWidget_), 0);
245
if (active_calltree_tab == current_calls_tab)
246
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(hangUpWidget_), 1);
247
else if (active_calltree_tab == history_tab) {
248
if (selectedCall->_recordfile && strlen(selectedCall->_recordfile) > 0) {
249
if (selectedCall->_record_is_playing)
250
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(stopRecordWidget_), 3);
252
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(playRecordWidget_), 3);
257
case CALL_STATE_CURRENT: {
258
DEBUG("UIManager: Call State Current");
259
gtk_action_set_sensitive(hangUpAction_, TRUE);
261
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(hangUpWidget_), pos++);
262
gtk_widget_set_sensitive(holdMenu_, TRUE);
263
gtk_widget_set_sensitive(holdToolbar_, TRUE);
264
gtk_widget_set_sensitive(transferToolbar_, TRUE);
265
gtk_action_set_sensitive(recordAction_, TRUE);
266
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(holdToolbar_), pos++);
267
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(transferToolbar_), pos++);
268
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(recordWidget_), pos++);
269
g_signal_handler_block(transferToolbar_, transferButtonConnId_);
270
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transferToolbar_), FALSE);
271
g_signal_handler_unblock(transferToolbar_, transferButtonConnId_);
272
g_signal_handler_block(recordWidget_, recordButtonConnId_);
273
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(recordWidget_), FALSE);
274
g_signal_handler_unblock(recordWidget_, recordButtonConnId_);
276
if (instant_messaging_enabled) {
277
gtk_action_set_sensitive(imAction_, TRUE);
278
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(imToolbar_), pos);
284
case CALL_STATE_RECORD: {
285
DEBUG("UIManager: Call State Record");
287
gtk_action_set_sensitive(hangUpAction_, TRUE);
288
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(hangUpWidget_), pos++);
289
gtk_widget_set_sensitive(holdMenu_, TRUE);
290
gtk_widget_set_sensitive(holdToolbar_, TRUE);
291
gtk_widget_set_sensitive(transferToolbar_, TRUE);
292
gtk_action_set_sensitive(recordAction_, TRUE);
293
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(holdToolbar_), pos++);
294
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(transferToolbar_), pos++);
295
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(recordWidget_), pos++);
296
g_signal_handler_block(transferToolbar_, transferButtonConnId_);
297
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transferToolbar_), FALSE);
298
g_signal_handler_unblock(transferToolbar_, transferButtonConnId_);
299
g_signal_handler_block(recordWidget_, recordButtonConnId_);
300
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(recordWidget_), TRUE);
301
g_signal_handler_unblock(recordWidget_, recordButtonConnId_);
303
if (instant_messaging_enabled) {
304
gtk_action_set_sensitive(imAction_, TRUE);
305
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(imToolbar_), pos);
255
DEBUG("UIManager: Call State Dialing");
256
gtk_action_set_sensitive(pickUpAction_, TRUE);
258
if (active_calltree_tab == current_calls_tab)
259
gtk_action_set_sensitive(hangUpAction_, TRUE);
261
g_object_ref(newCallWidget_);
262
remove_from_toolbar(newCallWidget_);
264
add_to_toolbar(toolbar_, pickUpWidget_, pos++);
266
if (active_calltree_tab == current_calls_tab)
267
add_to_toolbar(toolbar_, hangUpWidget_, pos++);
268
else if (active_calltree_tab == history_tab) {
269
if (is_non_empty(selectedCall->_recordfile)) {
270
if (selectedCall->_record_is_playing)
271
add_to_toolbar(toolbar_, stopRecordWidget_, pos);
273
add_to_toolbar(toolbar_, playRecordWidget_, pos);
278
case CALL_STATE_CURRENT:
280
DEBUG("UIManager: Call State Current");
281
gtk_action_set_sensitive(hangUpAction_, TRUE);
283
add_to_toolbar(toolbar_, hangUpWidget_, pos++);
284
gtk_widget_set_sensitive(holdMenu_, TRUE);
285
gtk_widget_set_sensitive(holdToolbar_, TRUE);
286
gtk_widget_set_sensitive(transferToolbar_, TRUE);
287
gtk_action_set_sensitive(recordAction_, TRUE);
288
add_to_toolbar(toolbar_, holdToolbar_, pos++);
289
add_to_toolbar(toolbar_, transferToolbar_, pos++);
290
add_to_toolbar(toolbar_, recordWidget_, pos++);
291
g_signal_handler_block(transferToolbar_, transferButtonConnId_);
292
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transferToolbar_), FALSE);
293
g_signal_handler_unblock(transferToolbar_, transferButtonConnId_);
294
g_signal_handler_block(recordWidget_, recordButtonConnId_);
295
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(recordWidget_), FALSE);
296
g_signal_handler_unblock(recordWidget_, recordButtonConnId_);
298
if (instant_messaging_enabled) {
299
gtk_action_set_sensitive(imAction_, TRUE);
300
add_to_toolbar(toolbar_, imToolbar_, pos);
306
case CALL_STATE_RECORD:
308
DEBUG("UIManager: Call State Record");
310
gtk_action_set_sensitive(hangUpAction_, TRUE);
311
add_to_toolbar(toolbar_, hangUpWidget_, pos++);
312
gtk_widget_set_sensitive(holdMenu_, TRUE);
313
gtk_widget_set_sensitive(holdToolbar_, TRUE);
314
gtk_widget_set_sensitive(transferToolbar_, TRUE);
315
gtk_action_set_sensitive(recordAction_, TRUE);
316
add_to_toolbar(toolbar_, holdToolbar_, pos++);
317
add_to_toolbar(toolbar_, transferToolbar_, pos++);
318
add_to_toolbar(toolbar_, recordWidget_, pos++);
319
g_signal_handler_block(transferToolbar_, transferButtonConnId_);
320
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transferToolbar_), FALSE);
321
g_signal_handler_unblock(transferToolbar_, transferButtonConnId_);
322
g_signal_handler_block(recordWidget_, recordButtonConnId_);
323
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(recordWidget_), TRUE);
324
g_signal_handler_unblock(recordWidget_, recordButtonConnId_);
326
if (instant_messaging_enabled) {
327
gtk_action_set_sensitive(imAction_, TRUE);
328
add_to_toolbar(toolbar_, imToolbar_, pos);
310
333
case CALL_STATE_BUSY:
311
334
case CALL_STATE_FAILURE:
312
DEBUG("UIManager: Call State Busy/Failure");
313
gtk_action_set_sensitive(hangUpAction_, TRUE);
314
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(hangUpWidget_), 1);
337
DEBUG("UIManager: Call State Busy/Failure");
338
gtk_action_set_sensitive(hangUpAction_, TRUE);
339
add_to_toolbar(toolbar_, hangUpWidget_, pos);
316
342
case CALL_STATE_TRANSFER:
317
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(hangUpWidget_), 1);
318
gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(transferToolbar_), 2);
319
g_signal_handler_block(transferToolbar_, transferButtonConnId_);
320
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transferToolbar_), TRUE);
321
g_signal_handler_unblock(transferToolbar_, transferButtonConnId_);
322
gtk_action_set_sensitive(hangUpAction_, TRUE);
323
gtk_widget_set_sensitive(holdMenu_, TRUE);
324
gtk_widget_set_sensitive(holdToolbar_, TRUE);
325
gtk_widget_set_sensitive(transferToolbar_, TRUE);
345
add_to_toolbar(toolbar_, hangUpWidget_, pos++);
346
add_to_toolbar(toolbar_, transferToolbar_, pos);
347
g_signal_handler_block(transferToolbar_, transferButtonConnId_);
348
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transferToolbar_), TRUE);
349
g_signal_handler_unblock(transferToolbar_, transferButtonConnId_);
350
gtk_action_set_sensitive(hangUpAction_, TRUE);
351
gtk_widget_set_sensitive(holdMenu_, TRUE);
352
gtk_widget_set_sensitive(holdToolbar_, TRUE);
353
gtk_widget_set_sensitive(transferToolbar_, TRUE);
328
357
ERROR("UIMAnager: Error: Unknown state in action update!");