2
/* GnomeMeeting -- A 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
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
* GnomeMeeting 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 OpenH323 and Pwlib, and distribute the combination, without
23
* applying the requirements of the GNU GPL to the OpenH323 program, as long
24
* as you do follow the requirements of the GNU GPL for all the rest of the
25
* 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.
39
#include "../../config.h"
42
#include "callshistory.h"
49
#include "callbacks.h"
50
#include "statusicon.h"
52
#include "urlhandler.h"
55
#include "gmentrydialog.h"
56
#include "gmstatusbar.h"
57
#include "gmconnectbutton.h"
58
#include "gmstockicons.h"
60
#include "gmcontacts.h"
61
#include "gmmenuaddon.h"
62
#include "gmstatsdrawingarea.h"
63
#include "gmlevelmeter.h"
66
#include "../pixmaps/text_logo.xpm"
67
#include "../pixmaps/gm_both_incrusted_frame.xpm"
69
#include <gdk/gdkkeysyms.h>
72
#include <libgnomeui/gnome-window-icon.h>
80
#if defined(P_FREEBSD) || defined (P_MACOSX)
84
#include <libxml/parser.h>
94
#define GM_MAIN_WINDOW(x) (GmWindow *) (x)
100
GtkWidget *input_signal;
101
GtkWidget *output_signal;
102
GtkObject *adj_input_volume;
103
GtkObject *adj_output_volume;
104
GtkWidget *audio_volume_frame;
106
GtkObject *adj_whiteness;
107
GtkObject *adj_brightness;
108
GtkObject *adj_colour;
109
GtkObject *adj_contrast;
110
GtkWidget *video_settings_frame;
113
GtkAccelGroup *accel;
115
GtkWidget *main_menu;
118
GtkWidget *window_vbox;
119
GtkWidget *window_hbox;
122
GtkWidget *status_label;
123
GtkWidget *info_label;
125
GtkWidget *statusbar;
126
GtkWidget *statusbar_ebox;
128
GtkWidget *main_notebook;
129
GtkWidget *main_video_image;
130
GtkWidget *local_video_image;
131
GtkWidget *local_video_window;
132
GtkWidget *remote_video_image;
133
GtkWidget *remote_video_window;
134
GtkWidget *video_frame;
135
GtkWidget *preview_button;
136
GtkWidget *connect_button;
137
GtkWidget *video_chan_button;
138
GtkWidget *audio_chan_button;
139
GtkWidget *incoming_call_popup;
140
GtkWidget *transfer_call_popup;
141
GtkWidget *stats_label;
142
GtkWidget *stats_drawing_area;
150
typedef struct _GmWindow GmWindow;
153
#define GM_WINDOW(x) (GmWindow *) (x)
160
* BEHAVIOR : Frees a GmMainWindow and its content.
161
* PRE : A non-NULL pointer to a GmMainWindow.
163
static void gm_mw_destroy (gpointer);
167
* BEHAVIOR : Returns a pointer to the private GmMainWindow
168
* used by the main book GMObject.
169
* PRE : The given GtkWidget pointer must be the main window GMObject.
171
static GmWindow *gm_mw_get_mw (GtkWidget *);
175
* BEHAVIOR : Create the toolbars of the main window.
176
* The toolbars are created in their initial state, with
177
* required items being unsensitive.
178
* PRE : The main window GMObject.
180
static void gm_mw_init_toolbars (GtkWidget *);
184
* BEHAVIOR : Create the menu of the main window.
185
* The menu is created in its initial state, with
186
* required items being unsensitive.
187
* PRE : The main window GMObject. The statusbar must have been
190
static void gm_mw_init_menu (GtkWidget *);
194
* BEHAVIOR : Builds the stats part of the main window.
195
* PRE : The given GtkWidget pointer must be the main window GMObject.
197
static void gm_mw_init_stats (GtkWidget *);
201
* BEHAVIOR : Builds the dialpad part of the main window.
202
* PRE : The given GtkWidget pointer must be the main window GMObject.
204
static void gm_mw_init_dialpad (GtkWidget *);
208
* BEHAVIOR : Builds the video settings part of the main window.
209
* PRE : The given GtkWidget pointer must be the main window GMObject.
211
static void gm_mw_init_video_settings (GtkWidget *);
215
* BEHAVIOR : Builds the audio settings part of the main window.
216
* PRE : The given GtkWidget pointer must be the main window GMObject.
218
static void gm_mw_init_audio_settings (GtkWidget *);
222
* BEHAVIOR : Creates a video window.
223
* PRE : The title of the window, the drawing area and the window
224
* name that will be used by gnomemeeting_window_show/hide.
226
GtkWidget *gm_mw_video_window_new (GtkWidget *,
235
* BEHAVIOR : Creates a video window.
238
void gm_mw_init_fullscreen_video_window (GtkWidget *);
242
* BEHAVIOR : Toggle the fullscreen state of the main window.
245
void gm_mw_toggle_fullscreen (GtkWidget *);
249
* BEHAVIOR : Return TRUE if the Esc key is pressed.
252
gboolean gm_mw_poll_fullscreen_video_window (GtkWidget *);
256
* BEHAVIOR : Creates a video window.
259
void gm_mw_destroy_fullscreen_video_window (GtkWidget *);
264
* BEHAVIOR : Show / hide the video section.
265
* PRE : The main window GMObject.
267
void gm_mw_show_video_section (GtkWidget *,
272
* BEHAVIOR : Show / hide the video section.
273
* PRE : The main window GMObject.
275
void gm_mw_show_control_panel (GtkWidget *,
282
* BEHAVIOR : Set the current active call on hold.
285
static void hold_current_call_cb (GtkWidget *,
290
* BEHAVIOR : Set the current active call audio or video channel on pause
291
* or not and update the GUI accordingly.
292
* PRE : GPOINTER_TO_INT (data) = 0 if audio, 1 if video.
294
static void pause_current_call_channel_cb (GtkWidget *,
299
* BEHAVIOR : Creates a dialog to transfer the current call and transfer
301
* PRE : The parent window.
303
static void transfer_current_call_cb (GtkWidget *,
307
/* DESCRIPTION : This callback is called when a video window is shown.
308
* BEHAVIOR : Set the WM HINTS to stay-on-top if the config key is set
312
static void video_window_shown_cb (GtkWidget *,
316
/* DESCRIPTION : This callback is called when the user changes the
317
* audio settings sliders in the main notebook.
318
* BEHAVIOR : Update the volume of the choosen mixers. If the update
319
* fails, the sliders are put back to 0.
320
* PRE : The main window GMObject.
322
static void audio_volume_changed_cb (GtkAdjustment *,
326
/* DESCRIPTION : This callback is called when the user changes one of the
327
* video settings sliders in the main notebook.
328
* BEHAVIOR : Updates the value in real time, if it fails, reset
330
* PRE : gpointer is a valid pointer to the main window GmObject.
332
static void video_settings_changed_cb (GtkAdjustment *,
336
/* DESCRIPTION : This callback is called when the user drops a contact.
337
* BEHAVIOR : Calls the user corresponding to the contact or transfer
338
* the calls to the user.
339
* PRE : Assumes data hides a GmWindow*
341
static void dnd_call_contact_cb (GtkWidget *widget,
348
/* DESCRIPTION : This callback is called when the user changes the
349
* page in the main notebook.
350
* BEHAVIOR : Update the config key accordingly.
351
* PRE : A valid pointer to the main window GmObject.
353
static void control_panel_section_changed_cb (GtkNotebook *,
359
/* DESCRIPTION : This callback is called when the user
360
* clicks on the dialpad button.
361
* BEHAVIOR : Generates a dialpad event.
362
* PRE : A valid pointer to the main window GMObject.
364
static void dialpad_button_clicked_cb (GtkButton *,
368
/* DESCRIPTION : This callback is called when the user tries to close
369
* the application using the window manager.
370
* BEHAVIOR : Calls the real callback if the notification icon is
371
* not shown else hide GM.
372
* PRE : A valid pointer to the main window GMObject.
374
static gint window_closed_cb (GtkWidget *,
379
/* DESCRIPTION : This callback is called when the user changes the zoom
380
* factor in the menu, and chooses to zoom in.
381
* BEHAVIOR : zoom *= 2.
382
* PRE : The GConf key to update with the new zoom.
384
static void zoom_in_changed_cb (GtkWidget *,
388
/* DESCRIPTION : This callback is called when the user changes the zoom
389
* factor in the menu, and chooses to zoom in.
390
* BEHAVIOR : zoom /= 2.
391
* PRE : The GConf key to update with the new zoom.
393
static void zoom_out_changed_cb (GtkWidget *,
397
/* DESCRIPTION : This callback is called when the user changes the zoom
398
* factor in the menu, and chooses to zoom in.
399
* BEHAVIOR : zoom = 1.
400
* PRE : The GConf key to update with the new zoom.
402
static void zoom_normal_changed_cb (GtkWidget *,
407
/* DESCRIPTION : This callback is called when the user toggles fullscreen
408
* factor in the popup menu.
409
* BEHAVIOR : Toggles the fullscreen configuration key.
412
static void fullscreen_changed_cb (GtkWidget *,
417
/* DESCRIPTION : This callback is called when the user toggles an
418
* item in the speed dials menu.
419
* BEHAVIOR : Calls the given speed dial.
420
* PRE : data is the speed dial as a gchar *
422
static void speed_dial_menu_item_selected_cb (GtkWidget *,
426
/* DESCRIPTION : This callback is called when the user changes the URL
428
* BEHAVIOR : It udpates the tooltip with the new URL.
429
* PRE : A valid pointer to the main window GMObject.
431
static void url_changed_cb (GtkEditable *,
435
/* DESCRIPTION : This callback is called when the user selects a match in the
436
* possible URLs list.
437
* BEHAVIOR : It udpates the URL bar and calls it.
440
static gboolean completion_url_selected_cb (GtkEntryCompletion *,
446
/* DESCRIPTION : This callback is called when the user clicks on enter
447
* with a non-empty URL bar.
448
* BEHAVIOR : It calls the URL.
451
static void url_activated_cb (GtkWidget *,
455
/* DESCRIPTION : This callback is called when the user presses the view
456
* mode button in the toolbar.
457
* BEHAVIOR : Updates the config cache to switch the video view.
460
static void view_mode_button_clicked_cb (GtkWidget *,
464
/* DESCRIPTION : This callback is called when the user presses a
465
* button in the toolbar.
466
* (See menu_toggle_changed)
467
* BEHAVIOR : Updates the config cache.
468
* PRE : data is the key.
470
static void toolbar_toggle_button_changed_cb (GtkWidget *,
474
/* DESCRIPTION : This callback is called when the status bar is clicked.
475
* BEHAVIOR : Clear all info message, not normal messages. Reset the
476
* endpoint missed calls number.
477
* PRE : The main window GMObject.
479
static gboolean statusbar_clicked_cb (GtkWidget *,
484
/* DESCRIPTION : This callback is called on delete event for the incoming
486
* BEHAVIOR : Disconnects and set the pointer to NULL, the destroy signal
487
* will destroy the dialog by itself.
488
* PRE : A valid main window GMObject.
490
static gboolean delete_incoming_call_dialog_cb (GtkWidget *,
495
/* DESCRIPTION : Called when the chat icon is clicked.
496
* BEHAVIOR : Show the chat window or hide it.
497
* If the chat window is shown during a call, the corresponding
499
* Reset the tray flashing state when the window is shown.
500
* PRE : The pointer must be a valid pointer to the chat window
503
static void show_chat_window_cb (GtkWidget *w,
507
/* DESCRIPTION : This callback is called in an idle loop.
508
* BEHAVIOR : Do the job of gm_main_window_urls_history_update, but
510
* PRE : A valid main window GMObject.
512
static gboolean gm_mw_urls_history_update_cb (gpointer data);
517
gm_mw_destroy (gpointer m)
519
GmWindow *mw = GM_WINDOW (m);
521
g_return_if_fail (mw != NULL);
523
delete ((GmWindow *) mw);
528
gm_mw_get_mw (GtkWidget *main_window)
530
g_return_val_if_fail (main_window != NULL, NULL);
532
return GM_MAIN_WINDOW (g_object_get_data (G_OBJECT (main_window),
538
gm_mw_init_toolbars (GtkWidget *main_window)
542
GtkWidget *button = NULL;
543
GtkToolItem *item = NULL;
545
GtkListStore *list_store = NULL;
546
GtkWidget *toolbar = NULL;
548
GtkEntryCompletion *completion = NULL;
550
GtkWidget *image = NULL;
552
GtkWidget *addressbook_window = NULL;
553
GtkWidget *chat_window = NULL;
555
#ifndef DISABLE_GNOME
557
BOOL toolbar_detachable = TRUE;
560
addressbook_window = GnomeMeeting::Process ()->GetAddressbookWindow ();
561
chat_window = GnomeMeeting::Process ()->GetChatWindow ();
564
g_return_if_fail (main_window != NULL);
566
mw = gm_mw_get_mw (main_window);
568
g_return_if_fail (mw != NULL);
571
#ifndef DISABLE_GNOME
573
gm_conf_get_bool ("/desktop/gnome/interface/toolbar_detachable");
577
/* The main horizontal toolbar */
578
toolbar = gtk_toolbar_new ();
579
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
580
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE);
585
item = gtk_tool_item_new ();
586
mw->combo = gtk_combo_box_entry_new_text ();
588
gtk_container_add (GTK_CONTAINER (item), mw->combo);
589
gtk_container_set_border_width (GTK_CONTAINER (item), 4);
590
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), TRUE);
592
completion = gtk_entry_completion_new ();
594
list_store = gtk_list_store_new (3,
599
gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion),
600
GTK_TREE_MODEL (list_store));
601
gtk_entry_completion_set_text_column (GTK_ENTRY_COMPLETION (completion), 2);
602
gtk_entry_set_completion (GTK_ENTRY (GTK_BIN (mw->combo)->child), completion);
604
gtk_entry_set_text (GTK_ENTRY (GTK_BIN (mw->combo)->child),
605
GMURL ().GetDefaultURL ());
607
gtk_entry_completion_set_match_func (GTK_ENTRY_COMPLETION (completion),
608
entry_completion_url_match_cb,
609
(gpointer) list_store,
612
gm_main_window_urls_history_update (main_window);
614
g_signal_connect (G_OBJECT (GTK_BIN (mw->combo)->child), "changed",
615
GTK_SIGNAL_FUNC (url_changed_cb), (gpointer) main_window);
616
g_signal_connect (G_OBJECT (GTK_BIN (mw->combo)->child), "activate",
617
GTK_SIGNAL_FUNC (url_activated_cb), NULL);
618
g_signal_connect (G_OBJECT (completion), "match-selected",
619
GTK_SIGNAL_FUNC (completion_url_selected_cb), NULL);
621
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
624
/* The connect button */
625
item = gtk_tool_item_new ();
626
mw->connect_button = gm_connect_button_new (GM_STOCK_CONNECT,
628
GTK_ICON_SIZE_LARGE_TOOLBAR,
631
gtk_container_add (GTK_CONTAINER (item), mw->connect_button);
632
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
634
gtk_tooltips_set_tip (mw->tips, GTK_WIDGET (mw->connect_button),
635
_("Enter an URL to call on the left, and click on this button to connect to the given URL"), NULL);
637
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
639
g_signal_connect (G_OBJECT (mw->connect_button), "clicked",
640
G_CALLBACK (connect_button_clicked_cb),
641
GTK_ENTRY (GTK_BIN (mw->combo)->child));
643
gtk_widget_show_all (GTK_WIDGET (toolbar));
645
#ifndef DISABLE_GNOME
646
behavior = (BONOBO_DOCK_ITEM_BEH_EXCLUSIVE
647
| BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL);
649
if (!toolbar_detachable)
650
behavior |= BONOBO_DOCK_ITEM_BEH_LOCKED;
652
gnome_app_add_docked (GNOME_APP (main_window), toolbar, "main_toolbar",
653
BonoboDockItemBehavior (behavior),
654
BONOBO_DOCK_TOP, 1, 0, 0);
656
gtk_box_pack_start (GTK_BOX (mw->window_vbox), toolbar,
661
/* The left toolbar */
662
toolbar = gtk_toolbar_new ();
663
gtk_toolbar_set_orientation (GTK_TOOLBAR (toolbar),
664
GTK_ORIENTATION_VERTICAL);
665
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
666
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE);
670
item = gtk_tool_item_new ();
671
button = gtk_button_new ();
672
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
673
image = gtk_image_new_from_stock (GM_STOCK_TEXT_CHAT,
674
GTK_ICON_SIZE_LARGE_TOOLBAR);
675
gtk_container_add (GTK_CONTAINER (button), image);
676
gtk_container_add (GTK_CONTAINER (item), button);
677
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
678
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (item),
679
mw->tips, _("Open text chat"), NULL);
681
gtk_widget_show (button);
682
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
683
GTK_TOOL_ITEM (item), -1);
685
g_signal_connect (G_OBJECT (button), "clicked",
686
GTK_SIGNAL_FUNC (show_chat_window_cb),
687
(gpointer) chat_window);
690
/* The control panel */
691
item = gtk_tool_item_new ();
692
button = gtk_button_new ();
693
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
694
image = gtk_image_new_from_stock (GM_STOCK_CONTROL_PANEL,
695
GTK_ICON_SIZE_LARGE_TOOLBAR);
696
gtk_container_add (GTK_CONTAINER (button), image);
697
gtk_container_add (GTK_CONTAINER (item), button);
698
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
700
gtk_widget_show (GTK_WIDGET (item));
701
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
702
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (item),
703
mw->tips, _("Change the view mode"), NULL);
705
g_signal_connect (G_OBJECT (button), "clicked",
706
GTK_SIGNAL_FUNC (view_mode_button_clicked_cb), NULL);
709
/* The address book */
710
item = gtk_tool_item_new ();
711
button = gtk_button_new ();
712
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
713
image = gtk_image_new_from_stock (GM_STOCK_ADDRESSBOOK_24,
714
GTK_ICON_SIZE_LARGE_TOOLBAR);
715
gtk_container_add (GTK_CONTAINER (button), image);
716
gtk_container_add (GTK_CONTAINER (item), button);
717
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
719
gtk_widget_show (GTK_WIDGET (item));
720
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
721
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (item),
722
mw->tips, _("Open address book"), NULL);
724
g_signal_connect (G_OBJECT (button), "clicked",
725
GTK_SIGNAL_FUNC (show_window_cb),
726
(gpointer) addressbook_window);
730
/* Video Preview Button */
731
item = gtk_tool_item_new ();
732
mw->preview_button = gtk_toggle_button_new ();
733
image = gtk_image_new_from_stock (GM_STOCK_VIDEO_PREVIEW,
734
GTK_ICON_SIZE_SMALL_TOOLBAR);
735
gtk_container_add (GTK_CONTAINER (mw->preview_button), image);
736
gtk_container_add (GTK_CONTAINER (item), mw->preview_button);
737
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
739
gtk_widget_show (mw->preview_button);
740
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
741
GTK_TOOL_ITEM (item), -1);
742
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (item), mw->tips,
743
_("Display images from your camera device"),
746
gtk_widget_set_size_request (GTK_WIDGET (mw->preview_button), 28, 28);
748
g_signal_connect (G_OBJECT (mw->preview_button), "toggled",
749
G_CALLBACK (toolbar_toggle_button_changed_cb),
750
(gpointer) VIDEO_DEVICES_KEY "enable_preview");
753
/* Audio Channel Button */
754
item = gtk_tool_item_new ();
755
mw->audio_chan_button = gtk_toggle_button_new ();
756
image = gtk_image_new_from_stock (GM_STOCK_AUDIO_MUTE,
757
GTK_ICON_SIZE_SMALL_TOOLBAR);
758
gtk_container_add (GTK_CONTAINER (mw->audio_chan_button), image);
759
gtk_container_add (GTK_CONTAINER (item), mw->audio_chan_button);
760
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
762
gtk_widget_show (mw->audio_chan_button);
763
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
764
GTK_TOOL_ITEM (item), -1);
765
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (item), mw->tips,
766
_("Audio transmission status. During a call, click here to suspend or resume the audio transmission."), NULL);
768
gtk_widget_set_size_request (GTK_WIDGET (mw->audio_chan_button), 28, 28);
769
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_chan_button), FALSE);
771
g_signal_connect (G_OBJECT (mw->audio_chan_button), "clicked",
772
G_CALLBACK (pause_current_call_channel_cb),
773
GINT_TO_POINTER (0));
776
/* Video Channel Button */
777
item = gtk_tool_item_new ();
778
mw->video_chan_button = gtk_toggle_button_new ();
779
image = gtk_image_new_from_stock (GM_STOCK_VIDEO_MUTE,
780
GTK_ICON_SIZE_SMALL_TOOLBAR);
781
gtk_container_add (GTK_CONTAINER (mw->video_chan_button), image);
782
gtk_container_add (GTK_CONTAINER (item), mw->video_chan_button);
783
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), FALSE);
785
gtk_widget_show (mw->video_chan_button);
786
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
787
GTK_TOOL_ITEM (item), -1);
788
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (item), mw->tips,
789
_("Video transmission status. During a call, click here to suspend or resume the video transmission."), NULL);
791
gtk_widget_set_size_request (GTK_WIDGET (mw->video_chan_button), 28, 28);
792
gtk_widget_set_sensitive (GTK_WIDGET (mw->video_chan_button), FALSE);
794
g_signal_connect (G_OBJECT (mw->video_chan_button), "clicked",
795
G_CALLBACK (pause_current_call_channel_cb),
796
GINT_TO_POINTER (1));
799
/* Add the toolbar to the UI */
800
#ifndef DISABLE_GNOME
801
behavior = BONOBO_DOCK_ITEM_BEH_EXCLUSIVE;
803
if (!toolbar_detachable)
804
behavior |= BONOBO_DOCK_ITEM_BEH_LOCKED;
806
gnome_app_add_toolbar (GNOME_APP (main_window), GTK_TOOLBAR (toolbar),
808
BonoboDockItemBehavior (behavior),
809
BONOBO_DOCK_LEFT, 2, 0, 0);
811
gtk_box_pack_start (GTK_BOX (mw->window_hbox), toolbar,
815
gtk_widget_show_all (GTK_WIDGET (toolbar));
820
gm_mw_init_menu (GtkWidget *main_window)
824
GtkWidget *addressbook_window = NULL;
825
GtkWidget *chat_window = NULL;
826
GtkWidget *druid_window = NULL;
827
GtkWidget *calls_history_window = NULL;
828
GtkWidget *history_window = NULL;
829
GtkWidget *prefs_window = NULL;
830
GtkWidget *accounts_window = NULL;
831
GtkWidget *pc2phone_window = NULL;
833
IncomingCallMode icm = AVAILABLE;
834
ViewMode mode = SOFTPHONE;
835
ControlPanelSection cps = DIALPAD;
836
gboolean show_video_section = FALSE;
839
GSList *glist = NULL;
841
g_return_if_fail (main_window != NULL);
842
mw = gm_mw_get_mw (main_window);
844
addressbook_window = GnomeMeeting::Process ()->GetAddressbookWindow ();
845
calls_history_window = GnomeMeeting::Process ()->GetCallsHistoryWindow ();
846
history_window = GnomeMeeting::Process ()->GetHistoryWindow ();
847
chat_window = GnomeMeeting::Process ()->GetChatWindow ();
848
druid_window = GnomeMeeting::Process ()->GetDruidWindow ();
849
prefs_window = GnomeMeeting::Process ()->GetPrefsWindow ();
850
accounts_window = GnomeMeeting::Process ()->GetAccountsWindow ();
851
pc2phone_window = GnomeMeeting::Process ()->GetPC2PhoneWindow ();
853
mw->main_menu = gtk_menu_bar_new ();
857
icm = (IncomingCallMode)
858
gm_conf_get_int (CALL_OPTIONS_KEY "incoming_call_mode");
859
cps = (ControlPanelSection)
860
gm_conf_get_int (USER_INTERFACE_KEY "main_window/control_panel_section");
862
gm_conf_get_int (USER_INTERFACE_KEY "main_window/view_mode");
864
gm_conf_get_bool (USER_INTERFACE_KEY "main_window/show_video_section");
867
static MenuEntry gnomemeeting_menu [] =
869
GTK_MENU_NEW (_("C_all")),
871
GTK_MENU_ENTRY("connect", _("C_onnect"), _("Create a new connection"),
872
GM_STOCK_CONNECT_16, 'o',
873
GTK_SIGNAL_FUNC (connect_cb), main_window, TRUE),
874
GTK_MENU_ENTRY("disconnect", _("_Disconnect"),
875
_("Close the current connection"),
876
GM_STOCK_DISCONNECT_16, 'd',
877
GTK_SIGNAL_FUNC (disconnect_cb), NULL, FALSE),
881
GTK_MENU_RADIO_ENTRY("available", _("_Available"),
882
_("Display a popup to accept the call"),
884
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
885
(gpointer) CALL_OPTIONS_KEY "incoming_call_mode",
886
(icm == AVAILABLE), TRUE),
887
GTK_MENU_RADIO_ENTRY("auto_answer", _("Aut_o Answer"),
888
_("Auto answer calls"),
890
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
891
(gpointer) CALL_OPTIONS_KEY "incoming_call_mode",
892
(icm == AUTO_ANSWER), TRUE),
893
GTK_MENU_RADIO_ENTRY("do_not_disturb", _("_Do Not Disturb"),
896
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
897
(gpointer) CALL_OPTIONS_KEY "incoming_call_mode",
898
(icm == DO_NOT_DISTURB), TRUE),
899
GTK_MENU_RADIO_ENTRY("forward", _("_Forward"), _("Forward calls"),
901
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
902
(gpointer) CALL_OPTIONS_KEY "incoming_call_mode",
903
(icm == FORWARD), TRUE),
907
GTK_SUBMENU_NEW("speed_dials", _("Speed dials")),
911
GTK_MENU_ENTRY("hold_call", _("_Hold Call"), _("Hold the current call"),
913
GTK_SIGNAL_FUNC (hold_current_call_cb), NULL,
915
GTK_MENU_ENTRY("transfer_call", _("_Transfer Call"),
916
_("Transfer the current call"),
918
GTK_SIGNAL_FUNC (transfer_current_call_cb), main_window,
923
GTK_MENU_ENTRY("suspend_audio", _("Suspend _Audio"),
924
_("Suspend or resume the audio transmission"),
926
GTK_SIGNAL_FUNC (pause_current_call_channel_cb),
927
GINT_TO_POINTER (0), FALSE),
928
GTK_MENU_ENTRY("suspend_video", _("Suspend _Video"),
929
_("Suspend or resume the video transmission"),
931
GTK_SIGNAL_FUNC (pause_current_call_channel_cb),
932
GINT_TO_POINTER (1), FALSE),
936
GTK_MENU_ENTRY("save_picture", _("_Save Current Picture"),
937
_("Save a snapshot of the current video"),
939
GTK_SIGNAL_FUNC (save_callback), NULL, FALSE),
943
GTK_MENU_ENTRY("close", _("_Close"), _("Close the Ekiga window"),
944
GTK_STOCK_CLOSE, 'W',
945
GTK_SIGNAL_FUNC (show_window_cb),
946
(gpointer) main_window, TRUE),
950
GTK_MENU_ENTRY("quit", _("_Quit"), _("Quit Ekiga"),
952
GTK_SIGNAL_FUNC (quit_callback), NULL, TRUE),
954
GTK_MENU_NEW (_("_Edit")),
956
GTK_MENU_ENTRY("configuration_druid", _("Configuration Druid"),
957
_("Run the configuration druid"),
959
GTK_SIGNAL_FUNC (show_window_cb),
960
(gpointer) druid_window, TRUE),
964
GTK_MENU_ENTRY("accounts", _("_Accounts"),
965
_("Edit your accounts"),
967
GTK_SIGNAL_FUNC (show_window_cb),
968
(gpointer) accounts_window, TRUE),
970
GTK_MENU_ENTRY("preferences", _("_Preferences"),
971
_("Change your preferences"),
972
GTK_STOCK_PREFERENCES, 'P',
973
GTK_SIGNAL_FUNC (show_window_cb),
974
(gpointer) prefs_window, TRUE),
976
GTK_MENU_NEW(_("_View")),
978
GTK_SUBMENU_NEW("view_mode", _("View _Mode")),
980
GTK_MENU_RADIO_ENTRY("softphone", _("Softp_hone"),
981
_("Show the softphone view"),
983
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
984
(gpointer)USER_INTERFACE_KEY "main_window/view_mode",
985
(mode == SOFTPHONE), TRUE),
986
GTK_MENU_RADIO_ENTRY("videophone", _("_Videophone"),
987
_("Show the videophone view"),
989
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
990
(gpointer)USER_INTERFACE_KEY "main_window/view_mode",
991
(mode == VIDEOPHONE), TRUE),
992
GTK_MENU_RADIO_ENTRY("full_view", _("_Full View"),
993
_("View all components"),
995
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
996
(gpointer)USER_INTERFACE_KEY "main_window/view_mode",
997
(mode == FULLVIEW), TRUE),
1001
GTK_SUBMENU_NEW("control_panel", _("Control Panel")),
1003
GTK_MENU_RADIO_ENTRY("dialpad", _("_Dialpad"), _("View the dialpad"),
1005
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
1006
(gpointer) USER_INTERFACE_KEY "main_window/control_panel_section",
1007
(cps == DIALPAD), TRUE),
1008
GTK_MENU_RADIO_ENTRY("audio_settings", _("_Audio Settings"),
1009
_("View audio settings"),
1011
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
1012
(gpointer) USER_INTERFACE_KEY "main_window/control_panel_section",
1013
(cps == AUDIO_SETTINGS), TRUE),
1014
GTK_MENU_RADIO_ENTRY("video_settings", _("_Video Settings"),
1015
_("View video settings"),
1017
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
1018
(gpointer) USER_INTERFACE_KEY "main_window/control_panel_section",
1019
(cps == VIDEO_SETTINGS), TRUE),
1020
GTK_MENU_RADIO_ENTRY("statistics", _("Statistics"),
1021
_("View audio/video transmission and reception statistics"),
1023
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
1024
(gpointer) USER_INTERFACE_KEY "main_window/control_panel_section",
1025
(cps == STATISTICS), TRUE),
1029
GTK_MENU_RADIO_ENTRY("local_video", _("Local Video"),
1030
_("Local video image"),
1032
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
1033
(gpointer) VIDEO_DISPLAY_KEY "video_view",
1035
GTK_MENU_RADIO_ENTRY("remote_video", _("Remote Video"),
1036
_("Remote video image"),
1038
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
1039
(gpointer) VIDEO_DISPLAY_KEY "video_view",
1041
GTK_MENU_RADIO_ENTRY("both_incrusted", _("Both (Picture-in-Picture)"),
1042
_("Both video images"),
1044
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
1045
(gpointer) VIDEO_DISPLAY_KEY "video_view",
1047
GTK_MENU_RADIO_ENTRY("both_side_by_side", _("Both (Side-by-Side)"),
1048
_("Both video images"),
1050
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
1051
(gpointer) VIDEO_DISPLAY_KEY "video_view",
1053
GTK_MENU_RADIO_ENTRY("both_new_windows",
1054
_("Both (Both in New Windows)"),
1055
_("Both video images"),
1057
GTK_SIGNAL_FUNC (radio_menu_changed_cb),
1058
(gpointer) VIDEO_DISPLAY_KEY "video_view",
1063
GTK_MENU_ENTRY("zoom_in", _("Zoom In"), _("Zoom in"),
1064
GTK_STOCK_ZOOM_IN, '+',
1065
GTK_SIGNAL_FUNC (zoom_in_changed_cb),
1066
(gpointer) VIDEO_DISPLAY_KEY "zoom_factor", FALSE),
1067
GTK_MENU_ENTRY("zoom_out", _("Zoom Out"), _("Zoom out"),
1068
GTK_STOCK_ZOOM_OUT, '-',
1069
GTK_SIGNAL_FUNC (zoom_out_changed_cb),
1070
(gpointer) VIDEO_DISPLAY_KEY "zoom_factor", FALSE),
1071
GTK_MENU_ENTRY("normal_size", _("Normal Size"), _("Normal size"),
1072
GTK_STOCK_ZOOM_100, '=',
1073
GTK_SIGNAL_FUNC (zoom_normal_changed_cb),
1074
(gpointer) VIDEO_DISPLAY_KEY "zoom_factor", FALSE),
1077
GTK_MENU_ENTRY("fullscreen", _("Fullscreen"), _("Switch to fullscreen"),
1078
GTK_STOCK_ZOOM_IN, 'f',
1079
GTK_SIGNAL_FUNC (fullscreen_changed_cb),
1080
(gpointer) main_window, FALSE),
1083
GTK_MENU_NEW(_("_Tools")),
1085
GTK_MENU_ENTRY("address_book", _("Address _Book"),
1086
_("Open the address book"),
1087
GM_STOCK_ADDRESSBOOK_16, 0,
1088
GTK_SIGNAL_FUNC (show_window_cb),
1089
(gpointer) addressbook_window, TRUE),
1093
GTK_MENU_ENTRY("chat_window", _("C_hat Window"),
1094
_("Open the chat window"),
1096
GTK_SIGNAL_FUNC (show_window_cb),
1097
(gpointer) chat_window, TRUE),
1099
GTK_MENU_ENTRY("log", _("General History"),
1100
_("View the operations history"),
1102
GTK_SIGNAL_FUNC (show_window_cb),
1103
(gpointer) history_window, TRUE),
1104
GTK_MENU_ENTRY("calls_history", _("Calls History"),
1105
_("View the calls history"),
1106
GM_STOCK_CALLS_HISTORY, 'h',
1107
GTK_SIGNAL_FUNC (show_window_cb),
1108
(gpointer) calls_history_window, TRUE),
1112
GTK_MENU_ENTRY("pc-to-phone", _("PC-To-Phone Account"),
1113
_("Manage your PC-To-Phone account"),
1115
GTK_SIGNAL_FUNC (show_window_cb),
1116
(gpointer) pc2phone_window, TRUE),
1118
GTK_MENU_NEW(_("_Help")),
1120
#ifndef DISABLE_GNOME
1121
GTK_MENU_ENTRY("help", _("_Contents"),
1122
_("Get help by reading the Ekiga manual"),
1123
GTK_STOCK_HELP, GDK_F1,
1124
GTK_SIGNAL_FUNC (help_cb), NULL, TRUE),
1126
GTK_MENU_ENTRY("about", _("_About"),
1127
_("View information about Ekiga"),
1128
GNOME_STOCK_ABOUT, 0,
1129
GTK_SIGNAL_FUNC (about_callback), (gpointer) main_window,
1132
GTK_MENU_ENTRY("help", _("_Contents"),
1133
_("Get help by reading the Ekiga manual"),
1134
GTK_STOCK_HELP, GDK_F1,
1137
GTK_MENU_ENTRY("about", _("_About"),
1138
_("View information about Ekiga"),
1140
GTK_SIGNAL_FUNC (about_callback), (gpointer) main_window,
1148
gtk_build_menu (mw->main_menu,
1154
gnomemeeting_addressbook_get_contacts (NULL, nbr,
1155
FALSE, NULL, NULL, NULL, "*");
1156
gm_main_window_speed_dials_menu_update (main_window, glist);
1157
g_slist_foreach (glist, (GFunc) gmcontact_delete, NULL);
1158
g_slist_free (glist);
1160
gtk_widget_show_all (GTK_WIDGET (mw->main_menu));
1165
gm_mw_init_stats (GtkWidget *main_window)
1167
GmWindow *mw = NULL;
1169
GtkWidget *frame = NULL;
1170
GtkWidget *frame2 = NULL;
1171
GtkWidget *label = NULL;
1172
GtkWidget *vbox = NULL;
1175
g_return_if_fail (main_window != NULL);
1176
mw = gm_mw_get_mw (main_window);
1179
/* The main frame */
1180
frame = gtk_frame_new (NULL);
1181
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
1182
gtk_container_set_border_width (GTK_CONTAINER (frame), 5);
1184
/* The first frame with statistics display */
1185
frame2 = gtk_frame_new (NULL);
1186
gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_IN);
1188
vbox = gtk_vbox_new (FALSE, 0);
1189
mw->stats_drawing_area = stats_drawing_area_new ();
1191
gtk_box_pack_start (GTK_BOX (vbox), frame2, FALSE, TRUE, 0);
1192
gtk_container_add (GTK_CONTAINER (frame2), mw->stats_drawing_area);
1194
gtk_widget_set_size_request (GTK_WIDGET (frame2), GM_QCIF_WIDTH-10, 47);
1195
gtk_widget_queue_draw (mw->stats_drawing_area);
1197
/* The second one with some labels */
1198
mw->stats_label = gtk_label_new ("");
1199
gtk_misc_set_alignment (GTK_MISC (mw->stats_label), 0, 0);
1200
gtk_box_pack_start (GTK_BOX (vbox), mw->stats_label, FALSE, TRUE, 3);
1202
gtk_container_add (GTK_CONTAINER (frame), vbox);
1204
gm_main_window_clear_stats (main_window);
1206
label = gtk_label_new (_("Statistics"));
1208
gtk_notebook_append_page (GTK_NOTEBOOK (mw->main_notebook), frame, label);
1213
gm_mw_init_dialpad (GtkWidget *main_window)
1215
GmWindow *mw = NULL;
1217
GtkSizeGroup *size_group_alpha = NULL;
1219
GtkWidget *box = NULL;
1220
GtkWidget *button = NULL;
1221
GtkWidget *label = NULL;
1222
GtkWidget *table = NULL;
1226
char *key_n [] = { "1", "2", "3", "4", "5", "6", "7", "8", "9",
1228
guint key_kp [] = { GDK_KP_1, GDK_KP_2, GDK_KP_3, GDK_KP_4, GDK_KP_5,
1229
GDK_KP_6, GDK_KP_7, GDK_KP_8, GDK_KP_9, GDK_KP_Multiply,
1230
GDK_KP_0, GDK_numbersign};
1232
char *key_a []= { " ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv",
1233
"wxyz", " ", " ", " "};
1235
gchar *text_label = NULL;
1238
g_return_if_fail (main_window != NULL);
1239
mw = gm_mw_get_mw (main_window);
1241
table = gtk_table_new (4, 3, TRUE);
1242
gtk_container_set_border_width (GTK_CONTAINER (table), 5);
1245
size_group_alpha = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
1247
for (i = 0 ; i < 12 ; i++) {
1249
box = gtk_hbox_new (FALSE, 0);
1251
label = gtk_label_new (NULL);
1253
g_strdup_printf (" %s ",
1255
g_object_set (label, "xalign", 1.0, NULL);
1256
gtk_label_set_markup (GTK_LABEL (label), text_label);
1257
gtk_box_pack_start (GTK_BOX(box), label, TRUE, TRUE, 0);
1259
label = gtk_label_new (NULL);
1261
g_strdup_printf ("<sub><span size=\"small\">%s</span></sub> ",
1263
g_object_set (label, "xalign", 0.0, NULL);
1264
gtk_label_set_markup (GTK_LABEL (label), text_label);
1265
gtk_size_group_add_widget (size_group_alpha, label);
1266
gtk_box_pack_start (GTK_BOX(box), label, FALSE, TRUE, 0);
1268
button = gtk_button_new ();
1269
gtk_container_set_border_width (GTK_CONTAINER (button), 0);
1270
gtk_container_add (GTK_CONTAINER (button), box);
1272
gtk_widget_add_accelerator (button, "activate",
1273
mw->accel, key_kp [i],
1274
(GdkModifierType) 0, (GtkAccelFlags) 0);
1276
gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (button),
1277
i%3, i%3+1, i/3, i/3+1,
1278
(GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
1279
(GtkAttachOptions) (GTK_FILL),
1282
g_signal_connect (G_OBJECT (button), "clicked",
1283
GTK_SIGNAL_FUNC (dialpad_button_clicked_cb),
1286
g_free (text_label);
1289
label = gtk_label_new (_("Dialpad"));
1291
gtk_notebook_append_page (GTK_NOTEBOOK (mw->main_notebook),
1297
gm_mw_init_video_settings (GtkWidget *main_window)
1299
GmWindow *mw = NULL;
1301
GtkWidget *label = NULL;
1302
GtkWidget *hbox = NULL;
1303
GtkWidget *vbox = NULL;
1304
GtkWidget *image = NULL;
1306
GtkWidget *hscale_brightness = NULL;
1307
GtkWidget *hscale_colour = NULL;
1308
GtkWidget *hscale_contrast = NULL;
1309
GtkWidget *hscale_whiteness = NULL;
1311
int brightness = 0, colour = 0, contrast = 0, whiteness = 0;
1313
g_return_if_fail (main_window != NULL);
1314
mw = gm_mw_get_mw (main_window);
1316
/* Webcam Control Frame, we need it to disable controls */
1317
mw->video_settings_frame = gtk_frame_new (NULL);
1318
gtk_frame_set_shadow_type (GTK_FRAME (mw->video_settings_frame),
1320
gtk_container_set_border_width (GTK_CONTAINER (mw->video_settings_frame), 5);
1323
vbox = gtk_vbox_new (0, FALSE);
1324
gtk_container_add (GTK_CONTAINER (mw->video_settings_frame), vbox);
1327
hbox = gtk_hbox_new (0, FALSE);
1328
image = gtk_image_new_from_stock (GM_STOCK_BRIGHTNESS, GTK_ICON_SIZE_MENU);
1329
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
1331
mw->adj_brightness = gtk_adjustment_new (brightness, 0.0,
1332
255.0, 1.0, 5.0, 1.0);
1333
hscale_brightness = gtk_hscale_new (GTK_ADJUSTMENT (mw->adj_brightness));
1334
gtk_range_set_update_policy (GTK_RANGE (hscale_brightness),
1335
GTK_UPDATE_DELAYED);
1336
gtk_scale_set_draw_value (GTK_SCALE (hscale_brightness), FALSE);
1337
gtk_scale_set_value_pos (GTK_SCALE (hscale_brightness), GTK_POS_RIGHT);
1338
gtk_box_pack_start (GTK_BOX (hbox), hscale_brightness, TRUE, TRUE, 2);
1339
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
1341
gtk_tooltips_set_tip (mw->tips, hscale_brightness,
1342
_("Adjust brightness"), NULL);
1344
g_signal_connect (G_OBJECT (mw->adj_brightness), "value-changed",
1345
G_CALLBACK (video_settings_changed_cb),
1346
(gpointer) main_window);
1349
hbox = gtk_hbox_new (0, FALSE);
1350
image = gtk_image_new_from_stock (GM_STOCK_WHITENESS, GTK_ICON_SIZE_MENU);
1351
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
1353
mw->adj_whiteness = gtk_adjustment_new (whiteness, 0.0,
1354
255.0, 1.0, 5.0, 1.0);
1355
hscale_whiteness = gtk_hscale_new (GTK_ADJUSTMENT (mw->adj_whiteness));
1356
gtk_range_set_update_policy (GTK_RANGE (hscale_whiteness),
1357
GTK_UPDATE_DELAYED);
1358
gtk_scale_set_draw_value (GTK_SCALE (hscale_whiteness), FALSE);
1359
gtk_scale_set_value_pos (GTK_SCALE (hscale_whiteness), GTK_POS_RIGHT);
1360
gtk_box_pack_start (GTK_BOX (hbox), hscale_whiteness, TRUE, TRUE, 2);
1361
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
1363
gtk_tooltips_set_tip (mw->tips, hscale_whiteness,
1364
_("Adjust whiteness"), NULL);
1366
g_signal_connect (G_OBJECT (mw->adj_whiteness), "value-changed",
1367
G_CALLBACK (video_settings_changed_cb),
1368
(gpointer) main_window);
1371
hbox = gtk_hbox_new (0, FALSE);
1372
image = gtk_image_new_from_stock (GM_STOCK_COLOURNESS, GTK_ICON_SIZE_MENU);
1373
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
1375
mw->adj_colour = gtk_adjustment_new (colour, 0.0,
1376
255.0, 1.0, 5.0, 1.0);
1377
hscale_colour = gtk_hscale_new (GTK_ADJUSTMENT (mw->adj_colour));
1378
gtk_range_set_update_policy (GTK_RANGE (hscale_colour),
1379
GTK_UPDATE_DELAYED);
1380
gtk_scale_set_draw_value (GTK_SCALE (hscale_colour), FALSE);
1381
gtk_scale_set_value_pos (GTK_SCALE (hscale_colour), GTK_POS_RIGHT);
1382
gtk_box_pack_start (GTK_BOX (hbox), hscale_colour, TRUE, TRUE, 2);
1383
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
1385
gtk_tooltips_set_tip (mw->tips, hscale_colour,
1386
_("Adjust color"), NULL);
1388
g_signal_connect (G_OBJECT (mw->adj_colour), "value-changed",
1389
G_CALLBACK (video_settings_changed_cb),
1390
(gpointer) main_window);
1393
hbox = gtk_hbox_new (0, FALSE);
1394
image = gtk_image_new_from_stock (GM_STOCK_CONTRAST, GTK_ICON_SIZE_MENU);
1395
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
1397
mw->adj_contrast = gtk_adjustment_new (contrast, 0.0,
1398
255.0, 1.0, 5.0, 1.0);
1399
hscale_contrast = gtk_hscale_new (GTK_ADJUSTMENT (mw->adj_contrast));
1400
gtk_range_set_update_policy (GTK_RANGE (hscale_contrast),
1401
GTK_UPDATE_DELAYED);
1402
gtk_scale_set_draw_value (GTK_SCALE (hscale_contrast), FALSE);
1403
gtk_scale_set_value_pos (GTK_SCALE (hscale_contrast), GTK_POS_RIGHT);
1404
gtk_box_pack_start (GTK_BOX (hbox), hscale_contrast, TRUE, TRUE, 2);
1405
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
1407
gtk_tooltips_set_tip (mw->tips, hscale_contrast,
1408
_("Adjust contrast"), NULL);
1410
g_signal_connect (G_OBJECT (mw->adj_contrast), "value-changed",
1411
G_CALLBACK (video_settings_changed_cb),
1412
(gpointer) main_window);
1414
label = gtk_label_new (_("Video"));
1416
gtk_notebook_append_page (GTK_NOTEBOOK(mw->main_notebook),
1417
mw->video_settings_frame, label);
1423
gm_mw_init_audio_settings (GtkWidget *main_window)
1425
GmWindow *mw = NULL;
1427
GtkWidget *hscale_play = NULL;
1428
GtkWidget *hscale_rec = NULL;
1429
GtkWidget *label = NULL;
1430
GtkWidget *hbox = NULL;
1431
GtkWidget *vbox = NULL;
1432
GtkWidget *small_vbox = NULL;
1435
/* Get the data from the GMObject */
1436
mw = gm_mw_get_mw (main_window);
1439
/* Audio control frame, we need it to disable controls */
1440
mw->audio_volume_frame = gtk_frame_new (NULL);
1441
gtk_frame_set_shadow_type (GTK_FRAME (mw->audio_volume_frame),
1443
gtk_container_set_border_width (GTK_CONTAINER (mw->audio_volume_frame), 5);
1447
vbox = gtk_vbox_new (0, FALSE);
1448
gtk_container_add (GTK_CONTAINER (mw->audio_volume_frame), vbox);
1451
hbox = gtk_hbox_new (0, FALSE);
1452
gtk_box_pack_start (GTK_BOX (hbox),
1453
gtk_image_new_from_stock (GM_STOCK_VOLUME,
1454
GTK_ICON_SIZE_SMALL_TOOLBAR),
1457
small_vbox = gtk_vbox_new (0, FALSE);
1458
mw->adj_output_volume = gtk_adjustment_new (0, 0.0, 100.0, 1.0, 5.0, 1.0);
1459
hscale_play = gtk_hscale_new (GTK_ADJUSTMENT (mw->adj_output_volume));
1460
gtk_range_set_update_policy (GTK_RANGE (hscale_play),
1461
GTK_UPDATE_DELAYED);
1462
gtk_scale_set_value_pos (GTK_SCALE (hscale_play), GTK_POS_RIGHT);
1463
gtk_scale_set_draw_value (GTK_SCALE (hscale_play), FALSE);
1464
gtk_box_pack_start (GTK_BOX (small_vbox), hscale_play, TRUE, TRUE, 0);
1466
mw->output_signal = gtk_levelmeter_new ();
1467
gtk_box_pack_start (GTK_BOX (small_vbox), mw->output_signal, TRUE, TRUE, 0);
1468
gtk_box_pack_start (GTK_BOX (hbox), small_vbox, TRUE, TRUE, 2);
1469
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
1472
hbox = gtk_hbox_new (0, FALSE);
1473
gtk_box_pack_start (GTK_BOX (hbox),
1474
gtk_image_new_from_stock (GM_STOCK_MICROPHONE,
1475
GTK_ICON_SIZE_SMALL_TOOLBAR),
1478
small_vbox = gtk_vbox_new (0, FALSE);
1479
mw->adj_input_volume = gtk_adjustment_new (0, 0.0, 100.0, 1.0, 5.0, 1.0);
1480
hscale_rec = gtk_hscale_new (GTK_ADJUSTMENT (mw->adj_input_volume));
1481
gtk_range_set_update_policy (GTK_RANGE (hscale_rec),
1482
GTK_UPDATE_DELAYED);
1483
gtk_scale_set_value_pos (GTK_SCALE (hscale_rec), GTK_POS_RIGHT);
1484
gtk_scale_set_draw_value (GTK_SCALE (hscale_rec), FALSE);
1485
gtk_box_pack_start (GTK_BOX (small_vbox), hscale_rec, TRUE, TRUE, 0);
1487
mw->input_signal = gtk_levelmeter_new ();
1488
gtk_box_pack_start (GTK_BOX (small_vbox), mw->input_signal, TRUE, TRUE, 0);
1489
gtk_box_pack_start (GTK_BOX (hbox), small_vbox, TRUE, TRUE, 2);
1490
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
1492
g_signal_connect (G_OBJECT (mw->adj_output_volume), "value-changed",
1493
G_CALLBACK (audio_volume_changed_cb), main_window);
1495
g_signal_connect (G_OBJECT (mw->adj_input_volume), "value-changed",
1496
G_CALLBACK (audio_volume_changed_cb), main_window);
1498
label = gtk_label_new (_("Audio"));
1500
gtk_notebook_append_page (GTK_NOTEBOOK (mw->main_notebook),
1501
mw->audio_volume_frame, label);
1506
gm_mw_video_window_new (GtkWidget *main_window,
1512
GmWindow *mw = NULL;
1514
GtkWidget *event_box = NULL;
1515
GtkWidget *vbox = NULL;
1516
GtkWidget *window = NULL;
1519
g_return_val_if_fail (main_window != NULL, NULL);
1520
mw = gm_mw_get_mw (main_window);
1521
g_return_val_if_fail (mw != NULL, NULL);
1524
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
1525
gtk_window_set_title (GTK_WINDOW (window), title);
1526
g_object_set_data_full (G_OBJECT (window), "window_name",
1527
g_strdup (window_name), g_free);
1529
event_box = gtk_event_box_new ();
1530
vbox = gtk_vbox_new (0, FALSE);
1531
image = gtk_image_new ();
1533
gtk_box_pack_start (GTK_BOX (vbox), image, TRUE, TRUE, 0);
1534
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
1536
gtk_container_add (GTK_CONTAINER (window), event_box);
1537
gtk_container_add (GTK_CONTAINER (event_box), vbox);
1538
gtk_widget_realize (image);
1540
gtk_widget_set_size_request (GTK_WIDGET (image), 176, 144);
1541
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
1543
gtk_widget_show_all (event_box);
1545
static MenuEntry local_popup_menu [] = {
1547
GTK_MENU_ENTRY("zoom_in", _("Zoom In"), _("Zoom in"),
1548
GTK_STOCK_ZOOM_IN, '+',
1549
GTK_SIGNAL_FUNC (zoom_in_changed_cb),
1550
(gpointer) VIDEO_DISPLAY_KEY "local_zoom_factor", TRUE),
1551
GTK_MENU_ENTRY("zoom_out", _("Zoom Out"), _("Zoom out"),
1552
GTK_STOCK_ZOOM_OUT, '-',
1553
GTK_SIGNAL_FUNC (zoom_out_changed_cb),
1554
(gpointer) VIDEO_DISPLAY_KEY "local_zoom_factor", TRUE),
1555
GTK_MENU_ENTRY("normal_size", _("Normal Size"), _("Normal size"),
1556
GTK_STOCK_ZOOM_100, '=',
1557
GTK_SIGNAL_FUNC (zoom_normal_changed_cb),
1558
(gpointer) VIDEO_DISPLAY_KEY "local_zoom_factor", TRUE),
1561
GTK_MENU_ENTRY("fullscreen", _("Fullscreen"), _("Switch to fullscreen"),
1562
GTK_STOCK_ZOOM_IN, 'f',
1563
GTK_SIGNAL_FUNC (fullscreen_changed_cb),
1564
(gpointer) main_window, TRUE),
1570
static MenuEntry remote_popup_menu [] = {
1572
GTK_MENU_ENTRY("zoom_in", _("Zoom In"), _("Zoom in"),
1573
GTK_STOCK_ZOOM_IN, '+',
1574
GTK_SIGNAL_FUNC (zoom_in_changed_cb),
1575
(gpointer) VIDEO_DISPLAY_KEY "remote_zoom_factor", TRUE),
1576
GTK_MENU_ENTRY("zoom_out", _("Zoom Out"), _("Zoom out"),
1577
GTK_STOCK_ZOOM_OUT, '-',
1578
GTK_SIGNAL_FUNC (zoom_out_changed_cb),
1579
(gpointer) VIDEO_DISPLAY_KEY "remote_zoom_factor", TRUE),
1580
GTK_MENU_ENTRY("normal_size", _("Normal Size"), _("Normal size"),
1581
GTK_STOCK_ZOOM_100, '=',
1582
GTK_SIGNAL_FUNC (zoom_normal_changed_cb),
1583
(gpointer) VIDEO_DISPLAY_KEY "remote_zoom_factor", TRUE),
1586
GTK_MENU_ENTRY("fullscreen", _("Fullscreen"), _("Switch to fullscreen"),
1587
GTK_STOCK_ZOOM_IN, 'f',
1588
GTK_SIGNAL_FUNC (fullscreen_changed_cb),
1589
(gpointer) main_window, TRUE),
1596
gtk_build_popup_menu (event_box, local_popup_menu, mw->accel);
1598
gtk_build_popup_menu (event_box, remote_popup_menu, mw->accel);
1600
g_signal_connect (G_OBJECT (window), "delete_event",
1601
G_CALLBACK (gtk_widget_hide_on_delete), 0);
1609
gm_mw_init_fullscreen_video_window (GtkWidget *main_window)
1611
GmWindow *mw = NULL;
1613
g_return_if_fail (main_window != NULL);
1615
mw = gm_mw_get_mw (main_window);
1617
g_return_if_fail (mw != NULL);
1619
mw->screen = SDL_GetVideoSurface ();
1622
SDL_Init (SDL_INIT_VIDEO);
1623
mw->screen = SDL_SetVideoMode (640, 480, 0,
1624
SDL_SWSURFACE | SDL_HWSURFACE |
1626
SDL_WM_ToggleFullScreen (mw->screen);
1627
SDL_ShowCursor (SDL_DISABLE);
1633
gm_mw_poll_fullscreen_video_window (GtkWidget *main_window)
1638
while (SDL_PollEvent (&event)) {
1640
if (event.type == SDL_KEYDOWN) {
1642
/* Exit Full Screen */
1643
if ((event.key.keysym.sym == SDLK_ESCAPE) ||
1644
(event.key.keysym.sym == SDLK_f)) {
1656
gm_mw_toggle_fullscreen (GtkWidget *main_window)
1658
if (gm_conf_get_float (VIDEO_DISPLAY_KEY "zoom_factor") == -1.0)
1659
gm_conf_set_float (VIDEO_DISPLAY_KEY "zoom_factor", 1.0);
1661
gm_conf_set_float (VIDEO_DISPLAY_KEY "zoom_factor", -1.0);
1666
gm_mw_destroy_fullscreen_video_window (GtkWidget *main_window)
1668
GmWindow *mw = NULL;
1670
g_return_if_fail (main_window != NULL);
1672
mw = gm_mw_get_mw (main_window);
1674
g_return_if_fail (mw != NULL);
1684
gm_mw_show_video_section (GtkWidget *main_window,
1687
GmWindow *mw = NULL;
1689
g_return_if_fail (main_window != NULL);
1691
mw = gm_mw_get_mw (main_window);
1693
g_return_if_fail (mw != NULL);
1696
gtk_widget_show_all (mw->video_frame);
1698
gtk_widget_hide (mw->video_frame);
1703
gm_mw_show_control_panel (GtkWidget *main_window,
1706
GmWindow *mw = NULL;
1708
g_return_if_fail (main_window != NULL);
1710
mw = gm_mw_get_mw (main_window);
1712
g_return_if_fail (mw != NULL);
1715
gtk_widget_show_all (mw->main_notebook);
1717
gtk_widget_hide (mw->main_notebook);
1723
gnomemeeting_tray_hack_cb (gpointer data)
1725
GtkWidget *main_window = NULL;
1726
GtkWidget *statusicon = NULL;
1728
statusicon = GnomeMeeting::Process ()->GetStatusicon ();
1729
main_window = GnomeMeeting::Process ()->GetMainWindow ();
1731
gdk_threads_enter ();
1733
if (!gm_statusicon_is_embedded (statusicon)) {
1735
gnomemeeting_error_dialog (GTK_WINDOW (main_window), _("Notification area not detected"), _("The notification area is not present in your panel, so Ekiga cannot start hidden."));
1736
gtk_widget_show (main_window);
1739
gdk_threads_leave ();
1745
hold_current_call_cb (GtkWidget *widget,
1749
GMManager *endpoint = NULL;
1751
BOOL is_on_hold = FALSE;
1753
endpoint = GnomeMeeting::Process ()->GetManager ();
1755
/* Release the GDK thread to prevent deadlocks, change
1756
* the hold state at the endpoint level.
1758
gdk_threads_leave ();
1759
call_token = endpoint->GetCurrentCallToken ();
1760
is_on_hold = endpoint->IsCallOnHold (call_token);
1761
if (endpoint->SetCallOnHold (call_token, !is_on_hold))
1762
is_on_hold = !is_on_hold; /* It worked */
1763
gdk_threads_enter ();
1768
pause_current_call_channel_cb (GtkWidget *widget,
1771
GMManager *endpoint = NULL;
1772
GMVideoGrabber *vg = NULL;
1774
GtkWidget *main_window = NULL;
1776
PString current_call_token;
1777
BOOL is_paused = FALSE;
1779
endpoint = GnomeMeeting::Process ()->GetManager ();
1780
current_call_token = endpoint->GetCurrentCallToken ();
1782
main_window = GnomeMeeting::Process ()->GetMainWindow ();
1784
if (current_call_token.IsEmpty ()
1785
&& (GPOINTER_TO_INT (data) == 1)
1786
&& endpoint->GetCallingState () == GMManager::Standby) {
1788
gdk_threads_leave ();
1789
vg = endpoint->GetVideoGrabber ();
1792
if (vg->IsGrabbing ()) {
1794
vg->StopGrabbing ();
1795
gm_main_window_set_channel_pause (main_window, TRUE, TRUE);
1799
vg->StartGrabbing ();
1800
gm_main_window_set_channel_pause (main_window, FALSE, TRUE);
1805
gdk_threads_enter ();
1809
if (GPOINTER_TO_INT (data) == 0) {
1811
gdk_threads_leave ();
1812
is_paused = endpoint->IsCallAudioPaused (current_call_token);
1813
if (endpoint->SetCallAudioPause (current_call_token, !is_paused))
1814
is_paused = !is_paused; /* It worked */
1815
gdk_threads_enter ();
1817
gm_main_window_set_channel_pause (main_window, is_paused, FALSE);
1821
gdk_threads_leave ();
1822
is_paused = endpoint->IsCallVideoPaused (current_call_token);
1823
if (endpoint->SetCallVideoPause (current_call_token, !is_paused))
1824
is_paused = !is_paused; /* It worked */
1825
gdk_threads_enter ();
1827
gm_main_window_set_channel_pause (main_window, is_paused, TRUE);
1834
transfer_current_call_cb (GtkWidget *widget,
1837
GtkWidget *main_window = NULL;
1839
g_return_if_fail (data != NULL);
1841
main_window = GnomeMeeting::Process ()->GetMainWindow ();
1843
gm_main_window_transfer_dialog_run (main_window, GTK_WIDGET (data), NULL);
1848
video_window_shown_cb (GtkWidget *w,
1851
GMManager *endpoint = NULL;
1853
endpoint = GnomeMeeting::Process ()->GetManager ();
1856
&& gm_conf_get_bool (VIDEO_DISPLAY_KEY "stay_on_top")
1857
&& endpoint->GetCallingState () == GMManager::Connected)
1858
gdk_window_set_always_on_top (GDK_WINDOW (w->window), TRUE);
1863
dnd_call_contact_cb (GtkWidget *widget,
1869
GmWindow *mw = NULL;
1870
GMManager *ep = NULL;
1872
GtkWidget *main_window = NULL;
1874
g_return_if_fail (data != NULL);
1876
ep = GnomeMeeting::Process ()->GetManager ();
1877
main_window = GnomeMeeting::Process ()->GetMainWindow ();
1879
mw = GM_WINDOW (data);
1881
if (contact && contact->url) {
1883
if (ep->GetCallingState () == GMManager::Connected)
1884
gm_main_window_transfer_dialog_run (main_window,
1887
else if (ep->GetCallingState () == GMManager::Standby)
1888
GnomeMeeting::Process ()->Connect (contact->url);
1890
gmcontact_delete (contact);
1896
audio_volume_changed_cb (GtkAdjustment *adjustment,
1899
GMManager *ep = NULL;
1900
GMPCSSEndpoint *pcssEP = NULL;
1902
BOOL success = FALSE;
1907
g_return_if_fail (data != NULL);
1909
ep = GnomeMeeting::Process ()->GetManager ();
1910
pcssEP = ep->GetPCSSEndpoint ();
1912
gm_main_window_get_volume_sliders_values (GTK_WIDGET (data),
1915
gdk_threads_leave ();
1916
success = pcssEP->SetDeviceVolume (play_vol, rec_vol);
1917
gdk_threads_enter ();
1920
gm_main_window_set_volume_sliders_values (GTK_WIDGET (data), 0, 0);
1925
video_settings_changed_cb (GtkAdjustment *adjustment,
1928
GMManager *ep = NULL;
1929
GMVideoGrabber *video_grabber = NULL;
1931
BOOL success = FALSE;
1933
int brightness = -1;
1938
g_return_if_fail (data != NULL);
1940
ep = GnomeMeeting::Process ()->GetManager ();
1942
gm_main_window_get_video_sliders_values (GTK_WIDGET (data),
1948
/* Notice about mutexes:
1949
The GDK lock is taken in the callback. We need to release it, because
1950
if CreateVideoGrabber is called in another thread, it will only
1951
release its internal mutex (also used by GetVideoGrabber) after it
1952
returns, but it will return only if it is opened, and it can't open
1953
if the GDK lock is held as it will wait on the GDK lock before
1955
gdk_threads_leave ();
1956
if ((video_grabber = ep->GetVideoGrabber ())) {
1959
success = video_grabber->SetWhiteness (whiteness << 8);
1961
success = video_grabber->SetBrightness (brightness << 8) || success;
1963
success = video_grabber->SetColour (colour << 8) || success;
1965
success = video_grabber->SetContrast (contrast << 8) || success;
1966
video_grabber->Unlock ();
1968
gdk_threads_enter ();
1971
gm_main_window_set_video_sliders_values (GTK_WIDGET (data), 0, 0, 0, 0);
1976
control_panel_section_changed_cb (GtkNotebook *notebook,
1977
GtkNotebookPage *page,
1981
GmWindow *mw = NULL;
1983
gint current_page = 0;
1985
g_return_if_fail (data != NULL);
1986
mw = gm_mw_get_mw (GTK_WIDGET (data));
1989
gtk_notebook_get_current_page (GTK_NOTEBOOK (mw->main_notebook));
1990
gm_conf_set_int (USER_INTERFACE_KEY "main_window/control_panel_section",
1996
dialpad_button_clicked_cb (GtkButton *button,
1999
GtkWidget *label = NULL;
2000
const char *button_text = NULL;
2006
GMManager *endpoint = NULL;
2008
g_return_if_fail (data != NULL);
2011
endpoint = GnomeMeeting::Process ()->GetManager ();
2013
label = ( (GtkBoxChild*) GTK_BOX (gtk_bin_get_child (GTK_BIN (button)) )->children->data )->widget;
2014
button_text = gtk_label_get_text (GTK_LABEL (label));
2017
&& strcmp (button_text, "")
2018
&& strlen (button_text) > 1
2019
&& button_text [0]) {
2021
/* Release the GDK thread to prevent deadlocks */
2022
gdk_threads_leave ();
2023
call_token = endpoint->GetCurrentCallToken ();
2025
/* Send the DTMF if there is a current call */
2026
if (!call_token.IsEmpty ()) {
2028
endpoint->SendDTMF (call_token, button_text [1]);
2031
gdk_threads_enter ();
2034
/* Update the GUI, ie the URL bar if we are not in a call,
2035
* and a button press in all cases */
2038
if (button_text [1] == '*')
2041
url += button_text [1];
2043
gm_main_window_append_call_url (GTK_WIDGET (data), url);
2046
gm_main_window_flash_message (GTK_WIDGET (data),
2054
window_closed_cb (GtkWidget *widget,
2058
GtkWidget *statusicon = NULL;
2060
GmWindow *mw = NULL;
2064
g_return_val_if_fail (data != NULL, FALSE);
2065
mw = gm_mw_get_mw (GTK_WIDGET (data));
2066
statusicon = GnomeMeeting::Process ()->GetStatusicon ();
2069
b = gm_statusicon_is_embedded (statusicon);
2072
quit_callback (NULL, data);
2074
gnomemeeting_window_hide (GTK_WIDGET (data));
2081
zoom_in_changed_cb (GtkWidget *widget,
2086
g_return_if_fail (data != NULL);
2088
zoom = gm_conf_get_float ((char *) data);
2093
gm_conf_set_float ((char *) data, zoom);
2098
zoom_out_changed_cb (GtkWidget *widget,
2103
g_return_if_fail (data != NULL);
2105
zoom = gm_conf_get_float ((char *) data);
2110
gm_conf_set_float ((char *) data, zoom);
2115
zoom_normal_changed_cb (GtkWidget *widget,
2120
g_return_if_fail (data != NULL);
2122
gm_conf_set_float ((char *) data, zoom);
2128
fullscreen_changed_cb (GtkWidget *widget,
2131
gm_mw_toggle_fullscreen (GTK_WIDGET (data));
2137
speed_dial_menu_item_selected_cb (GtkWidget *w,
2140
GtkWidget *main_window = NULL;
2142
GmWindow *mw = NULL;
2143
GMManager *ep = NULL;
2147
main_window = GnomeMeeting::Process ()->GetMainWindow ();
2149
mw = gm_mw_get_mw (main_window);
2150
ep = GnomeMeeting::Process ()->GetManager ();
2152
g_return_if_fail (data != NULL);
2154
url = g_strdup_printf ("%s#", (gchar *) data);
2155
gm_main_window_set_call_url (main_window, url);
2158
/* Directly Connect or run the transfer dialog */
2159
if (ep->GetCallingState () == GMManager::Connected)
2160
gm_main_window_transfer_dialog_run (main_window, main_window, url);
2162
GnomeMeeting::Process ()->Connect (url);
2169
url_changed_cb (GtkEditable *e,
2172
GmWindow *mw = NULL;
2174
const char *tip_text = NULL;
2176
g_return_if_fail (data != NULL);
2177
mw = gm_mw_get_mw (GTK_WIDGET (data));
2179
tip_text = gtk_entry_get_text (GTK_ENTRY (e));
2181
gtk_tooltips_set_tip (mw->tips, GTK_WIDGET (e), tip_text, NULL);
2186
completion_url_selected_cb (GtkEntryCompletion *completion,
2187
GtkTreeModel *model,
2193
gtk_tree_model_get (GTK_TREE_MODEL (model), iter, 1, &url, -1);
2195
GnomeMeeting::Process ()->Connect (url);
2204
url_activated_cb (GtkWidget *w,
2207
const char *url = NULL;
2209
url = gtk_entry_get_text (GTK_ENTRY (w));
2211
GnomeMeeting::Process ()->Connect (url);
2216
view_mode_button_clicked_cb (GtkWidget *w,
2221
m = gm_conf_get_int (USER_INTERFACE_KEY "main_window/view_mode");
2225
if (m == NUM_VIEW_MODES)
2228
gm_conf_set_int (USER_INTERFACE_KEY "main_window/view_mode", m);
2233
toolbar_toggle_button_changed_cb (GtkWidget *widget,
2236
bool shown = gm_conf_get_bool ((gchar *) data);
2238
gm_conf_set_bool ((gchar *) data, !shown);
2243
statusbar_clicked_cb (GtkWidget *widget,
2244
GdkEventButton *event,
2247
GMManager *ep = NULL;
2250
ep = GnomeMeeting::Process ()->GetManager ();
2252
ep->ResetMissedCallsNumber ();
2254
info = g_strdup_printf (_("Missed calls: %d - Voice Mails: %s"),
2255
ep->GetMissedCallsNumber (),
2256
(const char *) ep->GetMWI ());
2257
gm_main_window_push_info_message (GTK_WIDGET (data), info);
2266
delete_incoming_call_dialog_cb (GtkWidget *w,
2270
GmWindow *mw = NULL;
2272
g_return_val_if_fail (data != NULL, TRUE);
2274
mw = gm_mw_get_mw (GTK_WIDGET (data));
2276
g_return_val_if_fail (GTK_WIDGET (data), TRUE);
2278
mw->incoming_call_popup = NULL;
2280
GnomeMeeting::Process ()->Disconnect ();
2287
show_chat_window_cb (GtkWidget *w,
2290
GtkWidget *statusicon = NULL;
2295
GMManager *ep = NULL;
2297
ep = GnomeMeeting::Process ()->GetManager ();
2298
statusicon = GnomeMeeting::Process ()->GetStatusicon ();
2300
if (!gnomemeeting_window_is_visible (GTK_WIDGET (data))) {
2302
/* Check if there is an active call */
2303
gdk_threads_leave ();
2304
ep->GetCurrentConnectionInfo (name, url);
2305
gdk_threads_enter ();
2307
/* If we are in a call, add a tab with the given URL if there
2310
if (url && !gm_text_chat_window_has_tab (GTK_WIDGET (data), url)) {
2312
gm_text_chat_window_add_tab (GTK_WIDGET (data), url, name);
2314
gm_chat_window_update_calling_state (GTK_WIDGET (data),
2317
GMManager::Connected);
2320
gnomemeeting_window_show (GTK_WIDGET (data));
2321
gm_statusicon_signal_message (GTK_WIDGET (statusicon), FALSE);
2324
gnomemeeting_window_hide (GTK_WIDGET (data));
2329
gm_mw_urls_history_update_cb (gpointer data)
2331
GmWindow *mw = NULL;
2333
GmContact *c = NULL;
2337
GtkWidget *main_window = NULL;
2339
GtkTreeModel *history_model = NULL;
2340
GtkTreeModel *cache_model = NULL;
2341
GtkEntryCompletion *completion = NULL;
2343
GtkTreeIter tree_iter;
2347
GSList *contacts = NULL;
2348
GSList *iter = NULL;
2350
unsigned int cpt = 0;
2353
gchar *entry = NULL;
2355
main_window = GTK_WIDGET (data);
2357
g_return_val_if_fail (main_window != NULL, FALSE);
2359
mw = gm_mw_get_mw (main_window);
2362
/* Get the placed calls history */
2363
g_value_init (&val, G_TYPE_INT);
2364
g_value_set_int (&val, -1);
2365
g_object_set_property (G_OBJECT (mw->combo), "active", &val);
2367
gdk_threads_enter ();
2368
c2 = gm_calls_history_get_calls (PLACED_CALL, 10, FALSE);
2371
gtk_combo_box_get_model (GTK_COMBO_BOX (mw->combo));
2372
gtk_list_store_clear (GTK_LIST_STORE (history_model));
2373
gdk_threads_leave ();
2378
c = GM_CONTACT (iter->data);
2379
if (c->url && strcmp (c->url, "")) {
2381
gdk_threads_enter ();
2382
gtk_combo_box_prepend_text (GTK_COMBO_BOX (mw->combo), c->url);
2383
gdk_threads_leave ();
2387
iter = g_slist_next (iter);
2389
g_slist_foreach (c2, (GFunc) gmcontact_delete, NULL);
2394
/* Get the full address book */
2395
gdk_threads_enter ();
2396
c1 = gnomemeeting_addressbook_get_contacts (NULL,
2405
/* Get the full calls history */
2406
c2 = gm_calls_history_get_calls (MAX_VALUE_CALL, 25, TRUE);
2407
contacts = g_slist_concat (c1, c2);
2410
gtk_entry_get_completion (GTK_ENTRY (GTK_BIN (mw->combo)->child));
2412
gtk_entry_completion_get_model (GTK_ENTRY_COMPLETION (completion));
2413
gtk_list_store_clear (GTK_LIST_STORE (cache_model));
2414
gdk_threads_leave ();
2420
c = GM_CONTACT (iter->data);
2421
if (c->url && strcmp (c->url, "")) {
2425
if (c->fullname && strcmp (c->fullname, ""))
2426
entry = g_strdup_printf ("%s [%s]",
2430
entry = g_strdup (c->url);
2432
gdk_threads_enter ();
2433
gtk_list_store_append (GTK_LIST_STORE (cache_model), &tree_iter);
2434
gtk_list_store_set (GTK_LIST_STORE (cache_model), &tree_iter,
2437
2, (char *) entry, -1);
2438
gdk_threads_leave ();
2443
iter = g_slist_next (iter);
2446
g_slist_foreach (contacts, (GFunc) gmcontact_delete, NULL);
2447
g_slist_free (contacts);
2453
/* Public functions */
2455
gm_main_window_press_dialpad (GtkWidget *main_window,
2461
key = GDK_KP_Multiply;
2463
key = GDK_numbersign;
2465
key = GDK_KP_0 + atoi (&c);
2467
gtk_accel_groups_activate (G_OBJECT (main_window), key, (GdkModifierType) 0);
2472
gm_main_window_update_video (GtkWidget *main_window,
2473
const guchar *lbuffer,
2477
const guchar *rbuffer,
2482
gboolean bilinear_filtering)
2484
GmWindow *mw = NULL;
2486
GdkPixbuf *lsrc_pic = NULL;
2487
GdkPixbuf *zlsrc_pic = NULL;
2488
GdkPixbuf *rsrc_pic = NULL;
2489
GdkPixbuf *zrsrc_pic = NULL;
2490
GdkPixbuf *framepixbuf = NULL;
2491
GdkPixbuf *nzlsrc_pic = NULL;
2492
GdkPixbuf *tmpframe = NULL;
2495
Uint32 rmask, gmask, bmask, amask = 0;
2496
SDL_Surface *lsurface = NULL;
2497
SDL_Surface *rsurface = NULL;
2498
SDL_Surface *lblit_conf = NULL;
2499
SDL_Surface *rblit_conf = NULL;
2503
g_return_if_fail (main_window != NULL);
2505
mw = gm_mw_get_mw (main_window);
2507
/* to store the actual size of the video frame */
2508
int video_frame_width = 0;
2509
int video_frame_height = 0;
2510
/* to store the actual size of the video frame, excluding some pixels,
2511
* e.g. the GtkFrame's shadow */
2512
int video_frame_rwidth = 0;
2513
int video_frame_rheight = 0;
2515
/* some things for the BOTH_INCRUSTED mode: */
2516
/* the small pic's ratio (to the main video frame */
2517
const float incrusted_small_pic_ratio = 0.33;
2518
/* position of the small pic in % of width and height of the main
2520
const float incrusted_small_pic_relative_posx = 0.66;
2521
const float incrusted_small_pic_relative_posy = 0.66;
2522
/* forced minimum distances of the small pic to the main frame border right
2524
const int incrusted_small_pic_forced_border_right = 3;
2525
const int incrusted_small_pic_forced_border_down = 5;
2526
/* assumed thickness of the small frame for the local video (used to
2527
* calculate scale of the local video image) */
2528
const int incrusted_small_pic_assumed_frame_thickness = 4;
2531
int incrusted_frame_width = 0;
2532
int incrusted_frame_height = 0;
2534
int small_frame_absposx = 0;
2535
int small_frame_absposy = 0;
2537
int incrusted_resulting_width = 0;
2538
int incrusted_resulting_height = 0;
2539
int incrusted_max_resulting_width = 0;
2540
int incrusted_max_resulting_height = 0;
2542
/* booleans to handle some display types syntactically easier */
2543
gboolean display_both_side = FALSE;
2544
gboolean display_both_incrusted = FALSE;
2545
/* when the GtkFrame was just created, it has a zero size, but we are
2546
* requested to already render...
2547
* used to prevent drawing when the frame isn't ready built (width,height==0,0) */
2548
gboolean video_frame_ready = TRUE;
2550
/* resize the video frame to the requested size, depending on what we want
2552
switch (display_type) {
2554
gtk_widget_set_size_request (GTK_WIDGET (mw->video_frame),
2555
(int) (lf_width * lzoom),
2556
(int) (lf_height * lzoom)); break;
2558
gtk_widget_set_size_request (GTK_WIDGET (mw->video_frame),
2559
(int) (rf_width * rzoom),
2560
(int) (rf_height * rzoom)); break;
2561
case BOTH_INCRUSTED:
2562
gtk_widget_set_size_request (GTK_WIDGET (mw->video_frame),
2563
(int) (rf_width * rzoom),
2564
(int) (rf_height * rzoom)); break;
2566
gtk_widget_set_size_request (GTK_WIDGET (mw->video_frame),
2567
(int) (rf_width * rzoom * 2),
2568
(int) (rf_height * rzoom)); break;
2571
if (display_type == BOTH_SIDE) display_both_side = TRUE;
2572
if (display_type == BOTH_INCRUSTED) display_both_incrusted = TRUE;
2574
/* get the actual size of the video frame */
2575
video_frame_width = GTK_WIDGET (mw->video_frame)->allocation.width;
2576
video_frame_height = GTK_WIDGET (mw->video_frame)->allocation.height;
2577
/* compute reduced values, reductions are fixed,
2578
* we will use THESE values as base to scale the images */
2579
video_frame_rwidth = video_frame_width - 3;
2580
video_frame_rheight = video_frame_height;
2582
if (video_frame_rwidth < 0)
2583
{ video_frame_ready = FALSE; video_frame_rwidth = video_frame_width; };
2584
if (video_frame_rheight < 0)
2585
{ video_frame_ready = FALSE; video_frame_rheight = video_frame_height; };
2587
/* Update the display selection in the main and in the video popup menus */
2588
gtk_radio_menu_select_with_id (mw->main_menu, "local_video", display_type);
2592
if (display_type != FULLSCREEN)
2593
gm_mw_destroy_fullscreen_video_window (main_window);
2596
/* Select and show the correct windows */
2597
if (display_type == BOTH) { /* display == BOTH */
2599
/* Display the GnomeMeeting logo in the main window */
2600
gm_main_window_update_logo (main_window);
2602
if (!GTK_WIDGET_VISIBLE (mw->local_video_window))
2603
gnomemeeting_window_show (GTK_WIDGET (mw->local_video_window));
2604
if (!GTK_WIDGET_VISIBLE (mw->remote_video_window))
2605
gnomemeeting_window_show (GTK_WIDGET (mw->remote_video_window));
2608
else if (display_type == FULLSCREEN) {
2610
gm_mw_init_fullscreen_video_window (main_window);
2611
if (gm_mw_poll_fullscreen_video_window (main_window))
2612
gm_mw_toggle_fullscreen (main_window);
2617
if (GTK_WIDGET_VISIBLE (mw->local_video_window))
2618
gnomemeeting_window_hide (GTK_WIDGET (mw->local_video_window));
2619
if (GTK_WIDGET_VISIBLE (mw->remote_video_window))
2620
gnomemeeting_window_hide (GTK_WIDGET (mw->remote_video_window));
2622
if (!GTK_WIDGET_VISIBLE (mw->video_frame) && display_type != BOTH)
2623
gtk_widget_show_all (GTK_WIDGET (mw->video_frame));
2627
/* The real size picture, if required */
2628
if (display_type != REMOTE_VIDEO && lbuffer && video_frame_ready) {
2630
if (lf_width > 0 && lf_height > 0)
2632
gdk_pixbuf_new_from_data (lbuffer, GDK_COLORSPACE_RGB,
2633
FALSE, 8, lf_width, lf_height,
2637
if (!display_both_incrusted)
2638
/* scale the local image to the full available space, or,
2639
* if BOTH_SIDE: full_space/2 on X axis */
2641
gdk_pixbuf_scale_simple (lsrc_pic,
2642
display_both_side?video_frame_rwidth / 2:video_frame_rwidth,
2643
video_frame_rheight,
2644
bilinear_filtering?GDK_INTERP_BILINEAR:GDK_INTERP_NEAREST);
2647
/* scale the local image to the requested small size
2648
* for BOTH_INCRUSTED */
2650
gdk_pixbuf_scale_simple (lsrc_pic,
2651
(int) (video_frame_rwidth * incrusted_small_pic_ratio),
2652
(int) (video_frame_rheight * incrusted_small_pic_ratio),
2653
bilinear_filtering?GDK_INTERP_BILINEAR:GDK_INTERP_NEAREST);
2655
g_object_unref (lsrc_pic);
2660
if (display_type != LOCAL_VIDEO && rbuffer) {
2662
if (rf_width > 0 && rf_height > 0) {
2665
gdk_pixbuf_new_from_data (rbuffer, GDK_COLORSPACE_RGB,
2666
FALSE, 8, rf_width, rf_height,
2670
/* scale the remote image to the full available space, or,
2671
* if BOTH_SIDE: full_space/2 on X axis */
2673
gdk_pixbuf_scale_simple (rsrc_pic,
2674
display_both_side?video_frame_rwidth / 2:video_frame_rwidth,
2675
video_frame_rheight,
2676
bilinear_filtering?GDK_INTERP_BILINEAR:GDK_INTERP_NEAREST);
2678
g_object_unref (rsrc_pic);
2681
switch (display_type) {
2684
if (zlsrc_pic && video_frame_ready) {
2686
gtk_image_set_from_pixbuf (GTK_IMAGE (mw->main_video_image),
2687
GDK_PIXBUF (zlsrc_pic));
2688
g_object_unref (zlsrc_pic);
2693
if (zrsrc_pic && video_frame_ready) {
2695
gtk_image_set_from_pixbuf (GTK_IMAGE (mw->main_video_image),
2696
GDK_PIXBUF (zrsrc_pic));
2697
g_object_unref (zrsrc_pic);
2701
case BOTH_INCRUSTED:
2703
if (zlsrc_pic && zrsrc_pic && video_frame_ready) {
2705
/* get the frame out of XPM data */
2706
framepixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) gm_both_incrusted_frame_xpm);
2708
incrusted_frame_width = gdk_pixbuf_get_width (framepixbuf);
2709
incrusted_frame_height = gdk_pixbuf_get_height (framepixbuf);
2711
/* compute the position of the small frame */
2712
small_frame_absposx =
2713
(int) (video_frame_rwidth * incrusted_small_pic_relative_posx);
2714
small_frame_absposy =
2715
(int) (video_frame_rheight * incrusted_small_pic_relative_posy);
2717
/* scale the local pic down to fit inside the frame */
2719
gdk_pixbuf_scale_simple (zlsrc_pic,
2720
incrusted_frame_width - (2 * incrusted_small_pic_assumed_frame_thickness),
2721
incrusted_frame_height - (2 * incrusted_small_pic_assumed_frame_thickness),
2722
bilinear_filtering?GDK_INTERP_BILINEAR:GDK_INTERP_NEAREST);
2724
/* copy the local pic inside the frame */
2725
gdk_pixbuf_copy_area (nzlsrc_pic,
2727
gdk_pixbuf_get_width (nzlsrc_pic) - incrusted_small_pic_assumed_frame_thickness,
2728
gdk_pixbuf_get_height (nzlsrc_pic) - incrusted_small_pic_assumed_frame_thickness,
2730
incrusted_small_pic_assumed_frame_thickness, incrusted_small_pic_assumed_frame_thickness);
2732
/* scale the frame plus the picture to the requested size */
2733
tmpframe = gdk_pixbuf_scale_simple (framepixbuf,
2734
(int) (video_frame_rwidth * incrusted_small_pic_ratio),
2735
(int) (video_frame_rheight * incrusted_small_pic_ratio),
2736
GDK_INTERP_BILINEAR);
2738
/* make sure we're respecting the forced border */
2739
incrusted_resulting_width = small_frame_absposx + gdk_pixbuf_get_width (tmpframe);
2740
incrusted_resulting_height = small_frame_absposy + gdk_pixbuf_get_height (tmpframe);
2742
incrusted_max_resulting_width = video_frame_rwidth - incrusted_small_pic_forced_border_right;
2743
incrusted_max_resulting_height = video_frame_rheight - incrusted_small_pic_forced_border_down;
2745
if ( incrusted_resulting_width > incrusted_max_resulting_width )
2746
small_frame_absposx =
2747
video_frame_rwidth - gdk_pixbuf_get_width (tmpframe) - incrusted_small_pic_forced_border_right;
2749
if ( incrusted_resulting_height > incrusted_max_resulting_height )
2750
small_frame_absposy =
2751
video_frame_rheight - gdk_pixbuf_get_height (tmpframe) - incrusted_small_pic_forced_border_down;
2753
/* copy the small picture into the big one, freshly scaled, positioned
2754
* and polished :-) */
2755
gdk_pixbuf_copy_area (tmpframe,
2757
gdk_pixbuf_get_width (tmpframe),
2758
gdk_pixbuf_get_height (tmpframe),
2760
small_frame_absposx,
2761
small_frame_absposy);
2763
gtk_image_set_from_pixbuf (GTK_IMAGE (mw->main_video_image),
2764
GDK_PIXBUF (zrsrc_pic));
2766
g_object_unref (framepixbuf);
2767
g_object_unref (tmpframe);
2768
g_object_unref (nzlsrc_pic);
2769
g_object_unref (zrsrc_pic);
2770
g_object_unref (zlsrc_pic);
2776
if (zlsrc_pic && zrsrc_pic && video_frame_ready) {
2778
GdkPixbuf *tmp_pixbuf =
2779
gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
2781
video_frame_rheight);
2783
gdk_pixbuf_copy_area (zrsrc_pic,
2785
video_frame_rwidth / 2,
2786
video_frame_rheight,
2790
gdk_pixbuf_copy_area (zlsrc_pic,
2792
video_frame_rwidth / 2,
2793
video_frame_rheight,
2795
video_frame_rwidth / 2, 0);
2797
gtk_image_set_from_pixbuf (GTK_IMAGE (mw->main_video_image),
2798
GDK_PIXBUF (tmp_pixbuf));
2799
g_object_unref (zrsrc_pic);
2800
g_object_unref (zlsrc_pic);
2801
g_object_unref (tmp_pixbuf);
2808
if (zlsrc_pic && zrsrc_pic) {
2810
gtk_image_set_from_pixbuf (GTK_IMAGE (mw->remote_video_image),
2811
GDK_PIXBUF (zrsrc_pic));
2812
gtk_image_set_from_pixbuf (GTK_IMAGE (mw->local_video_image),
2813
GDK_PIXBUF (zlsrc_pic));
2815
g_object_unref (zrsrc_pic);
2816
g_object_unref (zlsrc_pic);
2823
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
2838
SDL_CreateRGBSurfaceFrom ((void *) gdk_pixbuf_get_pixels (zrsrc_pic),
2839
(int) (rf_width * rzoom),
2840
(int) (rf_height * rzoom),
2842
(int) (rf_width * rzoom * 3),
2843
rmask, gmask, bmask, amask);
2845
rblit_conf = SDL_DisplayFormat (rsurface);
2848
dest.x = (int) (mw->screen->w - (int) (rf_width * rzoom) - (int) (lf_width * lzoom) - 50) / 2;
2850
dest.x = (int) (mw->screen->w - (int) (rf_width * rzoom)) / 2;
2852
dest.y = (int) (mw->screen->h - (int) (rf_height * rzoom)) / 2;
2853
dest.w = (int) (rf_width * rzoom);
2854
dest.h = (int) (rf_height * rzoom);
2856
SDL_BlitSurface (rblit_conf, NULL, mw->screen, &dest);
2858
SDL_FreeSurface (rsurface);
2859
SDL_FreeSurface (rblit_conf);
2861
g_object_unref (zrsrc_pic);
2866
SDL_CreateRGBSurfaceFrom ((void *) gdk_pixbuf_get_pixels (zlsrc_pic),
2867
(int) (lf_width * lzoom),
2868
(int) (lf_height * lzoom),
2870
(int) (lf_width * lzoom * 3),
2871
rmask, gmask, bmask, amask);
2873
lblit_conf = SDL_DisplayFormat (lsurface);
2875
dest.x = 640 - (int) (lf_width * lzoom);
2876
dest.y = 480 - (int) (lf_height * lzoom);
2877
dest.w = (int) (lf_width * lzoom);
2878
dest.h = (int) (lf_height * lzoom);
2880
SDL_BlitSurface (lblit_conf, NULL, mw->screen, &dest);
2882
SDL_FreeSurface (lsurface);
2883
SDL_FreeSurface (lblit_conf);
2885
g_object_unref (zlsrc_pic);
2889
SDL_UpdateRect (mw->screen, 0, 0, 640, 480);
2899
gm_main_window_update_logo (GtkWidget *main_window)
2901
GmWindow *mw = NULL;
2903
GdkPixbuf *tmp = NULL;
2904
GdkPixbuf *scaledlogo = NULL;
2905
GdkPixbuf *text_logo_pix = NULL;
2910
GtkRequisition size_request;
2912
g_return_if_fail (main_window != NULL);
2914
mw = gm_mw_get_mw (main_window);
2917
gtk_widget_size_request (GTK_WIDGET (mw->video_frame), &size_request);
2919
if ((size_request.width != GM_QCIF_WIDTH) ||
2920
(size_request.height != GM_QCIF_HEIGHT)) {
2922
gtk_widget_set_size_request (GTK_WIDGET (mw->video_frame),
2926
text_logo_pix = gdk_pixbuf_new_from_xpm_data ((const char **) text_logo_xpm);
2927
width = gdk_pixbuf_get_width (text_logo_pix);
2928
height = gdk_pixbuf_get_height (text_logo_pix);
2930
tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 176, 144);
2931
gdk_pixbuf_fill (tmp, 0x000000FF); /* Opaque black */
2933
gdk_pixbuf_copy_area (text_logo_pix, 0, 0,
2936
((GM_QCIF_WIDTH - width) / 2),
2937
(GM_QCIF_HEIGHT - height) / 2);
2939
scaledlogo = gdk_pixbuf_scale_simple (tmp,
2942
GDK_INTERP_BILINEAR);
2944
gtk_image_set_from_pixbuf (GTK_IMAGE (mw->main_video_image),
2945
GDK_PIXBUF (scaledlogo));
2947
g_object_unref (text_logo_pix);
2948
g_object_unref (tmp);
2949
g_object_unref (scaledlogo);
2954
gm_main_window_set_call_hold (GtkWidget *main_window,
2955
gboolean is_on_hold)
2957
GmWindow *mw = NULL;
2959
GtkWidget *child = NULL;
2962
g_return_if_fail (main_window != NULL);
2964
mw = gm_mw_get_mw (main_window);
2966
g_return_if_fail (mw != NULL);
2969
child = GTK_BIN (gtk_menu_get_widget (mw->main_menu, "hold_call"))->child;
2973
if (GTK_IS_LABEL (child))
2974
gtk_label_set_text_with_mnemonic (GTK_LABEL (child),
2975
_("_Retrieve Call"));
2977
/* Set the audio and video buttons/menu to unsensitive */
2978
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_chan_button), FALSE);
2979
gtk_widget_set_sensitive (GTK_WIDGET (mw->video_chan_button), FALSE);
2981
gtk_menu_set_sensitive (mw->main_menu, "suspend_audio", FALSE);
2982
gtk_menu_set_sensitive (mw->main_menu, "suspend_video", FALSE);
2984
gm_main_window_set_channel_pause (main_window, TRUE, FALSE);
2985
gm_main_window_set_channel_pause (main_window, TRUE, TRUE);
2989
if (GTK_IS_LABEL (child))
2990
gtk_label_set_text_with_mnemonic (GTK_LABEL (child),
2993
gtk_widget_set_sensitive (GTK_WIDGET (mw->audio_chan_button), TRUE);
2994
gtk_widget_set_sensitive (GTK_WIDGET (mw->video_chan_button), TRUE);
2996
gtk_menu_set_sensitive (mw->main_menu, "suspend_audio", TRUE);
2997
gtk_menu_set_sensitive (mw->main_menu, "suspend_video", TRUE);
2999
gm_main_window_set_channel_pause (main_window, FALSE, FALSE);
3000
gm_main_window_set_channel_pause (main_window, FALSE, TRUE);
3006
gm_main_window_set_channel_pause (GtkWidget *main_window,
3010
GmWindow *mw = NULL;
3012
GtkWidget *child = NULL;
3013
GtkToggleButton *b = NULL;
3017
g_return_if_fail (main_window != NULL);
3019
mw = gm_mw_get_mw (main_window);
3021
g_return_if_fail (mw != NULL);
3024
if (!pause && !is_video)
3025
msg = g_strdup (_("Suspend _Audio"));
3026
else if (!pause && is_video)
3027
msg = g_strdup (_("Suspend _Video"));
3028
else if (pause && !is_video)
3029
msg = g_strdup (_("Resume _Audio"));
3030
else if (pause && is_video)
3031
msg = g_strdup (_("Resume _Video"));
3036
b = GTK_TOGGLE_BUTTON (mw->video_chan_button);
3038
GTK_BIN (gtk_menu_get_widget (mw->main_menu, "suspend_video"))->child;
3042
b = GTK_TOGGLE_BUTTON (mw->audio_chan_button);
3044
GTK_BIN (gtk_menu_get_widget (mw->main_menu, "suspend_audio"))->child;
3048
if (GTK_IS_LABEL (child))
3049
gtk_label_set_text_with_mnemonic (GTK_LABEL (child),
3052
g_signal_handlers_block_by_func (G_OBJECT (b),
3053
(gpointer) pause_current_call_channel_cb,
3054
GINT_TO_POINTER (is_video));
3055
gtk_toggle_button_set_active (b, pause);
3056
g_signal_handlers_unblock_by_func (G_OBJECT (b),
3057
(gpointer) pause_current_call_channel_cb,
3058
GINT_TO_POINTER (is_video));
3065
gm_main_window_update_calling_state (GtkWidget *main_window,
3066
unsigned calling_state)
3068
GmWindow *mw = NULL;
3070
g_return_if_fail (main_window != NULL);
3072
mw = gm_mw_get_mw (main_window);
3074
g_return_if_fail (mw!= NULL);
3077
switch (calling_state)
3079
case GMManager::Standby:
3082
/* Update the hold state */
3083
gm_main_window_set_call_hold (main_window, FALSE);
3086
/* Update the sensitivity, all channels are closed */
3087
gm_main_window_update_sensitivity (main_window, TRUE, FALSE, FALSE);
3088
gm_main_window_update_sensitivity (main_window, FALSE, FALSE, FALSE);
3091
/* Update the menus and toolbar items */
3092
gtk_menu_set_sensitive (mw->main_menu, "connect", TRUE);
3093
gtk_menu_set_sensitive (mw->main_menu, "disconnect", FALSE);
3094
gtk_menu_section_set_sensitive (mw->main_menu, "hold_call", FALSE);
3095
gtk_widget_set_sensitive (GTK_WIDGET (mw->preview_button), TRUE);
3098
/* Update the connect button */
3099
gm_connect_button_set_connected (GM_CONNECT_BUTTON (mw->connect_button),
3103
/* Destroy the incoming call popup */
3104
if (mw->incoming_call_popup) {
3106
gnomemeeting_threads_widget_destroy (mw->incoming_call_popup);
3107
mw->incoming_call_popup = NULL;
3110
/* Destroy the transfer call popup */
3111
if (mw->transfer_call_popup)
3112
gtk_dialog_response (GTK_DIALOG (mw->transfer_call_popup),
3113
GTK_RESPONSE_REJECT);
3116
/* Delete the full screen window */
3118
gm_mw_destroy_fullscreen_video_window (main_window);
3122
/* Hide the local and remove video windows */
3123
gnomemeeting_window_hide (mw->remote_video_window);
3124
gnomemeeting_window_hide (mw->local_video_window);
3129
case GMManager::Calling:
3131
/* Update the menus and toolbar items */
3132
gtk_menu_set_sensitive (mw->main_menu, "connect", FALSE);
3133
gtk_menu_set_sensitive (mw->main_menu, "disconnect", TRUE);
3134
gtk_widget_set_sensitive (GTK_WIDGET (mw->preview_button), FALSE);
3136
/* Update the connect button */
3137
gm_connect_button_set_connected (GM_CONNECT_BUTTON (mw->connect_button),
3143
case GMManager::Connected:
3145
/* Update the menus and toolbar items */
3146
gtk_menu_set_sensitive (mw->main_menu, "connect", FALSE);
3147
gtk_menu_set_sensitive (mw->main_menu, "disconnect", TRUE);
3148
gtk_menu_section_set_sensitive (mw->main_menu, "hold_call", TRUE);
3149
gtk_widget_set_sensitive (GTK_WIDGET (mw->preview_button), FALSE);
3151
/* Update the connect button */
3152
gm_connect_button_set_connected (GM_CONNECT_BUTTON (mw->connect_button),
3155
/* Destroy the incoming call popup */
3156
if (mw->incoming_call_popup) {
3158
gtk_widget_destroy (mw->incoming_call_popup);
3159
mw->incoming_call_popup = NULL;
3164
case GMManager::Called:
3166
/* Update the menus and toolbar items */
3167
gtk_menu_set_sensitive (mw->main_menu, "disconnect", TRUE);
3169
/* Update the connect button */
3170
gm_connect_button_set_connected (GM_CONNECT_BUTTON (mw->connect_button),
3179
gm_main_window_update_sensitivity (GtkWidget *main_window,
3182
BOOL is_transmitting)
3184
GmWindow *mw = NULL;
3186
GtkWidget *button = NULL;
3188
mw = gm_mw_get_mw (main_window);
3190
g_return_if_fail (mw != NULL);
3193
/* We are updating video related items */
3196
/* Receiving and sending => Everything sensitive in the section control */
3197
if (is_receiving && is_transmitting) {
3199
gtk_menu_section_set_sensitive (mw->main_menu,
3200
"local_video", TRUE);
3201
gtk_menu_section_set_sensitive (mw->main_menu,
3204
else { /* Not receiving or not sending or both */
3206
/* Default to nothing being sensitive */
3207
gtk_menu_section_set_sensitive (mw->main_menu,
3208
"local_video", FALSE);
3210
/* We are sending video, but not receiving
3211
* => local must be sensitive */
3212
if (is_transmitting) {
3214
gtk_menu_set_sensitive (mw->main_menu,
3215
"local_video", TRUE);
3217
/* We are receiving video, but not transmitting,
3218
* => remote must be sensitive */
3219
else if (is_receiving) {
3221
gtk_menu_set_sensitive (mw->main_menu,
3222
"remote_video", TRUE);
3225
/* We are not transmitting, and not receiving anything,
3226
* => Disable the zoom completely */
3227
if (!is_receiving && !is_transmitting) {
3229
gtk_menu_section_set_sensitive (mw->main_menu,
3231
gtk_menu_set_sensitive (mw->main_menu, "save_picture", FALSE);
3234
/* Or activate it as at least something is transmitted or
3236
gtk_menu_section_set_sensitive (mw->main_menu,
3239
gtk_menu_section_set_sensitive (mw->main_menu,
3240
"fullscreen", FALSE);
3242
gtk_menu_set_sensitive (mw->main_menu, "save_picture", TRUE);
3246
button = mw->video_chan_button;
3250
button = mw->audio_chan_button;
3253
if (is_transmitting) {
3256
gtk_menu_set_sensitive (mw->main_menu, "suspend_audio", TRUE);
3258
gtk_menu_set_sensitive (mw->main_menu, "suspend_video", TRUE);
3263
gtk_menu_set_sensitive (mw->main_menu, "suspend_audio", FALSE);
3265
gtk_menu_set_sensitive (mw->main_menu, "suspend_video", FALSE);
3271
GTK_TOGGLE_BUTTON (mw->preview_button)->active = is_transmitting;
3272
gtk_widget_set_state (mw->preview_button,
3273
is_transmitting?GTK_STATE_ACTIVE:GTK_STATE_NORMAL);
3276
GTK_TOGGLE_BUTTON (button)->active = !is_transmitting;
3277
gtk_widget_set_state (button,
3278
!is_transmitting?GTK_STATE_ACTIVE:GTK_STATE_NORMAL);
3280
gtk_widget_set_sensitive (GTK_WIDGET (button), is_transmitting);
3285
gm_main_window_set_volume_sliders_values (GtkWidget *main_window,
3289
GmWindow *mw = NULL;
3291
g_return_if_fail (main_window != NULL);
3293
mw = gm_mw_get_mw (main_window);
3295
g_return_if_fail (mw != NULL);
3297
if (output_volume != -1)
3298
GTK_ADJUSTMENT (mw->adj_output_volume)->value = output_volume;
3300
if (input_volume != -1)
3301
GTK_ADJUSTMENT (mw->adj_input_volume)->value = input_volume;
3303
gtk_widget_queue_draw (GTK_WIDGET (mw->audio_volume_frame));
3307
void gm_main_window_set_signal_levels (GtkWidget *main_window,
3311
GmWindow *mw = NULL;
3313
g_return_if_fail (main_window != NULL);
3315
mw = gm_mw_get_mw (main_window);
3317
g_return_if_fail (mw != NULL);
3320
gtk_levelmeter_set_level (GTK_LEVELMETER (mw->output_signal), output);
3323
gtk_levelmeter_set_level (GTK_LEVELMETER (mw->input_signal), input);
3327
void gm_main_window_clear_signal_levels (GtkWidget *main_window)
3329
GmWindow *mw = NULL;
3331
g_return_if_fail (main_window != NULL);
3333
mw = gm_mw_get_mw (main_window);
3335
g_return_if_fail (mw != NULL);
3337
gtk_levelmeter_clear (GTK_LEVELMETER (mw->output_signal));
3338
gtk_levelmeter_clear (GTK_LEVELMETER (mw->input_signal));
3343
gm_main_window_get_volume_sliders_values (GtkWidget *main_window,
3347
GmWindow *mw = NULL;
3349
g_return_if_fail (main_window != NULL);
3351
mw = gm_mw_get_mw (main_window);
3353
g_return_if_fail (mw != NULL);
3355
output_volume = (int) GTK_ADJUSTMENT (mw->adj_output_volume)->value;
3356
input_volume = (int) GTK_ADJUSTMENT (mw->adj_input_volume)->value;
3361
gm_main_window_set_video_sliders_values (GtkWidget *main_window,
3367
GmWindow *mw = NULL;
3369
g_return_if_fail (main_window != NULL);
3371
mw = gm_mw_get_mw (main_window);
3373
g_return_if_fail (mw != NULL);
3375
if (whiteness != -1)
3376
GTK_ADJUSTMENT (mw->adj_whiteness)->value = whiteness;
3378
if (brightness != -1)
3379
GTK_ADJUSTMENT (mw->adj_brightness)->value = brightness;
3382
GTK_ADJUSTMENT (mw->adj_colour)->value = colour;
3385
GTK_ADJUSTMENT (mw->adj_contrast)->value = contrast;
3387
gtk_widget_queue_draw (GTK_WIDGET (mw->video_settings_frame));
3392
gm_main_window_get_video_sliders_values (GtkWidget *main_window,
3398
GmWindow *mw = NULL;
3400
g_return_if_fail (main_window != NULL);
3402
mw = gm_mw_get_mw (main_window);
3404
g_return_if_fail (mw != NULL);
3406
whiteness = (int) GTK_ADJUSTMENT (mw->adj_whiteness)->value;
3407
brightness = (int) GTK_ADJUSTMENT (mw->adj_brightness)->value;
3408
colour = (int) GTK_ADJUSTMENT (mw->adj_colour)->value;
3409
contrast = (int) GTK_ADJUSTMENT (mw->adj_contrast)->value;
3414
gm_main_window_set_view_mode (GtkWidget *main_window,
3417
GmWindow *mw = NULL;
3419
GtkWidget *menu = NULL;
3421
g_return_if_fail (main_window != NULL);
3423
mw = gm_mw_get_mw (main_window);
3425
g_return_if_fail (mw != NULL);
3430
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mw->preview_button)))
3431
gm_mw_show_video_section (main_window, FALSE);
3432
gm_mw_show_control_panel (main_window, TRUE);
3436
gm_mw_show_video_section (main_window, TRUE);
3437
gm_mw_show_control_panel (main_window, FALSE);
3441
gm_mw_show_video_section (main_window, TRUE);
3442
gm_mw_show_control_panel (main_window, TRUE);
3450
menu = gtk_menu_get_widget (mw->main_menu, "softphone");
3452
gtk_radio_menu_select_with_widget (GTK_WIDGET (menu), m);
3457
gm_main_window_set_control_panel_section (GtkWidget *main_window,
3460
GmWindow *mw = NULL;
3462
GtkWidget *menu = NULL;
3464
g_return_if_fail (main_window != NULL);
3466
mw = gm_mw_get_mw (main_window);
3468
g_return_if_fail (mw != NULL);
3470
gtk_notebook_set_current_page (GTK_NOTEBOOK (mw->main_notebook), section);
3472
menu = gtk_menu_get_widget (mw->main_menu, "statistics");
3474
gtk_radio_menu_select_with_widget (GTK_WIDGET (menu), section);
3479
gm_main_window_set_incoming_call_mode (GtkWidget *main_window,
3482
GmWindow *mw = NULL;
3484
GtkWidget *menu = NULL;
3486
g_return_if_fail (main_window != NULL);
3488
mw = gm_mw_get_mw (main_window);
3490
g_return_if_fail (mw != NULL);
3493
menu = gtk_menu_get_widget (mw->main_menu, "available");
3495
gtk_radio_menu_select_with_widget (GTK_WIDGET (menu), i);
3500
gm_main_window_set_call_info (GtkWidget *main_window,
3501
const char *tr_audio_codec,
3502
const char *re_audio_codec,
3503
const char *tr_video_codec,
3504
const char *re_video_codec)
3506
GmWindow *mw = NULL;
3510
g_return_if_fail (main_window != NULL);
3512
mw = gm_mw_get_mw (main_window);
3514
g_return_if_fail (mw != NULL);
3517
g_strdup_printf ("<b>%s</b> %s/%s\n<b>%s</b> %s/%s",
3519
tr_audio_codec?tr_audio_codec:"-",
3520
tr_video_codec?tr_video_codec:"-",
3522
re_audio_codec?re_audio_codec:"-",
3523
re_video_codec?re_video_codec:"-");
3524
gtk_label_set_markup (GTK_LABEL (mw->info_label), info);
3530
gm_main_window_set_account_info (GtkWidget *main_window,
3531
int registered_accounts)
3533
GmWindow *mw = NULL;
3537
g_return_if_fail (main_window != NULL);
3539
mw = gm_mw_get_mw (main_window);
3541
g_return_if_fail (mw != NULL);
3544
g_strdup_printf ("\n<small>%s %d</small>",
3545
_("Registered accounts:"),
3546
registered_accounts);
3548
gtk_label_set_markup (GTK_LABEL (mw->info_label), info);
3554
gm_main_window_set_status (GtkWidget *main_window,
3557
GmWindow *mw = NULL;
3561
g_return_if_fail (main_window != NULL);
3563
mw = gm_mw_get_mw (main_window);
3565
g_return_if_fail (mw != NULL);
3567
#if !GTK_CHECK_VERSION (2, 6, 0)
3568
gchar *status2 = NULL;
3569
status2 = g_strndup (status, 23);
3570
info = g_strdup_printf ("<i>%s...</i>", status2);
3573
info = g_strdup_printf ("<i>%s</i>", status);
3576
gtk_label_set_markup (GTK_LABEL (mw->status_label), info);
3582
gm_main_window_speed_dials_menu_update (GtkWidget *main_window,
3585
GmWindow *mw = NULL;
3586
GmContact *contact = NULL;
3588
GtkWidget *item = NULL;
3589
GtkWidget *menu = NULL;
3591
GSList *glist_iter = NULL;
3592
GList *old_glist_iter = NULL;
3597
g_return_if_fail (main_window != NULL);
3599
mw = gm_mw_get_mw (main_window);
3601
menu = gtk_menu_get_widget (mw->main_menu, "speed_dials");
3603
while ((old_glist_iter = GTK_MENU_SHELL (menu)->children))
3604
gtk_container_remove (GTK_CONTAINER (menu),
3605
GTK_WIDGET (old_glist_iter->data));
3607
item = gtk_menu_get_attach_widget (GTK_MENU (menu));
3608
if (!g_slist_length (glist)) {
3610
gtk_widget_set_sensitive (item, FALSE);
3613
gtk_widget_set_sensitive (item, TRUE);
3616
while (glist_iter && glist_iter->data) {
3618
contact = GM_CONTACT (glist_iter->data);
3620
ml = g_strdup_printf ("<b>%s#</b> <i>%s</i>",
3624
item = gtk_menu_item_new_with_label (ml);
3625
gtk_label_set_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))),
3627
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
3628
gtk_widget_show (item);
3630
g_signal_connect_data (G_OBJECT (item), "activate",
3631
GTK_SIGNAL_FUNC (speed_dial_menu_item_selected_cb),
3632
(gpointer) g_strdup (contact->speeddial),
3633
(GClosureNotify) g_free, (GConnectFlags) 0);
3636
glist_iter = g_slist_next (glist_iter);
3644
gm_main_window_urls_history_update (GtkWidget *main_window)
3646
g_idle_add (gm_mw_urls_history_update_cb, main_window);
3651
gm_main_window_transfer_dialog_run (GtkWidget *main_window,
3652
GtkWidget *parent_window,
3655
GMManager *endpoint = NULL;
3656
GmWindow *mw = NULL;
3658
GMURL url = GMURL (u);
3662
const char *forward_url = NULL;
3664
g_return_val_if_fail (main_window != NULL, FALSE);
3665
g_return_val_if_fail (parent_window != NULL, FALSE);
3667
mw = gm_mw_get_mw (main_window);
3669
g_return_val_if_fail (mw != NULL, FALSE);
3672
endpoint = GnomeMeeting::Process ()->GetManager ();
3674
mw->transfer_call_popup =
3675
gm_entry_dialog_new (_("Transfer call to:"),
3678
gtk_window_set_transient_for (GTK_WINDOW (mw->transfer_call_popup),
3679
GTK_WINDOW (parent_window));
3681
gtk_dialog_set_default_response (GTK_DIALOG (mw->transfer_call_popup),
3682
GTK_RESPONSE_ACCEPT);
3684
if (!url.IsEmpty ())
3685
gm_entry_dialog_set_text (GM_ENTRY_DIALOG (mw->transfer_call_popup), u);
3687
gm_entry_dialog_set_text (GM_ENTRY_DIALOG (mw->transfer_call_popup),
3688
(const char *) url.GetDefaultURL ());
3690
gnomemeeting_threads_dialog_show (mw->transfer_call_popup);
3692
answer = gtk_dialog_run (GTK_DIALOG (mw->transfer_call_popup));
3695
case GTK_RESPONSE_ACCEPT:
3698
gm_entry_dialog_get_text (GM_ENTRY_DIALOG (mw->transfer_call_popup));
3699
new GMURLHandler (forward_url, TRUE);
3707
gtk_widget_destroy (mw->transfer_call_popup);
3708
mw->transfer_call_popup = NULL;
3710
return (answer == GTK_RESPONSE_ACCEPT);
3715
gm_main_window_incoming_call_dialog_show (GtkWidget *main_window,
3720
GmWindow *mw = NULL;
3722
GtkWidget *label = NULL;
3723
GtkWidget *vbox = NULL;
3724
GtkWidget *b1 = NULL;
3725
GtkWidget *b2 = NULL;
3726
GtkWidget *b3 = NULL;
3730
g_return_if_fail (main_window);
3732
mw = gm_mw_get_mw (main_window);
3734
g_return_if_fail (mw != NULL);
3737
mw->incoming_call_popup = gtk_dialog_new ();
3738
b2 = gtk_dialog_add_button (GTK_DIALOG (mw->incoming_call_popup),
3740
b3 = gtk_dialog_add_button (GTK_DIALOG (mw->incoming_call_popup),
3742
b1 = gtk_dialog_add_button (GTK_DIALOG (mw->incoming_call_popup),
3745
gtk_dialog_set_default_response (GTK_DIALOG (mw->incoming_call_popup), 2);
3747
vbox = GTK_DIALOG (mw->incoming_call_popup)->vbox;
3749
msg = g_strdup_printf ("%s <i>%s</i>",
3750
_("Incoming call from"), (const char*) utf8_name);
3751
label = gtk_label_new (NULL);
3752
gtk_label_set_markup (GTK_LABEL (label), msg);
3753
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 10);
3754
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.0);
3755
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
3760
label = gtk_label_new (NULL);
3762
g_strdup_printf ("<b>%s</b> <span foreground=\"blue\"><u>%s</u></span>",
3763
_("Remote URL:"), utf8_url);
3764
gtk_label_set_markup (GTK_LABEL (label), msg);
3765
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
3766
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 2);
3767
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
3773
label = gtk_label_new (NULL);
3774
msg = g_strdup_printf ("<b>%s</b> %s",
3775
_("Remote Application:"), utf8_app);
3776
gtk_label_set_markup (GTK_LABEL (label), msg);
3777
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
3778
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 2);
3779
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
3784
gtk_window_set_title (GTK_WINDOW (mw->incoming_call_popup), utf8_name);
3785
gtk_window_set_modal (GTK_WINDOW (mw->incoming_call_popup), TRUE);
3786
gtk_window_set_keep_above (GTK_WINDOW (mw->incoming_call_popup), TRUE);
3787
#if GTK_MINOR_VERSION >= 8
3788
gtk_window_set_urgency_hint (GTK_WINDOW (mw->incoming_call_popup), TRUE);
3790
gtk_window_set_transient_for (GTK_WINDOW (mw->incoming_call_popup),
3791
GTK_WINDOW (main_window));
3794
g_signal_connect (G_OBJECT (b1), "clicked",
3795
GTK_SIGNAL_FUNC (connect_cb), main_window);
3796
g_signal_connect (G_OBJECT (b2), "clicked",
3797
GTK_SIGNAL_FUNC (disconnect_cb), NULL);
3798
g_signal_connect (G_OBJECT (b3), "clicked",
3799
GTK_SIGNAL_FUNC (transfer_current_call_cb),
3800
mw->incoming_call_popup);
3802
g_signal_connect_swapped (G_OBJECT (b1), "clicked",
3803
GTK_SIGNAL_FUNC (gtk_widget_hide),
3804
mw->incoming_call_popup);
3805
g_signal_connect_swapped (G_OBJECT (b2), "clicked",
3806
GTK_SIGNAL_FUNC (gtk_widget_hide),
3807
mw->incoming_call_popup);
3809
g_signal_connect (G_OBJECT (mw->incoming_call_popup), "delete-event",
3810
GTK_SIGNAL_FUNC (delete_incoming_call_dialog_cb),
3813
gtk_widget_show_all (vbox);
3814
gnomemeeting_threads_dialog_show (mw->incoming_call_popup);
3819
gm_main_window_new ()
3821
GmWindow *mw = NULL;
3823
GtkWidget *window = NULL;
3824
GtkWidget *table = NULL;
3825
GtkWidget *frame = NULL;
3826
GdkPixbuf *pixbuf = NULL;
3827
GtkWidget *event_box = NULL;
3828
GtkWidget *vbox = NULL;
3829
gchar *filename = NULL;
3831
ControlPanelSection section = DIALPAD;
3832
ViewMode view_mode = SOFTPHONE;
3834
/* The Top-level window */
3835
#ifndef DISABLE_GNOME
3836
window = gnome_app_new ("gnomemeeting", NULL);
3838
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
3840
g_object_set_data_full (G_OBJECT (window), "window_name",
3841
g_strdup ("main_window"), g_free);
3843
gtk_window_set_title (GTK_WINDOW (window),
3845
gtk_window_set_position (GTK_WINDOW (window),
3846
GTK_WIN_POS_CENTER);
3849
/* The GMObject data */
3850
mw = new GmWindow ();
3851
mw->incoming_call_popup = mw->transfer_call_popup = NULL;
3855
g_object_set_data_full (G_OBJECT (window), "GMObject",
3856
mw, (GDestroyNotify) gm_mw_destroy);
3859
/* Tooltips and accelerators */
3860
mw->tips = gtk_tooltips_new ();
3861
mw->accel = gtk_accel_group_new ();
3862
gtk_window_add_accel_group (GTK_WINDOW (window), mw->accel);
3864
#ifdef DISABLE_GNOME
3865
mw->window_vbox = gtk_vbox_new (0, FALSE);
3866
gtk_container_add (GTK_CONTAINER (window), mw->window_vbox);
3867
gtk_widget_show_all (mw->window_vbox);
3870
mw->window_hbox = gtk_hbox_new (0, FALSE);
3871
gtk_widget_show_all (mw->window_hbox);
3874
/* The main menu and the toolbars */
3875
gm_mw_init_menu (window);
3876
#ifdef DISABLE_GNOME
3877
gtk_box_pack_start (GTK_BOX (mw->window_vbox), mw->main_menu,
3881
gm_mw_init_toolbars (window);
3883
#ifndef DISABLE_GNOME
3884
gnome_app_set_menus (GNOME_APP (window),
3885
GTK_MENU_BAR (mw->main_menu));
3887
gtk_box_pack_start (GTK_BOX (mw->window_vbox), mw->window_hbox,
3892
/* Create a table in the main window to attach things like buttons */
3893
table = gtk_table_new (3, 4, FALSE);
3894
gtk_container_set_border_width (GTK_CONTAINER (table), 6);
3895
#ifdef DISABLE_GNOME
3896
gtk_box_pack_start (GTK_BOX (mw->window_hbox), table, FALSE, FALSE, 0);
3897
gtk_widget_show (table);
3899
gnome_app_set_contents (GNOME_APP (window), table);
3901
gtk_widget_show (table);
3904
mw->main_notebook = gtk_notebook_new ();
3906
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (mw->main_notebook), GTK_POS_BOTTOM);
3908
gtk_notebook_popup_enable (GTK_NOTEBOOK (mw->main_notebook));
3909
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (mw->main_notebook), TRUE);
3910
gtk_notebook_set_scrollable (GTK_NOTEBOOK (mw->main_notebook), TRUE);
3912
gm_mw_init_dialpad (window);
3913
gm_mw_init_audio_settings (window);
3914
gm_mw_init_video_settings (window);
3915
gm_mw_init_stats (window);
3917
gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (mw->main_notebook),
3919
(GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
3920
(GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
3923
section = (ControlPanelSection)
3924
gm_conf_get_int (USER_INTERFACE_KEY "main_window/control_panel_section");
3925
gtk_widget_show_all (GTK_WIDGET (mw->main_notebook));
3926
gm_main_window_set_control_panel_section (window, section);
3929
/* The frame that contains information about the call */
3930
frame = gtk_frame_new (NULL);
3931
vbox = gtk_vbox_new (0, FALSE);
3932
gtk_container_add (GTK_CONTAINER (frame), vbox);
3933
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
3934
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
3935
mw->status_label = gtk_label_new (NULL);
3936
gtk_misc_set_alignment (GTK_MISC (mw->status_label), 0.0, 0.0);
3937
gtk_box_pack_start (GTK_BOX (vbox), mw->status_label, FALSE, FALSE, 2);
3939
mw->info_label = gtk_label_new (NULL);
3940
gtk_misc_set_alignment (GTK_MISC (mw->info_label), 0.05, 0.0);
3941
gtk_box_pack_start (GTK_BOX (vbox), mw->info_label, FALSE, FALSE, 0);
3942
#if GTK_CHECK_VERSION (2, 6, 0)
3943
gtk_label_set_ellipsize (GTK_LABEL (mw->info_label), PANGO_ELLIPSIZE_END);
3944
gtk_label_set_ellipsize (GTK_LABEL (mw->status_label), PANGO_ELLIPSIZE_END);
3947
gm_main_window_set_status (window, _("Standby"));
3948
gm_main_window_set_account_info (window, 0);
3950
gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (frame),
3952
(GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
3953
(GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
3955
gtk_widget_show_all (frame);
3958
/* The frame that contains the video */
3959
mw->video_frame = gtk_frame_new (NULL);
3960
gtk_frame_set_shadow_type (GTK_FRAME (mw->video_frame), GTK_SHADOW_ETCHED_IN);
3962
event_box = gtk_event_box_new ();
3964
gtk_container_add (GTK_CONTAINER (event_box), mw->video_frame);
3966
mw->main_video_image = gtk_image_new ();
3967
gtk_container_set_border_width (GTK_CONTAINER (mw->video_frame), 0);
3968
gtk_container_add (GTK_CONTAINER (mw->video_frame), mw->main_video_image);
3970
gtk_widget_set_size_request (GTK_WIDGET (mw->video_frame),
3971
GM_QCIF_WIDTH + GM_FRAME_SIZE,
3972
GM_QCIF_HEIGHT + GM_FRAME_SIZE);
3974
gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (event_box),
3976
(GtkAttachOptions) GTK_EXPAND,
3977
(GtkAttachOptions) GTK_EXPAND,
3979
gtk_widget_show (event_box);
3983
mw->statusbar_ebox = gtk_event_box_new ();
3984
mw->statusbar = gm_statusbar_new ();
3985
gtk_container_add (GTK_CONTAINER (mw->statusbar_ebox), mw->statusbar);
3987
#ifdef DISABLE_GNOME
3988
gtk_box_pack_start (GTK_BOX (mw->window_vbox), mw->statusbar_ebox,
3991
gnome_app_set_statusbar_custom (GNOME_APP (window),
3992
mw->statusbar_ebox, mw->statusbar);
3994
gtk_widget_show_all (mw->statusbar_ebox);
3996
g_signal_connect (G_OBJECT (mw->statusbar_ebox), "button-press-event",
3997
GTK_SIGNAL_FUNC (statusbar_clicked_cb), window);
4000
/* The 2 video window popups */
4001
mw->local_video_window =
4002
gm_mw_video_window_new (window,
4005
mw->local_video_image,
4006
"local_video_window");
4007
mw->remote_video_window =
4008
gm_mw_video_window_new (window,
4011
mw->remote_video_image,
4012
"remote_video_window");
4014
gm_main_window_update_logo (window);
4016
g_signal_connect (G_OBJECT (mw->local_video_window), "show",
4017
GTK_SIGNAL_FUNC (video_window_shown_cb), NULL);
4018
g_signal_connect (G_OBJECT (mw->remote_video_window), "show",
4019
GTK_SIGNAL_FUNC (video_window_shown_cb), NULL);
4022
/* Add the window icon and title */
4023
gtk_window_set_title (GTK_WINDOW (window), _("Ekiga"));
4025
filename = g_build_filename (DATA_DIR, "pixmaps", PACKAGE_NAME ".png", NULL);
4026
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
4030
gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
4031
g_object_unref (G_OBJECT (pixbuf));
4034
gtk_widget_realize (window);
4035
gtk_window_set_resizable (GTK_WINDOW (window), false);
4037
g_signal_connect_after (G_OBJECT (mw->main_notebook), "switch-page",
4038
G_CALLBACK (control_panel_section_changed_cb),
4042
/* Set the correct view mode */
4043
view_mode = (ViewMode)
4044
gm_conf_get_int (USER_INTERFACE_KEY "main_window/view_mode");
4045
gm_main_window_set_view_mode (window, view_mode);
4048
/* Init the Drag and drop features */
4049
gmcontacts_dnd_set_dest (GTK_WIDGET (window), dnd_call_contact_cb, mw);
4051
/* if the user tries to close the window : delete_event */
4052
g_signal_connect (G_OBJECT (window), "delete_event",
4053
G_CALLBACK (window_closed_cb),
4056
g_signal_connect (G_OBJECT (window), "show",
4057
GTK_SIGNAL_FUNC (video_window_shown_cb), NULL);
4064
gm_main_window_flash_message (GtkWidget *main_window,
4068
GmWindow *mw = NULL;
4072
g_return_if_fail (main_window != NULL);
4074
mw = gm_mw_get_mw (main_window);
4078
va_start (args, msg);
4079
vsnprintf (buffer, 1024, msg, args);
4080
gm_statusbar_flash_message (GM_STATUSBAR (mw->statusbar), buffer);
4086
gm_main_window_push_message (GtkWidget *main_window,
4090
GmWindow *mw = NULL;
4094
g_return_if_fail (main_window != NULL);
4095
g_return_if_fail (vm != NULL);
4097
mw = gm_mw_get_mw (main_window);
4099
info = g_strdup_printf (_("Missed calls: %d - Voice Mails: %s"), missed, vm);
4100
gm_main_window_push_info_message (main_window, info);
4107
gm_main_window_push_message (GtkWidget *main_window,
4111
GmWindow *mw = NULL;
4115
g_return_if_fail (main_window != NULL);
4117
mw = gm_mw_get_mw (main_window);
4121
va_start (args, msg);
4122
vsnprintf (buffer, 1024, msg, args);
4123
gm_statusbar_push_message (GM_STATUSBAR (mw->statusbar), buffer);
4129
gm_main_window_push_info_message (GtkWidget *main_window,
4133
GmWindow *mw = NULL;
4135
g_return_if_fail (main_window != NULL);
4137
mw = gm_mw_get_mw (main_window);
4141
va_start (args, msg);
4142
gm_statusbar_push_info_message (GM_STATUSBAR (mw->statusbar), msg, args);
4148
gm_main_window_set_call_url (GtkWidget *main_window,
4151
GmWindow *mw = NULL;
4153
GtkWidget *entry = NULL;
4155
g_return_if_fail (main_window != NULL && url != NULL);
4157
mw = gm_mw_get_mw (main_window);
4159
g_return_if_fail (mw != NULL);
4161
entry = GTK_WIDGET (GTK_BIN (mw->combo)->child);
4163
gtk_entry_set_text (GTK_ENTRY (entry), url);
4164
gtk_editable_set_position (GTK_EDITABLE (entry), -1);
4165
gtk_widget_grab_focus (GTK_WIDGET (entry));
4166
gtk_editable_select_region (GTK_EDITABLE (entry), -1, -1);
4171
gm_main_window_append_call_url (GtkWidget *main_window,
4174
GmWindow *mw = NULL;
4176
GtkWidget *entry = NULL;
4180
g_return_if_fail (main_window != NULL && url != NULL);
4182
mw = gm_mw_get_mw (main_window);
4184
g_return_if_fail (mw != NULL && url != NULL);
4186
entry = GTK_WIDGET (GTK_BIN (mw->combo)->child);
4188
if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), NULL, NULL)) {
4190
gtk_editable_delete_selection (GTK_EDITABLE (entry));
4191
pos = gtk_editable_get_position (GTK_EDITABLE (entry));
4194
gtk_editable_insert_text (GTK_EDITABLE (entry), url, strlen (url), &pos);
4195
gtk_widget_grab_focus (GTK_WIDGET (entry));
4196
gtk_editable_select_region (GTK_EDITABLE (entry), -1, -1);
4201
gm_main_window_get_call_url (GtkWidget *main_window)
4203
GmWindow *mw = NULL;
4205
g_return_val_if_fail (main_window != NULL, NULL);
4207
mw = gm_mw_get_mw (main_window);
4209
g_return_val_if_fail (mw != NULL, NULL);
4211
return gtk_entry_get_text (GTK_ENTRY (GTK_BIN (mw->combo)->child));
4216
gm_main_window_clear_stats (GtkWidget *main_window)
4218
GmWindow *mw = NULL;
4220
g_return_if_fail (main_window != NULL);
4222
mw = gm_mw_get_mw (main_window);
4224
g_return_if_fail (mw != NULL);
4226
gm_main_window_update_stats (main_window, 0, 0, 0, 0, 0, 0, 0, 0);
4227
stats_drawing_area_clear (mw->stats_drawing_area);
4232
gm_main_window_update_stats (GtkWidget *main_window,
4237
float new_video_octets_received,
4238
float new_video_octets_transmitted,
4239
float new_audio_octets_received,
4240
float new_audio_octets_transmitted)
4242
GmWindow *mw = NULL;
4244
gchar *stats_msg = NULL;
4247
g_return_if_fail (main_window != NULL);
4249
mw = gm_mw_get_mw (main_window);
4251
g_return_if_fail (mw != NULL);
4254
stats_msg = g_strdup_printf (_("Lost packets: %.1f %%\nLate packets: %.1f %%\nOut of order packets: %.1f %%\nJitter buffer: %d ms"), lost, late, out_of_order, jitter);
4255
gtk_label_set_text (GTK_LABEL (mw->stats_label), stats_msg);
4258
stats_drawing_area_new_data (mw->stats_drawing_area,
4259
new_video_octets_received,
4260
new_video_octets_transmitted,
4261
new_audio_octets_received,
4262
new_audio_octets_transmitted);
4267
gm_main_window_get_current_picture (GtkWidget *main_window)
4269
GmWindow *mw = NULL;
4271
g_return_val_if_fail (main_window != NULL, NULL);
4273
mw = gm_mw_get_mw (main_window);
4275
g_return_val_if_fail (mw != NULL, NULL);
4277
return gtk_image_get_pixbuf (GTK_IMAGE (mw->main_video_image));
4282
gm_main_window_set_stay_on_top (GtkWidget *main_window,
4283
gboolean stay_on_top)
4285
GmWindow *mw = NULL;
4287
GdkWindow *gm_window = NULL;
4288
GdkWindow *local_window = NULL;
4289
GdkWindow *remote_window = NULL;
4291
g_return_if_fail (main_window != NULL);
4293
mw = gm_mw_get_mw (main_window);
4295
g_return_if_fail (mw != NULL);
4298
gm_window = GDK_WINDOW (main_window->window);
4299
local_window = GDK_WINDOW (mw->local_video_window->window);
4300
remote_window = GDK_WINDOW (mw->remote_video_window->window);
4302
/* Update the stay-on-top attribute */
4303
gdk_window_set_always_on_top (GDK_WINDOW (gm_window), stay_on_top);
4304
gdk_window_set_always_on_top (GDK_WINDOW (local_window), stay_on_top);
4305
gdk_window_set_always_on_top (GDK_WINDOW (remote_window), stay_on_top);
4315
GMManager *endpoint = NULL;
4317
PProcess::PreInitialise (argc, argv, envp);
4319
GtkWidget *main_window = NULL;
4320
GtkWidget *druid_window = NULL;
4321
GtkWidget *dialog = NULL;
4325
gchar *key_name = NULL;
4328
int debug_level = 0;
4332
setenv ("ESD_NO_SPAWN", "1", 1);
4336
/* Threads + Locale Init + config */
4337
g_thread_init (NULL);
4338
gdk_threads_init ();
4341
gtk_init (&argc, &argv);
4343
gtk_init (NULL, NULL);
4348
gm_conf_init (argc, argv);
4350
/* Upgrade the preferences */
4351
gnomemeeting_conf_upgrade ();
4353
/* Initialize gettext */
4354
path = g_build_filename (DATA_DIR, "locale", NULL);
4355
textdomain (GETTEXT_PACKAGE);
4356
bindtextdomain (GETTEXT_PACKAGE, path);
4357
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
4360
#ifndef DISABLE_GNOME
4361
/* Cope with command line options */
4362
struct poptOption arguments [] =
4364
{"debug", 'd', POPT_ARG_INT, &debug_level,
4365
1, N_("Prints debug messages in the console (level between 1 and 6)"),
4367
{"call", 'c', POPT_ARG_STRING, &url,
4368
1, N_("Makes Ekiga call the given URL"), NULL},
4369
{NULL, '\0', 0, NULL, 0, NULL, NULL}
4372
/* GnomeMeeting Initialisation */
4373
gnome_program_init ("ekiga", VERSION,
4374
LIBGNOMEUI_MODULE, argc, argv,
4375
GNOME_PARAM_POPT_TABLE, arguments,
4376
GNOME_PARAM_HUMAN_READABLE_NAME,
4378
GNOME_PARAM_APP_DATADIR, DATA_DIR,
4381
GOptionEntry arguments [] =
4384
"debug", 'd', 0, G_OPTION_ARG_INT, &debug_level,
4385
N_("Prints debug messages in the console (level between 1 and 6)"),
4389
"call", 'c', 0, G_OPTION_ARG_STRING, &url,
4390
N_("Makes Ekiga call the given URL"),
4397
GOptionContext *context = g_option_context_new (NULL);
4398
g_option_context_add_main_entries (context, arguments, PACKAGE_NAME);
4399
g_option_context_set_help_enabled (context, TRUE);
4401
(void)g_option_context_parse (context, &argc, &argv, NULL);
4402
g_option_context_free (context);
4405
gdk_threads_enter ();
4408
#ifndef DISABLE_GNOME
4409
if (bonobo_component_init (argc, argv))
4413
/* GnomeMeeting main initialisation */
4414
static GnomeMeeting instance;
4417
if (debug_level != 0)
4418
PTrace::Initialise (PMAX (PMIN (4, debug_level), 0), NULL,
4419
PTrace::Timestamp | PTrace::Thread
4420
| PTrace::Blocks | PTrace::DateAndTime);
4422
/* Detect the devices, exit if it fails */
4423
if (!GnomeMeeting::Process ()->DetectDevices ()) {
4425
dialog = gnomemeeting_error_dialog (NULL, _("No usable audio plugin detected"), _("Ekiga didn't find any usable audio plugin. Make sure that your installation is correct."));
4427
g_signal_handlers_disconnect_by_func (G_OBJECT (dialog),
4428
(gpointer) gtk_widget_destroy,
4431
gtk_dialog_run (GTK_DIALOG (dialog));
4432
gtk_widget_destroy (dialog);
4438
GnomeMeeting::Process ()->BuildGUI ();
4441
/* Init the config DB, exit if it fails */
4442
if (!gnomemeeting_conf_init ()) {
4444
key_name = g_strdup ("\"/apps/" PACKAGE_NAME "/general/gconf_test_age\"");
4445
msg = g_strdup_printf (_("Ekiga got an invalid value for the GConf key %s.\n\nIt probably means that your GConf schemas have not been correctly installed or the that permissions are not correct.\n\nPlease check the FAQ (http://www.ekiga.org/), the throubleshooting 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);
4447
dialog = gnomemeeting_error_dialog (GTK_WINDOW (main_window),
4448
_("Gconf key error"), msg);
4450
g_signal_handlers_disconnect_by_func (G_OBJECT (dialog),
4451
(gpointer) gtk_widget_destroy,
4458
gtk_dialog_run (GTK_DIALOG (dialog));
4459
gtk_widget_destroy (dialog);
4464
/* Init the process */
4465
GnomeMeeting::Process ()->DetectInterfaces ();
4466
GnomeMeeting::Process ()->Init ();
4468
main_window = GnomeMeeting::Process ()->GetMainWindow ();
4469
druid_window = GnomeMeeting::Process ()->GetDruidWindow ();
4470
endpoint = GnomeMeeting::Process ()->GetManager ();
4472
if (gm_conf_get_int (GENERAL_KEY "version")
4473
< 1000 * MAJOR_VERSION + 10 * MINOR_VERSION + BUILD_NUMBER) {
4475
gtk_widget_show_all (GTK_WIDGET (druid_window));
4479
/* Show the main window */
4480
if (!gm_conf_get_bool (USER_INTERFACE_KEY "start_hidden"))
4481
gnomemeeting_window_show (main_window);
4483
g_timeout_add (15000, (GtkFunction) gnomemeeting_tray_hack_cb, NULL);
4488
/* Call the given host if needed */
4490
GnomeMeeting::Process ()->Connect (url);
4495
gdk_threads_leave ();
4497
GnomeMeeting::Process ()->Exit ();
4508
APIENTRY WinMain (HINSTANCE hInstance,
4509
HINSTANCE hPrevInstance,
4513
return main (0, NULL, NULL);