2
/* Ekiga -- A VoIP and Video-Conferencing application
3
* Copyright (C) 2000-2006 Damien Sandras
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20
* Ekiga is licensed under the GPL license and as a special exception,
21
* you have permission to link or otherwise combine this program with the
22
* programs OPAL, OpenH323 and PWLIB, and distribute the combination,
23
* without applying the requirements of the GNU GPL to the OPAL, OpenH323
24
* and PWLIB programs, as long as you do follow the requirements of the
25
* GNU GPL for all the rest of the software thus combined.
30
* main_window.cpp - description
31
* -------------------------------
32
* begin : Mon Mar 26 2001
33
* copyright : (C) 2000-2006 by Damien Sandras
34
* description : This file contains all the functions needed to
35
* build the main window.
47
#include "callbacks.h"
48
#include "statusicon.h"
50
#include "statusmenu.h"
53
#include "gmentrydialog.h"
54
#include "gmstatusbar.h"
55
#include "gmconnectbutton.h"
56
#include "gmstockicons.h"
59
#include "gmmenuaddon.h"
60
#include "gmlevelmeter.h"
61
#include "gmpowermeter.h"
62
#include "gmconfwidgets.h"
64
#include "menu-builder-gtk.h"
66
#include "platform/gm-platform.h"
68
#include <gdk/gdkkeysyms.h>
71
#include "components/dbus.h"
78
#include "platform/winpaths.h"
79
#include <gdk/gdkwin32.h>
89
#include <libnotify/notify.h>
92
#if defined(P_FREEBSD) || defined (P_MACOSX)
96
#include <libxml/parser.h>
98
#include "videoinput-core.h"
99
#include "audioinput-core.h"
100
#include "audiooutput-core.h"
102
#include "call-core.h"
104
#include "gtk-frontend.h"
105
#include "services.h"
106
#include "form-dialog-gtk.h"
108
#include "../devices/videooutput.h"
110
enum CallingState {Standby, Calling, Connected, Called};
112
enum DeviceType { AudioInput, AudioOutput, VideoInput} ;
113
struct deviceStruct {
115
DeviceType deviceType;
121
_GmMainWindow (Ekiga::ServiceCore & _core) : core (_core) { }
123
GtkWidget *input_signal;
124
GtkWidget *output_signal;
125
GtkObject *adj_input_volume;
126
GtkObject *adj_output_volume;
127
GtkWidget *audio_input_volume_frame;
128
GtkWidget *audio_output_volume_frame;
129
GtkWidget *audio_settings_window;
130
GtkWidget *audio_settings_button;
132
GtkObject *adj_whiteness;
133
GtkObject *adj_brightness;
134
GtkObject *adj_colour;
135
GtkObject *adj_contrast;
136
GtkWidget *video_settings_button;
137
GtkWidget *video_settings_frame;
138
GtkWidget *video_settings_window;
140
GtkListStore *completion;
142
GtkAccelGroup *accel;
144
GtkWidget *main_menu;
145
GtkWidget *main_toolbar;
147
GtkWidget *window_vbox;
149
GtkWidget *status_label_ebox;
150
GtkWidget *info_text;
151
GtkWidget *info_label;
153
GtkWidget *statusbar;
154
GtkWidget *statusbar_ebox;
155
GtkWidget *qualitymeter;
157
GtkWidget *main_notebook;
160
GtkWidget *main_video_image;
161
GtkWidget *local_video_image;
162
GtkWidget *remote_video_image;
163
GtkWidget *video_frame;
164
GtkWidget *preview_button;
165
GtkWidget *connect_button;
166
GtkWidget *hold_button;
167
GtkWidget *transfer_call_popup;
168
GtkWidget *status_option_menu;
169
Ekiga::Presentity* presentity;
172
GdkGC* video_widget_gc;
175
unsigned int calling_state;
176
bool audio_transmission_active;
177
bool audio_reception_active;
178
bool video_transmission_active;
179
bool video_reception_active;
180
std::string transmitted_video_codec;
181
std::string transmitted_audio_codec;
182
std::string received_video_codec;
183
std::string received_audio_codec;
184
unsigned int timeout_id;
185
unsigned int levelmeter_timeout_id;
186
Ekiga::Call *current_call;
187
Ekiga::ServiceCore & core;
188
std::vector<sigc::connection> connections;
189
std::list<std::string> accounts;
192
typedef struct _GmMainWindow GmMainWindow;
195
#define GM_MAIN_WINDOW(x) (GmMainWindow *) (x)
210
* BEHAVIOR : Frees a GmMainWindow and its content.
211
* PRE : A non-NULL pointer to a GmMainWindow.
213
static void gm_mw_destroy (gpointer);
217
* BEHAVIOR : Returns a pointer to the private GmMainWindow
218
* used by the main book GMObject.
219
* PRE : The given GtkWidget pointer must be the main window GMObject.
221
static GmMainWindow *gm_mw_get_mw (GtkWidget *);
225
* BEHAVIOR : Create the URI toolbar of the main window.
226
* The toolbar is created in its initial state, with
227
* required items being unsensitive.
228
* PRE : The main window GMObject.
230
static GtkWidget *gm_mw_init_uri_toolbar (GtkWidget *);
234
* BEHAVIOR : Create the status menu toolbar of the main window.
235
* PRE : The main window GMObject.
237
static GtkWidget *gm_mw_init_status_toolbar (GtkWidget *);
241
* BEHAVIOR : Create the menu of the main window.
242
* The menu is created in its initial state, with
243
* required items being unsensitive.
244
* PRE : The main window GMObject. The statusbar must have been
247
static void gm_mw_init_menu (GtkWidget *);
251
* behavior : Builds the contacts list part of the main window.
252
* pre : The given GtkWidget pointer must be the main window GMObject.
254
static void gm_mw_init_contacts_list (GtkWidget *);
258
* behavior : builds the dialpad part of the main window.
259
* pre : the given GtkWidget pointer must be the main window GMObject.
261
static void gm_mw_init_dialpad (GtkWidget *);
264
* BEHAVIOR : Builds the video settings popup of the main window.
265
* PRE : The given GtkWidget pointer must be the main window GMObject.
267
static GtkWidget *gm_mw_video_settings_window_new (GtkWidget *);
271
* BEHAVIOR : Builds the audio settings popup for the main window.
272
* PRE : The given GtkWidget pointer must be the main window GMObject.
274
static GtkWidget *gm_mw_audio_settings_window_new (GtkWidget *);
278
* BEHAVIOR : Builds the call part of the main window.
279
* PRE : The given GtkWidget pointer must be the main window GMObject.
281
static void gm_mw_init_call (GtkWidget *);
285
* BEHAVIOR : Builds the call history part of the main window.
286
* PRE : The given GtkWidget pointer must be the main window GMObject.
288
static void gm_mw_init_history (GtkWidget *);
292
* BEHAVIOR : enables/disables the zoom related menuitems according
294
* PRE : The main window GMObject.
296
static void gm_mw_zooms_menu_update_sensitivity (GtkWidget *,
298
static void gm_main_window_toggle_fullscreen (Ekiga::VideoOutputFSToggle toggle,
299
GtkWidget *main_window);
301
static void gm_main_window_show_call_panel (GtkWidget *self);
303
static void gm_main_window_hide_call_panel (GtkWidget *self);
305
void gm_main_window_clear_signal_levels (GtkWidget *main_window);
307
void gm_main_window_selected_presentity_build_menu (GtkWidget *main_window);
309
void gm_main_window_incoming_call_dialog_show (GtkWidget *main_window,
313
void gm_main_window_incoming_call_notify (GtkWidget *main_window,
319
/* DESCRIPTION : This callback is called when the user selects a presentity
321
* BEHAVIOR : Populates the Chat->Contact submenu
324
static void on_presentity_selected (GtkWidget* view,
325
Ekiga::Presentity* presentity,
328
/* DESCRIPTION : This callback is called when the chat window alerts about
330
* BEHAVIOR : Plays a sound (if enabled)
333
static void on_chat_unread_alert (GtkWidget*,
336
/* DESCRIPTION : This callback is called when the control panel
337
* section key changes.
338
* BEHAVIOR : Sets the right page, and also sets
339
* the good value for the radio menu.
342
static void panel_section_changed_nt (gpointer id,
347
/* DESCRIPTION : This callback is called when the call panel
348
* section key changes.
349
* BEHAVIOR : Show it or hide it, resize the window appropriately.
352
static void show_call_panel_changed_nt (G_GNUC_UNUSED gpointer id,
357
/** Pull a trigger from a Ekiga::Service
359
* @param data is a pointer to the Ekiga::Trigger
361
static void pull_trigger_cb (GtkWidget * /*widget*/,
365
/** Show the widget passed as parameter
367
* @param data is a pointer to the widget to show
369
static void show_widget_cb (GtkWidget * /*widget*/,
374
* BEHAVIOR : Set the current active call on hold.
377
static void hold_current_call_cb (GtkWidget *,
382
* BEHAVIOR : Set the current active call audio channel on pause or not
383
* PRE : a pointer to the main window
385
static void toggle_audio_stream_pause_cb (GtkWidget *,
390
* BEHAVIOR : Set the current active call video channel on pause or not
391
* PRE : a pointer to the main window
393
static void toggle_video_stream_pause_cb (GtkWidget *,
398
* BEHAVIOR : Creates a dialog to transfer the current call and transfer
400
* PRE : The parent window.
402
static void transfer_current_call_cb (GtkWidget *,
406
/* DESCRIPTION : This callback is called when a video window is shown.
407
* BEHAVIOR : Set the WM HINTS to stay-on-top if the config key is set
411
static void video_window_shown_cb (GtkWidget *,
414
/* DESCRIPTION : This callback is called when the user changes the
415
* audio settings sliders in the main notebook.
416
* BEHAVIOR : Update the volume of the choosen mixers. If the update
417
* fails, the sliders are put back to 0.
418
* PRE : The main window GMObject.
420
static void audio_volume_changed_cb (GtkAdjustment *,
424
/* DESCRIPTION : This callback is called when the user changes one of the
425
* video settings sliders in the main notebook.
426
* BEHAVIOR : Updates the value in real time, if it fails, reset
428
* PRE : gpointer is a valid pointer to the main window GmObject.
430
static void video_settings_changed_cb (GtkAdjustment *,
434
/* DESCRIPTION : This callback is called when the user changes the
435
* page in the main notebook.
436
* BEHAVIOR : Update the config key accordingly.
437
* PRE : A valid pointer to the main window GmObject.
439
static void panel_section_changed_cb (GtkNotebook *,
445
/* DESCRIPTION : This callback is called when the user
446
* clicks on the dialpad button.
447
* BEHAVIOR : Generates a dialpad event.
448
* PRE : A valid pointer to the main window GMObject.
450
static void dialpad_button_clicked_cb (EkigaDialpad *dialpad,
451
const gchar *button_text,
452
GtkWidget *main_window);
455
/* DESCRIPTION : This callback is called when the user tries to close
456
* the application using the window manager.
457
* BEHAVIOR : Calls the real callback if the notification icon is
458
* not shown else hide GM.
459
* PRE : A valid pointer to the main window GMObject.
461
static gint window_closed_cb (GtkWidget *,
466
/* DESCRIPTION : This callback is called when the user tries to close
467
* the main window using the FILE-menu
468
* BEHAVIOUR : Directly calls window_closed_cb (i.e. it's just a wrapper)
472
static void window_closed_from_menu_cb (GtkWidget *,
476
/* DESCRIPTION : This callback is called when the user changes the zoom
477
* factor in the menu, and chooses to zoom in.
478
* BEHAVIOR : zoom *= 2.
479
* PRE : The GConf key to update with the new zoom.
481
static void zoom_in_changed_cb (GtkWidget *,
485
/* DESCRIPTION : This callback is called when the user changes the zoom
486
* factor in the menu, and chooses to zoom in.
487
* BEHAVIOR : zoom /= 2.
488
* PRE : The GConf key to update with the new zoom.
490
static void zoom_out_changed_cb (GtkWidget *,
494
/* DESCRIPTION : This callback is called when the user changes the zoom
495
* factor in the menu, and chooses to zoom in.
496
* BEHAVIOR : zoom = 1.
497
* PRE : The GConf key to update with the new zoom.
499
static void zoom_normal_changed_cb (GtkWidget *,
503
display_changed_cb (GtkWidget *widget,
506
/* DESCRIPTION : This callback is called when the user toggles fullscreen
507
* factor in the popup menu.
508
* BEHAVIOR : Toggles the fullscreen configuration key.
511
static void fullscreen_changed_cb (GtkWidget *,
514
/* DESCRIPTION : This callback is called when the user changes the URL
516
* BEHAVIOR : It udpates the tooltip with the new URL
517
* and the completion cache.
518
* PRE : A valid pointer to the main window GMObject.
520
static void url_changed_cb (GtkEditable *,
523
/* DESCRIPTION : This callback is called when the user presses a
524
* button in the toolbar.
525
* (See menu_toggle_changed)
526
* BEHAVIOR : Updates the config cache.
527
* PRE : data is the key.
529
static void toolbar_toggle_button_changed_cb (GtkWidget *,
533
/* DESCRIPTION : This callback is called when the status bar is clicked.
534
* BEHAVIOR : Clear all info message, not normal messages.
535
* PRE : The main window GMObject.
537
static gboolean statusbar_clicked_cb (GtkWidget *,
542
/* DESCRIPTION : This callback is called if main window is focussed
543
* BEHAVIOR : currently only: unset urgency hint
546
static gboolean main_window_focus_event_cb (GtkWidget *,
550
static void audio_volume_window_shown_cb (GtkWidget *widget,
553
static void audio_volume_window_hidden_cb (GtkWidget *widget,
561
static void on_ready_cb (gpointer self)
563
gm_main_window_set_busy (GTK_WIDGET (self), false);
567
static void on_registration_event (const Ekiga::Account & account,
568
Ekiga::AccountCore::RegistrationState state,
569
std::string /*info*/,
572
GmMainWindow *mw = NULL;
575
std::string aor = account.get_aor ();
577
g_return_if_fail (GTK_WIDGET (self) != NULL);
578
mw = gm_mw_get_mw (GTK_WIDGET (self));
581
case Ekiga::AccountCore::Registered:
582
/* Translators: Is displayed once an account "%s" is registered. */
583
msg = g_strdup_printf (_("Registered %s"), aor.c_str ());
584
mw->accounts.push_back (account.get_host ());
587
case Ekiga::AccountCore::Unregistered:
588
/* Translators: Is displayed once an account "%s" is unregistered. */
589
msg = g_strdup_printf (_("Unregistered %s"), aor.c_str ());
590
mw->accounts.remove (account.get_host ());
593
case Ekiga::AccountCore::UnregistrationFailed:
594
msg = g_strdup_printf (_("Could not unregister %s"), aor.c_str ());
597
case Ekiga::AccountCore::RegistrationFailed:
598
msg = g_strdup_printf (_("Could not register %s"), aor.c_str ());
601
case Ekiga::AccountCore::Processing:
607
gm_main_window_flash_message (GTK_WIDGET (self), "%s", msg);
613
static void on_setup_call_cb (Ekiga::CallManager & /*manager*/,
617
GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
618
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
620
if (!call.is_outgoing ()) {
621
gm_main_window_update_calling_state (GTK_WIDGET (self), Called);
622
audiooutput_core->start_play_event("incoming_call_sound", 4000, 256);
624
gm_main_window_incoming_call_notify (GTK_WIDGET (self), call);
626
gm_main_window_incoming_call_dialog_show (GTK_WIDGET (self), call);
630
gm_main_window_update_calling_state (GTK_WIDGET (self), Calling);
631
if (!call.get_remote_uri ().empty ())
632
gm_main_window_set_call_url (GTK_WIDGET (self), call.get_remote_uri ().c_str());
633
mw->current_call = &call;
638
static void on_ringing_call_cb (Ekiga::CallManager & /*manager*/,
642
GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
643
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
645
if (call.is_outgoing ()) {
646
audiooutput_core->start_play_event("ring_tone_sound", 3000, 256);
652
static gboolean on_stats_refresh_cb (gpointer self)
656
GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
658
if (mw->calling_state == Connected && mw->current_call) {
660
Ekiga::VideoOutputStats videooutput_stats;
661
Ekiga::VideoOutputCore *videooutput_core = dynamic_cast<Ekiga::VideoOutputCore *> (mw->core.get ("videooutput-core"));
662
videooutput_core->get_videooutput_stats(videooutput_stats);
664
msg = g_strdup_printf (_("A:%.1f/%.1f V:%.1f/%.1f FPS:%d/%d"),
665
mw->current_call->get_transmitted_audio_bandwidth (),
666
mw->current_call->get_received_audio_bandwidth (),
667
mw->current_call->get_transmitted_video_bandwidth (),
668
mw->current_call->get_received_video_bandwidth (),
669
videooutput_stats.tx_fps,
670
videooutput_stats.rx_fps);
671
gm_main_window_flash_message (GTK_WIDGET (self), msg);
672
gm_main_window_set_call_duration (GTK_WIDGET (self), mw->current_call->get_duration ().c_str ());
675
unsigned int jitter = mw->current_call->get_jitter_size ();
676
double lost = mw->current_call->get_lost_packets ();
677
double late = mw->current_call->get_late_packets ();
678
double out_of_order = mw->current_call->get_out_of_order_packets ();
680
gm_main_window_update_stats (GTK_WIDGET (self), lost, late, out_of_order, jitter,
682
videooutput_stats.rx_width,
683
videooutput_stats.rx_height,
684
videooutput_stats.tx_width,
685
videooutput_stats.tx_height);
690
static gboolean on_signal_level_refresh_cb (gpointer self)
692
GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
694
Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->core.get ("audioinput-core"));
695
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
697
gtk_levelmeter_set_level (GTK_LEVELMETER (mw->output_signal), audiooutput_core->get_average_level());
698
gtk_levelmeter_set_level (GTK_LEVELMETER (mw->input_signal), audioinput_core->get_average_level());
702
static void on_established_call_cb (Ekiga::CallManager & /*manager*/,
706
GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
709
info = g_strdup_printf (_("Connected with %s"),
710
call.get_remote_party_name ().c_str ());
712
if (!call.get_remote_uri ().empty ())
713
gm_main_window_set_call_url (GTK_WIDGET (self), call.get_remote_uri ().c_str());
714
if (gm_conf_get_bool (VIDEO_DISPLAY_KEY "stay_on_top"))
715
gm_main_window_set_stay_on_top (GTK_WIDGET (self), TRUE);
716
gm_main_window_set_status (GTK_WIDGET (self), info);
717
gm_main_window_flash_message (GTK_WIDGET (self), "%s", info);
718
if (!gm_conf_get_bool (USER_INTERFACE_KEY "main_window/show_call_panel"))
719
gm_main_window_show_call_panel (GTK_WIDGET (self));
720
gm_main_window_update_calling_state (GTK_WIDGET (self), Connected);
722
mw->current_call = &call;
724
mw->timeout_id = g_timeout_add (1000, on_stats_refresh_cb, self);
726
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
728
audiooutput_core->stop_play_event("incoming_call_sound");
729
audiooutput_core->stop_play_event("ring_tone_sound");
735
static void on_cleared_call_cb (Ekiga::CallManager & /*manager*/,
740
GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
742
if (gm_conf_get_bool (VIDEO_DISPLAY_KEY "stay_on_top"))
743
gm_main_window_set_stay_on_top (GTK_WIDGET (self), FALSE);
744
gm_main_window_update_calling_state (GTK_WIDGET (self), Standby);
745
gm_main_window_set_status (GTK_WIDGET (self), _("Standby"));
746
gm_main_window_set_call_duration (GTK_WIDGET (self), NULL);
747
gm_main_window_set_call_info (GTK_WIDGET (self), NULL, NULL, NULL, NULL);
748
if (!gm_conf_get_bool (USER_INTERFACE_KEY "main_window/show_call_panel"))
749
gm_main_window_hide_call_panel (GTK_WIDGET (self));
750
gm_main_window_clear_stats (GTK_WIDGET (self));
751
gm_main_window_update_logo_have_window (GTK_WIDGET (self));
752
gm_main_window_push_message (GTK_WIDGET (self), "%s", reason.c_str ());
754
if (mw->current_call && mw->current_call->get_id () == call.get_id ()) {
756
mw->current_call = NULL;
757
g_source_remove (mw->timeout_id);
760
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
762
audiooutput_core->stop_play_event("incoming_call_sound");
763
audiooutput_core->stop_play_event("ring_tone_sound");
765
gm_main_window_clear_signal_levels(GTK_WIDGET (self));
769
static void on_cleared_incoming_call_cb (std::string /*reason*/,
772
GmMainWindow *mw = NULL;
774
GtkWidget *main_window = NULL;
776
main_window = GnomeMeeting::Process ()->GetMainWindow ();
777
mw = gm_mw_get_mw (main_window);
778
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
779
audiooutput_core->stop_play_event("incoming_call_sound");
780
audiooutput_core->stop_play_event("ring_tone_sound");
783
notify_notification_close (NOTIFY_NOTIFICATION (self), NULL);
785
gtk_widget_destroy (GTK_WIDGET (self));
790
static void on_missed_incoming_call_cb (gpointer self)
793
notify_notification_close (NOTIFY_NOTIFICATION (self), NULL);
795
gtk_widget_destroy (GTK_WIDGET (self));
800
void gm_main_window_add_device_dialog_show (GtkWidget *main_window,
801
const Ekiga::Device & device,
802
DeviceType deviceType);
804
static void on_held_call_cb (Ekiga::CallManager & /*manager*/,
805
Ekiga::Call & /*call*/,
808
gchar *info_string = NULL;
810
gm_main_window_set_call_hold (GTK_WIDGET (self), true);
811
info_string = g_strdup (_("Call on hold"));
812
gm_main_window_flash_message (GTK_WIDGET (self), "%s", info_string);
813
g_free (info_string);
817
static void on_retrieved_call_cb (Ekiga::CallManager & /*manager*/,
818
Ekiga::Call & /*call*/,
821
gchar *info_string = NULL;
823
gm_main_window_set_call_hold (GTK_WIDGET (self), false);
824
info_string = g_strdup (_("Call retrieved"));
825
gm_main_window_flash_message (GTK_WIDGET (self), "%s", info_string);
826
g_free (info_string);
830
static void on_missed_call_cb (Ekiga::CallManager & /*manager*/,
834
GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
835
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
837
audiooutput_core->stop_play_event("incoming_call_sound");
838
audiooutput_core->stop_play_event("ring_tone_sound");
841
info = g_strdup_printf (_("Missed call from %s"),
842
call.get_remote_party_name ().c_str ());
843
gm_main_window_push_message (GTK_WIDGET (self), "%s", info);
848
static void on_stream_opened_cb (Ekiga::CallManager & /*manager*/,
849
Ekiga::Call & /* call */,
851
Ekiga::Call::StreamType type,
852
bool is_transmitting,
855
GmMainWindow *mw = NULL;
857
g_return_if_fail (GTK_WIDGET (self) != NULL);
858
mw = gm_mw_get_mw (GTK_WIDGET (self));
859
g_return_if_fail (mw != NULL);
861
bool is_closing = false;
862
bool is_encoding = is_transmitting;
863
bool is_video = (type == Ekiga::Call::Video);
865
/* FIXME: This should not be needed anymore */
866
if (type == Ekiga::Call::Video) {
869
(is_encoding ? mw->video_transmission_active = false : mw->video_reception_active = false)
870
:(is_encoding ? mw->video_transmission_active = true : mw->video_reception_active = true);
873
is_closing ? mw->transmitted_video_codec = "" : mw->transmitted_video_codec = name;
875
is_closing ? mw->received_video_codec = "" : mw->received_video_codec = name;
880
(is_encoding ? mw->audio_transmission_active = false : mw->audio_reception_active = false)
881
:(is_encoding ? mw->audio_transmission_active = true : mw->audio_reception_active = true);
884
is_closing ? mw->transmitted_audio_codec = "" : mw->transmitted_audio_codec = name;
886
is_closing ? mw->received_audio_codec = "" : mw->received_audio_codec = name;
889
gm_main_window_update_sensitivity (GTK_WIDGET (self),
891
is_video ? mw->video_reception_active : mw->audio_reception_active,
892
is_video ? mw->video_transmission_active : mw->audio_transmission_active);
893
gm_main_window_set_call_info (GTK_WIDGET (self),
894
mw->transmitted_audio_codec.c_str (),
895
mw->received_audio_codec.c_str (),
896
mw->transmitted_video_codec.c_str (),
897
mw->received_audio_codec.c_str ());
901
static void on_stream_closed_cb (Ekiga::CallManager & /*manager*/,
902
Ekiga::Call & /* call */,
904
Ekiga::Call::StreamType type,
905
bool is_transmitting,
908
GmMainWindow *mw = NULL;
910
g_return_if_fail (GTK_WIDGET (self) != NULL);
911
mw = gm_mw_get_mw (GTK_WIDGET (self));
912
g_return_if_fail (mw != NULL);
914
bool is_closing = true;
915
bool is_encoding = is_transmitting;
916
bool is_video = (type == Ekiga::Call::Video);
918
/* FIXME: This should not be needed anymore */
919
if (type == Ekiga::Call::Video) {
922
(is_encoding ? mw->video_transmission_active = false : mw->video_reception_active = false)
923
:(is_encoding ? mw->video_transmission_active = true : mw->video_reception_active = true);
926
is_closing ? mw->transmitted_video_codec = "" : mw->transmitted_video_codec = name;
928
is_closing ? mw->received_video_codec = "" : mw->received_video_codec = name;
933
(is_encoding ? mw->audio_transmission_active = false : mw->audio_reception_active = false)
934
:(is_encoding ? mw->audio_transmission_active = true : mw->audio_reception_active = true);
937
is_closing ? mw->transmitted_audio_codec = "" : mw->transmitted_audio_codec = name;
939
is_closing ? mw->received_audio_codec = "" : mw->received_audio_codec = name;
942
gm_main_window_update_sensitivity (GTK_WIDGET (self),
944
is_video ? mw->video_reception_active : mw->audio_reception_active,
945
is_video ? mw->video_transmission_active : mw->audio_transmission_active);
946
gm_main_window_set_call_info (GTK_WIDGET (self),
947
mw->transmitted_audio_codec.c_str (),
948
mw->received_audio_codec.c_str (),
949
mw->transmitted_video_codec.c_str (),
950
mw->received_audio_codec.c_str ());
954
static void on_stream_paused_cb (Ekiga::CallManager & /*manager*/,
955
Ekiga::Call & /*call*/,
956
std::string /*name*/,
957
Ekiga::Call::StreamType type,
960
gm_main_window_set_channel_pause (GTK_WIDGET (self), true, (type == Ekiga::Call::Video));
964
static void on_stream_resumed_cb (Ekiga::CallManager & /*manager*/,
965
Ekiga::Call & /*call*/,
966
std::string /*name*/,
967
Ekiga::Call::StreamType type,
970
gm_main_window_set_channel_pause (GTK_WIDGET (self), false, (type == Ekiga::Call::Video));
974
static bool on_handle_errors (std::string error,
977
g_return_val_if_fail (data != NULL, false);
979
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (data),
982
GTK_BUTTONS_OK, NULL);
984
gtk_window_set_title (GTK_WINDOW (dialog), _("Error"));
985
gtk_label_set_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), error.c_str ());
987
g_signal_connect_swapped (GTK_OBJECT (dialog), "response",
988
G_CALLBACK (gtk_widget_destroy),
989
GTK_OBJECT (dialog));
991
gtk_widget_show_all (dialog);
999
* Display Engine Callbacks
1003
on_videooutput_device_opened_cb (Ekiga::VideoOutputManager & /* manager */,
1004
Ekiga::VideoOutputAccel /* accel */,
1005
Ekiga::VideoOutputMode mode,
1010
GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
1013
gtk_menu_section_set_sensitive (mw->main_menu, "local_video", TRUE);
1014
gtk_menu_section_set_sensitive (mw->main_menu, "fullscreen", TRUE);
1018
if (mode == Ekiga::VO_MODE_LOCAL)
1019
gtk_menu_set_sensitive (mw->main_menu, "local_video", TRUE);
1021
if (mode == Ekiga::VO_MODE_REMOTE)
1022
gtk_menu_set_sensitive (mw->main_menu, "remote_video", TRUE);
1025
gtk_radio_menu_select_with_id (mw->main_menu, "local_video", mode);
1027
gtk_menu_set_sensitive (mw->main_menu, "zoom_in", (zoom == 200) ? FALSE : TRUE);
1028
gtk_menu_set_sensitive (mw->main_menu, "zoom_out", (zoom == 50) ? FALSE : TRUE);
1029
gtk_menu_set_sensitive (mw->main_menu, "normal_size", (zoom == 100) ? FALSE : TRUE);
1033
on_videooutput_device_closed_cb (Ekiga::VideoOutputManager & /* manager */, gpointer self)
1035
GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
1037
gtk_menu_section_set_sensitive (mw->main_menu, "local_video", FALSE);
1039
gtk_menu_section_set_sensitive (mw->main_menu, "fullscreen", TRUE);
1041
gtk_menu_section_set_sensitive (mw->main_menu, "zoom_in", FALSE);
1045
on_videooutput_device_error_cb (Ekiga::VideoOutputManager & /* manager */,
1046
Ekiga::VideoOutputErrorCodes error_code,
1049
PTRACE(1, "Error opening the output device");
1053
on_fullscreen_mode_changed_cb (Ekiga::VideoOutputManager & /* manager */, Ekiga::VideoOutputFSToggle toggle, gpointer self)
1055
gm_main_window_toggle_fullscreen (toggle, GTK_WIDGET (self));
1059
on_size_changed_cb (Ekiga::VideoOutputManager & /* manager */, unsigned width, unsigned height, gpointer self)
1061
GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
1065
gtk_widget_size_request (GTK_WIDGET (mw->main_video_image), &req);
1066
gtk_window_get_size (GTK_WINDOW (self), &x, &y);
1067
gtk_widget_set_size_request (GTK_WIDGET (mw->main_video_image), width, height);
1068
gtk_window_resize (GTK_WINDOW (self), width, height);
1071
rect.x = mw->main_video_image->allocation.x;
1072
rect.y = mw->main_video_image->allocation.y;
1073
rect.width = mw->main_video_image->allocation.width;
1074
rect.height = mw->main_video_image->allocation.height;
1076
gdk_window_invalidate_rect (GDK_WINDOW (GTK_WIDGET (self)->window), &rect , TRUE);
1080
on_videoinput_device_opened_cb (Ekiga::VideoInputManager & /* manager */,
1081
Ekiga::VideoInputDevice & /* device */,
1082
Ekiga::VideoInputSettings & settings,
1085
GmMainWindow *mw = NULL;
1086
g_return_if_fail (self != NULL);
1087
mw = gm_mw_get_mw (GTK_WIDGET (self));
1088
g_return_if_fail (mw != NULL);
1090
gtk_widget_set_sensitive (GTK_WIDGET (mw->video_settings_frame), settings.modifyable ? TRUE : FALSE);
1091
gtk_widget_set_sensitive (GTK_WIDGET (mw->video_settings_button), settings.modifyable ? TRUE : FALSE);
1092
GTK_ADJUSTMENT (mw->adj_whiteness)->value = settings.whiteness;
1093
GTK_ADJUSTMENT (mw->adj_brightness)->value = settings.brightness;
1094
GTK_ADJUSTMENT (mw->adj_colour)->value = settings.colour;
1095
GTK_ADJUSTMENT (mw->adj_contrast)->value = settings.contrast;
1097
gtk_widget_queue_draw (GTK_WIDGET (mw->video_settings_frame));
1103
on_videoinput_device_closed_cb (Ekiga::VideoInputManager & /* manager */, Ekiga::VideoInputDevice & /*device*/, gpointer self)
1105
GmMainWindow *mw = NULL;
1106
g_return_if_fail (self != NULL);
1107
mw = gm_mw_get_mw (GTK_WIDGET (self));
1108
g_return_if_fail (mw != NULL);
1110
gm_main_window_update_sensitivity (GTK_WIDGET (self), TRUE, FALSE, FALSE);
1111
gm_main_window_update_logo_have_window (GTK_WIDGET (self));
1113
gtk_widget_set_sensitive (GTK_WIDGET (mw->video_settings_button), FALSE);
1117
on_videoinput_device_added_cb (const Ekiga::VideoInputDevice & device, bool isDesired, gpointer self)
1119
GmMainWindow *mw = NULL;
1120
g_return_if_fail (self != NULL);
1121
mw = gm_mw_get_mw (GTK_WIDGET (self));
1122
g_return_if_fail (mw != NULL);
1123
gchar* message = NULL;
1125
/* Translators: This is a hotplug status */
1126
message = g_strdup_printf (_("Added video input device %s"),
1127
device.GetString().c_str ());
1128
gm_main_window_flash_message (GTK_WIDGET (self), "%s", message);
1130
if (!isDesired && mw->calling_state == Standby && !mw->current_call)
1131
gm_main_window_add_device_dialog_show (GTK_WIDGET (self), device, VideoInput);
1135
on_videoinput_device_removed_cb (const Ekiga::VideoInputDevice & device, bool, gpointer self)
1137
GmMainWindow *mw = NULL;
1138
g_return_if_fail (self != NULL);
1139
mw = gm_mw_get_mw (GTK_WIDGET (self));
1140
g_return_if_fail (mw != NULL);
1141
gchar* message = NULL;
1143
/* Translators: This is a hotplug status */
1144
message = g_strdup_printf (_("Removed video input device %s"),
1145
device.GetString().c_str ());
1146
gm_main_window_flash_message (GTK_WIDGET (self), "%s", message);
1151
on_videoinput_device_error_cb (Ekiga::VideoInputManager & /* manager */,
1152
Ekiga::VideoInputDevice & device,
1153
Ekiga::VideoInputErrorCodes error_code,
1156
gchar *dialog_title = NULL;
1157
gchar *dialog_msg = NULL;
1158
gchar *tmp_msg = NULL;
1161
g_strdup_printf (_("Error while accessing video device %s"),
1162
(const char *) device.name.c_str());
1164
tmp_msg = g_strdup (_("A moving logo will be transmitted during calls. Notice that you can always transmit a given image or the moving logo by choosing \"Picture\" as video plugin and \"Moving logo\" or \"Static picture\" as device."));
1165
switch (error_code) {
1167
case Ekiga::VI_ERROR_DEVICE:
1168
dialog_msg = g_strconcat (_("There was an error while opening the device. In case it is a pluggable device it may be sufficient to reconnect it. If not, or if it still is not accessible, please check your permissions and make sure that the appropriate driver is loaded."), "\n\n", tmp_msg, NULL);
1171
case Ekiga::VI_ERROR_FORMAT:
1172
dialog_msg = g_strconcat (_("Your video driver doesn't support the requested video format."), "\n\n", tmp_msg, NULL);
1175
case Ekiga::VI_ERROR_CHANNEL:
1176
dialog_msg = g_strconcat (_("Could not open the chosen channel."), "\n\n", tmp_msg, NULL);
1179
case Ekiga::VI_ERROR_COLOUR:
1180
dialog_msg = g_strconcat (_("Your driver doesn't seem to support any of the color formats supported by Ekiga.\n Please check your kernel driver documentation in order to determine which Palette is supported."), "\n\n", tmp_msg, NULL);
1183
case Ekiga::VI_ERROR_FPS:
1184
dialog_msg = g_strconcat (_("Error while setting the frame rate."), "\n\n", tmp_msg, NULL);
1187
case Ekiga::VI_ERROR_SCALE:
1188
dialog_msg = g_strconcat (_("Error while setting the frame size."), "\n\n", tmp_msg, NULL);
1191
case Ekiga::VI_ERROR_NONE:
1193
dialog_msg = g_strconcat (_("Unknown error."), "\n\n", tmp_msg, NULL);
1197
gnomemeeting_warning_dialog_on_widget (GTK_WINDOW (GTK_WIDGET (self)),
1198
"show_device_warnings",
1201
g_free (dialog_msg);
1202
g_free (dialog_title);
1207
on_audioinput_device_opened_cb (Ekiga::AudioInputManager & /* manager */,
1208
Ekiga::AudioInputDevice & /* device */,
1209
Ekiga::AudioInputSettings & settings,
1212
GmMainWindow *mw = NULL;
1213
g_return_if_fail (self != NULL);
1214
mw = gm_mw_get_mw (GTK_WIDGET (self));
1215
g_return_if_fail (mw != NULL);
1217
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_input_volume_frame), settings.modifyable ? TRUE : FALSE);
1218
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_settings_button), settings.modifyable ? TRUE : FALSE);
1219
GTK_ADJUSTMENT (mw->adj_input_volume)->value = settings.volume;
1221
gtk_widget_queue_draw (GTK_WIDGET (mw->audio_input_volume_frame));
1227
on_audioinput_device_closed_cb (Ekiga::AudioInputManager & /* manager */,
1228
Ekiga::AudioInputDevice & /*device*/,
1231
GmMainWindow *mw = NULL;
1232
g_return_if_fail (self != NULL);
1233
mw = gm_mw_get_mw (GTK_WIDGET (self));
1234
g_return_if_fail (mw != NULL);
1236
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_settings_button), FALSE);
1237
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_input_volume_frame), FALSE);
1241
on_audioinput_device_added_cb (const Ekiga::AudioInputDevice & device,
1245
GmMainWindow *mw = NULL;
1246
g_return_if_fail (self != NULL);
1247
mw = gm_mw_get_mw (GTK_WIDGET (self));
1248
g_return_if_fail (mw != NULL);
1249
gchar* message = NULL;
1251
/* Translators: This is a hotplug status */
1252
message = g_strdup_printf (_("Added audio input device %s"),
1253
device.GetString().c_str ());
1254
gm_main_window_flash_message (GTK_WIDGET (self), "%s", message);
1256
if (!isDesired && mw->calling_state == Standby && !mw->current_call)
1257
gm_main_window_add_device_dialog_show (GTK_WIDGET (self), device, AudioInput);
1262
on_audioinput_device_removed_cb (const Ekiga::AudioInputDevice & device,
1266
GmMainWindow *mw = NULL;
1267
g_return_if_fail (self != NULL);
1268
mw = gm_mw_get_mw (GTK_WIDGET (self));
1269
g_return_if_fail (mw != NULL);
1270
gchar* message = NULL;
1272
/* Translators: This is a hotplug status */
1273
message = g_strdup_printf (_("Removed audio input device %s"),
1274
device.GetString().c_str ());
1275
gm_main_window_flash_message (GTK_WIDGET (self), "%s", message);
1280
on_audioinput_device_error_cb (Ekiga::AudioInputManager & /* manager */,
1281
Ekiga::AudioInputDevice & device,
1282
Ekiga::AudioInputErrorCodes error_code,
1285
gchar *dialog_title = NULL;
1286
gchar *dialog_msg = NULL;
1287
gchar *tmp_msg = NULL;
1290
g_strdup_printf (_("Error while opening audio input device %s"),
1291
(const char *) device.name.c_str());
1293
/* Translators: This happens when there is an error with audio input:
1294
* Nothing ("silence") will be transmitted */
1295
tmp_msg = g_strdup (_("Only silence will be transmitted."));
1296
switch (error_code) {
1298
case Ekiga::AI_ERROR_DEVICE:
1299
dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Unable to open the selected audio device for recording. In case it is a pluggable device it may be sufficient to reconnect it. If not, or if it still is not accessible, please check your audio setup, the permissions and that the device is not busy."), NULL);
1302
case Ekiga::AI_ERROR_READ:
1303
dialog_msg = g_strconcat (tmp_msg, "\n\n", _("The selected audio device was successfully opened but it is impossible to read data from this device. In case it is a pluggable device it may be sufficient to reconnect it. If not, or if it still is not accessible, please check your audio setup."), NULL);
1306
case Ekiga::AI_ERROR_NONE:
1308
dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Unknown error."), NULL);
1312
gnomemeeting_warning_dialog_on_widget (GTK_WINDOW (GTK_WIDGET (self)),
1313
"show_device_warnings",
1316
g_free (dialog_msg);
1317
g_free (dialog_title);
1323
on_audiooutput_device_opened_cb (Ekiga::AudioOutputManager & /*manager*/,
1324
Ekiga::AudioOutputPS ps,
1325
Ekiga::AudioOutputDevice & /*device*/,
1326
Ekiga::AudioOutputSettings & settings,
1329
if (ps == Ekiga::secondary)
1332
GmMainWindow *mw = NULL;
1333
g_return_if_fail (self != NULL);
1334
mw = gm_mw_get_mw (GTK_WIDGET (self));
1335
g_return_if_fail (mw != NULL);
1337
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_settings_button), settings.modifyable ? TRUE : FALSE);
1338
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_output_volume_frame), settings.modifyable ? TRUE : FALSE);
1339
GTK_ADJUSTMENT (mw->adj_output_volume)->value = settings.volume;
1341
gtk_widget_queue_draw (GTK_WIDGET (mw->audio_output_volume_frame));
1347
on_audiooutput_device_closed_cb (Ekiga::AudioOutputManager & /*manager*/,
1348
Ekiga::AudioOutputPS ps,
1349
Ekiga::AudioOutputDevice & /*device*/,
1352
if (ps == Ekiga::secondary)
1355
GmMainWindow *mw = NULL;
1356
g_return_if_fail (self != NULL);
1357
mw = gm_mw_get_mw (GTK_WIDGET (self));
1358
g_return_if_fail (mw != NULL);
1360
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_settings_button), FALSE);
1361
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_output_volume_frame), FALSE);
1365
on_audiooutput_device_added_cb (const Ekiga::AudioOutputDevice & device,
1369
GmMainWindow *mw = NULL;
1370
g_return_if_fail (self != NULL);
1371
mw = gm_mw_get_mw (GTK_WIDGET (self));
1372
g_return_if_fail (mw != NULL);
1373
gchar* message = NULL;
1375
message = g_strdup_printf (_("Added audio output device %s"), device.GetString().c_str ());
1376
gm_main_window_flash_message (GTK_WIDGET (self), "%s", message);
1378
if (!isDesired && mw->calling_state == Standby && !mw->current_call)
1379
gm_main_window_add_device_dialog_show (GTK_WIDGET (self), device, AudioOutput);
1383
on_audiooutput_device_removed_cb (const Ekiga::AudioOutputDevice & device,
1387
GmMainWindow *mw = NULL;
1388
g_return_if_fail (self != NULL);
1389
mw = gm_mw_get_mw (GTK_WIDGET (self));
1390
g_return_if_fail (mw != NULL);
1391
gchar* message = NULL;
1393
message = g_strdup_printf (_("Removed audio output device %s"),
1394
device.GetString().c_str ());
1395
gm_main_window_flash_message (GTK_WIDGET (self), "%s", message);
1400
on_audiooutput_device_error_cb (Ekiga::AudioOutputManager & /*manager */,
1401
Ekiga::AudioOutputPS ps,
1402
Ekiga::AudioOutputDevice & device,
1403
Ekiga::AudioOutputErrorCodes error_code,
1406
if (ps == Ekiga::secondary)
1409
gchar *dialog_title = NULL;
1410
gchar *dialog_msg = NULL;
1411
gchar *tmp_msg = NULL;
1414
g_strdup_printf (_("Error while opening audio output device %s"),
1415
(const char *) device.name.c_str());
1417
tmp_msg = g_strdup (_("No incoming sound will be played."));
1418
switch (error_code) {
1420
case Ekiga::AO_ERROR_DEVICE:
1421
dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Unable to open the selected audio device for playing. In case it is a pluggable device it may be sufficient to reconnect it. If not, or if it still is not accessible, please check your audio setup, the permissions and that the device is not busy."), NULL);
1424
case Ekiga::AO_ERROR_WRITE:
1425
dialog_msg = g_strconcat (tmp_msg, "\n\n", _("The selected audio device was successfully opened but it is impossible to write data from this device. In case it is a pluggable device it may be sufficient to reconnect it. If not, or if it still is not accessible, please check your audio setup."), NULL);
1428
case Ekiga::AO_ERROR_NONE:
1430
dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Unknown error."), NULL);
1434
gnomemeeting_warning_dialog_on_widget (GTK_WINDOW (GTK_WIDGET (self)),
1435
"show_device_warnings",
1438
g_free (dialog_msg);
1439
g_free (dialog_title);
1444
/* Implementation */
1446
gm_mw_destroy (gpointer m)
1448
GmMainWindow *mw = GM_MAIN_WINDOW (m);
1450
g_return_if_fail (mw != NULL);
1452
gtk_widget_destroy (mw->audio_settings_window);
1453
gtk_widget_destroy (mw->video_settings_window);
1455
delete ((GmMainWindow *) mw);
1459
static GmMainWindow *
1460
gm_mw_get_mw (GtkWidget *main_window)
1462
g_return_val_if_fail (main_window != NULL, NULL);
1464
return GM_MAIN_WINDOW (g_object_get_data (G_OBJECT (main_window),
1470
incoming_call_response_cb (GtkDialog *incoming_call_popup,
1474
Ekiga::Call *call = (Ekiga::Call *) data;
1476
gtk_widget_hide (GTK_WIDGET (incoming_call_popup));
1494
add_device_response_cb (GtkDialog *add_device_popup,
1498
deviceStruct *device_struct = (deviceStruct*) data;
1500
gtk_widget_hide (GTK_WIDGET (add_device_popup));
1502
if (response == 2) {
1504
switch (device_struct->deviceType)
1507
gm_conf_set_string (AUDIO_DEVICES_KEY "input_device", device_struct->name);
1510
gm_conf_set_string (AUDIO_DEVICES_KEY "output_device", device_struct->name);
1513
gm_conf_set_string (VIDEO_DEVICES_KEY "input_device", device_struct->name);
1521
place_call_cb (GtkWidget * /*widget*/,
1526
Ekiga::CallCore *call_core = NULL;
1527
GmMainWindow *mw = NULL;
1529
mw = gm_mw_get_mw (GTK_WIDGET (data));
1531
if (mw->calling_state == Standby && !mw->current_call) {
1535
gm_main_window_update_calling_state (GTK_WIDGET (data), Calling);
1536
call_core = dynamic_cast<Ekiga::CallCore*> (mw->core.get ("call-core"));
1537
uri = gm_main_window_get_call_url (GTK_WIDGET (data));
1538
if (call_core->dial (uri)) {
1540
pos = uri.find ("@");
1541
if (pos != std::string::npos) {
1543
std::string host = uri.substr (pos + 1);
1544
mw->accounts.remove (host);
1545
mw->accounts.push_front (host);
1550
gm_main_window_flash_message (GTK_WIDGET (data), _("Could not connect to remote host"));
1551
gm_main_window_update_calling_state (GTK_WIDGET (data), Standby);
1558
hangup_call_cb (GtkWidget * /*widget*/,
1561
GmMainWindow *mw = NULL;
1563
mw = gm_mw_get_mw (GTK_WIDGET (data));
1565
if (mw->current_call) {
1567
mw->current_call->hangup ();
1568
mw->current_call = NULL;
1574
toggle_call_cb (GtkWidget *widget,
1577
GmMainWindow *mw = NULL;
1579
mw = gm_mw_get_mw (GTK_WIDGET (data));
1581
if (mw->current_call && gm_connect_button_get_connected (GM_CONNECT_BUTTON (mw->connect_button)))
1582
hangup_call_cb (widget, data);
1583
else if (!mw->current_call && !gm_connect_button_get_connected (GM_CONNECT_BUTTON (mw->connect_button)))
1584
place_call_cb (widget, data);
1589
on_status_icon_embedding_change (G_GNUC_UNUSED GObject obj,
1590
G_GNUC_UNUSED GParamSpec param,
1591
G_GNUC_UNUSED gpointer data)
1593
GtkWidget *main_window = NULL;
1594
GtkStatusIcon *status_icon = NULL;
1596
status_icon = GTK_STATUS_ICON (GnomeMeeting::Process ()->GetStatusicon ());
1597
main_window = GnomeMeeting::Process ()->GetMainWindow ();
1599
/* force the main window to show if no status icon for the user */
1600
if (!gtk_status_icon_is_embedded (GTK_STATUS_ICON (status_icon)))
1601
gtk_widget_show (main_window);
1605
gm_mw_init_uri_toolbar (GtkWidget *main_window)
1607
GmMainWindow *mw = NULL;
1609
GtkToolItem *item = NULL;
1611
GtkWidget *toolbar = NULL;
1612
GtkEntryCompletion *completion = NULL;
1614
g_return_val_if_fail (main_window != NULL, NULL);
1615
mw = gm_mw_get_mw (main_window);
1616
g_return_val_if_fail (mw != NULL, NULL);
1619
/* The main horizontal toolbar */
1620
toolbar = gtk_toolbar_new ();
1621
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
1622
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE);
1627
item = gtk_tool_item_new ();
1628
mw->entry = gtk_entry_new ();
1629
mw->completion = gtk_list_store_new (1, G_TYPE_STRING);
1630
completion = gtk_entry_completion_new ();
1631
gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion), GTK_TREE_MODEL (mw->completion));
1632
gtk_entry_set_completion (GTK_ENTRY (mw->entry), completion);
1633
gtk_entry_completion_set_inline_completion (GTK_ENTRY_COMPLETION (completion), false);
1634
gtk_entry_completion_set_popup_completion (GTK_ENTRY_COMPLETION (completion), true);
1635
gtk_entry_completion_set_text_column (GTK_ENTRY_COMPLETION (completion), 0);
1637
gtk_container_add (GTK_CONTAINER (item), mw->entry);
1638
gtk_container_set_border_width (GTK_CONTAINER (item), 0);
1639
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), true);
1641
gtk_entry_set_text (GTK_ENTRY (mw->entry), "sip:");
1643
// activate Ctrl-L to get the entry focus
1644
gtk_widget_add_accelerator (mw->entry, "grab-focus",
1646
(GdkModifierType) GDK_CONTROL_MASK,
1649
gtk_editable_set_position (GTK_EDITABLE (GTK_WIDGET (mw->entry)), -1);
1651
g_signal_connect (G_OBJECT (mw->entry), "changed",
1652
GTK_SIGNAL_FUNC (url_changed_cb), main_window);
1653
g_signal_connect (G_OBJECT (mw->entry), "activate",
1654
GTK_SIGNAL_FUNC (place_call_cb), main_window);
1656
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
1658
/* The connect button */
1659
item = gtk_tool_item_new ();
1660
mw->connect_button = gm_connect_button_new (GM_STOCK_PHONE_PICK_UP_24,
1661
GM_STOCK_PHONE_HANG_UP_24,
1662
GTK_ICON_SIZE_LARGE_TOOLBAR);
1663
gtk_container_add (GTK_CONTAINER (item), mw->connect_button);
1664
gtk_container_set_border_width (GTK_CONTAINER (mw->connect_button), 0);
1665
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
1667
gtk_widget_set_tooltip_text (GTK_WIDGET (mw->connect_button),
1668
_("Enter a URI on the left, and click this button to place a call"));
1670
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
1672
g_signal_connect (G_OBJECT (mw->connect_button), "clicked",
1673
G_CALLBACK (toggle_call_cb),
1676
gtk_widget_show_all (GTK_WIDGET (toolbar));
1683
gm_mw_init_status_toolbar (GtkWidget *main_window)
1685
GmMainWindow *mw = NULL;
1687
GtkWidget *toolbar = NULL;
1688
GtkToolItem *item = NULL;
1690
g_return_val_if_fail (main_window != NULL, NULL);
1691
mw = gm_mw_get_mw (main_window);
1692
g_return_val_if_fail (mw != NULL, NULL);
1695
/* The main horizontal toolbar */
1696
toolbar = gtk_toolbar_new ();
1697
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
1698
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE);
1700
item = gtk_tool_item_new ();
1701
mw->status_option_menu = status_menu_new ();
1702
status_menu_set_parent_window (STATUS_MENU (mw->status_option_menu),
1703
GTK_WINDOW (main_window));
1704
gtk_container_add (GTK_CONTAINER (item), mw->status_option_menu);
1705
gtk_container_set_border_width (GTK_CONTAINER (item), 0);
1706
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), TRUE);
1708
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
1710
gtk_widget_show_all (toolbar);
1717
gm_mw_init_menu (GtkWidget *main_window)
1719
GmMainWindow *mw = NULL;
1721
Ekiga::ServiceCore *services = NULL;
1722
Ekiga::Trigger *local_cluster_trigger = NULL;
1723
GtkFrontend *gtk_frontend = NULL;
1725
GtkWidget *addressbook_window = NULL;
1726
GtkWidget *accounts_window = NULL;
1728
bool show_call_panel = false;
1730
PanelSection cps = DIALPAD;
1732
g_return_if_fail (main_window != NULL);
1733
mw = gm_mw_get_mw (main_window);
1735
services = GnomeMeeting::Process ()->GetServiceCore ();
1736
local_cluster_trigger = dynamic_cast<Ekiga::Trigger *>(services->get ("local-cluster"));
1737
gtk_frontend = dynamic_cast<GtkFrontend *>(services->get ("gtk-frontend"));
1738
addressbook_window = GTK_WIDGET (gtk_frontend->get_addressbook_window ());
1739
accounts_window = GnomeMeeting::Process ()->GetAccountsWindow ();
1741
mw->main_menu = gtk_menu_bar_new ();
1743
/* Default values */
1744
show_call_panel = gm_conf_get_bool (USER_INTERFACE_KEY "main_window/show_call_panel");
1745
cps = (PanelSection) gm_conf_get_int (USER_INTERFACE_KEY "main_window/panel_section");
1747
static MenuEntry gnomemeeting_menu [] =
1749
GTK_MENU_NEW (_("_Chat")),
1751
GTK_MENU_ENTRY("connect", _("Ca_ll"), _("Place a new call"),
1752
GM_STOCK_PHONE_PICK_UP_16, 'o',
1753
GTK_SIGNAL_FUNC (place_call_cb), main_window, TRUE),
1754
GTK_MENU_ENTRY("disconnect", _("_Hang up"),
1755
_("Terminate the current call"),
1756
GM_STOCK_PHONE_HANG_UP_16, GDK_Escape,
1757
GTK_SIGNAL_FUNC (hangup_call_cb), main_window, FALSE),
1761
GTK_MENU_ENTRY("add_contact", _("A_dd Contact"), _("Add a contact to the roster"),
1763
GTK_SIGNAL_FUNC (pull_trigger_cb), local_cluster_trigger, true),
1765
GTK_MENU_THEME_ENTRY("address_book", _("Address _Book"),
1767
GM_ICON_ADDRESSBOOK, 'b',
1768
GTK_SIGNAL_FUNC (show_widget_cb),
1769
(gpointer) addressbook_window, TRUE),
1773
GTK_MENU_ENTRY("contact", _("_Contact"),
1774
_("Act on selected contact"),
1775
GTK_STOCK_EXECUTE, 0,
1780
GTK_MENU_ENTRY("hold_call", _("H_old Call"), _("Hold the current call"),
1782
GTK_SIGNAL_FUNC (hold_current_call_cb), main_window,
1784
GTK_MENU_ENTRY("transfer_call", _("_Transfer Call"),
1785
_("Transfer the current call"),
1787
GTK_SIGNAL_FUNC (transfer_current_call_cb), main_window,
1792
GTK_MENU_ENTRY("suspend_audio", _("Suspend _Audio"),
1793
_("Suspend or resume the audio transmission"),
1795
GTK_SIGNAL_FUNC (toggle_audio_stream_pause_cb),
1796
main_window, FALSE),
1797
GTK_MENU_ENTRY("suspend_video", _("Suspend _Video"),
1798
_("Suspend or resume the video transmission"),
1800
GTK_SIGNAL_FUNC (toggle_video_stream_pause_cb),
1801
main_window, FALSE),
1805
GTK_MENU_ENTRY("close", NULL, _("Close the Ekiga window"),
1806
GTK_STOCK_CLOSE, 'W',
1807
GTK_SIGNAL_FUNC (window_closed_from_menu_cb),
1808
(gpointer) main_window, TRUE),
1812
GTK_MENU_ENTRY("quit", NULL, _("Quit"),
1813
GTK_STOCK_QUIT, 'Q',
1814
GTK_SIGNAL_FUNC (quit_callback), NULL, TRUE),
1816
GTK_MENU_NEW (_("_Edit")),
1818
GTK_MENU_ENTRY("configuration_assistant", _("_Configuration Assistant"),
1819
_("Run the configuration assistant"),
1821
G_CALLBACK (show_assistant_window_cb),
1826
GTK_MENU_ENTRY("accounts", _("_Accounts"),
1827
_("Edit your accounts"),
1829
GTK_SIGNAL_FUNC (show_window_cb),
1830
(gpointer) accounts_window, TRUE),
1832
GTK_MENU_ENTRY("preferences", NULL,
1833
_("Change your preferences"),
1834
GTK_STOCK_PREFERENCES, 0,
1835
G_CALLBACK (show_prefs_window_cb),
1838
GTK_MENU_NEW(_("_View")),
1840
GTK_MENU_RADIO_ENTRY("contacts", _("Con_tacts"), _("View the contacts list"),
1842
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
1843
(gpointer) USER_INTERFACE_KEY "main_window/panel_section",
1844
(cps == CONTACTS), TRUE),
1845
GTK_MENU_RADIO_ENTRY("dialpad", _("_Dialpad"), _("View the dialpad"),
1847
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
1848
(gpointer) USER_INTERFACE_KEY "main_window/panel_section",
1849
(cps == DIALPAD), TRUE),
1850
GTK_MENU_RADIO_ENTRY("callhistory", _("_Call History"), _("View the call history"),
1852
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
1853
(gpointer) USER_INTERFACE_KEY "main_window/panel_section",
1854
(cps == CALL), TRUE),
1858
GTK_MENU_TOGGLE_ENTRY("callpanel", _("_Show Call Panel"), _("Show the call panel"),
1860
GTK_SIGNAL_FUNC (toggle_menu_changed_cb),
1861
(gpointer) USER_INTERFACE_KEY "main_window/show_call_panel",
1862
show_call_panel, TRUE),
1866
GTK_MENU_RADIO_ENTRY("local_video", _("_Local Video"),
1867
_("Local video image"),
1869
GTK_SIGNAL_FUNC (display_changed_cb),
1870
(gpointer) VIDEO_DISPLAY_KEY "video_view",
1872
GTK_MENU_RADIO_ENTRY("remote_video", _("_Remote Video"),
1873
_("Remote video image"),
1875
GTK_SIGNAL_FUNC (display_changed_cb),
1876
(gpointer) VIDEO_DISPLAY_KEY "video_view",
1878
GTK_MENU_RADIO_ENTRY("both_incrusted", _("_Picture-in-Picture"),
1879
_("Both video images"),
1881
GTK_SIGNAL_FUNC (display_changed_cb),
1882
(gpointer) VIDEO_DISPLAY_KEY "video_view",
1884
GTK_MENU_RADIO_ENTRY("both_incrusted_window", _("Picture-in-Picture in Separate _Window"),
1885
_("Both video images"),
1887
GTK_SIGNAL_FUNC (display_changed_cb),
1888
(gpointer) VIDEO_DISPLAY_KEY "video_view",
1892
GTK_MENU_ENTRY("zoom_in", NULL, _("Zoom in"),
1893
GTK_STOCK_ZOOM_IN, '+',
1894
GTK_SIGNAL_FUNC (zoom_in_changed_cb),
1895
(gpointer) VIDEO_DISPLAY_KEY "zoom", FALSE),
1896
GTK_MENU_ENTRY("zoom_out", NULL, _("Zoom out"),
1897
GTK_STOCK_ZOOM_OUT, '-',
1898
GTK_SIGNAL_FUNC (zoom_out_changed_cb),
1899
(gpointer) VIDEO_DISPLAY_KEY "zoom", FALSE),
1900
GTK_MENU_ENTRY("normal_size", NULL, _("Normal size"),
1901
GTK_STOCK_ZOOM_100, '0',
1902
GTK_SIGNAL_FUNC (zoom_normal_changed_cb),
1903
(gpointer) VIDEO_DISPLAY_KEY "zoom", FALSE),
1904
GTK_MENU_ENTRY("fullscreen", _("_Fullscreen"), _("Switch to fullscreen"),
1905
GTK_STOCK_ZOOM_IN, GDK_F11,
1906
GTK_SIGNAL_FUNC (fullscreen_changed_cb),
1907
(gpointer) main_window, FALSE),
1909
GTK_MENU_NEW(_("_Help")),
1911
GTK_MENU_ENTRY("help", NULL,
1912
_("Get help by reading the Ekiga manual"),
1913
GTK_STOCK_HELP, GDK_F1,
1914
GTK_SIGNAL_FUNC (help_cb), NULL, TRUE),
1916
GTK_MENU_ENTRY("about", NULL,
1917
_("View information about Ekiga"),
1919
GTK_SIGNAL_FUNC (about_callback), (gpointer) main_window,
1926
gtk_build_menu (mw->main_menu,
1931
gtk_widget_show_all (GTK_WIDGET (mw->main_menu));
1936
gm_mw_init_contacts_list (GtkWidget *main_window)
1938
GmMainWindow *mw = NULL;
1940
GtkWidget *label = NULL;
1942
GtkFrontend *gtk_frontend = NULL;
1943
Ekiga::ServiceCore *services = NULL;
1944
GtkWidget* roster_view = NULL;
1946
g_return_if_fail (main_window != NULL);
1947
mw = gm_mw_get_mw (main_window);
1949
services = GnomeMeeting::Process ()->GetServiceCore ();
1950
g_return_if_fail (services != NULL);
1952
gtk_frontend = dynamic_cast<GtkFrontend *>(services->get ("gtk-frontend"));
1954
label = gtk_label_new (_("Contacts"));
1955
roster_view = GTK_WIDGET (gtk_frontend->get_roster_view ());
1956
gtk_notebook_append_page (GTK_NOTEBOOK (mw->main_notebook),
1957
roster_view, label);
1958
g_signal_connect (G_OBJECT (roster_view), "presentity-selected",
1959
G_CALLBACK (on_presentity_selected), main_window);
1964
gm_mw_init_dialpad (GtkWidget *main_window)
1966
GmMainWindow *mw = NULL;
1968
GtkWidget *dialpad = NULL;
1969
GtkWidget *alignment = NULL;
1970
GtkWidget *label = NULL;
1972
g_return_if_fail (main_window != NULL);
1973
mw = gm_mw_get_mw (main_window);
1975
dialpad = ekiga_dialpad_new (mw->accel);
1976
g_signal_connect (dialpad, "button-clicked",
1977
G_CALLBACK (dialpad_button_clicked_cb), main_window);
1979
alignment = gtk_alignment_new (0.5, 0.5, 0.2, 0.2);
1980
gtk_container_add (GTK_CONTAINER (alignment), dialpad);
1982
label = gtk_label_new (_("Dialpad"));
1983
gtk_notebook_append_page (GTK_NOTEBOOK (mw->main_notebook),
1989
gm_mw_video_settings_window_new (GtkWidget *main_window)
1991
GmMainWindow *mw = NULL;
1993
GtkWidget *hbox = NULL;
1994
GtkWidget *vbox = NULL;
1995
GtkWidget *image = NULL;
1996
GtkWidget *window = NULL;
1998
GtkWidget *hscale_brightness = NULL;
1999
GtkWidget *hscale_colour = NULL;
2000
GtkWidget *hscale_contrast = NULL;
2001
GtkWidget *hscale_whiteness = NULL;
2003
int brightness = 0, colour = 0, contrast = 0, whiteness = 0;
2005
g_return_val_if_fail (main_window != NULL, NULL);
2006
mw = gm_mw_get_mw (main_window);
2009
/* Build the window */
2010
window = gtk_dialog_new ();
2011
g_object_set_data_full (G_OBJECT (window), "window_name",
2012
g_strdup ("video_settings_window"), g_free);
2013
gtk_dialog_add_button (GTK_DIALOG (window),
2015
GTK_RESPONSE_CANCEL);
2017
gtk_window_set_title (GTK_WINDOW (window),
2018
_("Video Settings"));
2020
/* Webcam Control Frame, we need it to disable controls */
2021
mw->video_settings_frame = gtk_frame_new (NULL);
2022
gtk_frame_set_shadow_type (GTK_FRAME (mw->video_settings_frame),
2024
gtk_container_set_border_width (GTK_CONTAINER (mw->video_settings_frame), 5);
2027
vbox = gtk_vbox_new (0, FALSE);
2028
gtk_container_add (GTK_CONTAINER (mw->video_settings_frame), vbox);
2031
hbox = gtk_hbox_new (0, FALSE);
2032
image = gtk_image_new_from_icon_name (GM_ICON_BRIGHTNESS, GTK_ICON_SIZE_MENU);
2033
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
2035
mw->adj_brightness = gtk_adjustment_new (brightness, 0.0,
2036
255.0, 1.0, 5.0, 1.0);
2037
hscale_brightness = gtk_hscale_new (GTK_ADJUSTMENT (mw->adj_brightness));
2038
gtk_range_set_update_policy (GTK_RANGE (hscale_brightness),
2039
GTK_UPDATE_DELAYED);
2040
gtk_scale_set_draw_value (GTK_SCALE (hscale_brightness), FALSE);
2041
gtk_scale_set_value_pos (GTK_SCALE (hscale_brightness), GTK_POS_RIGHT);
2042
gtk_box_pack_start (GTK_BOX (hbox), hscale_brightness, TRUE, TRUE, 2);
2043
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
2045
gtk_widget_set_tooltip_text (hscale_brightness, _("Adjust brightness"));
2047
g_signal_connect (G_OBJECT (mw->adj_brightness), "value-changed",
2048
G_CALLBACK (video_settings_changed_cb),
2049
(gpointer) main_window);
2052
hbox = gtk_hbox_new (0, FALSE);
2053
image = gtk_image_new_from_icon_name (GM_ICON_WHITENESS, GTK_ICON_SIZE_MENU);
2054
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
2056
mw->adj_whiteness = gtk_adjustment_new (whiteness, 0.0,
2057
255.0, 1.0, 5.0, 1.0);
2058
hscale_whiteness = gtk_hscale_new (GTK_ADJUSTMENT (mw->adj_whiteness));
2059
gtk_range_set_update_policy (GTK_RANGE (hscale_whiteness),
2060
GTK_UPDATE_DELAYED);
2061
gtk_scale_set_draw_value (GTK_SCALE (hscale_whiteness), FALSE);
2062
gtk_scale_set_value_pos (GTK_SCALE (hscale_whiteness), GTK_POS_RIGHT);
2063
gtk_box_pack_start (GTK_BOX (hbox), hscale_whiteness, TRUE, TRUE, 2);
2064
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
2066
gtk_widget_set_tooltip_text (hscale_whiteness, _("Adjust whiteness"));
2068
g_signal_connect (G_OBJECT (mw->adj_whiteness), "value-changed",
2069
G_CALLBACK (video_settings_changed_cb),
2070
(gpointer) main_window);
2073
hbox = gtk_hbox_new (0, FALSE);
2074
image = gtk_image_new_from_icon_name (GM_ICON_COLOURNESS, GTK_ICON_SIZE_MENU);
2075
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
2077
mw->adj_colour = gtk_adjustment_new (colour, 0.0,
2078
255.0, 1.0, 5.0, 1.0);
2079
hscale_colour = gtk_hscale_new (GTK_ADJUSTMENT (mw->adj_colour));
2080
gtk_range_set_update_policy (GTK_RANGE (hscale_colour),
2081
GTK_UPDATE_DELAYED);
2082
gtk_scale_set_draw_value (GTK_SCALE (hscale_colour), FALSE);
2083
gtk_scale_set_value_pos (GTK_SCALE (hscale_colour), GTK_POS_RIGHT);
2084
gtk_box_pack_start (GTK_BOX (hbox), hscale_colour, TRUE, TRUE, 2);
2085
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
2087
gtk_widget_set_tooltip_text (hscale_colour, _("Adjust color"));
2089
g_signal_connect (G_OBJECT (mw->adj_colour), "value-changed",
2090
G_CALLBACK (video_settings_changed_cb),
2091
(gpointer) main_window);
2094
hbox = gtk_hbox_new (0, FALSE);
2095
image = gtk_image_new_from_icon_name (GM_ICON_CONTRAST, GTK_ICON_SIZE_MENU);
2096
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
2098
mw->adj_contrast = gtk_adjustment_new (contrast, 0.0,
2099
255.0, 1.0, 5.0, 1.0);
2100
hscale_contrast = gtk_hscale_new (GTK_ADJUSTMENT (mw->adj_contrast));
2101
gtk_range_set_update_policy (GTK_RANGE (hscale_contrast),
2102
GTK_UPDATE_DELAYED);
2103
gtk_scale_set_draw_value (GTK_SCALE (hscale_contrast), FALSE);
2104
gtk_scale_set_value_pos (GTK_SCALE (hscale_contrast), GTK_POS_RIGHT);
2105
gtk_box_pack_start (GTK_BOX (hbox), hscale_contrast, TRUE, TRUE, 2);
2106
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
2108
gtk_widget_set_tooltip_text (hscale_contrast, _("Adjust contrast"));
2110
g_signal_connect (G_OBJECT (mw->adj_contrast), "value-changed",
2111
G_CALLBACK (video_settings_changed_cb),
2112
(gpointer) main_window);
2114
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (window)->vbox),
2115
mw->video_settings_frame);
2116
gtk_widget_show_all (mw->video_settings_frame);
2118
gtk_widget_set_sensitive (GTK_WIDGET (mw->video_settings_frame), FALSE);
2120
/* That's an usual GtkWindow, connect it to the signals */
2121
g_signal_connect_swapped (GTK_OBJECT (window),
2123
G_CALLBACK (gnomemeeting_window_hide),
2126
g_signal_connect (GTK_OBJECT (window),
2128
G_CALLBACK (delete_window_cb), NULL);
2136
gm_mw_audio_settings_window_new (GtkWidget *main_window)
2138
GmMainWindow *mw = NULL;
2140
GtkWidget *hscale_play = NULL;
2141
GtkWidget *hscale_rec = NULL;
2142
GtkWidget *hbox = NULL;
2143
GtkWidget *vbox = NULL;
2144
GtkWidget *small_vbox = NULL;
2145
GtkWidget *window = NULL;
2148
/* Get the data from the GMObject */
2149
g_return_val_if_fail (main_window != NULL, NULL);
2150
mw = gm_mw_get_mw (main_window);
2153
/* Build the window */
2154
window = gtk_dialog_new ();
2155
g_object_set_data_full (G_OBJECT (window), "window_name",
2156
g_strdup ("audio_settings_window"), g_free);
2157
gtk_dialog_add_button (GTK_DIALOG (window),
2159
GTK_RESPONSE_CANCEL);
2161
gtk_window_set_title (GTK_WINDOW (window),
2162
_("Audio Settings"));
2164
/* Audio control frame, we need it to disable controls */
2165
mw->audio_output_volume_frame = gtk_frame_new (NULL);
2166
gtk_frame_set_shadow_type (GTK_FRAME (mw->audio_output_volume_frame),
2168
gtk_container_set_border_width (GTK_CONTAINER (mw->audio_output_volume_frame), 5);
2172
vbox = gtk_vbox_new (0, FALSE);
2173
gtk_container_add (GTK_CONTAINER (mw->audio_output_volume_frame), vbox);
2176
hbox = gtk_hbox_new (0, FALSE);
2177
gtk_box_pack_start (GTK_BOX (hbox),
2178
gtk_image_new_from_icon_name (GM_ICON_AUDIO_VOLUME_HIGH,
2179
GTK_ICON_SIZE_SMALL_TOOLBAR),
2182
small_vbox = gtk_vbox_new (0, FALSE);
2183
mw->adj_output_volume = gtk_adjustment_new (0, 0.0, 101.0, 1.0, 5.0, 1.0);
2184
hscale_play = gtk_hscale_new (GTK_ADJUSTMENT (mw->adj_output_volume));
2185
gtk_range_set_update_policy (GTK_RANGE (hscale_play),
2186
GTK_UPDATE_DELAYED);
2187
gtk_scale_set_value_pos (GTK_SCALE (hscale_play), GTK_POS_RIGHT);
2188
gtk_scale_set_draw_value (GTK_SCALE (hscale_play), FALSE);
2189
gtk_box_pack_start (GTK_BOX (small_vbox), hscale_play, TRUE, TRUE, 0);
2191
mw->output_signal = gtk_levelmeter_new ();
2192
gtk_box_pack_start (GTK_BOX (small_vbox), mw->output_signal, TRUE, TRUE, 0);
2193
gtk_box_pack_start (GTK_BOX (hbox), small_vbox, TRUE, TRUE, 2);
2194
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
2196
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (window)->vbox),
2197
mw->audio_output_volume_frame);
2198
gtk_widget_show_all (mw->audio_output_volume_frame);
2199
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_output_volume_frame), FALSE);
2201
/* Audio control frame, we need it to disable controls */
2202
mw->audio_input_volume_frame = gtk_frame_new (NULL);
2203
gtk_frame_set_shadow_type (GTK_FRAME (mw->audio_input_volume_frame),
2205
gtk_container_set_border_width (GTK_CONTAINER (mw->audio_input_volume_frame), 5);
2208
vbox = gtk_vbox_new (0, FALSE);
2209
gtk_container_add (GTK_CONTAINER (mw->audio_input_volume_frame), vbox);
2212
hbox = gtk_hbox_new (0, FALSE);
2213
gtk_box_pack_start (GTK_BOX (hbox),
2214
gtk_image_new_from_icon_name (GM_ICON_MICROPHONE,
2215
GTK_ICON_SIZE_SMALL_TOOLBAR),
2218
small_vbox = gtk_vbox_new (0, FALSE);
2219
mw->adj_input_volume = gtk_adjustment_new (0, 0.0, 101.0, 1.0, 5.0, 1.0);
2220
hscale_rec = gtk_hscale_new (GTK_ADJUSTMENT (mw->adj_input_volume));
2221
gtk_range_set_update_policy (GTK_RANGE (hscale_rec),
2222
GTK_UPDATE_DELAYED);
2223
gtk_scale_set_value_pos (GTK_SCALE (hscale_rec), GTK_POS_RIGHT);
2224
gtk_scale_set_draw_value (GTK_SCALE (hscale_rec), FALSE);
2225
gtk_box_pack_start (GTK_BOX (small_vbox), hscale_rec, TRUE, TRUE, 0);
2227
mw->input_signal = gtk_levelmeter_new ();
2228
gtk_box_pack_start (GTK_BOX (small_vbox), mw->input_signal, TRUE, TRUE, 0);
2229
gtk_box_pack_start (GTK_BOX (hbox), small_vbox, TRUE, TRUE, 2);
2230
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
2232
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (window)->vbox),
2233
mw->audio_input_volume_frame);
2234
gtk_widget_show_all (mw->audio_input_volume_frame);
2235
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_input_volume_frame), FALSE);
2237
g_signal_connect (G_OBJECT (mw->adj_output_volume), "value-changed",
2238
G_CALLBACK (audio_volume_changed_cb), main_window);
2240
g_signal_connect (G_OBJECT (mw->adj_input_volume), "value-changed",
2241
G_CALLBACK (audio_volume_changed_cb), main_window);
2246
/* That's an usual GtkWindow, connect it to the signals */
2247
g_signal_connect_swapped (GTK_OBJECT (window),
2249
G_CALLBACK (gnomemeeting_window_hide),
2252
g_signal_connect (GTK_OBJECT (window),
2254
G_CALLBACK (delete_window_cb), NULL);
2256
g_signal_connect (G_OBJECT (window), "show",
2257
GTK_SIGNAL_FUNC (audio_volume_window_shown_cb), main_window);
2259
g_signal_connect (G_OBJECT (window), "hide",
2260
GTK_SIGNAL_FUNC (audio_volume_window_hidden_cb), main_window);
2267
gm_mw_init_call (GtkWidget *main_window)
2269
GmMainWindow *mw = NULL;
2271
GtkWidget *frame = NULL;
2272
GtkWidget *event_box = NULL;
2273
GtkWidget *table = NULL;
2275
GtkWidget *toolbar = NULL;
2276
GtkToolItem *item = NULL;
2278
GtkWidget *image = NULL;
2279
GtkWidget *alignment = NULL;
2282
gdk_color_parse ("white", &white);
2284
/* Get the data from the GMObject */
2285
mw = gm_mw_get_mw (main_window);
2287
/* The main table */
2288
frame = gtk_frame_new (NULL);
2289
event_box = gtk_event_box_new ();
2290
gtk_widget_modify_bg (event_box, GTK_STATE_PRELIGHT, &white);
2291
gtk_widget_modify_bg (event_box, GTK_STATE_NORMAL, &white);
2292
table = gtk_table_new (3, 4, FALSE);
2293
gtk_container_add (GTK_CONTAINER (event_box), table);
2294
gtk_container_add (GTK_CONTAINER (frame), event_box);
2296
/* The frame that contains the video */
2297
mw->video_frame = gtk_frame_new (NULL);
2298
gtk_frame_set_shadow_type (GTK_FRAME (mw->video_frame),
2301
mw->main_video_image = gtk_image_new ();
2302
gtk_container_set_border_width (GTK_CONTAINER (mw->video_frame), 0);
2303
gtk_container_add (GTK_CONTAINER (mw->video_frame), mw->main_video_image);
2304
gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (mw->video_frame),
2306
(GtkAttachOptions) GTK_EXPAND,
2307
(GtkAttachOptions) GTK_EXPAND,
2310
/* The frame that contains information about the call */
2312
GtkTextBuffer *buffer = NULL;
2314
mw->info_text = gtk_text_view_new ();
2315
gtk_widget_modify_bg (mw->info_text, GTK_STATE_PRELIGHT, &white);
2316
gtk_widget_modify_bg (mw->info_text, GTK_STATE_NORMAL, &white);
2317
gtk_widget_modify_bg (mw->info_text, GTK_STATE_INSENSITIVE, &white);
2319
gtk_text_view_set_editable (GTK_TEXT_VIEW (mw->info_text), FALSE);
2320
gtk_widget_set_sensitive (GTK_WIDGET (mw->info_text), FALSE);
2321
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (mw->info_text),
2324
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (mw->info_text));
2325
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (mw->info_text), FALSE);
2327
gtk_text_buffer_create_tag (buffer, "status",
2328
"foreground", "black",
2329
"paragraph-background", "white",
2330
"justification", GTK_JUSTIFY_CENTER,
2331
"weight", PANGO_WEIGHT_BOLD,
2334
gtk_text_buffer_create_tag (buffer, "codecs",
2335
"justification", GTK_JUSTIFY_RIGHT,
2336
"stretch", PANGO_STRETCH_CONDENSED,
2337
"foreground", "darkgray",
2338
"paragraph-background", "white",
2340
gtk_text_buffer_create_tag (buffer, "call-duration",
2341
"foreground", "black",
2342
"paragraph-background", "white",
2343
"justification", GTK_JUSTIFY_CENTER,
2344
"weight", PANGO_WEIGHT_BOLD,
2347
gm_main_window_set_status (main_window, _("Standby"));
2348
gm_main_window_set_call_duration (main_window, NULL);
2349
gm_main_window_set_call_info (main_window, NULL, NULL, NULL, NULL);
2351
alignment = gtk_alignment_new (0.0, 0.0, 1.0, 0.0);
2352
gtk_container_add (GTK_CONTAINER (alignment), mw->info_text);
2353
gtk_table_attach (GTK_TABLE (table), alignment,
2355
(GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
2356
(GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
2360
toolbar = gtk_toolbar_new ();
2361
gtk_widget_modify_bg (toolbar, GTK_STATE_PRELIGHT, &white);
2362
gtk_widget_modify_bg (toolbar, GTK_STATE_NORMAL, &white);
2363
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
2364
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE);
2367
item = gtk_tool_item_new ();
2368
mw->audio_settings_button = gtk_button_new ();
2369
gtk_button_set_relief (GTK_BUTTON (mw->audio_settings_button), GTK_RELIEF_NONE);
2370
image = gtk_image_new_from_icon_name (GM_ICON_AUDIO_VOLUME_HIGH,
2371
GTK_ICON_SIZE_MENU);
2372
gtk_container_add (GTK_CONTAINER (mw->audio_settings_button), image);
2373
gtk_container_add (GTK_CONTAINER (item), mw->audio_settings_button);
2374
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
2376
gtk_widget_show (mw->audio_settings_button);
2377
gtk_widget_set_sensitive (mw->audio_settings_button, FALSE);
2378
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
2379
GTK_TOOL_ITEM (item), -1);
2380
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item),
2381
_("Change the volume of your soundcard"));
2382
g_signal_connect (G_OBJECT (mw->audio_settings_button), "clicked",
2383
G_CALLBACK (show_window_cb),
2384
(gpointer) mw->audio_settings_window);
2386
/* Video Settings */
2387
item = gtk_tool_item_new ();
2388
mw->video_settings_button = gtk_button_new ();
2389
gtk_button_set_relief (GTK_BUTTON (mw->video_settings_button), GTK_RELIEF_NONE);
2390
image = gtk_image_new_from_stock (GM_STOCK_COLOR_BRIGHTNESS_CONTRAST,
2391
GTK_ICON_SIZE_MENU);
2392
gtk_container_add (GTK_CONTAINER (mw->video_settings_button), image);
2393
gtk_container_add (GTK_CONTAINER (item), mw->video_settings_button);
2394
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
2396
gtk_widget_show (mw->video_settings_button);
2397
gtk_widget_set_sensitive (mw->video_settings_button, FALSE);
2398
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
2399
GTK_TOOL_ITEM (item), -1);
2400
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item),
2401
_("Change the color settings of your video device"));
2403
g_signal_connect (G_OBJECT (mw->video_settings_button), "clicked",
2404
G_CALLBACK (show_window_cb),
2405
(gpointer) mw->video_settings_window);
2407
/* Video Preview Button */
2408
item = gtk_tool_item_new ();
2409
mw->preview_button = gtk_toggle_button_new ();
2410
gtk_button_set_relief (GTK_BUTTON (mw->preview_button), GTK_RELIEF_NONE);
2411
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mw->preview_button),
2412
gm_conf_get_bool (VIDEO_DEVICES_KEY "enable_preview"));
2413
image = gtk_image_new_from_icon_name (GM_ICON_CAMERA_VIDEO,
2414
GTK_ICON_SIZE_MENU);
2415
gtk_container_add (GTK_CONTAINER (mw->preview_button), image);
2416
gtk_container_add (GTK_CONTAINER (item), mw->preview_button);
2417
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
2419
gtk_widget_show (mw->preview_button);
2420
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
2421
GTK_TOOL_ITEM (item), -1);
2422
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item),
2423
_("Display images from your camera device"));
2425
g_signal_connect (G_OBJECT (mw->preview_button), "toggled",
2426
G_CALLBACK (toolbar_toggle_button_changed_cb),
2427
(gpointer) VIDEO_DEVICES_KEY "enable_preview");
2430
item = gtk_tool_item_new ();
2431
mw->hold_button = gtk_toggle_button_new ();
2432
image = gtk_image_new_from_icon_name (GM_ICON_MEDIA_PLAYBACK_PAUSE,
2433
GTK_ICON_SIZE_MENU);
2434
gtk_button_set_relief (GTK_BUTTON (mw->hold_button), GTK_RELIEF_NONE);
2435
gtk_container_add (GTK_CONTAINER (mw->hold_button), image);
2436
gtk_container_add (GTK_CONTAINER (item), mw->hold_button);
2437
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
2439
gtk_widget_show (mw->hold_button);
2440
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
2441
GTK_TOOL_ITEM (item), -1);
2442
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item),
2443
_("Hold the current call"));
2444
gtk_widget_set_sensitive (GTK_WIDGET (mw->hold_button), FALSE);
2446
g_signal_connect (G_OBJECT (mw->hold_button), "clicked",
2447
G_CALLBACK (hold_current_call_cb), main_window);
2449
alignment = gtk_alignment_new (0.0, 0.0, 1.0, 0.0);
2450
gtk_container_add (GTK_CONTAINER (alignment), toolbar);
2451
gtk_table_attach (GTK_TABLE (table), alignment,
2453
(GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
2454
(GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
2457
gtk_paned_pack2 (GTK_PANED (mw->hpaned), frame, true, false);
2461
gm_mw_init_history (GtkWidget *main_window)
2463
GmMainWindow *mw = NULL;
2464
Ekiga::ServiceCore *services = NULL;
2465
GtkWidget *label = NULL;
2466
GtkFrontend *gtk_frontend = NULL;
2468
g_return_if_fail (main_window != NULL);
2469
mw = gm_mw_get_mw (main_window);
2471
services = GnomeMeeting::Process ()->GetServiceCore ();
2472
g_return_if_fail (services != NULL);
2474
gtk_frontend = dynamic_cast<GtkFrontend *>(services->get ("gtk-frontend"));
2476
label = gtk_label_new (_("Call history"));
2477
gtk_notebook_append_page (GTK_NOTEBOOK (mw->main_notebook),
2478
GTK_WIDGET (gtk_frontend->get_call_history_view ()),
2483
gm_mw_zooms_menu_update_sensitivity (GtkWidget *main_window,
2486
GmMainWindow *mw = NULL;
2488
mw = gm_mw_get_mw (main_window);
2490
g_return_if_fail (mw != NULL);
2492
/* between 0.5 and 2.0 zoom */
2493
/* like above, also update the popup menus of the separate video windows */
2494
gtk_menu_set_sensitive (mw->main_menu, "zoom_in",
2495
(zoom == 200) ? FALSE : TRUE);
2497
gtk_menu_set_sensitive (mw->main_menu, "zoom_out",
2498
(zoom == 50) ? FALSE : TRUE);
2500
gtk_menu_set_sensitive (mw->main_menu, "normal_size",
2501
(zoom == 100) ? FALSE : TRUE);
2507
gnomemeeting_tray_hack_cb (G_GNUC_UNUSED gpointer data)
2509
GtkWidget *main_window = NULL;
2510
GtkStatusIcon *statusicon = NULL;
2512
statusicon = GTK_STATUS_ICON (GnomeMeeting::Process ()->GetStatusicon ());
2513
main_window = GnomeMeeting::Process ()->GetMainWindow ();
2515
//gdk_threads_enter ();
2517
if (!gtk_status_icon_is_embedded (GTK_STATUS_ICON (statusicon)))
2518
gtk_widget_show (main_window);
2520
//gdk_threads_leave ();
2527
on_presentity_selected (G_GNUC_UNUSED GtkWidget* view,
2528
Ekiga::Presentity* presentity,
2531
GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
2533
g_return_if_fail (mw != NULL);
2535
mw->presentity = presentity;
2537
gm_main_window_selected_presentity_build_menu (GTK_WIDGET (self));
2542
on_chat_unread_alert (G_GNUC_UNUSED GtkWidget* widget,
2543
G_GNUC_UNUSED gpointer data)
2545
if (!gm_conf_get_bool (SOUND_EVENTS_KEY "enable_new_message_sound"))
2548
Ekiga::ServiceCore *core = GnomeMeeting::Process ()->GetServiceCore ();
2549
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
2551
std::string file_name_string = gm_conf_get_string (SOUND_EVENTS_KEY "new_message_sound");
2553
if (!file_name_string.empty ())
2554
audiooutput_core->play_file(file_name_string);
2559
panel_section_changed_nt (G_GNUC_UNUSED gpointer id,
2565
g_return_if_fail (data != NULL);
2567
if (gm_conf_entry_get_type (entry) == GM_CONF_INT) {
2569
//gdk_threads_enter ();
2570
section = gm_conf_entry_get_int (entry);
2571
gm_main_window_set_panel_section (GTK_WIDGET (data),
2573
//gdk_threads_leave ();
2579
show_call_panel_changed_nt (G_GNUC_UNUSED gpointer id,
2583
g_return_if_fail (data != NULL);
2585
if (gm_conf_entry_get_type (entry) == GM_CONF_BOOL) {
2587
//gdk_threads_enter ();
2588
if (gm_conf_entry_get_bool (entry))
2589
gm_main_window_show_call_panel (GTK_WIDGET (data));
2591
gm_main_window_hide_call_panel (GTK_WIDGET (data));
2593
//gdk_threads_leave ();
2599
pull_trigger_cb (GtkWidget * /*widget*/,
2602
Ekiga::Trigger *trigger = (Ekiga::Trigger *) data;
2604
g_return_if_fail (trigger != NULL);
2611
show_widget_cb (GtkWidget * /*widget*/,
2614
g_return_if_fail (data != NULL);
2616
gtk_widget_show_all (GTK_WIDGET (data));
2621
hold_current_call_cb (G_GNUC_UNUSED GtkWidget *widget,
2624
GmMainWindow *mw = NULL;
2626
mw = gm_mw_get_mw (GTK_WIDGET (data));
2628
if (mw->current_call) {
2629
mw->current_call->toggle_hold ();
2635
toggle_audio_stream_pause_cb (GtkWidget * /*widget*/,
2638
GmMainWindow *mw = NULL;
2640
mw = gm_mw_get_mw (GTK_WIDGET (data));
2642
if (mw->current_call)
2643
mw->current_call->toggle_stream_pause (Ekiga::Call::Audio);
2648
toggle_video_stream_pause_cb (GtkWidget * /*widget*/,
2651
GmMainWindow *mw = NULL;
2653
mw = gm_mw_get_mw (GTK_WIDGET (data));
2655
if (mw->current_call)
2656
mw->current_call->toggle_stream_pause (Ekiga::Call::Video);
2662
transfer_current_call_cb (G_GNUC_UNUSED GtkWidget *widget,
2665
GtkWidget *main_window = NULL;
2667
g_return_if_fail (data != NULL);
2669
main_window = GnomeMeeting::Process ()->GetMainWindow ();
2671
gm_main_window_transfer_dialog_run (main_window, GTK_WIDGET (data), NULL);
2676
video_window_expose_cb (GtkWidget *main_window,
2677
G_GNUC_UNUSED GdkEventExpose *event,
2678
G_GNUC_UNUSED gpointer data)
2680
GmMainWindow *mw = NULL;
2685
mw = gm_mw_get_mw (main_window);
2689
GtkWidget* videoWidget = mw->main_video_image;
2690
if (!GTK_WIDGET_REALIZED(videoWidget))
2693
if (!GDK_IS_WINDOW(mw->main_video_image->window))
2696
Ekiga::DisplayInfo display_info;
2697
display_info.x = mw->main_video_image->allocation.x;
2698
display_info.y = mw->main_video_image->allocation.y;
2700
display_info.hwnd = ((HWND)GDK_WINDOW_HWND (mw->main_video_image->window));
2702
if (!mw->video_widget_gc) {
2703
mw->video_widget_gc = gdk_gc_new(mw->main_video_image->window);
2704
if ( mw->video_widget_gc == NULL)
2709
if (GDK_GC_XGC(mw->video_widget_gc) == NULL)
2712
display_info.gc = GDK_GC_XGC(mw->video_widget_gc);
2713
display_info.xdisplay = GDK_GC_XDISPLAY (mw->video_widget_gc);
2715
display_info.window = GDK_WINDOW_XWINDOW (mw->main_video_image->window);
2716
if (display_info.window == 0) //FIXME: Should be None
2721
display_info.widget_info_set = TRUE;
2723
Ekiga::VideoOutputCore *videooutput_core = dynamic_cast<Ekiga::VideoOutputCore *> (mw->core.get ("videooutput-core"));
2724
videooutput_core->set_display_info(display_info);
2730
video_window_shown_cb (GtkWidget *w,
2733
GmMainWindow *mw = NULL;
2735
mw = gm_mw_get_mw (GTK_WIDGET (data));
2737
if (gm_conf_get_bool (VIDEO_DISPLAY_KEY "stay_on_top")
2738
&& mw->current_call)
2739
gdk_window_set_always_on_top (GDK_WINDOW (w->window), TRUE);
2744
audio_volume_changed_cb (GtkAdjustment * /*adjustment*/,
2747
GmMainWindow *mw = NULL;
2748
g_return_if_fail (data != NULL);
2749
mw = gm_mw_get_mw (GTK_WIDGET (data));
2751
Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->core.get ("audioinput-core"));
2752
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
2754
audiooutput_core->set_volume(Ekiga::primary, (unsigned)GTK_ADJUSTMENT (mw->adj_output_volume)->value);
2755
audioinput_core->set_volume((unsigned)GTK_ADJUSTMENT (mw->adj_input_volume)->value);
2759
audio_volume_window_shown_cb (GtkWidget * /*widget*/,
2762
GmMainWindow *mw = NULL;
2763
g_return_if_fail (data != NULL);
2764
mw = gm_mw_get_mw (GTK_WIDGET (data));
2766
Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->core.get ("audioinput-core"));
2767
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
2769
audioinput_core->set_average_collection(true);
2770
audiooutput_core->set_average_collection(true);
2771
mw->levelmeter_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 50, on_signal_level_refresh_cb, data, NULL);
2776
audio_volume_window_hidden_cb (GtkWidget * /*widget*/,
2779
GmMainWindow *mw = NULL;
2780
g_return_if_fail (data != NULL);
2781
mw = gm_mw_get_mw (GTK_WIDGET (data));
2783
Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->core.get ("audioinput-core"));
2784
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
2786
g_source_remove (mw->levelmeter_timeout_id);
2787
audioinput_core->set_average_collection(false);
2788
audiooutput_core->set_average_collection(false);
2792
video_settings_changed_cb (GtkAdjustment * /*adjustment*/,
2795
GmMainWindow *mw = NULL;
2796
g_return_if_fail (data != NULL);
2797
mw = gm_mw_get_mw (GTK_WIDGET (data));
2798
g_return_if_fail (mw != NULL);
2800
Ekiga::VideoInputCore *videoinput_core = dynamic_cast<Ekiga::VideoInputCore *> (mw->core.get ("videoinput-core"));
2802
videoinput_core->set_whiteness ((unsigned) GTK_ADJUSTMENT (mw->adj_whiteness)->value);
2803
videoinput_core->set_brightness ((unsigned) GTK_ADJUSTMENT (mw->adj_brightness)->value);
2804
videoinput_core->set_colour ((unsigned) GTK_ADJUSTMENT (mw->adj_colour)->value);
2805
videoinput_core->set_contrast ((unsigned) GTK_ADJUSTMENT (mw->adj_contrast)->value);
2810
panel_section_changed_cb (G_GNUC_UNUSED GtkNotebook *notebook,
2811
G_GNUC_UNUSED GtkNotebookPage *page,
2812
G_GNUC_UNUSED gint page_num,
2815
GmMainWindow *mw = NULL;
2817
gint current_page = 0;
2819
g_return_if_fail (data != NULL);
2820
mw = gm_mw_get_mw (GTK_WIDGET (data));
2823
gtk_notebook_get_current_page (GTK_NOTEBOOK (mw->main_notebook));
2824
gm_conf_set_int (USER_INTERFACE_KEY "main_window/panel_section",
2830
dialpad_button_clicked_cb (EkigaDialpad * /* dialpad */,
2831
const gchar *button_text,
2832
GtkWidget *main_window)
2834
GmMainWindow *mw = NULL;
2836
mw = gm_mw_get_mw (main_window);
2838
if (mw->current_call)
2839
mw->current_call->send_dtmf (button_text[0]);
2841
gm_main_window_append_call_url (main_window, button_text);
2846
window_closed_cb (G_GNUC_UNUSED GtkWidget *widget,
2847
G_GNUC_UNUSED GdkEvent *event,
2850
GtkStatusIcon *statusicon = NULL;
2851
GtkWidget *main_window = NULL;
2853
GmMainWindow *mw = NULL;
2855
main_window = GnomeMeeting::Process ()->GetMainWindow ();
2856
statusicon = GTK_STATUS_ICON (GnomeMeeting::Process ()->GetStatusicon ());
2857
mw = gm_mw_get_mw (GTK_WIDGET (main_window));
2859
/* Hide in any case, but quit program when we don't have a status menu */
2860
gtk_widget_hide (GTK_WIDGET (data));
2861
if (!gtk_status_icon_is_embedded (GTK_STATUS_ICON (statusicon)))
2862
quit_callback (NULL, data);
2869
window_closed_from_menu_cb (GtkWidget *widget,
2872
window_closed_cb (widget, NULL, data);
2877
zoom_in_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
2880
GtkWidget *main_window = GnomeMeeting::Process ()->GetMainWindow ();
2881
g_return_if_fail (main_window != NULL);
2883
GmMainWindow *mw = gm_mw_get_mw (main_window);
2884
g_return_if_fail (mw != NULL);
2886
g_return_if_fail (data != NULL);
2888
Ekiga::DisplayInfo display_info;
2890
display_info.zoom = gm_conf_get_int ((char *) data);
2892
if (display_info.zoom < 200)
2893
display_info.zoom = display_info.zoom * 2;
2895
gm_conf_set_int ((char *) data, display_info.zoom);
2896
gm_mw_zooms_menu_update_sensitivity (main_window, display_info.zoom);
2901
zoom_out_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
2904
GtkWidget *main_window = GnomeMeeting::Process ()->GetMainWindow ();
2905
g_return_if_fail (main_window != NULL);
2907
GmMainWindow *mw = gm_mw_get_mw (main_window);
2908
g_return_if_fail (mw != NULL);
2910
g_return_if_fail (data != NULL);
2912
Ekiga::DisplayInfo display_info;
2914
display_info.zoom = gm_conf_get_int ((char *) data);
2916
if (display_info.zoom > 50)
2917
display_info.zoom = (unsigned int) (display_info.zoom / 2);
2919
gm_conf_set_int ((char *) data, display_info.zoom);
2920
gm_mw_zooms_menu_update_sensitivity (main_window, display_info.zoom);
2925
zoom_normal_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
2928
GtkWidget *main_window = GnomeMeeting::Process ()->GetMainWindow ();
2929
g_return_if_fail (main_window != NULL);
2931
GmMainWindow *mw = gm_mw_get_mw (main_window);
2932
g_return_if_fail (mw != NULL);
2934
g_return_if_fail (data != NULL);
2936
Ekiga::DisplayInfo display_info;
2938
display_info.zoom = 100;
2940
gm_conf_set_int ((char *) data, display_info.zoom);
2941
gm_mw_zooms_menu_update_sensitivity (main_window, display_info.zoom);
2946
display_changed_cb (GtkWidget *widget,
2949
GtkWidget *main_window = GnomeMeeting::Process ()->GetMainWindow ();
2950
g_return_if_fail (main_window != NULL);
2952
GmMainWindow *mw = gm_mw_get_mw (main_window);
2953
g_return_if_fail (mw != NULL);
2955
g_return_if_fail (data != NULL);
2957
GSList *group = NULL;
2958
int group_last_pos = 0;
2960
Ekiga::DisplayInfo display_info;
2962
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (widget));
2963
group_last_pos = g_slist_length (group) - 1; /* If length 1, last pos is 0 */
2965
/* Only do something when a new CHECK_MENU_ITEM becomes active,
2966
not when it becomes inactive */
2967
if (GTK_CHECK_MENU_ITEM (widget)->active) {
2971
if (group->data == widget)
2975
group = g_slist_next (group);
2978
gm_conf_set_int ((gchar *) data, group_last_pos - active);
2984
fullscreen_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
2985
G_GNUC_UNUSED gpointer data)
2987
GtkWidget* main_window = GnomeMeeting::Process()->GetMainWindow ();
2988
g_return_if_fail (main_window != NULL);
2989
gm_main_window_toggle_fullscreen (Ekiga::VO_FS_TOGGLE, main_window);
2994
url_changed_cb (GtkEditable *e,
2997
GmMainWindow *mw = NULL;
3000
const char *tip_text = NULL;
3001
gchar *entry = NULL;
3003
g_return_if_fail (data != NULL);
3004
mw = gm_mw_get_mw (GTK_WIDGET (data));
3006
tip_text = gtk_entry_get_text (GTK_ENTRY (e));
3008
if (g_strrstr (tip_text, "@") == NULL) {
3010
gtk_list_store_clear (mw->completion);
3012
for (std::list<std::string>::iterator it = mw->accounts.begin ();
3013
it != mw->accounts.end ();
3016
entry = g_strdup_printf ("%s@%s", tip_text, it->c_str ());
3017
gtk_list_store_append (mw->completion, &iter);
3018
gtk_list_store_set (mw->completion, &iter, 0, entry, -1);
3023
gtk_widget_set_tooltip_text (GTK_WIDGET (e), tip_text);
3028
toolbar_toggle_button_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
3031
bool shown = gm_conf_get_bool ((gchar *) data);
3033
gm_conf_set_bool ((gchar *) data, !shown);
3038
statusbar_clicked_cb (G_GNUC_UNUSED GtkWidget *widget,
3039
G_GNUC_UNUSED GdkEventButton *event,
3042
GmMainWindow *mw = NULL;
3044
g_return_val_if_fail (data != NULL, TRUE);
3046
mw = gm_mw_get_mw (GTK_WIDGET (data));
3048
g_return_val_if_fail (GTK_WIDGET (data), TRUE);
3050
gm_main_window_push_message (GTK_WIDGET (data), NULL);
3057
main_window_focus_event_cb (GtkWidget *main_window,
3058
G_GNUC_UNUSED GdkEventFocus *event,
3059
G_GNUC_UNUSED gpointer user_data)
3061
if (gtk_window_get_urgency_hint (GTK_WINDOW (main_window)))
3062
gtk_window_set_urgency_hint (GTK_WINDOW (main_window), FALSE);
3068
/* Public functions */
3070
gm_main_window_press_dialpad (GtkWidget *main_window,
3076
key = GDK_KP_Multiply;
3078
key = GDK_numbersign;
3080
key = GDK_KP_0 + atoi (&c);
3082
gtk_accel_groups_activate (G_OBJECT (main_window), key, (GdkModifierType) 0);
3087
gm_main_window_get_video_widget (GtkWidget *main_window)
3089
GmMainWindow *mw = NULL;
3091
g_return_val_if_fail (main_window != NULL, NULL);
3092
mw = gm_mw_get_mw (main_window);
3093
g_return_val_if_fail (mw != NULL, NULL);
3095
return mw->main_video_image;
3100
gm_main_window_update_logo_have_window (GtkWidget *main_window)
3102
GmMainWindow *mw = NULL;
3104
g_return_if_fail (main_window != NULL);
3106
mw = gm_mw_get_mw (main_window);
3107
g_return_if_fail (mw != NULL);
3109
g_object_set (G_OBJECT (mw->main_video_image),
3110
"icon-name", GM_ICON_LOGO,
3114
gtk_widget_set_size_request (GTK_WIDGET (mw->main_video_image),
3115
GM_QCIF_WIDTH, GM_QCIF_HEIGHT);
3118
rect.x = mw->main_video_image->allocation.x;
3119
rect.y = mw->main_video_image->allocation.y;
3120
rect.width = mw->main_video_image->allocation.width;
3121
rect.height = mw->main_video_image->allocation.height;
3123
gdk_window_invalidate_rect (GDK_WINDOW (main_window->window), &rect , TRUE);
3128
gm_main_window_set_call_hold (GtkWidget *main_window,
3131
GmMainWindow *mw = NULL;
3133
GtkWidget *child = NULL;
3136
g_return_if_fail (main_window != NULL);
3138
mw = gm_mw_get_mw (main_window);
3140
g_return_if_fail (mw != NULL);
3143
child = GTK_BIN (gtk_menu_get_widget (mw->main_menu, "hold_call"))->child;
3147
if (GTK_IS_LABEL (child))
3148
gtk_label_set_text_with_mnemonic (GTK_LABEL (child),
3149
_("_Retrieve Call"));
3151
/* Set the audio and video menu to unsensitive */
3152
gtk_menu_set_sensitive (mw->main_menu, "suspend_audio", FALSE);
3153
gtk_menu_set_sensitive (mw->main_menu, "suspend_video", FALSE);
3155
gm_main_window_set_channel_pause (main_window, TRUE, FALSE);
3156
gm_main_window_set_channel_pause (main_window, TRUE, TRUE);
3160
if (GTK_IS_LABEL (child))
3161
gtk_label_set_text_with_mnemonic (GTK_LABEL (child),
3164
gtk_menu_set_sensitive (mw->main_menu, "suspend_audio", TRUE);
3165
gtk_menu_set_sensitive (mw->main_menu, "suspend_video", TRUE);
3167
gm_main_window_set_channel_pause (main_window, FALSE, FALSE);
3168
gm_main_window_set_channel_pause (main_window, FALSE, TRUE);
3171
g_signal_handlers_block_by_func (G_OBJECT (mw->hold_button),
3172
(gpointer) hold_current_call_cb,
3174
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mw->hold_button),
3176
g_signal_handlers_unblock_by_func (G_OBJECT (mw->hold_button),
3177
(gpointer) hold_current_call_cb,
3183
gm_main_window_set_channel_pause (GtkWidget *main_window,
3187
GmMainWindow *mw = NULL;
3189
GtkWidget *child = NULL;
3193
g_return_if_fail (main_window != NULL);
3195
mw = gm_mw_get_mw (main_window);
3197
g_return_if_fail (mw != NULL);
3200
if (!pause && !is_video)
3201
msg = g_strdup (_("Suspend _Audio"));
3202
else if (!pause && is_video)
3203
msg = g_strdup (_("Suspend _Video"));
3204
else if (pause && !is_video)
3205
msg = g_strdup (_("Resume _Audio"));
3206
else if (pause && is_video)
3207
msg = g_strdup (_("Resume _Video"));
3213
GTK_BIN (gtk_menu_get_widget (mw->main_menu, "suspend_video"))->child;
3218
GTK_BIN (gtk_menu_get_widget (mw->main_menu, "suspend_audio"))->child;
3222
if (GTK_IS_LABEL (child))
3223
gtk_label_set_text_with_mnemonic (GTK_LABEL (child),
3231
gm_main_window_update_calling_state (GtkWidget *main_window,
3232
unsigned calling_state)
3234
GmMainWindow *mw = NULL;
3236
g_return_if_fail (main_window != NULL);
3238
mw = gm_mw_get_mw (main_window);
3240
g_return_if_fail (mw!= NULL);
3242
gm_main_window_selected_presentity_build_menu (main_window);
3243
switch (calling_state)
3247
/* Update the hold state */
3248
gm_main_window_set_call_hold (main_window, FALSE);
3250
/* Update the sensitivity, all channels are closed */
3251
gm_main_window_update_sensitivity (main_window, TRUE, FALSE, FALSE);
3252
gm_main_window_update_sensitivity (main_window, FALSE, FALSE, FALSE);
3254
/* Update the menus and toolbar items */
3255
gtk_menu_set_sensitive (mw->main_menu, "connect", TRUE);
3256
gtk_menu_set_sensitive (mw->main_menu, "disconnect", FALSE);
3257
gtk_menu_section_set_sensitive (mw->main_menu, "hold_call", FALSE);
3258
gtk_widget_set_sensitive (GTK_WIDGET (mw->hold_button), FALSE);
3259
gtk_widget_set_sensitive (GTK_WIDGET (mw->preview_button), TRUE);
3261
/* Update the connect button */
3262
gm_connect_button_set_connected (GM_CONNECT_BUTTON (mw->connect_button),
3265
/* Destroy the transfer call popup */
3266
if (mw->transfer_call_popup)
3267
gtk_dialog_response (GTK_DIALOG (mw->transfer_call_popup),
3268
GTK_RESPONSE_REJECT);
3275
/* Update the menus and toolbar items */
3276
gtk_menu_set_sensitive (mw->main_menu, "connect", FALSE);
3277
gtk_menu_set_sensitive (mw->main_menu, "disconnect", TRUE);
3278
gtk_widget_set_sensitive (GTK_WIDGET (mw->preview_button), FALSE);
3280
/* Update the connect button */
3281
gm_connect_button_set_connected (GM_CONNECT_BUTTON (mw->connect_button),
3289
/* Update the menus and toolbar items */
3290
gtk_menu_set_sensitive (mw->main_menu, "connect", FALSE);
3291
gtk_menu_set_sensitive (mw->main_menu, "disconnect", TRUE);
3292
gtk_menu_section_set_sensitive (mw->main_menu, "hold_call", TRUE);
3293
gtk_widget_set_sensitive (GTK_WIDGET (mw->hold_button), TRUE);
3294
gtk_widget_set_sensitive (GTK_WIDGET (mw->preview_button), FALSE);
3296
/* Update the connect button */
3297
gm_connect_button_set_connected (GM_CONNECT_BUTTON (mw->connect_button),
3305
/* Update the menus and toolbar items */
3306
gtk_menu_set_sensitive (mw->main_menu, "disconnect", TRUE);
3308
/* Update the connect button */
3309
gm_connect_button_set_connected (GM_CONNECT_BUTTON (mw->connect_button),
3318
mw->calling_state = calling_state;
3323
gm_main_window_update_sensitivity (GtkWidget *main_window,
3325
bool /*is_receiving*/,
3326
bool is_transmitting)
3328
GmMainWindow *mw = NULL;
3330
mw = gm_mw_get_mw (main_window);
3332
g_return_if_fail (mw != NULL);
3334
if (is_transmitting) {
3337
gtk_menu_set_sensitive (mw->main_menu, "suspend_audio", TRUE);
3339
gtk_menu_set_sensitive (mw->main_menu, "suspend_video", TRUE);
3344
gtk_menu_set_sensitive (mw->main_menu, "suspend_audio", FALSE);
3346
gtk_menu_set_sensitive (mw->main_menu, "suspend_video", FALSE);
3353
gm_main_window_toggle_fullscreen (Ekiga::VideoOutputFSToggle toggle,
3354
GtkWidget *main_window)
3356
GmMainWindow *mw = gm_mw_get_mw (main_window);
3357
g_return_if_fail (mw != NULL);
3359
Ekiga::VideoOutputMode videooutput_mode;
3362
case Ekiga::VO_FS_OFF:
3363
if (gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view") == Ekiga::VO_MODE_FULLSCREEN) {
3365
videooutput_mode = (Ekiga::VideoOutputMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view_before_fullscreen");
3366
gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view", videooutput_mode);
3369
case Ekiga::VO_FS_ON:
3370
if (gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view") != Ekiga::VO_MODE_FULLSCREEN) {
3372
videooutput_mode = (Ekiga::VideoOutputMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view");
3373
gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view_before_fullscreen", videooutput_mode);
3374
gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view", Ekiga::VO_MODE_FULLSCREEN);
3378
case Ekiga::VO_FS_TOGGLE:
3380
if (gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view") == Ekiga::VO_MODE_FULLSCREEN) {
3382
videooutput_mode = (Ekiga::VideoOutputMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view_before_fullscreen");
3383
gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view", videooutput_mode);
3387
videooutput_mode = (Ekiga::VideoOutputMode) gm_conf_get_int (VIDEO_DISPLAY_KEY "video_view");
3388
gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view_before_fullscreen", videooutput_mode);
3389
gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view", Ekiga::VO_MODE_FULLSCREEN);
3397
gm_main_window_show_call_panel (GtkWidget *self)
3399
GmMainWindow *mw = NULL;
3401
mw = gm_mw_get_mw (GTK_WIDGET (self));
3403
if (!GTK_WIDGET_VISIBLE (gtk_paned_get_child2 (GTK_PANED (mw->hpaned)))) {
3404
gtk_widget_show_all (gtk_paned_get_child2 (GTK_PANED (mw->hpaned)));
3410
gm_main_window_hide_call_panel (GtkWidget *self)
3412
GmMainWindow *mw = NULL;
3416
mw = gm_mw_get_mw (GTK_WIDGET (self));
3418
if (GTK_WIDGET_VISIBLE (gtk_paned_get_child2 (GTK_PANED (mw->hpaned)))) {
3420
gtk_widget_size_request (gtk_paned_get_child2 (GTK_PANED (mw->hpaned)), &req);
3421
gtk_window_get_size (GTK_WINDOW (self), &x, &y);
3422
gtk_widget_hide (gtk_paned_get_child2 (GTK_PANED (mw->hpaned)));
3424
gtk_window_resize (GTK_WINDOW (self), x, y);
3430
gm_main_window_set_busy (GtkWidget *main_window,
3433
GmMainWindow *mw = NULL;
3435
GdkCursor *cursor = NULL;
3437
mw = gm_mw_get_mw (main_window);
3439
g_return_if_fail (mw != NULL);
3441
gtk_widget_set_sensitive (mw->main_toolbar, !busy);
3442
gtk_widget_set_sensitive (mw->main_menu, !busy);
3446
cursor = gdk_cursor_new (GDK_WATCH);
3447
gdk_window_set_cursor (GTK_WIDGET (main_window)->window, cursor);
3448
gdk_cursor_unref (cursor);
3451
gdk_window_set_cursor (GTK_WIDGET (main_window)->window, NULL);
3455
gm_main_window_clear_signal_levels (GtkWidget *main_window)
3457
GmMainWindow *mw = NULL;
3459
g_return_if_fail (main_window != NULL);
3461
mw = gm_mw_get_mw (main_window);
3463
g_return_if_fail (mw != NULL);
3465
gtk_levelmeter_clear (GTK_LEVELMETER (mw->output_signal));
3466
gtk_levelmeter_clear (GTK_LEVELMETER (mw->input_signal));
3470
gm_main_window_selected_presentity_build_menu (GtkWidget *main_window)
3472
GmMainWindow *mw = NULL;
3473
GtkWidget* menu = NULL;
3475
g_return_if_fail (main_window != NULL);
3477
mw = gm_mw_get_mw (main_window);
3479
g_return_if_fail (mw != NULL);
3481
menu = gtk_menu_get_widget (mw->main_menu, "contact");
3482
if (mw->presentity != NULL) {
3484
MenuBuilderGtk builder;
3485
gtk_widget_set_sensitive (menu, TRUE);
3486
if (mw->presentity->populate_menu (builder)) {
3488
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), builder.menu);
3489
gtk_widget_show_all (builder.menu);
3493
gtk_widget_set_sensitive (menu, FALSE);
3494
g_object_unref (builder.menu);
3499
gtk_widget_set_sensitive (menu, FALSE);
3500
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), NULL);
3505
void gm_main_window_incoming_call_dialog_show (GtkWidget *main_window,
3508
GmMainWindow *mw = NULL;
3510
GdkPixbuf *pixbuf = NULL;
3512
GtkWidget *label = NULL;
3513
GtkWidget *vbox = NULL;
3514
GtkWidget *b1 = NULL;
3515
GtkWidget *b2 = NULL;
3516
GtkWidget *incoming_call_popup = NULL;
3520
// FIXME could the call become invalid ?
3521
const char *utf8_name = call.get_remote_party_name ().c_str ();
3522
const char *utf8_app = call.get_remote_application ().c_str ();
3523
const char *utf8_url = call.get_remote_uri ().c_str ();
3524
const char *utf8_local = call.get_local_party_name ().c_str ();
3526
g_return_if_fail (main_window);
3528
mw = gm_mw_get_mw (main_window);
3530
g_return_if_fail (mw != NULL);
3532
incoming_call_popup = gtk_dialog_new ();
3533
b2 = gtk_dialog_add_button (GTK_DIALOG (incoming_call_popup),
3535
b1 = gtk_dialog_add_button (GTK_DIALOG (incoming_call_popup),
3538
gtk_dialog_set_default_response (GTK_DIALOG (incoming_call_popup), 2);
3540
vbox = GTK_DIALOG (incoming_call_popup)->vbox;
3542
msg = g_strdup_printf ("%s <i>%s</i>", _("Incoming call from"), (const char*) utf8_name);
3543
label = gtk_label_new (NULL);
3544
gtk_label_set_markup (GTK_LABEL (label), msg);
3545
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 10);
3546
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.0);
3547
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
3550
pixbuf = gtk_widget_render_icon (GTK_WIDGET (incoming_call_popup),
3551
GM_STOCK_PHONE_PICK_UP_16,
3552
GTK_ICON_SIZE_MENU, NULL);
3553
gtk_window_set_icon (GTK_WINDOW (incoming_call_popup), pixbuf);
3554
g_object_unref (pixbuf);
3558
label = gtk_label_new (NULL);
3559
msg = g_strdup_printf ("<b>%s</b> <span foreground=\"blue\"><u>%s</u></span>",
3560
_("Remote URI:"), utf8_url);
3561
gtk_label_set_markup (GTK_LABEL (label), msg);
3562
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
3563
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 2);
3564
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
3570
label = gtk_label_new (NULL);
3571
msg = g_strdup_printf ("<b>%s</b> %s",
3572
_("Remote Application:"), utf8_app);
3573
gtk_label_set_markup (GTK_LABEL (label), msg);
3574
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
3575
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 2);
3576
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
3582
label = gtk_label_new (NULL);
3584
g_strdup_printf ("<b>%s</b> %s",
3585
_("Account ID:"), utf8_local);
3586
gtk_label_set_markup (GTK_LABEL (label), msg);
3587
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
3588
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 2);
3589
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
3593
msg = g_strdup_printf (_("Call from %s"), (const char*) utf8_name);
3594
gtk_window_set_title (GTK_WINDOW (incoming_call_popup), msg);
3596
gtk_window_set_modal (GTK_WINDOW (incoming_call_popup), TRUE);
3597
gtk_window_set_keep_above (GTK_WINDOW (incoming_call_popup), TRUE);
3598
gtk_window_set_urgency_hint (GTK_WINDOW (main_window), TRUE);
3599
gtk_window_set_transient_for (GTK_WINDOW (incoming_call_popup),
3600
GTK_WINDOW (main_window));
3602
gtk_widget_show_all (incoming_call_popup);
3604
g_signal_connect (G_OBJECT (incoming_call_popup), "delete_event",
3605
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
3606
g_signal_connect (G_OBJECT (incoming_call_popup), "response",
3607
GTK_SIGNAL_FUNC (incoming_call_response_cb), &call);
3609
call.cleared.connect (sigc::bind (sigc::ptr_fun (on_cleared_incoming_call_cb),
3610
(gpointer) incoming_call_popup));
3611
call.missed.connect (sigc::bind (sigc::ptr_fun (on_missed_incoming_call_cb),
3612
(gpointer) incoming_call_popup));
3618
notify_action_cb (NotifyNotification *notification,
3622
Ekiga::Call *call = (Ekiga::Call *) data;
3624
notify_notification_close (notification, NULL);
3628
if (!strcmp (action, "accept"))
3637
closed_cb (NotifyNotification* /*notify*/,
3638
gpointer main_window)
3640
GmMainWindow *mw = NULL;
3642
g_return_if_fail (main_window != NULL);
3644
mw = gm_mw_get_mw (GTK_WIDGET (main_window));
3646
g_return_if_fail (mw != NULL);
3648
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
3649
if (audiooutput_core)
3650
audiooutput_core->stop_play_event ("incoming_call_sound");
3654
void gm_main_window_incoming_call_notify (GtkWidget *main_window,
3657
NotifyNotification *notify = NULL;
3659
GtkStatusIcon *statusicon = NULL;
3663
gchar *account = NULL;
3665
gchar *title = NULL;
3667
statusicon = GTK_STATUS_ICON (GnomeMeeting::Process ()->GetStatusicon ());
3669
// FIXME could the call become invalid ?
3670
const char *utf8_name = call.get_remote_party_name ().c_str ();
3671
const char *utf8_app = call.get_remote_application ().c_str ();
3672
const char *utf8_url = call.get_remote_uri ().c_str ();
3673
const char *utf8_local = call.get_local_party_name ().c_str ();
3675
title = g_strdup_printf ("%s %s", _("Incoming call from"), (const char*) utf8_name);
3678
uri = g_strdup_printf ("<b>%s</b> %s", _("Remote URI:"), utf8_url);
3680
app = g_strdup_printf ("<b>%s</b> %s", _("Remote Application:"), utf8_app);
3682
account = g_strdup_printf ("<b>%s</b> %s", _("Account ID:"), utf8_local);
3684
body = g_strdup_printf ("%s\n%s\n%s", uri, app, account);
3686
notify = notify_notification_new (title, body, GM_ICON_LOGO, NULL);
3687
notify_notification_add_action (notify, "accept", _("Accept"), notify_action_cb, &call, NULL);
3688
notify_notification_add_action (notify, "reject", _("Reject"), notify_action_cb, &call, NULL);
3689
notify_notification_set_timeout (notify, NOTIFY_EXPIRES_NEVER);
3690
notify_notification_set_urgency (notify, NOTIFY_URGENCY_CRITICAL);
3691
notify_notification_attach_to_status_icon (notify, statusicon);
3692
if (!notify_notification_show (notify, NULL))
3693
gm_main_window_incoming_call_dialog_show (main_window, call);
3695
call.cleared.connect (sigc::bind (sigc::ptr_fun (on_cleared_incoming_call_cb),
3696
(gpointer) notify));
3697
call.missed.connect (sigc::bind (sigc::ptr_fun (on_missed_incoming_call_cb),
3698
(gpointer) notify));
3701
g_signal_connect (notify, "closed", G_CALLBACK (closed_cb), main_window);
3712
gm_main_window_set_panel_section (GtkWidget *main_window,
3715
GmMainWindow *mw = NULL;
3717
GtkWidget *menu = NULL;
3719
g_return_if_fail (main_window != NULL);
3721
mw = gm_mw_get_mw (main_window);
3723
g_return_if_fail (mw != NULL);
3725
gtk_notebook_set_current_page (GTK_NOTEBOOK (mw->main_notebook), section);
3727
menu = gtk_menu_get_widget (mw->main_menu, "dialpad");
3729
gtk_radio_menu_select_with_widget (GTK_WIDGET (menu), section);
3734
gm_main_window_set_status (GtkWidget *main_window,
3735
std::string /*short_status*/,
3736
std::string /*long_status*/)
3738
GmMainWindow *mw = NULL;
3741
const char * status [] =
3745
_("Do Not Disturb"),
3751
g_return_if_fail (main_window != NULL);
3753
mw = gm_mw_get_mw (main_window);
3754
g_return_if_fail (mw != NULL);
3759
gm_main_window_set_call_info (GtkWidget *main_window,
3760
const char *tr_audio_codec,
3761
G_GNUC_UNUSED const char *re_audio_codec,
3762
const char *tr_video_codec,
3763
G_GNUC_UNUSED const char *re_video_codec)
3765
GmMainWindow *mw = NULL;
3768
GtkTextIter *end_iter = NULL;
3769
GtkTextBuffer *buffer = NULL;
3773
g_return_if_fail (main_window != NULL);
3775
mw = gm_mw_get_mw (main_window);
3777
g_return_if_fail (mw != NULL);
3779
if (!tr_audio_codec && !tr_video_codec)
3780
info = g_strdup (" ");
3782
info = g_strdup_printf ("%s - %s",
3783
tr_audio_codec?tr_audio_codec:"",
3784
tr_video_codec?tr_video_codec:"");
3786
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (mw->info_text));
3787
gtk_text_buffer_get_start_iter (buffer, &iter);
3788
gtk_text_iter_forward_lines (&iter, 2);
3789
end_iter = gtk_text_iter_copy (&iter);
3790
gtk_text_iter_forward_line (end_iter);
3791
gtk_text_buffer_delete (buffer, &iter, end_iter);
3792
gtk_text_iter_free (end_iter);
3793
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, info,
3794
-1, "codecs", NULL);
3800
gm_main_window_set_status (GtkWidget *main_window,
3803
GmMainWindow *mw = NULL;
3806
GtkTextIter* end_iter = NULL;
3807
GtkTextBuffer *buffer = NULL;
3811
g_return_if_fail (main_window != NULL);
3813
mw = gm_mw_get_mw (main_window);
3815
g_return_if_fail (mw != NULL);
3817
info = g_strdup_printf ("%s\n", status);
3819
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (mw->info_text));
3820
gtk_text_buffer_get_start_iter (buffer, &iter);
3821
end_iter = gtk_text_iter_copy (&iter);
3822
gtk_text_iter_forward_line (end_iter);
3823
gtk_text_buffer_delete (buffer, &iter, end_iter);
3824
gtk_text_iter_free (end_iter);
3825
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, info,
3826
-1, "status", NULL);
3832
gm_main_window_set_call_duration (GtkWidget *main_window,
3833
const char *duration)
3835
GmMainWindow *mw = NULL;
3838
GtkTextIter* end_iter = NULL;
3839
GtkTextBuffer *buffer = NULL;
3843
g_return_if_fail (main_window != NULL);
3845
mw = gm_mw_get_mw (main_window);
3847
g_return_if_fail (mw != NULL);
3850
info = g_strdup_printf (_("Call Duration: %s\n"), duration);
3852
info = g_strdup ("\n");
3854
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (mw->info_text));
3855
gtk_text_buffer_get_start_iter (buffer, &iter);
3856
gtk_text_iter_forward_line (&iter);
3857
end_iter = gtk_text_iter_copy (&iter);
3858
gtk_text_iter_forward_line (end_iter);
3859
gtk_text_buffer_delete (buffer, &iter, end_iter);
3860
gtk_text_iter_free (end_iter);
3861
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, info,
3862
-1, "call-duration", NULL);
3869
gm_main_window_transfer_dialog_run (GtkWidget *main_window,
3870
GtkWidget *parent_window,
3873
GmMainWindow *mw = NULL;
3877
const char *forward_url = NULL;
3879
g_return_val_if_fail (main_window != NULL, FALSE);
3880
g_return_val_if_fail (parent_window != NULL, FALSE);
3882
mw = gm_mw_get_mw (main_window);
3884
g_return_val_if_fail (mw != NULL, FALSE);
3886
mw->transfer_call_popup =
3887
gm_entry_dialog_new (_("Transfer call to:"),
3890
gtk_window_set_transient_for (GTK_WINDOW (mw->transfer_call_popup),
3891
GTK_WINDOW (parent_window));
3893
gtk_dialog_set_default_response (GTK_DIALOG (mw->transfer_call_popup),
3894
GTK_RESPONSE_ACCEPT);
3896
if (u && !strcmp (u, ""))
3897
gm_entry_dialog_set_text (GM_ENTRY_DIALOG (mw->transfer_call_popup), u);
3899
gm_entry_dialog_set_text (GM_ENTRY_DIALOG (mw->transfer_call_popup), "sip:");
3901
gnomemeeting_threads_dialog_show (mw->transfer_call_popup);
3903
answer = gtk_dialog_run (GTK_DIALOG (mw->transfer_call_popup));
3906
case GTK_RESPONSE_ACCEPT:
3908
forward_url = gm_entry_dialog_get_text (GM_ENTRY_DIALOG (mw->transfer_call_popup));
3909
if (strcmp (forward_url, "") && mw->current_call)
3910
mw->current_call->transfer (forward_url);
3917
gtk_widget_destroy (mw->transfer_call_popup);
3918
mw->transfer_call_popup = NULL;
3920
return (answer == GTK_RESPONSE_ACCEPT);
3925
gm_main_window_add_device_dialog_show (GtkWidget *main_window,
3926
const Ekiga::Device & device,
3927
DeviceType deviceType)
3929
GmMainWindow *mw = NULL;
3931
GtkWidget *label = NULL;
3932
GtkWidget *vbox = NULL;
3933
GtkWidget *b1 = NULL;
3934
GtkWidget *b2 = NULL;
3935
GtkWidget *add_device_popup = NULL;
3937
g_return_if_fail (main_window);
3938
mw = gm_mw_get_mw (main_window);
3939
g_return_if_fail (mw != NULL);
3942
add_device_popup = gtk_dialog_new ();
3943
b2 = gtk_dialog_add_button (GTK_DIALOG (add_device_popup),
3945
b1 = gtk_dialog_add_button (GTK_DIALOG (add_device_popup),
3948
gtk_dialog_set_default_response (GTK_DIALOG (add_device_popup), 2);
3950
vbox = GTK_DIALOG (add_device_popup)->vbox;
3955
switch (deviceType) {
3957
msg = _("Detected new audio input device:");
3958
title = _("Audio Devices");
3961
msg = _("Detected new audio output device:");
3962
title = _("Audio Devices");
3965
msg = _("Detected new video input device:");
3966
title = _("Video Devices");
3971
label = gtk_label_new (NULL);
3972
gtk_label_set_markup (GTK_LABEL (label), msg.c_str());
3973
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 2);
3974
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
3975
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
3977
msg = "<b>" + device.GetString() + "</b>";
3978
label = gtk_label_new (NULL);
3979
gtk_label_set_markup (GTK_LABEL (label), msg.c_str());
3980
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 2);
3981
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
3982
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
3984
msg = _("Do you want to use it as default device?");
3985
label = gtk_label_new (NULL);
3986
gtk_label_set_markup (GTK_LABEL (label), msg.c_str());
3987
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 2);
3988
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
3989
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
3991
gtk_window_set_title (GTK_WINDOW (add_device_popup), title.c_str ());
3992
gtk_window_set_modal (GTK_WINDOW (add_device_popup), TRUE);
3993
gtk_window_set_keep_above (GTK_WINDOW (add_device_popup), TRUE);
3994
gtk_window_set_urgency_hint (GTK_WINDOW (main_window), TRUE);
3995
gtk_window_set_transient_for (GTK_WINDOW (add_device_popup),
3996
GTK_WINDOW (main_window));
3998
gtk_widget_show_all (add_device_popup);
4001
// g_signal_connect (G_OBJECT (add_device_popup), "delete_event",
4002
// G_CALLBACK (gtk_widget_hide_on_delete), NULL);
4003
// g_signal_connect (G_OBJECT (add_device_popup), "response",
4004
// GTK_SIGNAL_FUNC (add_device_response_cb), &device);
4006
deviceStruct* device_struct = g_new(deviceStruct, 1);
4007
snprintf (device_struct->name, sizeof (device_struct->name), "%s", (device.GetString()).c_str());
4008
device_struct->deviceType = deviceType;
4010
g_signal_connect_data (G_OBJECT (add_device_popup), "delete_event",
4011
G_CALLBACK (gtk_widget_hide_on_delete),
4012
(gpointer) device_struct,
4013
(GClosureNotify) g_free,
4016
g_signal_connect_data (G_OBJECT (add_device_popup), "response",
4017
G_CALLBACK (add_device_response_cb),
4018
(gpointer) device_struct,
4019
(GClosureNotify) g_free,
4024
gm_main_window_new (Ekiga::ServiceCore & core)
4026
GmMainWindow *mw = NULL;
4028
GtkWidget *window = NULL;
4030
GtkWidget *status_toolbar = NULL;
4032
GtkStatusIcon *status_icon = NULL;
4034
PanelSection section = DIALPAD;
4036
sigc::connection conn;
4038
Ekiga::ServiceCore *services = NULL;
4039
GtkFrontend *gtk_frontend = NULL;
4040
GtkWidget *chat_window = NULL;
4042
/* initialize the callback to play IM message sound */
4043
services = GnomeMeeting::Process ()->GetServiceCore ();
4044
gtk_frontend = dynamic_cast<GtkFrontend *>(services->get ("gtk-frontend"));
4045
chat_window = GTK_WIDGET (gtk_frontend->get_chat_window ());
4047
g_signal_connect (chat_window, "unread-alert",
4048
G_CALLBACK (on_chat_unread_alert), NULL);
4050
/* The Top-level window */
4051
window = gm_window_new_with_key (USER_INTERFACE_KEY "main_window");
4052
gm_window_set_hide_on_delete (GM_WINDOW (window), FALSE);
4053
gtk_window_set_title (GTK_WINDOW (window),
4056
g_signal_connect (G_OBJECT (window), "focus-in-event",
4057
GTK_SIGNAL_FUNC (main_window_focus_event_cb), NULL);
4060
/* The GMObject data */
4061
mw = new GmMainWindow (core);
4062
mw->presentity = NULL;
4063
mw->transfer_call_popup = NULL;
4064
mw->current_call = NULL;
4065
mw->timeout_id = -1;
4066
mw->levelmeter_timeout_id = -1;
4067
mw->audio_transmission_active = mw->audio_reception_active
4068
= mw->video_transmission_active = mw->video_reception_active = false;
4069
g_object_set_data_full (G_OBJECT (window), "GMObject",
4070
mw, (GDestroyNotify) gm_mw_destroy);
4073
mw->video_widget_gc = NULL;
4077
mw->accel = gtk_accel_group_new ();
4078
gtk_window_add_accel_group (GTK_WINDOW (window), mw->accel);
4079
g_object_unref (mw->accel);
4081
mw->window_vbox = gtk_vbox_new (0, FALSE);
4082
gtk_container_add (GTK_CONTAINER (window), mw->window_vbox);
4083
gtk_widget_show_all (mw->window_vbox);
4086
mw->statusbar = gm_statusbar_new ();
4087
gm_mw_init_menu (window);
4088
gtk_box_pack_start (GTK_BOX (mw->window_vbox), mw->main_menu,
4092
mw->main_toolbar = gm_mw_init_uri_toolbar (window);
4093
gtk_box_pack_start (GTK_BOX (mw->window_vbox), mw->main_toolbar, false, false, 0);
4095
/* The Audio & Video Settings windows */
4096
mw->audio_settings_window = gm_mw_audio_settings_window_new (window);
4097
mw->video_settings_window = gm_mw_video_settings_window_new (window);
4099
/* The 2 parts of the gui */
4100
mw->hpaned = gtk_hpaned_new ();
4101
gtk_box_pack_start (GTK_BOX (mw->window_vbox), mw->hpaned,
4104
mw->main_notebook = gtk_notebook_new ();
4106
gtk_notebook_popup_enable (GTK_NOTEBOOK (mw->main_notebook));
4107
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (mw->main_notebook), true);
4108
gtk_notebook_set_scrollable (GTK_NOTEBOOK (mw->main_notebook), true);
4110
gm_mw_init_contacts_list (window);
4111
gm_mw_init_dialpad (window);
4112
gtk_paned_pack1 (GTK_PANED (mw->hpaned), mw->main_notebook, true, false);
4114
gm_mw_init_call (window);
4115
gm_mw_init_history (window);
4117
section = (PanelSection)
4118
gm_conf_get_int (USER_INTERFACE_KEY "main_window/panel_section");
4119
gtk_widget_show (mw->hpaned);
4120
gtk_widget_show_all (GTK_WIDGET (gtk_paned_get_child1 (GTK_PANED (mw->hpaned))));
4121
if (gm_conf_get_bool (USER_INTERFACE_KEY "main_window/show_call_panel"))
4122
gtk_widget_show_all (GTK_WIDGET (gtk_paned_get_child2 (GTK_PANED (mw->hpaned))));
4123
gm_main_window_set_panel_section (window, section);
4125
/* Status toolbar */
4126
status_toolbar = gm_mw_init_status_toolbar (window);
4127
gtk_box_pack_start (GTK_BOX (mw->window_vbox), status_toolbar, false, false, 0);
4129
/* The statusbar with qualitymeter */
4130
gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (mw->statusbar), TRUE);
4131
GtkShadowType shadow_type;
4132
gtk_widget_style_get (mw->statusbar, "shadow-type", &shadow_type, NULL);
4134
GtkWidget *frame = gtk_frame_new (NULL);
4135
gtk_frame_set_shadow_type (GTK_FRAME (frame), shadow_type);
4136
gtk_box_pack_start (GTK_BOX (mw->statusbar), frame, FALSE, TRUE, 0);
4138
gtk_box_reorder_child (GTK_BOX (mw->statusbar), frame, 0);
4140
mw->qualitymeter = gm_powermeter_new ();
4141
gtk_container_add (GTK_CONTAINER (frame), mw->qualitymeter);
4143
mw->statusbar_ebox = gtk_event_box_new ();
4144
gtk_container_add (GTK_CONTAINER (mw->statusbar_ebox), mw->statusbar);
4146
gtk_box_pack_start (GTK_BOX (mw->window_vbox), mw->statusbar_ebox,
4148
gtk_widget_show_all (mw->statusbar_ebox);
4150
g_signal_connect (G_OBJECT (mw->statusbar_ebox), "button-press-event",
4151
GTK_SIGNAL_FUNC (statusbar_clicked_cb), window);
4153
gtk_widget_realize (window);
4154
gm_main_window_update_logo_have_window (window);
4155
g_signal_connect_after (G_OBJECT (mw->main_notebook), "switch-page",
4156
G_CALLBACK (panel_section_changed_cb),
4159
/* if the user tries to close the window : delete_event */
4160
g_signal_connect (G_OBJECT (window), "delete_event",
4161
G_CALLBACK (window_closed_cb),
4163
g_signal_connect (G_OBJECT (window), "show",
4164
GTK_SIGNAL_FUNC (video_window_shown_cb), window);
4165
g_signal_connect (G_OBJECT (window), "expose-event",
4166
GTK_SIGNAL_FUNC (video_window_expose_cb), NULL);
4168
/* New Display Engine signals */
4169
Ekiga::VideoOutputCore *videooutput_core = dynamic_cast<Ekiga::VideoOutputCore *> (mw->core.get ("videooutput-core"));
4171
conn = videooutput_core->device_opened.connect (sigc::bind (sigc::ptr_fun (on_videooutput_device_opened_cb), (gpointer) window));
4172
mw->connections.push_back (conn);
4174
conn = videooutput_core->device_closed.connect (sigc::bind (sigc::ptr_fun (on_videooutput_device_closed_cb), (gpointer) window));
4175
mw->connections.push_back (conn);
4177
conn = videooutput_core->device_error.connect (sigc::bind (sigc::ptr_fun (on_videooutput_device_error_cb), (gpointer) window));
4178
mw->connections.push_back (conn);
4180
conn = videooutput_core->size_changed.connect (sigc::bind (sigc::ptr_fun (on_size_changed_cb), (gpointer) window));
4181
mw->connections.push_back (conn);
4183
conn = videooutput_core->fullscreen_mode_changed.connect (sigc::bind (sigc::ptr_fun (on_fullscreen_mode_changed_cb), (gpointer) window));
4184
mw->connections.push_back (conn);
4186
/* New VideoInput Engine signals */
4187
Ekiga::VideoInputCore *videoinput_core = dynamic_cast<Ekiga::VideoInputCore *> (mw->core.get ("videoinput-core"));
4189
conn = videoinput_core->device_opened.connect (sigc::bind (sigc::ptr_fun (on_videoinput_device_opened_cb), (gpointer) window));
4190
mw->connections.push_back (conn);
4192
conn = videoinput_core->device_closed.connect (sigc::bind (sigc::ptr_fun (on_videoinput_device_closed_cb), (gpointer) window));
4193
mw->connections.push_back (conn);
4195
conn = videoinput_core->device_added.connect (sigc::bind (sigc::ptr_fun (on_videoinput_device_added_cb), (gpointer) window));
4196
mw->connections.push_back (conn);
4198
conn = videoinput_core->device_removed.connect (sigc::bind (sigc::ptr_fun (on_videoinput_device_removed_cb), (gpointer) window));
4199
mw->connections.push_back (conn);
4201
conn = videoinput_core->device_error.connect (sigc::bind (sigc::ptr_fun (on_videoinput_device_error_cb), (gpointer) window));
4202
mw->connections.push_back (conn);
4204
/* New AudioInput Engine signals */
4205
Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->core.get ("audioinput-core"));
4207
conn = audioinput_core->device_opened.connect (sigc::bind (sigc::ptr_fun (on_audioinput_device_opened_cb), (gpointer) window));
4208
mw->connections.push_back (conn);
4210
conn = audioinput_core->device_closed.connect (sigc::bind (sigc::ptr_fun (on_audioinput_device_closed_cb), (gpointer) window));
4211
mw->connections.push_back (conn);
4213
conn = audioinput_core->device_added.connect (sigc::bind (sigc::ptr_fun (on_audioinput_device_added_cb), (gpointer) window));
4214
mw->connections.push_back (conn);
4216
conn = audioinput_core->device_removed.connect (sigc::bind (sigc::ptr_fun (on_audioinput_device_removed_cb), (gpointer) window));
4217
mw->connections.push_back (conn);
4219
conn = audioinput_core->device_error.connect (sigc::bind (sigc::ptr_fun (on_audioinput_device_error_cb), (gpointer) window));
4220
mw->connections.push_back (conn);
4222
/* New AudioOutput Engine signals */
4223
Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
4225
conn = audiooutput_core->device_opened.connect (sigc::bind (sigc::ptr_fun (on_audiooutput_device_opened_cb), (gpointer) window));
4226
mw->connections.push_back (conn);
4228
conn = audiooutput_core->device_closed.connect (sigc::bind (sigc::ptr_fun (on_audiooutput_device_closed_cb), (gpointer) window));
4229
mw->connections.push_back (conn);
4231
conn = audiooutput_core->device_added.connect (sigc::bind (sigc::ptr_fun (on_audiooutput_device_added_cb), (gpointer) window));
4232
mw->connections.push_back (conn);
4234
conn = audiooutput_core->device_removed.connect (sigc::bind (sigc::ptr_fun (on_audiooutput_device_removed_cb), (gpointer) window));
4235
mw->connections.push_back (conn);
4237
conn = audiooutput_core->device_error.connect (sigc::bind (sigc::ptr_fun (on_audiooutput_device_error_cb), (gpointer) window));
4238
mw->connections.push_back (conn);
4240
/* New Call Engine signals */
4241
Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore *> (mw->core.get ("call-core"));
4242
Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore *> (mw->core.get ("account-core"));
4244
/* Engine Signals callbacks */
4245
conn = account_core->registration_event.connect (sigc::bind (sigc::ptr_fun (on_registration_event), (gpointer) window));
4246
mw->connections.push_back (conn);
4248
conn = call_core->ready.connect (sigc::bind (sigc::ptr_fun (on_ready_cb), (gpointer) window));
4249
mw->connections.push_back (conn);
4251
conn = call_core->setup_call.connect (sigc::bind (sigc::ptr_fun (on_setup_call_cb), (gpointer) window));
4252
mw->connections.push_back (conn);
4254
conn = call_core->ringing_call.connect (sigc::bind (sigc::ptr_fun (on_ringing_call_cb), (gpointer) window));
4255
mw->connections.push_back (conn);
4257
conn = call_core->established_call.connect (sigc::bind (sigc::ptr_fun (on_established_call_cb), (gpointer) window));
4258
mw->connections.push_back (conn);
4260
conn = call_core->cleared_call.connect (sigc::bind (sigc::ptr_fun (on_cleared_call_cb), (gpointer) window));
4261
mw->connections.push_back (conn);
4263
conn = call_core->held_call.connect (sigc::bind (sigc::ptr_fun (on_held_call_cb), (gpointer) window));
4264
mw->connections.push_back (conn);
4266
conn = call_core->retrieved_call.connect (sigc::bind (sigc::ptr_fun (on_retrieved_call_cb), (gpointer) window));
4267
mw->connections.push_back (conn);
4269
conn = call_core->missed_call.connect (sigc::bind (sigc::ptr_fun (on_missed_call_cb), (gpointer) window));
4270
mw->connections.push_back (conn);
4272
conn = call_core->stream_opened.connect (sigc::bind (sigc::ptr_fun (on_stream_opened_cb), (gpointer) window));
4273
mw->connections.push_back (conn);
4275
conn = call_core->stream_closed.connect (sigc::bind (sigc::ptr_fun (on_stream_closed_cb), (gpointer) window));
4276
mw->connections.push_back (conn);
4278
conn = call_core->stream_paused.connect (sigc::bind (sigc::ptr_fun (on_stream_paused_cb), (gpointer) window));
4279
mw->connections.push_back (conn);
4281
conn = call_core->stream_resumed.connect (sigc::bind (sigc::ptr_fun (on_stream_resumed_cb), (gpointer) window));
4282
mw->connections.push_back (conn);
4284
conn = call_core->errors.add_handler (sigc::bind (sigc::ptr_fun (on_handle_errors), (gpointer) window));
4285
mw->connections.push_back (conn);
4288
gm_conf_notifier_add (USER_INTERFACE_KEY "main_window/panel_section",
4289
panel_section_changed_nt, window);
4291
gm_conf_notifier_add (USER_INTERFACE_KEY "main_window/show_call_panel",
4292
show_call_panel_changed_nt, window);
4294
/* Track status icon embed changes */
4295
status_icon = GTK_STATUS_ICON (GnomeMeeting::Process ()->GetStatusicon ());
4296
g_signal_connect (G_OBJECT (status_icon), "notify::embedded",
4297
G_CALLBACK (on_status_icon_embedding_change), NULL);
4299
/* Until we are ready, nothing possible */
4300
gm_main_window_set_busy (window, true);
4307
gm_main_window_flash_message (GtkWidget *main_window,
4311
GmMainWindow *mw = NULL;
4315
g_return_if_fail (main_window != NULL);
4317
mw = gm_mw_get_mw (main_window);
4321
va_start (args, msg);
4326
vsnprintf (buffer, 1024, msg, args);
4328
gm_statusbar_flash_message (GM_STATUSBAR (mw->statusbar), "%s", buffer);
4334
gm_main_window_push_message (GtkWidget *main_window,
4338
GmMainWindow *mw = NULL;
4342
g_return_if_fail (main_window != NULL);
4344
mw = gm_mw_get_mw (main_window);
4348
va_start (args, msg);
4353
vsnprintf (buffer, 1024, msg, args);
4355
gm_statusbar_push_message (GM_STATUSBAR (mw->statusbar), "%s", buffer);
4361
gm_main_window_push_info_message (GtkWidget *main_window,
4365
GmMainWindow *mw = NULL;
4368
g_return_if_fail (main_window != NULL);
4370
mw = gm_mw_get_mw (main_window);
4374
va_start (args, msg);
4375
buffer = g_strdup_vprintf (msg, args);
4376
gm_statusbar_push_info_message (GM_STATUSBAR (mw->statusbar), "%s", buffer);
4383
gm_main_window_set_call_url (GtkWidget *main_window,
4386
GmMainWindow *mw = NULL;
4388
g_return_if_fail (main_window != NULL && url != NULL);
4390
mw = gm_mw_get_mw (main_window);
4392
g_return_if_fail (mw != NULL);
4394
gtk_entry_set_text (GTK_ENTRY (mw->entry), url);
4395
gtk_editable_set_position (GTK_EDITABLE (mw->entry), -1);
4396
gtk_widget_grab_focus (GTK_WIDGET (mw->entry));
4397
gtk_editable_select_region (GTK_EDITABLE (mw->entry), -1, -1);
4402
gm_main_window_append_call_url (GtkWidget *main_window,
4405
GmMainWindow *mw = NULL;
4409
g_return_if_fail (main_window != NULL && url != NULL);
4411
mw = gm_mw_get_mw (main_window);
4413
g_return_if_fail (mw != NULL && url != NULL);
4415
if (gtk_editable_get_selection_bounds (GTK_EDITABLE (mw->entry), NULL, NULL))
4416
gtk_editable_delete_selection (GTK_EDITABLE (mw->entry));
4418
pos = gtk_editable_get_position (GTK_EDITABLE (mw->entry));
4419
gtk_editable_insert_text (GTK_EDITABLE (mw->entry), url, strlen (url), &pos);
4420
gtk_editable_select_region (GTK_EDITABLE (mw->entry), -1, -1);
4421
gtk_editable_set_position (GTK_EDITABLE (mw->entry), pos);
4426
gm_main_window_get_call_url (GtkWidget *main_window)
4428
GmMainWindow *mw = NULL;
4430
g_return_val_if_fail (main_window != NULL, NULL);
4432
mw = gm_mw_get_mw (main_window);
4434
g_return_val_if_fail (mw != NULL, NULL);
4436
return gtk_entry_get_text (GTK_ENTRY (mw->entry));
4441
gm_main_window_clear_stats (GtkWidget *main_window)
4443
GmMainWindow *mw = NULL;
4445
g_return_if_fail (main_window != NULL);
4447
mw = gm_mw_get_mw (main_window);
4449
g_return_if_fail (mw != NULL);
4451
gm_main_window_update_stats (main_window, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
4452
if (mw->qualitymeter)
4453
gm_powermeter_set_level (GM_POWERMETER (mw->qualitymeter), 0.0);
4458
gm_main_window_update_stats (GtkWidget *main_window,
4463
G_GNUC_UNUSED float new_video_octets_received,
4464
G_GNUC_UNUSED float new_video_octets_transmitted,
4465
G_GNUC_UNUSED float new_audio_octets_received,
4466
G_GNUC_UNUSED float new_audio_octets_transmitted,
4467
unsigned int re_width,
4468
unsigned int re_height,
4469
unsigned int tr_width,
4470
unsigned int tr_height)
4472
GmMainWindow *mw = NULL;
4474
gchar *stats_msg = NULL;
4475
gchar *stats_msg_tr = NULL;
4476
gchar *stats_msg_re = NULL;
4478
int jitter_quality = 0;
4479
gfloat quality_level = 0.0;
4482
g_return_if_fail (main_window != NULL);
4484
mw = gm_mw_get_mw (main_window);
4486
g_return_if_fail (mw != NULL);
4488
if ((tr_width > 0) && (tr_height > 0))
4490
* TX is a common abbreviation for "transmit" */
4491
stats_msg_tr = g_strdup_printf (_("TX: %dx%d "), tr_width, tr_height);
4493
if ((re_width > 0) && (re_height > 0))
4495
* RX is a common abbreviation for "receive" */
4496
stats_msg_re = g_strdup_printf (_("RX: %dx%d "), re_width, re_height);
4498
stats_msg = g_strdup_printf (_("Lost packets: %.1f %%\nLate packets: %.1f %%\nOut of order packets: %.1f %%\nJitter buffer: %d ms%s%s%s"),
4503
(stats_msg_tr || stats_msg_re) ? "\nResolution: " : "",
4504
(stats_msg_tr) ? stats_msg_tr : "",
4505
(stats_msg_re) ? stats_msg_re : "");
4507
g_free(stats_msg_tr);
4508
g_free(stats_msg_re);
4511
if (mw->statusbar_ebox) {
4512
gtk_widget_set_tooltip_text (GTK_WIDGET (mw->statusbar_ebox), stats_msg);
4516
/* "arithmetics" for the quality level */
4517
/* Thanks Snark for the math hints */
4519
jitter_quality = 100;
4520
if (jitter >= 30 && jitter < 50)
4521
jitter_quality = 100 - (jitter - 30);
4522
if (jitter >= 50 && jitter < 100)
4523
jitter_quality = 80 - (jitter - 50) * 20 / 50;
4524
if (jitter >= 100 && jitter < 150)
4525
jitter_quality = 60 - (jitter - 100) * 20 / 50;
4526
if (jitter >= 150 && jitter < 200)
4527
jitter_quality = 40 - (jitter - 150) * 20 / 50;
4528
if (jitter >= 200 && jitter < 300)
4529
jitter_quality = 20 - (jitter - 200) * 20 / 100;
4530
if (jitter >= 300 || jitter_quality < 0)
4533
quality_level = (float) jitter_quality / 100;
4535
if ( (lost > 0.0) ||
4537
((out_of_order > 0.0) && quality_level > 0.2) ) {
4538
quality_level = 0.2;
4541
if ( (lost > 0.02) ||
4543
(out_of_order > 0.02) ) {
4547
if (mw->qualitymeter)
4548
gm_powermeter_set_level (GM_POWERMETER (mw->qualitymeter),
4554
gm_main_window_get_current_picture (GtkWidget *main_window)
4556
GmMainWindow *mw = NULL;
4558
g_return_val_if_fail (main_window != NULL, NULL);
4560
mw = gm_mw_get_mw (main_window);
4562
g_return_val_if_fail (mw != NULL, NULL);
4564
return gtk_image_get_pixbuf (GTK_IMAGE (mw->main_video_image));
4569
gm_main_window_set_stay_on_top (GtkWidget *main_window,
4570
gboolean stay_on_top)
4572
GmMainWindow *mw = NULL;
4574
GdkWindow *gm_window = NULL;
4576
g_return_if_fail (main_window != NULL);
4577
mw = gm_mw_get_mw (main_window);
4578
g_return_if_fail (mw != NULL);
4580
gm_window = GDK_WINDOW (main_window->window);
4582
/* Update the stay-on-top attribute */
4583
gdk_window_set_always_on_top (GDK_WINDOW (gm_window), stay_on_top);
4592
GOptionContext *context = NULL;
4594
GtkWidget *main_window = NULL;
4595
GtkWidget *assistant_window = NULL;
4597
GtkWidget *dialog = NULL;
4602
gchar *title = NULL;
4604
int debug_level = 0;
4605
int debug_level_up = 0;
4608
GnomeProgram *program;
4613
if (!XInitThreads ())
4617
/* PWLIB initialization */
4618
PProcess::PreInitialise (argc, argv, envp);
4620
/* GTK+ initialization */
4622
g_thread_init (NULL);
4623
// gdk_threads_init ();
4625
signal (SIGPIPE, SIG_IGN);
4628
/* initialize platform-specific code */
4629
gm_platform_init ();
4631
/* Configuration backend initialization */
4634
/* Gettext initialization */
4635
path = g_build_filename (DATA_DIR, "locale", NULL);
4636
textdomain (GETTEXT_PACKAGE);
4637
bindtextdomain (GETTEXT_PACKAGE, path);
4638
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
4641
/* Arguments initialization */
4642
GOptionEntry arguments [] =
4645
"debug", 'd', 0, G_OPTION_ARG_INT, &debug_level,
4646
N_("Prints debug messages in the console (level between 1 and 5)"),
4650
"debug_user_plane", 'u', 0, G_OPTION_ARG_INT, &debug_level_up,
4651
N_("Prints user plane debug messages in the console (level between 1 and 4)"),
4655
"call", 'c', 0, G_OPTION_ARG_STRING, &url,
4656
N_("Makes Ekiga call the given URI"),
4660
NULL, 0, 0, (GOptionArg)0, NULL,
4665
context = g_option_context_new (NULL);
4666
g_option_context_add_main_entries (context, arguments, PACKAGE_NAME);
4667
g_option_context_set_help_enabled (context, TRUE);
4669
/* GNOME Initialisation */
4671
program = gnome_program_init (PACKAGE_NAME, VERSION,
4672
LIBGNOMEUI_MODULE, argc, argv,
4673
GNOME_PARAM_GOPTION_CONTEXT, context,
4674
GNOME_PARAM_HUMAN_READABLE_NAME, "ekiga",
4675
GNOME_PARAM_APP_DATADIR, DATA_DIR,
4678
g_option_context_add_group (context, gtk_get_option_group (TRUE));
4679
g_option_context_parse (context, &argc, &argv, NULL);
4680
g_option_context_free (context);
4684
notify_init (PACKAGE_NAME);
4688
char* text_label = g_strdup_printf ("%d", debug_level);
4689
setenv ("PTLIB_TRACE_CODECS", text_label, TRUE);
4690
g_free (text_label);
4691
text_label = g_strdup_printf ("%d", debug_level_up);
4692
setenv ("PTLIB_TRACE_CODECS_USER_PLANE", text_label, TRUE);
4693
g_free (text_label);
4695
char* text_label = g_strdup_printf ("PTLIB_TRACE_CODECS=%d", debug_level);
4696
_putenv (text_label);
4697
g_free (text_label);
4698
text_label = g_strdup_printf ("PTLIB_TRACE_CODECS_USER_PLANE=%d", debug_level_up);
4699
_putenv (text_label);
4700
g_free (text_label);
4703
/* Ekiga initialisation */
4704
static GnomeMeeting instance;
4706
if (debug_level != 0)
4707
PTrace::Initialise (PMAX (PMIN (5, debug_level), 0), NULL,
4708
PTrace::Timestamp | PTrace::Thread
4709
| PTrace::Blocks | PTrace::DateAndTime);
4710
#ifdef EKIGA_REVISION
4711
PTRACE(1, "Ekiga SVN revision: " << EKIGA_REVISION);
4715
if (!ekiga_dbus_claim_ownership ()) {
4716
ekiga_dbus_client_show ();
4718
ekiga_dbus_client_connect (url);
4723
/* Configuration database initialization */
4725
if (!gnomemeeting_conf_check ())
4732
GnomeMeeting::Process ()->InitEngine ();
4733
GnomeMeeting::Process ()->BuildGUI ();
4734
GnomeMeeting::Process ()->DetectInterfaces ();
4736
/* Add depreciated notifiers */
4737
gnomemeeting_conf_init ();
4739
/* Show the window if there is no error, exit with a popup if there
4742
main_window = GnomeMeeting::Process ()->GetMainWindow ();
4743
GmMainWindow *mw = gm_mw_get_mw (main_window); //TODO no gm_mw_get_mw here
4744
Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore *> (mw->core.get ("call-core"));
4747
if (gm_conf_get_int (GENERAL_KEY "version")
4748
< 1000 * MAJOR_VERSION + 10 * MINOR_VERSION + BUILD_NUMBER) {
4750
gnomemeeting_conf_upgrade ();
4751
assistant_window = GnomeMeeting::Process ()->GetAssistantWindow ();
4752
gtk_widget_show_all (assistant_window);
4756
/* Show the main window */
4757
if (!gm_conf_get_bool (USER_INTERFACE_KEY "start_hidden"))
4758
gtk_widget_show (main_window);
4760
g_timeout_add (15000, (GtkFunction) gnomemeeting_tray_hack_cb, NULL);
4763
/* Call the given host if needed */
4765
call_core->dial (url);
4772
title = g_strdup (_("No usable audio plugin detected"));
4773
msg = g_strdup (_("Ekiga didn't find any usable audio plugin. Make sure that your installation is correct."));
4776
title = g_strdup (_("No usable audio codecs detected"));
4777
msg = g_strdup (_("Ekiga didn't find any usable audio codec. Make sure that your installation is correct."));
4782
gchar *key_name = g_strdup ("\"/apps/" PACKAGE_NAME "/general/gconf_test_age\"");
4783
title = g_strdup (_("Configuration database corruption"));
4784
msg = g_strdup_printf (_("Ekiga got an invalid value for the configuration key %s.\n\nIt probably means that your configuration schemas have not been correctly installed or that the permissions are not correct.\n\nPlease check the FAQ (http://www.ekiga.org/), the troubleshooting section of the GConf site (http://www.gnome.org/projects/gconf/) or the mailing list archives for more information (http://mail.gnome.org) about this problem."), key_name);
4793
dialog = gtk_message_dialog_new (GTK_WINDOW (main_window),
4796
GTK_BUTTONS_OK, NULL);
4798
gtk_window_set_title (GTK_WINDOW (dialog), title);
4799
gtk_label_set_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), msg);
4801
g_signal_connect (GTK_OBJECT (dialog), "response",
4802
G_CALLBACK (quit_callback),
4803
GTK_OBJECT (dialog));
4804
g_signal_connect_swapped (GTK_OBJECT (dialog), "response",
4805
G_CALLBACK (gtk_widget_destroy),
4806
GTK_OBJECT (dialog));
4808
gtk_widget_show_all (dialog);
4815
/* Create the dbus server instance */
4816
EkigaDBusComponent *dbus_component = ekiga_dbus_component_new (&mw->core);
4820
//gdk_threads_enter ();
4822
//gdk_threads_leave ();
4825
g_object_unref (dbus_component);
4829
GnomeMeeting::Process ()->Exit ();
4831
/* Save and shutdown the configuration */
4833
gm_conf_shutdown ();
4836
g_object_unref (program);
4839
/* deinitialize platform-specific code */
4840
gm_platform_shutdown ();
4856
extern "C" void __getmainargs (int *argcp, char ***argvp, char ***envp, int glob, _startupinfo *sinfo);
4858
APIENTRY WinMain (HINSTANCE hInstance,
4859
HINSTANCE hPrevInstance,
4868
_startupinfo info = {0};
4870
ekr_mutex = CreateMutex (NULL, FALSE, "EkigaIsRunning");
4871
if (GetLastError () == ERROR_ALREADY_EXISTS)
4872
MessageBox (NULL, "Ekiga is running already !", "Ekiga - 2nd instance", MB_ICONEXCLAMATION | MB_OK);
4875
/* use msvcrt.dll to parse command line */
4876
__getmainargs (&argc, &argv, &env, 0, &info);
4878
std::freopen("stdout.txt", "w", stdout);
4879
std::freopen("stderr.txt", "w", stderr);
4881
iresult = main (argc, argv, env);
4883
CloseHandle (ekr_mutex);