[ekiga] Call Window: Moved it to the GtkFrontend part of the engine.



commit d2a12b3f10be39c31b597217af663eb9e9d70e00
Author: Damien Sandras <dsandras beip be>
Date:   Tue May 1 15:32:36 2012 +0200

    Call Window: Moved it to the GtkFrontend part of the engine.
    
    Where it belongs...

 lib/Makefile.am                                    |    2 +
 .../engine/gui/gtk-frontend/call-window.cpp        |   62 +++++++-------------
 .../engine/gui/gtk-frontend/call-window.h          |    2 +-
 lib/engine/gui/gtk-frontend/gtk-frontend.cpp       |    8 +++
 lib/engine/gui/gtk-frontend/gtk-frontend.h         |    3 +
 src/Makefile.am                                    |    2 -
 src/ekiga.cpp                                      |   16 -----
 src/ekiga.h                                        |    8 ---
 src/gui/main_window.cpp                            |   12 +++-
 9 files changed, 44 insertions(+), 71 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index f478e9e..c939ad7 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -431,6 +431,8 @@ libekiga_la_SOURCES += \
 	$(engine_dir)/gui/gtk-frontend/addressbook-window.cpp \
 	$(engine_dir)/gui/gtk-frontend/book-view-gtk.h \
 	$(engine_dir)/gui/gtk-frontend/book-view-gtk.cpp \
+	$(engine_dir)/gui/gtk-frontend/call-window.h \
+	$(engine_dir)/gui/gtk-frontend/call-window.cpp \
 	$(engine_dir)/gui/gtk-frontend/roster-view-gtk.h \
 	$(engine_dir)/gui/gtk-frontend/roster-view-gtk.cpp \
 	$(engine_dir)/gui/gtk-frontend/call-history-view-gtk.h \
diff --git a/src/gui/call_window.cpp b/lib/engine/gui/gtk-frontend/call-window.cpp
similarity index 98%
rename from src/gui/call_window.cpp
rename to lib/engine/gui/gtk-frontend/call-window.cpp
index eb62d14..7443051 100644
--- a/src/gui/call_window.cpp
+++ b/lib/engine/gui/gtk-frontend/call-window.cpp
@@ -35,19 +35,14 @@
  *                          build the call window.
  */
 
-#include "revision.h"
-
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
 
 #include "config.h"
 
-#include "call_window.h"
+#include "call-window.h"
 
-#include "ekiga.h"
-#include "conf.h"
 #include "dialpad.h"
-#include "statusmenu.h"
 
 #include "gmdialog.h"
 #include "gmentrydialog.h"
@@ -99,6 +94,9 @@ struct deviceStruct {
 
 G_DEFINE_TYPE (EkigaCallWindow, ekiga_call_window, GM_TYPE_WINDOW);
 
+#define USER_INTERFACE_KEY "/apps/" PACKAGE_NAME "/general/user_interface/"
+#define VIDEO_DISPLAY_KEY USER_INTERFACE_KEY "video_display/"
+#define VIDEO_DEVICES_KEY "/apps/" PACKAGE_NAME "/devices/video/"
 
 struct _EkigaCallWindowPrivate
 {
@@ -501,68 +499,57 @@ static void
 zoom_in_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
 		    gpointer data)
 {
-  GtkWidget *call_window = GnomeMeeting::Process ()->GetCallWindow ();
-  g_return_if_fail (call_window != NULL);
-
   g_return_if_fail (data != NULL);
 
   Ekiga::DisplayInfo display_info;
-  ekiga_call_window_set_video_size (EKIGA_CALL_WINDOW (call_window), GM_QCIF_WIDTH, GM_QCIF_HEIGHT);
+  ekiga_call_window_set_video_size (EKIGA_CALL_WINDOW (data), GM_QCIF_WIDTH, GM_QCIF_HEIGHT);
 
-  display_info.zoom = gm_conf_get_int ((char *) data);
+  display_info.zoom = gm_conf_get_int (VIDEO_DISPLAY_KEY "zoom");
 
   if (display_info.zoom < 200)
     display_info.zoom = display_info.zoom * 2;
 
   gm_conf_set_int ((char *) data, display_info.zoom);
-  ekiga_call_window_zooms_menu_update_sensitivity (EKIGA_CALL_WINDOW (call_window), display_info.zoom);
+  ekiga_call_window_zooms_menu_update_sensitivity (EKIGA_CALL_WINDOW (data), display_info.zoom);
 }
 
 static void
 zoom_out_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
 		     gpointer data)
 {
-  GtkWidget *call_window = GnomeMeeting::Process ()->GetCallWindow ();
-  g_return_if_fail (call_window != NULL);
-
   g_return_if_fail (data != NULL);
 
   Ekiga::DisplayInfo display_info;
-  ekiga_call_window_set_video_size (EKIGA_CALL_WINDOW (call_window), GM_QCIF_WIDTH, GM_QCIF_HEIGHT);
+  ekiga_call_window_set_video_size (EKIGA_CALL_WINDOW (data), GM_QCIF_WIDTH, GM_QCIF_HEIGHT);
 
   display_info.zoom = gm_conf_get_int ((char *) data);
 
   if (display_info.zoom  > 50)
     display_info.zoom  = (unsigned int) (display_info.zoom  / 2);
 
-  gm_conf_set_int ((char *) data, display_info.zoom);
-  ekiga_call_window_zooms_menu_update_sensitivity (EKIGA_CALL_WINDOW (call_window), display_info.zoom);
+  gm_conf_set_int (VIDEO_DISPLAY_KEY "zoom", display_info.zoom);
+  ekiga_call_window_zooms_menu_update_sensitivity (EKIGA_CALL_WINDOW (data), display_info.zoom);
 }
 
 static void
 zoom_normal_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
 			gpointer data)
 {
-  GtkWidget *call_window = GnomeMeeting::Process ()->GetCallWindow ();
-  g_return_if_fail (call_window != NULL);
-
   g_return_if_fail (data != NULL);
 
   Ekiga::DisplayInfo display_info;
-  ekiga_call_window_set_video_size (EKIGA_CALL_WINDOW (call_window), GM_QCIF_WIDTH, GM_QCIF_HEIGHT);
+  ekiga_call_window_set_video_size (EKIGA_CALL_WINDOW (data), GM_QCIF_WIDTH, GM_QCIF_HEIGHT);
 
   display_info.zoom  = 100;
 
-  gm_conf_set_int ((char *) data, display_info.zoom);
-  ekiga_call_window_zooms_menu_update_sensitivity (EKIGA_CALL_WINDOW (call_window), display_info.zoom);
+  gm_conf_set_int (VIDEO_DISPLAY_KEY "zoom", display_info.zoom);
+  ekiga_call_window_zooms_menu_update_sensitivity (EKIGA_CALL_WINDOW (data), display_info.zoom);
 }
 
 static void
 display_changed_cb (GtkWidget *widget,
 		    gpointer data)
 {
-  GtkWidget *call_window = GnomeMeeting::Process ()->GetCallWindow ();
-  g_return_if_fail (call_window != NULL);
   g_return_if_fail (data != NULL);
 
   GSList *group = NULL;
@@ -584,8 +571,8 @@ display_changed_cb (GtkWidget *widget,
       group = g_slist_next (group);
     }
 
-    if (!EKIGA_CALL_WINDOW(call_window)->priv->changing_back_to_local_after_a_call)
-      gm_conf_set_int ((gchar *) data, group_last_pos - active);
+    if (!EKIGA_CALL_WINDOW (data)->priv->changing_back_to_local_after_a_call)
+      gm_conf_set_int (VIDEO_DISPLAY_KEY "video_view", group_last_pos - active);
   }
 }
 
@@ -593,8 +580,6 @@ static void
 fullscreen_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
 		       G_GNUC_UNUSED gpointer data)
 {
-  GtkWidget* call_window = GnomeMeeting::Process()->GetCallWindow ();
-  g_return_if_fail (call_window != NULL);
   ekiga_call_window_toggle_fullscreen (Ekiga::VO_FS_TOGGLE);
 }
 
@@ -2006,35 +1991,32 @@ ekiga_call_window_init_menu (EkigaCallWindow *cw)
       GTK_MENU_RADIO_ENTRY("local_video", _("_Local Video"),
 			   _("Local video image"),
 			   NULL, '1',
-			   G_CALLBACK (display_changed_cb),
-			   (gpointer) VIDEO_DISPLAY_KEY "video_view",
+			   G_CALLBACK (display_changed_cb), cw,
 			   true, false),
       GTK_MENU_RADIO_ENTRY("remote_video", _("_Remote Video"),
 			   _("Remote video image"),
 			   NULL, '2',
-			   G_CALLBACK (display_changed_cb),
-			   (gpointer) VIDEO_DISPLAY_KEY "video_view",
+			   G_CALLBACK (display_changed_cb), cw,
 			   false, false),
       GTK_MENU_RADIO_ENTRY("both_incrusted", _("_Picture-in-Picture"),
 			   _("Both video images"),
 			   NULL, '3',
-			   G_CALLBACK (display_changed_cb),
-			   (gpointer) VIDEO_DISPLAY_KEY "video_view",
+			   G_CALLBACK (display_changed_cb), cw,
 			   false, false),
       GTK_MENU_SEPARATOR,
 
       GTK_MENU_ENTRY("zoom_in", NULL, _("Zoom in"),
 		     GTK_STOCK_ZOOM_IN, '+',
 		     G_CALLBACK (zoom_in_changed_cb),
-		     (gpointer) VIDEO_DISPLAY_KEY "zoom", false),
+		     (gpointer) cw, false),
       GTK_MENU_ENTRY("zoom_out", NULL, _("Zoom out"),
 		     GTK_STOCK_ZOOM_OUT, '-',
 		     G_CALLBACK (zoom_out_changed_cb),
-		     (gpointer) VIDEO_DISPLAY_KEY "zoom", false),
+		     (gpointer) cw, false),
       GTK_MENU_ENTRY("normal_size", NULL, _("Normal size"),
 		     GTK_STOCK_ZOOM_100, '0',
 		     G_CALLBACK (zoom_normal_changed_cb),
-		     (gpointer) VIDEO_DISPLAY_KEY "zoom", false),
+		     (gpointer) cw, false),
       GTK_MENU_ENTRY("fullscreen", _("_Fullscreen"), _("Switch to fullscreen"),
 		     GTK_STOCK_ZOOM_IN, GDK_F11,
 		     G_CALLBACK (fullscreen_changed_cb),
@@ -2682,7 +2664,7 @@ ekiga_call_window_class_init (EkigaCallWindowClass *klass)
 }
 
 GtkWidget *
-gm_call_window_new (Ekiga::ServiceCore & core)
+call_window_new (Ekiga::ServiceCore & core)
 {
   EkigaCallWindow *cw;
 
diff --git a/src/gui/call_window.h b/lib/engine/gui/gtk-frontend/call-window.h
similarity index 97%
rename from src/gui/call_window.h
rename to lib/engine/gui/gtk-frontend/call-window.h
index 57141c2..972780c 100644
--- a/src/gui/call_window.h
+++ b/lib/engine/gui/gtk-frontend/call-window.h
@@ -69,5 +69,5 @@ G_END_DECLS
  * BEHAVIOR     :  Builds the call window and adds the popup to the image.
  * PRE          :  Accels.
  */
-GtkWidget *gm_call_window_new (Ekiga::ServiceCore & core);
+GtkWidget *call_window_new (Ekiga::ServiceCore & core);
 #endif
diff --git a/lib/engine/gui/gtk-frontend/gtk-frontend.cpp b/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
index 34ca930..b3c8e9c 100644
--- a/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
+++ b/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
@@ -48,6 +48,7 @@
 #include "contact-core.h"
 #include "presence-core.h"
 #include "addressbook-window.h"
+#include "call-window.h"
 #include "chat-window.h"
 #include "statusicon.h"
 #include "roster-view-gtk.h"
@@ -100,6 +101,7 @@ void GtkFrontend::build ()
   boost::shared_ptr<Ekiga::ChatCore> chat_core = core.get<Ekiga::ChatCore> ("chat-core");
 
   addressbook_window = addressbook_window_new_with_key (*contact_core, "/apps/" PACKAGE_NAME "/general/user_interface/addressbook_window");
+  call_window = call_window_new (core);
   chat_window = chat_window_new (*chat_core, "/apps/" PACKAGE_NAME "/general/user_interface/chat_window");
   status_icon = status_icon_new (core);
 }
@@ -123,6 +125,12 @@ const GtkWidget *GtkFrontend::get_addressbook_window () const
 }
 
 
+const GtkWidget *GtkFrontend::get_call_window () const
+{
+  return call_window;
+}
+
+
 const GtkWidget *GtkFrontend::get_chat_window () const
 {
   return chat_window;
diff --git a/lib/engine/gui/gtk-frontend/gtk-frontend.h b/lib/engine/gui/gtk-frontend/gtk-frontend.h
index 61b8121..c3e5a42 100644
--- a/lib/engine/gui/gtk-frontend/gtk-frontend.h
+++ b/lib/engine/gui/gtk-frontend/gtk-frontend.h
@@ -65,6 +65,8 @@ public:
 
   const GtkWidget *get_addressbook_window () const;
 
+  const GtkWidget *get_call_window () const;
+
   const GtkWidget *get_chat_window () const;
 
   const StatusIcon *get_status_icon () const;
@@ -72,6 +74,7 @@ public:
 private :
 
   GtkWidget *addressbook_window;
+  GtkWidget *call_window;
   GtkWidget *chat_window;
   StatusIcon *status_icon;
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 20d5cff..f613bd7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -63,8 +63,6 @@ ekiga_SOURCES +=			\
 	gui/conf.cpp			\
 	gui/default_devices.cpp	        \
 	gui/default_devices.h	        \
-	gui/call_window.h		\
-	gui/call_window.cpp		\
 	gui/main.cpp		        \
 	gui/main_window.h		\
 	gui/main_window.cpp		\
diff --git a/src/ekiga.cpp b/src/ekiga.cpp
index ebea8cf..41de9cf 100644
--- a/src/ekiga.cpp
+++ b/src/ekiga.cpp
@@ -42,7 +42,6 @@
 #include "preferences.h"
 #include "assistant.h"
 #include "accounts.h"
-#include "call_window.h"
 #include "main_window.h"
 #include "notify.h"
 #include "gmstockicons.h"
@@ -62,7 +61,6 @@ GnomeMeeting::GnomeMeeting ()
   assistant_window = NULL;
   prefs_window = NULL;
   main_window = NULL;
-  call_window = NULL;
   assistant_window = NULL;
   accounts_window = NULL;
 }
@@ -81,10 +79,6 @@ GnomeMeeting::Exit ()
     gtk_widget_destroy (main_window);
   main_window = NULL;
 
-  if (call_window)
-    gtk_widget_destroy (call_window);
-  call_window = NULL;
-
   if (assistant_window)
     gtk_widget_destroy (assistant_window);
   assistant_window = NULL;
@@ -110,13 +104,6 @@ GnomeMeeting::GetMainWindow ()
 
 
 GtkWidget *
-GnomeMeeting::GetCallWindow ()
-{
-  return call_window;
-}
-
-
-GtkWidget *
 GnomeMeeting::GetPrefsWindow ()
 {
   return prefs_window;
@@ -152,7 +139,6 @@ void GnomeMeeting::BuildGUI (Ekiga::ServiceCorePtr services)
   accounts_window = gm_accounts_window_new (*services);
   prefs_window = gm_prefs_window_new (services.get ());
   assistant_window = ekiga_assistant_new (services.get ());
-  call_window = gm_call_window_new (*services);
   main_window = gm_main_window_new (*services);
   // FIXME should be moved inside the gm_accounts_window_new code
   gtk_window_set_transient_for (GTK_WINDOW (accounts_window), GTK_WINDOW (main_window));
@@ -160,8 +146,6 @@ void GnomeMeeting::BuildGUI (Ekiga::ServiceCorePtr services)
   gtk_window_set_transient_for (GTK_WINDOW (prefs_window), GTK_WINDOW (main_window));
   // FIXME should be moved in ekiga_assistant_new
   gtk_window_set_transient_for (GTK_WINDOW (assistant_window), GTK_WINDOW (main_window));
-  // FIXME should be moved in call window
-  gtk_window_set_transient_for (GTK_WINDOW (call_window), GTK_WINDOW (main_window));
 
   notify_start (*services);
 
diff --git a/src/ekiga.h b/src/ekiga.h
index bc9ad58..5621edd 100644
--- a/src/ekiga.h
+++ b/src/ekiga.h
@@ -84,13 +84,6 @@ class GnomeMeeting : public PProcess
 
 
   /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Returns a pointer to the call window GObject.
-   * PRE          :  /
-   */
-  GtkWidget *GetCallWindow ();
-
-
-  /* DESCRIPTION  :  /
    * BEHAVIOR     :  Returns a pointer to the preferences window GMObject.
    * PRE          :  /
    */
@@ -133,7 +126,6 @@ class GnomeMeeting : public PProcess
 
   /* The different components of the GUI */
   GtkWidget *main_window;
-  GtkWidget *call_window;
   GtkWidget *history_window;
   GtkWidget *assistant_window;
   GtkWidget *prefs_window;
diff --git a/src/gui/main_window.cpp b/src/gui/main_window.cpp
index 64d80d2..37a9e5c 100644
--- a/src/gui/main_window.cpp
+++ b/src/gui/main_window.cpp
@@ -598,6 +598,7 @@ static void on_setup_call_cb (boost::shared_ptr<Ekiga::CallManager> manager,
   EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (self);
   GtkWidget *call_window = NULL;
   boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core = mw->priv->core->get<Ekiga::AudioOutputCore> ("audiooutput-core");
+  boost::shared_ptr<GtkFrontend> gtk_frontend = mw->priv->core->get<GtkFrontend> ("gtk-frontend");
 
   if (!call->is_outgoing () && !manager->get_auto_answer ()) {
     if (mw->priv->current_call)
@@ -611,7 +612,7 @@ static void on_setup_call_cb (boost::shared_ptr<Ekiga::CallManager> manager,
   else {
 
     /* Show call window */
-    call_window = GnomeMeeting::Process ()->GetCallWindow ();
+    call_window = GTK_WIDGET (gtk_frontend->get_call_window ());
     gtk_widget_show (call_window);
 
     mw->priv->current_call = call;
@@ -662,7 +663,8 @@ static void on_established_call_cb (boost::shared_ptr<Ekiga::CallManager>  /*man
   audiooutput_core->stop_play_event("ring_tone_sound");
 
   /* Show call window */
-  call_window = GnomeMeeting::Process ()->GetCallWindow ();
+  boost::shared_ptr<GtkFrontend> gtk_frontend = mw->priv->core->get<GtkFrontend> ("gtk-frontend");
+  call_window = GTK_WIDGET (gtk_frontend->get_call_window ());
   gtk_widget_show (call_window);
 }
 
@@ -694,7 +696,8 @@ static void on_cleared_call_cb (boost::shared_ptr<Ekiga::CallManager>  /*manager
 
   /* Hide call window */
   if (!gm_conf_get_bool (VIDEO_DEVICES_KEY "enable_preview")) {
-    call_window = GnomeMeeting::Process ()->GetCallWindow ();
+    boost::shared_ptr<GtkFrontend> gtk_frontend = mw->priv->core->get<GtkFrontend> ("gtk-frontend");
+    call_window = GTK_WIDGET (gtk_frontend->get_call_window ());
     g_timeout_add_seconds (2, on_delayed_hide_call_window_cb, call_window);
   }
 
@@ -1067,7 +1070,8 @@ video_preview_changed_nt (G_GNUC_UNUSED gpointer id,
   if (gm_conf_entry_get_type (entry) == GM_CONF_BOOL) {
 
     EkigaMainWindow* mw = EKIGA_MAIN_WINDOW (data);
-    GtkWidget *call_window = GnomeMeeting::Process ()->GetCallWindow ();
+    boost::shared_ptr<GtkFrontend> gtk_frontend = mw->priv->core->get<GtkFrontend> ("gtk-frontend");
+    GtkWidget *call_window = GTK_WIDGET (gtk_frontend->get_call_window ());
 
     if (gm_conf_entry_get_type (entry) == GM_CONF_BOOL) {
       if (mw->priv->calling_state == Standby) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]