~noskcaj/ubuntu/saucy/sflphone/merge-1.2.3-2

« back to all changes in this revision

Viewing changes to gnome/src/contacts/calltree.c

  • Committer: Package Import Robot
  • Author(s): Francois Marier
  • Date: 2012-02-18 21:47:09 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120218214709-6362d71gqdsdkrj5
Tags: 1.0.2-1
* New upstream release
  - remove logging patch (applied upstream)
  - update s390 patch since it was partially applied upstream
* Include the Evolution plugin as a separate binary package

* Fix compilation issues on SH4 (closes: #658987)
* Merge Ubuntu's binutils-gold linking fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "calllist.h"
34
34
#include "calltree.h"
35
35
#include <stdlib.h>
36
 
#include <glib/gprintf.h>
37
36
 
38
37
#include "eel-gconf-extensions.h"
39
38
#include "unused.h"
211
210
                }
212
211
            } else {
213
212
                // If history or contact: double click action places a new call
214
 
                callable_obj_t* new_call = create_new_call(CALL, CALL_STATE_DIALING, "", selectedCall->_accountID, selectedCall->_peer_name, selectedCall->_peer_number);
 
213
                callable_obj_t* new_call = create_new_call(CALL, CALL_STATE_DIALING, "", selectedCall->_accountID, selectedCall->_display_name, selectedCall->_peer_number);
215
214
 
216
215
                calllist_add_call(current_calls_tab, new_call);
217
216
                calltree_add_call(current_calls_tab, new_call, NULL);
332
331
    return TRUE;
333
332
}
334
333
 
 
334
static gchar *clean_display_number(gchar *name)
 
335
{
 
336
    const gchar SIP_PREFIX[] = "<sip:";
 
337
    const gchar SIPS_PREFIX[] = "<sips:";
 
338
    if (g_str_has_prefix(name, SIP_PREFIX))
 
339
        name += (sizeof(SIP_PREFIX) - 1);
 
340
    else if (g_str_has_prefix(name, SIPS_PREFIX))
 
341
        name += (sizeof(SIPS_PREFIX) - 1);
 
342
    return name;
 
343
}
335
344
 
336
345
static gchar *
337
346
calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, const gchar *const audio_codec)
339
348
    gchar display_number[strlen(c->_peer_number) + 1];
340
349
    strcpy(display_number, c->_peer_number);
341
350
 
342
 
    if (c->_type != CALL || c->_history_state != OUTGOING) {
 
351
    if (c->_type != CALL || !call_was_outgoing(c)) {
343
352
        // Get the hostname for this call (NULL if not existent)
344
353
        gchar * hostname = g_strrstr(c->_peer_number, "@");
345
354
 
349
358
    }
350
359
 
351
360
    // Different display depending on type
352
 
    const gchar *name, *details = NULL;
 
361
    gchar *name, *details = NULL;
353
362
 
354
 
    if (*c->_peer_name) {
355
 
        name = c->_peer_name;
 
363
    if (*c->_display_name) {
 
364
        name = c->_display_name;
356
365
        details = display_number;
357
366
    } else {
358
367
        name = display_number;
 
368
        name = clean_display_number(name);
359
369
        details = "";
360
370
    }
361
371
 
564
574
    calltree_remove_call_recursive(tab, c, NULL);
565
575
}
566
576
 
 
577
GdkPixbuf *history_state_to_pixbuf(const gchar *history_state)
 
578
{
 
579
    gchar *svg_filename = g_strconcat(ICONS_DIR, "/", history_state, ".svg", NULL);
 
580
    GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(svg_filename, NULL);
 
581
    g_free(svg_filename);
 
582
    return pixbuf;
 
583
}
 
584
 
567
585
static void
568
586
calltree_update_call_recursive(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
569
587
{
689
707
                }
690
708
 
691
709
            } else if (tab == history_tab) {
692
 
                if (parent == NULL) {
693
 
                    // parent is NULL this is not a conference participant
694
 
                    switch (c->_history_state) {
695
 
                        case INCOMING:
696
 
                            pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/incoming.svg", NULL);
697
 
                            break;
698
 
                        case OUTGOING:
699
 
                            pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/outgoing.svg", NULL);
700
 
                            break;
701
 
                        case MISSED:
702
 
                            pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/missed.svg", NULL);
703
 
                            break;
704
 
                        default:
705
 
                            WARN("History - Should not happen!");
706
 
                    }
707
 
                } else // parent is not NULL this is a conference participant
 
710
                // parent is NULL this is not a conference participant
 
711
                if (parent == NULL)
 
712
                    pixbuf = history_state_to_pixbuf(c->_history_state);
 
713
                else // parent is not NULL this is a conference participant
708
714
                    pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/current.svg", NULL);
709
715
 
710
716
                g_free(description);
716
722
                g_free(duration);
717
723
 
718
724
                gchar *old_description = description;
719
 
                description = g_strconcat(old_description , full_duration, NULL);
 
725
                description = g_strconcat(old_description, full_duration, NULL);
720
726
                g_free(full_duration);
721
727
                g_free(old_description);
722
728
            }
742
748
 
743
749
void calltree_update_call(calltab_t* tab, callable_obj_t * c)
744
750
{
745
 
    return calltree_update_call_recursive(tab, c, NULL);
 
751
    calltree_update_call_recursive(tab, c, NULL);
746
752
}
747
753
 
748
754
void calltree_add_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
856
862
    GtkTreeIter iter;
857
863
    gtk_tree_store_prepend(history_tab->store, &iter, NULL);
858
864
 
859
 
    GdkPixbuf *pixbuf = NULL;
860
 
 
861
 
    switch (c->_history_state) {
862
 
        case INCOMING:
863
 
            pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/incoming.svg", NULL);
864
 
            break;
865
 
        case OUTGOING:
866
 
            pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/outgoing.svg", NULL);
867
 
            break;
868
 
        case MISSED:
869
 
            pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/missed.svg", NULL);
870
 
            break;
871
 
        default:
872
 
            WARN("History - Should not happen!");
873
 
    }
 
865
    GdkPixbuf *pixbuf = history_state_to_pixbuf(c->_history_state);
874
866
 
875
867
    gchar *date = get_formatted_start_timestamp(c->_time_start);
876
868
    gchar *duration = get_call_duration(c);
1526
1518
        dbus_join_participant(calltree_selected_call->_callID,
1527
1519
                              calltree_dragged_call->_callID);
1528
1520
    else if (g_strcmp0(string, SFL_TRANSFER_CALL) == 0) {
1529
 
        DEBUG("Calltree: Transfering call %s, to %s",
 
1521
        DEBUG("Calltree: Transferring call %s, to %s",
1530
1522
              calltree_selected_call->_peer_number,
1531
1523
              calltree_dragged_call->_peer_number);
1532
1524
        dbus_attended_transfer(calltree_selected_call, calltree_dragged_call);