diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-call-window.c | 412 | ||||
-rw-r--r-- | src/empathy-call-window.ui | 15 | ||||
-rw-r--r-- | src/empathy-preferences.c | 25 | ||||
-rw-r--r-- | src/empathy-preferences.ui | 167 |
4 files changed, 246 insertions, 373 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index afd02522b..5ed4e93d3 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -41,8 +41,10 @@ #include <gst/farsight/fs-utils.h> #include <libempathy/empathy-camera-monitor.h> +#include <libempathy/empathy-gsettings.h> #include <libempathy/empathy-tp-contact-factory.h> #include <libempathy/empathy-utils.h> + #include <libempathy-gtk/empathy-avatar-image.h> #include <libempathy-gtk/empathy-ui-utils.h> #include <libempathy-gtk/empathy-sound-manager.h> @@ -59,7 +61,6 @@ #include "empathy-audio-src.h" #include "empathy-audio-sink.h" #include "empathy-video-src.h" -#include "ev-sidebar.h" #include "empathy-mic-menu.h" #define CONTENT_HBOX_BORDER_WIDTH 6 @@ -125,7 +126,6 @@ struct _EmpathyCallWindowPriv GtkWidget *remote_user_avatar_widget; GtkWidget *remote_user_avatar_toolbar; GtkWidget *remote_user_name_toolbar; - GtkWidget *sidebar; GtkWidget *status_label; GtkWidget *hangup_button; GtkWidget *audio_call_button; @@ -136,7 +136,6 @@ struct _EmpathyCallWindowPriv GtkWidget *toolbar; GtkWidget *bottom_toolbar; GtkWidget *pane; - GtkAction *menu_sidebar; GtkAction *menu_fullscreen; /* The box that contains self and remote avatar and video @@ -152,9 +151,6 @@ struct _EmpathyCallWindowPriv guint bus_message_source_id; gdouble volume; - GtkWidget *volume_scale; - GtkWidget *volume_progress_bar; - GtkAdjustment *audio_input_adj; GtkWidget *dtmf_panel; @@ -189,10 +185,6 @@ struct _EmpathyCallWindowPriv GTimer *timer; guint timer_id; - GtkWidget *video_contrast; - GtkWidget *video_brightness; - GtkWidget *video_gamma; - GMutex *lock; gboolean call_started; gboolean sending_video; @@ -206,11 +198,11 @@ struct _EmpathyCallWindowPriv /* Those fields represent the state of the window before it actually was in fullscreen mode. */ - gboolean sidebar_was_visible_before_fs; + gboolean dialpad_was_visible_before_fs; gint original_width_before_fs; gint original_height_before_fs; - gint x, y, w, h, sidebar_width; + gint x, y, w, h, dialpad_width; gboolean maximized; /* TRUE if the call should be started when the pipeline is playing */ @@ -220,6 +212,7 @@ struct _EmpathyCallWindowPriv EmpathySoundManager *sound_mgr; + GSettings *settings; EmpathyMicMenu *mic_menu; }; @@ -240,19 +233,6 @@ static void empathy_call_window_set_send_video (EmpathyCallWindow *window, static void empathy_call_window_mic_toggled_cb ( GtkToggleToolButton *toggle, EmpathyCallWindow *window); -static void empathy_call_window_sidebar_cb (GtkToggleAction *menu, - EmpathyCallWindow *self); - -static void empathy_call_window_sidebar_hidden_cb (EvSidebar *sidebar, - EmpathyCallWindow *window); - -static void empathy_call_window_sidebar_shown_cb (EvSidebar *sidebar, - EmpathyCallWindow *window); - -static void empathy_call_window_sidebar_changed_cb (EvSidebar *sidebar, - const gchar *page, - EmpathyCallWindow *window); - static void empathy_call_window_hangup_cb (gpointer object, EmpathyCallWindow *window); @@ -346,137 +326,14 @@ dtmf_button_released_cb (GtkButton *button, EmpathyCallWindow *window) g_object_unref (call); } -static GtkWidget * -empathy_call_window_create_video_input_add_slider (EmpathyCallWindow *self, - gchar *label_text, GtkWidget *bin) -{ - GtkWidget *vbox = gtk_vbox_new (FALSE, 2); - GtkWidget *scale = gtk_vscale_new_with_range (0, 100, 10); - GtkWidget *label = gtk_label_new (label_text); - - gtk_widget_set_sensitive (scale, FALSE); - - gtk_container_add (GTK_CONTAINER (bin), vbox); - - gtk_range_set_inverted (GTK_RANGE (scale), TRUE); - gtk_box_pack_start (GTK_BOX (vbox), scale, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - - return scale; -} - -static void -empathy_call_window_video_contrast_changed_cb (GtkAdjustment *adj, - EmpathyCallWindow *self) - -{ - EmpathyCallWindowPriv *priv = GET_PRIV (self); - - empathy_video_src_set_channel (priv->video_input, - EMPATHY_GST_VIDEO_SRC_CHANNEL_CONTRAST, gtk_adjustment_get_value (adj)); -} - -static void -empathy_call_window_video_brightness_changed_cb (GtkAdjustment *adj, - EmpathyCallWindow *self) - -{ - EmpathyCallWindowPriv *priv = GET_PRIV (self); - - empathy_video_src_set_channel (priv->video_input, - EMPATHY_GST_VIDEO_SRC_CHANNEL_BRIGHTNESS, gtk_adjustment_get_value (adj)); -} - -static void -empathy_call_window_video_gamma_changed_cb (GtkAdjustment *adj, - EmpathyCallWindow *self) - -{ - EmpathyCallWindowPriv *priv = GET_PRIV (self); - - empathy_video_src_set_channel (priv->video_input, - EMPATHY_GST_VIDEO_SRC_CHANNEL_GAMMA, gtk_adjustment_get_value (adj)); -} - - -static GtkWidget * -empathy_call_window_create_video_input (EmpathyCallWindow *self) -{ - EmpathyCallWindowPriv *priv = GET_PRIV (self); - GtkWidget *hbox; - - hbox = gtk_hbox_new (TRUE, 3); - - priv->video_contrast = empathy_call_window_create_video_input_add_slider ( - self, _("Contrast"), hbox); - - priv->video_brightness = empathy_call_window_create_video_input_add_slider ( - self, _("Brightness"), hbox); - - priv->video_gamma = empathy_call_window_create_video_input_add_slider ( - self, _("Gamma"), hbox); - - return hbox; -} - -static void -empathy_call_window_setup_video_input (EmpathyCallWindow *self) -{ - EmpathyCallWindowPriv *priv = GET_PRIV (self); - guint supported; - GtkAdjustment *adj; - - supported = empathy_video_src_get_supported_channels (priv->video_input); - - if (supported & EMPATHY_GST_VIDEO_SRC_SUPPORTS_CONTRAST) - { - adj = gtk_range_get_adjustment (GTK_RANGE (priv->video_contrast)); - - gtk_adjustment_set_value (adj, - empathy_video_src_get_channel (priv->video_input, - EMPATHY_GST_VIDEO_SRC_CHANNEL_CONTRAST)); - - g_signal_connect (G_OBJECT (adj), "value-changed", - G_CALLBACK (empathy_call_window_video_contrast_changed_cb), self); - - gtk_widget_set_sensitive (priv->video_contrast, TRUE); - } - - if (supported & EMPATHY_GST_VIDEO_SRC_SUPPORTS_BRIGHTNESS) - { - adj = gtk_range_get_adjustment (GTK_RANGE (priv->video_brightness)); - - gtk_adjustment_set_value (adj, - empathy_video_src_get_channel (priv->video_input, - EMPATHY_GST_VIDEO_SRC_CHANNEL_BRIGHTNESS)); - - g_signal_connect (G_OBJECT (adj), "value-changed", - G_CALLBACK (empathy_call_window_video_brightness_changed_cb), self); - gtk_widget_set_sensitive (priv->video_brightness, TRUE); - } - - if (supported & EMPATHY_GST_VIDEO_SRC_SUPPORTS_GAMMA) - { - adj = gtk_range_get_adjustment (GTK_RANGE (priv->video_gamma)); - - gtk_adjustment_set_value (adj, - empathy_video_src_get_channel (priv->video_input, - EMPATHY_GST_VIDEO_SRC_CHANNEL_GAMMA)); - - g_signal_connect (G_OBJECT (adj), "value-changed", - G_CALLBACK (empathy_call_window_video_gamma_changed_cb), self); - gtk_widget_set_sensitive (priv->video_gamma, TRUE); - } -} - static void -empathy_call_window_mic_volume_changed_cb (GtkAdjustment *adj, - EmpathyCallWindow *self) +empathy_call_window_mic_volume_changed (EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); gdouble volume; - volume = gtk_adjustment_get_value (adj)/100.0; + volume = g_settings_get_double (priv->settings, + EMPATHY_PREFS_CALL_SOUND_VOLUME) / 100.0; /* Don't store the volume because of muting */ if (volume > 0 || gtk_toggle_tool_button_get_active ( @@ -495,56 +352,11 @@ empathy_call_window_mic_volume_changed_cb (GtkAdjustment *adj, } static void -empathy_call_window_audio_input_level_changed_cb (EmpathyGstAudioSrc *src, - gdouble level, EmpathyCallWindow *window) +empathy_call_window_prefs_volume_changed_cb (GSettings *settings, + gchar *key, + EmpathyCallWindow *self) { - gdouble value; - EmpathyCallWindowPriv *priv = GET_PRIV (window); - - value = CLAMP (pow (10, level / 20), 0.0, 1.0); - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->volume_progress_bar), - value); -} - -static GtkWidget * -empathy_call_window_create_audio_input (EmpathyCallWindow *self) -{ - EmpathyCallWindowPriv *priv = GET_PRIV (self); - GtkWidget *hbox, *vbox, *label; - - hbox = gtk_hbox_new (TRUE, 3); - - vbox = gtk_vbox_new (FALSE, 3); - gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 3); - - priv->volume_scale = gtk_vscale_new_with_range (0, 150, 100); - gtk_range_set_inverted (GTK_RANGE (priv->volume_scale), TRUE); - label = gtk_label_new (_("Volume")); - - priv->audio_input_adj = gtk_range_get_adjustment ( - GTK_RANGE (priv->volume_scale)); - priv->volume = empathy_audio_src_get_volume (EMPATHY_GST_AUDIO_SRC - (priv->audio_input)); - gtk_adjustment_set_value (priv->audio_input_adj, priv->volume * 100); - - g_signal_connect (G_OBJECT (priv->audio_input_adj), "value-changed", - G_CALLBACK (empathy_call_window_mic_volume_changed_cb), self); - - gtk_box_pack_start (GTK_BOX (vbox), priv->volume_scale, TRUE, TRUE, 3); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 3); - - priv->volume_progress_bar = gtk_progress_bar_new (); - - gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->volume_progress_bar), - GTK_ORIENTATION_VERTICAL); - - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->volume_progress_bar), - 0); - - gtk_box_pack_start (GTK_BOX (hbox), priv->volume_progress_bar, FALSE, FALSE, - 3); - - return hbox; + empathy_call_window_mic_volume_changed (self); } static void @@ -602,10 +414,6 @@ create_audio_input (EmpathyCallWindow *self) priv->audio_input = empathy_audio_src_new (); gst_object_ref (priv->audio_input); gst_object_sink (priv->audio_input); - - tp_g_signal_connect_object (priv->audio_input, "peak-level-changed", - G_CALLBACK (empathy_call_window_audio_input_level_changed_cb), - self, 0); } static void @@ -932,8 +740,8 @@ empathy_call_window_configure_event_cb (GtkWidget *widget, gtk_window_get_position (GTK_WINDOW (self), &self->priv->x, &self->priv->y); gtk_window_get_size (GTK_WINDOW (self), &self->priv->w, &self->priv->h); - gtk_widget_get_preferred_width (self->priv->sidebar, - &self->priv->sidebar_width, NULL); + gtk_widget_get_preferred_width (self->priv->dtmf_panel, + &self->priv->dialpad_width, NULL); gdk_window = gtk_widget_get_window (widget); window_state = gdk_window_get_state (gdk_window); @@ -946,12 +754,12 @@ static void empathy_call_window_destroyed_cb (GtkWidget *object, EmpathyCallWindow *self) { - if (gtk_widget_get_visible (self->priv->sidebar)) + if (gtk_widget_get_visible (self->priv->dtmf_panel)) { - /* Save the geometry as if the sidebar was hidden. */ + /* Save the geometry as if the dialpad was hidden. */ empathy_geometry_save_values (GTK_WINDOW (self), self->priv->x, self->priv->y, - self->priv->w - self->priv->sidebar_width, self->priv->h, + self->priv->w - self->priv->dialpad_width, self->priv->h, self->priv->maximized); } } @@ -962,9 +770,7 @@ empathy_call_window_init (EmpathyCallWindow *self) EmpathyCallWindowPriv *priv; GtkBuilder *gui; GtkWidget *top_vbox; - GtkWidget *page; gchar *filename; - GtkWidget *scroll; ClutterConstraint *size_constraint; ClutterActor *remote_avatar; GtkStyleContext *context; @@ -990,7 +796,6 @@ empathy_call_window_init (EmpathyCallWindow *self) "dialpad", &priv->dialpad_button, "toolbar", &priv->toolbar, "bottom_toolbar", &priv->bottom_toolbar, - "menusidebar", &priv->menu_sidebar, "ui_manager", &priv->ui_manager, "menufullscreen", &priv->menu_fullscreen, "details_vbox", &priv->details_vbox, @@ -1014,7 +819,6 @@ empathy_call_window_init (EmpathyCallWindow *self) "hangup", "clicked", empathy_call_window_hangup_cb, "audiocall", "clicked", empathy_call_window_audio_call_cb, "videocall", "clicked", empathy_call_window_video_call_cb, - "menusidebar", "toggled", empathy_call_window_sidebar_cb, "volume", "value-changed", empathy_call_window_volume_changed_cb, "microphone", "toggled", empathy_call_window_mic_toggled_cb, "camera", "toggled", empathy_call_window_camera_toggled_cb, @@ -1040,7 +844,8 @@ empathy_call_window_init (EmpathyCallWindow *self) priv->content_hbox = gtk_hbox_new (FALSE, CONTENT_HBOX_SPACING); gtk_container_set_border_width (GTK_CONTAINER (priv->content_hbox), CONTENT_HBOX_BORDER_WIDTH); - gtk_paned_pack1 (GTK_PANED (priv->pane), priv->content_hbox, TRUE, FALSE); + gtk_box_pack_start (GTK_BOX (priv->pane), priv->content_hbox, + TRUE, TRUE, 0); /* avatar/video box */ priv->video_layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, @@ -1093,43 +898,22 @@ empathy_call_window_init (EmpathyCallWindow *self) /* The call will be started as soon the pipeline is playing */ priv->start_call_when_playing = TRUE; - priv->sidebar = ev_sidebar_new (); - g_signal_connect (G_OBJECT (priv->sidebar), - "hide", G_CALLBACK (empathy_call_window_sidebar_hidden_cb), self); - g_signal_connect (G_OBJECT (priv->sidebar), - "show", G_CALLBACK (empathy_call_window_sidebar_shown_cb), self); - g_signal_connect (G_OBJECT (priv->sidebar), "changed", - G_CALLBACK (empathy_call_window_sidebar_changed_cb), self); - gtk_paned_pack2 (GTK_PANED (priv->pane), priv->sidebar, FALSE, FALSE); - - page = empathy_call_window_create_audio_input (self); - ev_sidebar_add_page (EV_SIDEBAR (priv->sidebar), "audio-input", - _("Audio input"), page); - - page = empathy_call_window_create_video_input (self); - ev_sidebar_add_page (EV_SIDEBAR (priv->sidebar), "video-input", - _("Video input"), page); - priv->dtmf_panel = empathy_create_dtmf_dialpad (G_OBJECT (self), G_CALLBACK (dtmf_button_pressed_cb), G_CALLBACK (dtmf_button_released_cb)); - ev_sidebar_add_page (EV_SIDEBAR (priv->sidebar), "dialpad", - _("Dialpad"), priv->dtmf_panel); - gtk_widget_set_sensitive (priv->dtmf_panel, FALSE); + gtk_box_pack_start (GTK_BOX (priv->pane), priv->dtmf_panel, + FALSE, FALSE, 0); - /* Put the details vbox in a scroll window as it can require a lot of - * horizontal space. */ - scroll = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroll), - priv->details_vbox); + gtk_box_pack_start (GTK_BOX (priv->pane), priv->details_vbox, + FALSE, FALSE, 0); - ev_sidebar_add_page (EV_SIDEBAR (priv->sidebar), "details", _("Details"), - scroll); + gtk_widget_set_sensitive (priv->dtmf_panel, FALSE); gtk_widget_show_all (top_vbox); - gtk_widget_hide (priv->sidebar); + gtk_widget_hide (priv->dtmf_panel); + gtk_widget_hide (priv->details_vbox); priv->fullscreen = empathy_call_window_fullscreen_new (self); @@ -1161,10 +945,14 @@ empathy_call_window_init (EmpathyCallWindow *self) empathy_call_window_show_hangup_button (self, TRUE); + priv->settings = g_settings_new (EMPATHY_PREFS_CALL_SCHEMA); + g_signal_connect (priv->settings, "changed::"EMPATHY_PREFS_CALL_SOUND_VOLUME, + G_CALLBACK (empathy_call_window_prefs_volume_changed_cb), self); + empathy_geometry_bind (GTK_WINDOW (self), "call-window"); /* These signals are used to track the window position and save it * when the window is destroyed. We need to do this as we don't want - * the window geometry to be saved with the sidebar taken into account. */ + * the window geometry to be saved with the dialpad taken into account. */ g_signal_connect (self, "destroy", G_CALLBACK (empathy_call_window_destroyed_cb), self); g_signal_connect (self, "configure-event", @@ -1295,13 +1083,12 @@ empathy_call_window_setup_avatars (EmpathyCallWindow *self, { EmpathyCallWindowPriv *priv = GET_PRIV (self); - g_signal_connect (priv->contact, "notify::name", - G_CALLBACK (contact_name_changed_cb), self); - g_signal_connect (priv->contact, "notify::avatar", - G_CALLBACK (contact_avatar_changed_cb), self); - /* FIXME: There's no EmpathyContact::presence yet */ - g_signal_connect (priv->contact, "notify::presence", - G_CALLBACK (contact_presence_changed_cb), self); + tp_g_signal_connect_object (priv->contact, "notify::name", + G_CALLBACK (contact_name_changed_cb), self, 0); + tp_g_signal_connect_object (priv->contact, "notify::avatar", + G_CALLBACK (contact_avatar_changed_cb), self, 0); + tp_g_signal_connect_object (priv->contact, "notify::presence", + G_CALLBACK (contact_presence_changed_cb), self, 0); set_window_title (self); set_remote_user_name (self, priv->contact); @@ -1671,6 +1458,7 @@ empathy_call_window_dispose (GObject *object) tp_clear_object (&priv->ui_manager); tp_clear_object (&priv->fullscreen); tp_clear_object (&priv->camera_monitor); + tp_clear_object (&priv->settings); g_list_free_full (priv->notifiers, g_object_unref); @@ -1791,9 +1579,6 @@ empathy_call_window_reset_pipeline (EmpathyCallWindow *self) g_object_unref (priv->pipeline); priv->pipeline = NULL; - g_signal_handlers_disconnect_by_func (priv->audio_input_adj, - empathy_call_window_mic_volume_changed_cb, self); - if (priv->audio_output != NULL) g_object_unref (priv->audio_output); priv->audio_output = NULL; @@ -1892,9 +1677,6 @@ empathy_call_window_disconnected (EmpathyCallWindow *self, display_video_preview (self, TRUE); } - gtk_progress_bar_set_fraction ( - GTK_PROGRESS_BAR (priv->volume_progress_bar), 0); - /* destroy the video output; it will be recreated when we'll redial */ disconnect_video_output_motion_handler (self); if (priv->video_output != NULL) @@ -2665,8 +2447,6 @@ empathy_call_window_bus_message (GstBus *bus, GstMessage *message, if (GST_MESSAGE_SRC (message) == GST_OBJECT (priv->video_input)) { gst_message_parse_state_changed (message, NULL, &newstate, NULL); - if (newstate == GST_STATE_PAUSED) - empathy_call_window_setup_video_input (self); } if (GST_MESSAGE_SRC (message) == GST_OBJECT (priv->pipeline) && !priv->call_started) @@ -2865,14 +2645,14 @@ show_controls (EmpathyCallWindow *window, gboolean set_fullscreen) if (set_fullscreen) { - gtk_widget_hide (priv->sidebar); + gtk_widget_hide (priv->dtmf_panel); gtk_widget_hide (menu); gtk_widget_hide (priv->toolbar); } else { - if (priv->sidebar_was_visible_before_fs) - gtk_widget_show (priv->sidebar); + if (priv->dialpad_was_visible_before_fs) + gtk_widget_show (priv->dtmf_panel); gtk_widget_show (menu); gtk_widget_show (priv->toolbar); @@ -2915,7 +2695,7 @@ empathy_call_window_state_event_cb (GtkWidget *widget, if (set_fullscreen) { - gboolean sidebar_was_visible; + gboolean dialpad_was_visible; GtkAllocation allocation; gint original_width, original_height; @@ -2923,9 +2703,11 @@ empathy_call_window_state_event_cb (GtkWidget *widget, original_width = allocation.width; original_height = allocation.height; - g_object_get (priv->sidebar, "visible", &sidebar_was_visible, NULL); + g_object_get (priv->dtmf_panel, + "visible", &dialpad_was_visible, + NULL); - priv->sidebar_was_visible_before_fs = sidebar_was_visible; + priv->dialpad_was_visible_before_fs = dialpad_was_visible; priv->original_width_before_fs = original_width; priv->original_height_before_fs = original_height; @@ -2956,68 +2738,32 @@ empathy_call_window_state_event_cb (GtkWidget *widget, } static void -empathy_call_window_update_sidebar_buttons (EmpathyCallWindow *window, - gboolean toggled) -{ - EmpathyCallWindowPriv *priv = GET_PRIV (window); - - /* Update dialpad button */ - g_signal_handlers_block_by_func (priv->dialpad_button, - empathy_call_window_dialpad_cb, window); - gtk_toggle_tool_button_set_active ( - GTK_TOGGLE_TOOL_BUTTON (priv->dialpad_button), - toggled); - g_signal_handlers_unblock_by_func (priv->dialpad_button, - empathy_call_window_dialpad_cb, window); - - /* Update sidebar menu */ - g_signal_handlers_block_by_func (priv->menu_sidebar, - empathy_call_window_sidebar_cb, window); - gtk_toggle_action_set_active ( - GTK_TOGGLE_ACTION (priv->menu_sidebar), - gtk_widget_get_visible (priv->sidebar)); - g_signal_handlers_unblock_by_func (priv->menu_sidebar, - empathy_call_window_sidebar_cb, window); -} - -static void -empathy_call_window_show_sidebar (EmpathyCallWindow *window, +empathy_call_window_show_dialpad (EmpathyCallWindow *window, gboolean active) { EmpathyCallWindowPriv *priv = GET_PRIV (window); - int w, h, sidebar_width, handle_size; + int w, h, dialpad_width; GtkAllocation allocation; - gchar *page; - gboolean dialpad_shown; gtk_widget_get_allocation (GTK_WIDGET (window), &allocation); w = allocation.width; h = allocation.height; - gtk_widget_style_get (priv->pane, "handle_size", &handle_size, NULL); - - gtk_widget_get_preferred_width (priv->sidebar, &sidebar_width, NULL); + gtk_widget_get_preferred_width (priv->dtmf_panel, &dialpad_width, NULL); if (active) { - gtk_widget_show (priv->sidebar); - w += sidebar_width + handle_size; + gtk_widget_show (priv->dtmf_panel); + w += dialpad_width; } else { - w -= sidebar_width + handle_size; - gtk_widget_hide (priv->sidebar); + w -= dialpad_width; + gtk_widget_hide (priv->dtmf_panel); } if (w > 0 && h > 0) gtk_window_resize (GTK_WINDOW (window), w, h); - - /* Update the 'Dialpad' menu */ - page = ev_sidebar_get_current_page (EV_SIDEBAR (priv->sidebar)); - dialpad_shown = active && !tp_strdiff (page, "dialpad"); - g_free (page); - - empathy_call_window_update_sidebar_buttons (window, dialpad_shown); } static void @@ -3060,9 +2806,8 @@ empathy_call_window_mic_toggled_cb (GtkToggleToolButton *toggle, if (active) { - empathy_audio_src_set_volume (EMPATHY_GST_AUDIO_SRC (priv->audio_input), - priv->volume); - gtk_adjustment_set_value (priv->audio_input_adj, priv->volume * 100); + g_settings_set_double (priv->settings, EMPATHY_PREFS_CALL_SOUND_VOLUME, + priv->volume * 100); } else { @@ -3071,36 +2816,12 @@ empathy_call_window_mic_toggled_cb (GtkToggleToolButton *toggle, * sides mute at the same time on certain CMs AFAIK. Need to revisit this * in the future. GNOME #574574 */ - empathy_audio_src_set_volume (EMPATHY_GST_AUDIO_SRC (priv->audio_input), - 0); - gtk_adjustment_set_value (priv->audio_input_adj, 0); + g_settings_set_double (priv->settings, EMPATHY_PREFS_CALL_SOUND_VOLUME, + 0); } } static void -empathy_call_window_sidebar_hidden_cb (EvSidebar *sidebar, - EmpathyCallWindow *window) -{ - empathy_call_window_show_sidebar (window, FALSE); -} - -static void -empathy_call_window_sidebar_shown_cb (EvSidebar *sidebar, - EmpathyCallWindow *window) -{ - empathy_call_window_show_sidebar (window, TRUE); -} - -static void -empathy_call_window_sidebar_changed_cb (EvSidebar *sidebar, - const gchar *page, - EmpathyCallWindow *window) -{ - empathy_call_window_update_sidebar_buttons (window, - !tp_strdiff (page, "dialpad")); -} - -static void empathy_call_window_hangup_cb (gpointer object, EmpathyCallWindow *window) { @@ -3123,13 +2844,10 @@ empathy_call_window_restart_call (EmpathyCallWindow *window) create_video_output_widget (window); - g_signal_connect (G_OBJECT (priv->audio_input_adj), "value-changed", - G_CALLBACK (empathy_call_window_mic_volume_changed_cb), window); - /* While the call was disconnected, the input volume might have changed. * However, since the audio_input source was destroyed, its volume has not * been updated during that time. That's why we manually update it here */ - empathy_call_window_mic_volume_changed_cb (priv->audio_input_adj, window); + empathy_call_window_mic_volume_changed (window); priv->outgoing = TRUE; empathy_call_window_set_state_connecting (window); @@ -3149,23 +2867,11 @@ static void empathy_call_window_dialpad_cb (GtkToggleToolButton *button, EmpathyCallWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); gboolean active; active = gtk_toggle_tool_button_get_active (button); - if (active) - ev_sidebar_set_current_page (EV_SIDEBAR (priv->sidebar), "dialpad"); - - empathy_call_window_show_sidebar (window, active); -} - -static void -empathy_call_window_sidebar_cb (GtkToggleAction *menu, - EmpathyCallWindow *self) -{ - empathy_call_window_show_sidebar (self, - gtk_toggle_action_get_active (menu)); + empathy_call_window_show_dialpad (window, active); } static void diff --git a/src/empathy-call-window.ui b/src/empathy-call-window.ui index 8c0d5777e..88127e1ad 100644 --- a/src/empathy-call-window.ui +++ b/src/empathy-call-window.ui @@ -18,12 +18,6 @@ </object> </child> <child> - <object class="GtkToggleAction" id="menusidebar"> - <property name="name">menusidebar</property> - <property name="label" translatable="yes">_Sidebar</property> - </object> - </child> - <child> <object class="GtkAction" id="edit"> <property name="name">edit</property> <property name="label" translatable="yes">_Edit</property> @@ -79,7 +73,6 @@ </menu> <menu action="view"> <menuitem action="menufullscreen"/> - <menuitem action="menusidebar"/> </menu> </menubar> <popup name="video-popup"> @@ -206,15 +199,9 @@ </packing> </child> <child> - <object class="GtkHPaned" id="pane"> + <object class="GtkHBox" id="pane"> <property name="visible">True</property> <property name="can_focus">True</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> </object> <packing> <property name="position">3</property> diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c index 9db4739d6..0e90d00fd 100644 --- a/src/empathy-preferences.c +++ b/src/empathy-preferences.c @@ -75,6 +75,9 @@ struct _EmpathyPreferencesPriv { GtkWidget *checkbutton_notifications_contact_signin; GtkWidget *checkbutton_notifications_contact_signout; + GtkWidget *scale_call_volume; + GtkWidget *adj_call_volume; + GtkWidget *treeview_spell_checker; GtkWidget *checkbutton_location_publish; @@ -93,6 +96,7 @@ struct _EmpathyPreferencesPriv { GSettings *gsettings; GSettings *gsettings_chat; + GSettings *gsettings_call; GSettings *gsettings_loc; GSettings *gsettings_notify; GSettings *gsettings_sound; @@ -259,6 +263,12 @@ preferences_setup_widgets (EmpathyPreferences *preferences) "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (priv->gsettings_call, + EMPATHY_PREFS_CALL_SOUND_VOLUME, + priv->adj_call_volume, + "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (priv->gsettings, EMPATHY_PREFS_AUTOCONNECT, priv->checkbutton_autoconnect, @@ -1078,6 +1088,13 @@ preferences_themes_setup (EmpathyPreferences *preferences) preferences); } +static gchar* +preferences_call_format_volume_cb (GtkScale *scale, + gdouble value) +{ + return g_strdup_printf ("%g%%", value); +} + static void empathy_preferences_response (GtkDialog *widget, gint response) @@ -1094,6 +1111,7 @@ empathy_preferences_finalize (GObject *self) g_object_unref (priv->gsettings); g_object_unref (priv->gsettings_chat); + g_object_unref (priv->gsettings_call); g_object_unref (priv->gsettings_loc); g_object_unref (priv->gsettings_notify); g_object_unref (priv->gsettings_sound); @@ -1166,6 +1184,8 @@ empathy_preferences_init (EmpathyPreferences *preferences) "checkbutton_location_resource_network", &priv->checkbutton_location_resource_network, "checkbutton_location_resource_cell", &priv->checkbutton_location_resource_cell, "checkbutton_location_resource_gps", &priv->checkbutton_location_resource_gps, + "call_volume_scale", &priv->scale_call_volume, + "call_volume_adjustment", &priv->adj_call_volume, NULL); g_free (filename); @@ -1176,6 +1196,7 @@ empathy_preferences_init (EmpathyPreferences *preferences) priv->gsettings = g_settings_new (EMPATHY_PREFS_SCHEMA); priv->gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA); + priv->gsettings_call = g_settings_new (EMPATHY_PREFS_CALL_SCHEMA); priv->gsettings_loc = g_settings_new (EMPATHY_PREFS_LOCATION_SCHEMA); priv->gsettings_notify = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA); priv->gsettings_sound = g_settings_new (EMPATHY_PREFS_SOUNDS_SCHEMA); @@ -1189,6 +1210,10 @@ empathy_preferences_init (EmpathyPreferences *preferences) preferences, 0); preferences_preview_theme_changed_cb (priv->theme_manager, preferences); + g_signal_connect (priv->scale_call_volume, "format-value", + G_CALLBACK (preferences_call_format_volume_cb), + preferences); + preferences_themes_setup (preferences); preferences_setup_widgets (preferences); diff --git a/src/empathy-preferences.ui b/src/empathy-preferences.ui index 2549d51ad..f8dc0a0d3 100644 --- a/src/empathy-preferences.ui +++ b/src/empathy-preferences.ui @@ -1,6 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <requires lib="gtk+" version="2.16"/> + <object class="GtkAdjustment" id="call_volume_adjustment"> + <property name="upper">150</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkNotebook" id="notebook"> <property name="visible">True</property> <property name="can_focus">True</property> @@ -457,6 +462,150 @@ </packing> </child> <child> + <object class="GtkBox" id="vbox6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">12</property> + <property name="orientation">vertical</property> + <property name="spacing">18</property> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkBox" id="box5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label12"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Input volume</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkScale" id="call_volume_scale"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="adjustment">call_volume_adjustment</property> + <property name="round_digits">0</property> + <property name="digits">0</property> + <property name="value_pos">bottom</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label13"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Input level</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkProgressBar" id="progressbar2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Audio</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="position">3</property> + </packing> + </child> + <child type="tab"> + <object class="GtkLabel" id="label608"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Calls</property> + </object> + <packing> + <property name="position">3</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> <object class="GtkBox" id="vbox1"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -667,7 +816,7 @@ </child> </object> <packing> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> <child type="tab"> @@ -677,7 +826,7 @@ <property name="label" translatable="yes">Location</property> </object> <packing> - <property name="position">3</property> + <property name="position">4</property> <property name="tab_fill">False</property> </packing> </child> @@ -796,7 +945,7 @@ </child> </object> <packing> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> <child type="tab"> @@ -806,7 +955,7 @@ <property name="label" translatable="yes">Spell Checking</property> </object> <packing> - <property name="position">4</property> + <property name="position">5</property> <property name="tab_fill">False</property> </packing> </child> @@ -946,7 +1095,7 @@ </child> </object> <packing> - <property name="position">5</property> + <property name="position">6</property> </packing> </child> <child type="tab"> @@ -956,9 +1105,15 @@ <property name="label" translatable="yes">Themes</property> </object> <packing> - <property name="position">5</property> + <property name="position">6</property> <property name="tab_fill">False</property> </packing> </child> </object> + <object class="GtkSizeGroup" id="sizegroup1"> + <widgets> + <widget name="label12"/> + <widget name="label13"/> + </widgets> + </object> </interface> |