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

« back to all changes in this revision

Viewing changes to gnome/src/config/videoconf.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: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
4
4
 *
5
5
 *  This program is free software; you can redistribute it and/or modify
48
48
static GtkWidget *v4l2_hbox;
49
49
static GtkWidget *v4l2_nodev;
50
50
 
51
 
static GtkWidget *preview_button;
 
51
static GtkWidget *camera_button;
52
52
 
53
53
static GtkWidget *codecTreeView; // View used instead of store to get access to selection
54
54
static GtkWidget *codecMoveUpButton;
95
95
    dbus_set_is_always_recording(enabled);
96
96
}
97
97
 
98
 
static const gchar *const PREVIEW_START_STR = "_Start";
99
 
static const gchar *const PREVIEW_STOP_STR = "_Stop";
 
98
static const gchar *const CAMERA_START_STR = "_Start";
 
99
static const gchar *const CAMERA_STOP_STR = "_Stop";
100
100
 
101
101
static void
102
 
preview_button_toggled(GtkButton *button, G_GNUC_UNUSED gpointer data)
 
102
camera_button_toggled(GtkButton *button, G_GNUC_UNUSED gpointer data)
103
103
{
104
 
    preview_button = GTK_WIDGET(button);
 
104
    camera_button = GTK_WIDGET(button);
105
105
    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
106
 
        dbus_start_video_preview();
 
106
        dbus_start_video_camera();
107
107
    else
108
 
        dbus_stop_video_preview();
109
 
 
110
 
    update_preview_button_label();
111
 
}
112
 
 
113
 
void
114
 
set_preview_button_sensitivity(gboolean sensitive)
115
 
{
116
 
    if (!preview_button || !GTK_IS_WIDGET(preview_button))
117
 
        return;
118
 
    g_debug("%ssetting preview button", sensitive ? "" : "Un");
119
 
    gtk_widget_set_sensitive(GTK_WIDGET(preview_button), sensitive);
120
 
}
121
 
 
122
 
void
123
 
update_preview_button_label()
124
 
{
125
 
    if (!preview_button || !GTK_IS_WIDGET(preview_button))
126
 
        return;
127
 
 
128
 
    GtkToggleButton *button = GTK_TOGGLE_BUTTON(preview_button);
129
 
    if (dbus_has_video_preview_started()) {
 
108
        dbus_stop_video_camera();
 
109
 
 
110
    update_camera_button_label();
 
111
}
 
112
 
 
113
void
 
114
set_camera_button_sensitivity(gboolean sensitive)
 
115
{
 
116
    if (!camera_button || !GTK_IS_WIDGET(camera_button))
 
117
        return;
 
118
    g_debug("%ssetting camera button", sensitive ? "" : "Un");
 
119
    gtk_widget_set_sensitive(GTK_WIDGET(camera_button), sensitive);
 
120
}
 
121
 
 
122
void
 
123
update_camera_button_label()
 
124
{
 
125
    if (!camera_button || !GTK_IS_WIDGET(camera_button))
 
126
        return;
 
127
 
 
128
    GtkToggleButton *button = GTK_TOGGLE_BUTTON(camera_button);
 
129
    if (dbus_has_video_camera_started()) {
130
130
        /* We call g_object_set to avoid triggering the "toggled" signal */
131
 
        gtk_button_set_label(GTK_BUTTON(button), _(PREVIEW_STOP_STR));
 
131
        gtk_button_set_label(GTK_BUTTON(button), _(CAMERA_STOP_STR));
132
132
        g_object_set(button, "active", TRUE, NULL);
133
133
    } else {
134
 
        gtk_button_set_label(GTK_BUTTON(button), _(PREVIEW_START_STR));
 
134
        gtk_button_set_label(GTK_BUTTON(button), _(CAMERA_START_STR));
135
135
        g_object_set(button, "active", FALSE, NULL);
136
136
    }
137
137
}
605
605
        if (!rate || !*rate || set_combo_index_from_str(GTK_COMBO_BOX(v4l2Rate), rate, c)) {
606
606
            // if setting is invalid, choose first entry
607
607
            gtk_combo_box_set_active(GTK_COMBO_BOX(v4l2Rate), 0);
608
 
            dbus_set_active_video_device_rate(get_active_text(GTK_COMBO_BOX(v4l2Rate)));
 
608
            gchar *selected = get_active_text(GTK_COMBO_BOX(v4l2Rate));
 
609
            if (selected) {
 
610
                dbus_set_active_video_device_rate(selected);
 
611
                g_free(selected);
 
612
            }
609
613
        }
610
614
        g_free(rate);
611
615
    } else
658
662
        if (!size || !*size || set_combo_index_from_str(GTK_COMBO_BOX(v4l2Size), size, c)) {
659
663
            // if setting is invalid, choose first entry
660
664
            gtk_combo_box_set_active(GTK_COMBO_BOX(v4l2Size), 0);
661
 
            dbus_set_active_video_device_size(get_active_text(GTK_COMBO_BOX(v4l2Size)));
 
665
            gchar *selected = get_active_text(GTK_COMBO_BOX(v4l2Size));
 
666
            if (selected) {
 
667
                dbus_set_active_video_device_size(selected);
 
668
                g_free(selected);
 
669
            }
662
670
        }
663
671
        g_free(size);
664
672
    } else
710
718
        if (!channel || !*channel || set_combo_index_from_str(GTK_COMBO_BOX(v4l2Channel), channel, c)) {
711
719
            // if setting is invalid, choose first entry
712
720
            gtk_combo_box_set_active(GTK_COMBO_BOX(v4l2Channel), 0);
713
 
            dbus_set_active_video_device_channel(get_active_text(GTK_COMBO_BOX(v4l2Channel)));
 
721
            gchar *selected = get_active_text(GTK_COMBO_BOX(v4l2Channel));
 
722
            if (selected) {
 
723
                dbus_set_active_video_device_channel(selected);
 
724
                g_free(selected);
 
725
            }
714
726
        }
715
727
        g_free(channel);
716
728
    } else
757
769
        if (!dev || !*dev || set_combo_index_from_str(GTK_COMBO_BOX(v4l2Device), dev, c)) {
758
770
            // if setting is invalid, choose first entry
759
771
            gtk_combo_box_set_active(GTK_COMBO_BOX(v4l2Device), 0);
760
 
            dbus_set_active_video_device(get_active_text(GTK_COMBO_BOX(v4l2Device)));
 
772
            gchar *selected = get_active_text(GTK_COMBO_BOX(v4l2Device));
 
773
            if (selected) {
 
774
                dbus_set_active_video_device(selected);
 
775
                g_free(selected);
 
776
            }
761
777
        }
762
778
        g_free(dev);
763
779
        return TRUE;
785
801
    if (preferences_dialog_fill_video_input_device_list()) {
786
802
        gtk_widget_show_all(v4l2_hbox);
787
803
        gtk_widget_hide(v4l2_nodev);
788
 
        gtk_widget_set_sensitive(preview_button, TRUE);
 
804
        gtk_widget_set_sensitive(camera_button, TRUE);
789
805
    } else if (GTK_IS_WIDGET(v4l2_hbox)) {
790
806
        gtk_widget_hide(v4l2_hbox);
791
807
        gtk_widget_show(v4l2_nodev);
792
 
        gtk_widget_set_sensitive(preview_button, FALSE);
 
808
        gtk_widget_set_sensitive(camera_button, FALSE);
793
809
    }
794
810
}
795
811
 
894
910
    GtkWidget *v4l2box = v4l2_box();
895
911
    gtk_grid_attach(GTK_GRID(grid), v4l2box, 0, 1, 1, 1);
896
912
 
897
 
    gnome_main_section_new_with_grid(_("Preview"), &frame, &grid);
 
913
    gnome_main_section_new_with_grid(_("Camera"), &frame, &grid);
898
914
    gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
899
915
 
900
 
    const gboolean started = dbus_has_video_preview_started();
 
916
    const gboolean started = dbus_has_video_camera_started();
901
917
 
902
 
    preview_button = gtk_toggle_button_new_with_mnemonic(started ? _(PREVIEW_STOP_STR) : _(PREVIEW_START_STR));
903
 
    gtk_widget_set_size_request(preview_button, 80, 30);
904
 
    gtk_grid_attach(GTK_GRID(grid), preview_button, 0, 0, 1, 1);
905
 
    gtk_widget_show(GTK_WIDGET(preview_button));
 
918
    camera_button = gtk_toggle_button_new_with_mnemonic(started ? _(CAMERA_STOP_STR) : _(CAMERA_START_STR));
 
919
    gtk_widget_set_size_request(camera_button, 80, 30);
 
920
    gtk_grid_attach(GTK_GRID(grid), camera_button, 0, 0, 1, 1);
 
921
    gtk_widget_show(GTK_WIDGET(camera_button));
906
922
    if (started)
907
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(preview_button), TRUE);
908
 
    g_signal_connect(G_OBJECT(preview_button), "toggled",
909
 
                     G_CALLBACK(preview_button_toggled), NULL);
 
923
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(camera_button), TRUE);
 
924
    g_signal_connect(G_OBJECT(camera_button), "toggled",
 
925
                     G_CALLBACK(camera_button_toggled), NULL);
910
926
 
911
927
    gboolean active_call = FALSE;
912
928
    gchar **list = dbus_get_call_list();
917
933
    }
918
934
 
919
935
    if (active_call)
920
 
        gtk_widget_set_sensitive(GTK_WIDGET(preview_button), FALSE);
 
936
        gtk_widget_set_sensitive(GTK_WIDGET(camera_button), FALSE);
921
937
 
922
938
    gtk_widget_show_all(vbox);
923
939