~ubuntu-branches/ubuntu/trusty/sflphone/trusty

« back to all changes in this revision

Viewing changes to gnome/src/actions.c

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (4.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20140128182336-jrsv0k9u6cawc068
Tags: 1.3.0-1
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
 
2
 *  Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
3
3
 *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
4
4
 *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
5
5
 *
130
130
    account_t *acc = account_list_get_current();
131
131
    status_tray_icon_online(acc != NULL);
132
132
 
 
133
    static const char * const account_types[] = {
 
134
        N_("(SIP)"),
 
135
        N_("(IAX)")
 
136
    };
 
137
 
133
138
    gchar* msg;
134
139
    if (acc) {
135
 
        msg = g_markup_printf_escaped("%s %s (%s)" ,
136
 
                                      _("Using account"),
 
140
        const guint type_idx = account_is_IAX(acc);
 
141
        msg = g_markup_printf_escaped(_("%s %s"),
137
142
                                      (gchar*) account_lookup(acc, CONFIG_ACCOUNT_ALIAS),
138
 
                                      (gchar*) account_lookup(acc, CONFIG_ACCOUNT_TYPE));
 
143
                                      _(account_types[type_idx]));
139
144
    } else {
140
145
        msg = g_markup_printf_escaped(_("No registered accounts"));
141
146
    }
341
346
    statusbar_update_clock("");
342
347
 
343
348
    // Allow screen saver to start
344
 
    guint nbcall = calllist_get_size(current_calls_tab);
345
 
    if(nbcall == 1)
 
349
    if (calllist_get_size(current_calls_tab) == 1)
346
350
        dbus_screensaver_uninhibit();
347
351
}
348
352
 
352
356
    callable_obj_t *selectedCall = calltab_get_selected_call(active_calltree_tab);
353
357
 
354
358
    // Disable screensaver if the list is empty call
355
 
    guint nbcall = calllist_get_size(current_calls_tab);
356
 
    if(nbcall == 0)
 
359
    if (calllist_get_size(current_calls_tab) == 0)
357
360
        dbus_screensaver_inhibit();
358
361
 
359
362
    if (!selectedCall) {
506
509
    if (!account) {
507
510
        g_warning("Account is NULL");
508
511
    } else if (account_has_autoanswer_on(account)) {
509
 
        calltab_set_selected_call(active_calltree_tab, c);
 
512
        calltab_select_call(active_calltree_tab, c);
510
513
        sflphone_pick_up(client);
511
514
    }
512
515
}
583
586
    if(nbcall == 0)
584
587
        dbus_screensaver_inhibit();
585
588
 
586
 
    callable_obj_t *current_selected_call = calltab_get_selected_call(current_calls_tab);
 
589
    callable_obj_t *selected_call = calllist_empty(current_calls_tab) ? NULL :
 
590
        calltab_get_selected_call(current_calls_tab);
587
591
 
588
 
    if (current_selected_call != NULL) {
589
 
        gchar *confID = dbus_get_conference_id(current_selected_call->_callID);
 
592
    if (selected_call != NULL) {
 
593
        gchar *confID = dbus_get_conference_id(selected_call->_callID);
590
594
        if(g_strcmp0(confID, "") != 0) {
591
595
            sflphone_on_hold();
592
596
        }
593
597
    }
594
598
 
595
599
    // Play a tone when creating a new call
596
 
    if (calllist_get_size(current_calls_tab) == 0)
 
600
    if (calllist_empty(current_calls_tab))
597
601
        dbus_start_tone(TRUE , (current_account_has_new_message()  > 0) ? TONE_WITH_MESSAGE : TONE_WITHOUT_MESSAGE) ;
598
602
 
599
603
    callable_obj_t *c = create_new_call(CALL, CALL_STATE_DIALING, "", "", "", "");
611
615
void
612
616
sflphone_keypad(guint keyval, const gchar * key, SFLPhoneClient *client)
613
617
{
614
 
    callable_obj_t * c = calltab_get_selected_call(current_calls_tab);
 
618
    callable_obj_t * c = calllist_empty(current_calls_tab) ? NULL :
 
619
                         calltab_get_selected_call(current_calls_tab);
615
620
 
616
621
    const gboolean current_is_active_tab = calltab_has_name(active_calltree_tab, CURRENT_CALLS);
617
622
    if (!current_is_active_tab || (current_is_active_tab && !c)) {
744
749
 
745
750
    // Make sure the previously found account is registered, take first one registered elsewhere
746
751
    if (account) {
747
 
        gpointer status = g_hash_table_lookup(account->properties, "Status");
 
752
        const gchar *status = account_lookup(account, CONFIG_ACCOUNT_REGISTRATION_STATUS);
748
753
        if (!utf8_case_equal(status, "REGISTERED")) {
749
754
            // Place the call with the first registered account
750
755
            account = account_list_get_by_state(ACCOUNT_STATE_REGISTERED);
812
817
    dbus_add_main_participant(c->_confID);
813
818
}
814
819
 
815
 
void
 
820
 
 
821
gboolean
816
822
sflphone_rec_call(SFLPhoneClient *client)
817
823
{
 
824
    gboolean result = FALSE;
818
825
    callable_obj_t * selectedCall = calltab_get_selected_call(current_calls_tab);
819
826
    conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls_tab);
820
827
 
821
828
    if (selectedCall) {
822
 
        g_debug("Set record for selected call");
823
 
        dbus_set_record(selectedCall->_callID);
 
829
        result = dbus_toggle_recording(selectedCall->_callID);
824
830
        calltree_update_call(current_calls_tab, selectedCall, client, TRUE);
825
831
    } else if (selectedConf) {
826
 
        g_debug("Set record for selected conf");
827
 
        dbus_set_record(selectedConf->_confID);
 
832
        result = dbus_toggle_recording(selectedConf->_confID);
828
833
 
829
834
        switch (selectedConf->_state) {
830
835
            case CONFERENCE_STATE_ACTIVE_ATTACHED:
851
856
    } else {
852
857
        update_actions(client);
853
858
    }
854
 
}
855
 
 
856
 
void
857
 
sflphone_mute_call()
858
 
{
859
 
    g_debug("%s", __PRETTY_FUNCTION__);
860
 
 
861
 
    toggle_slider_mute_microphone();
 
859
    return result;
862
860
}
863
861
 
864
862
static void