ekiga r5883 - in trunk: . src/endpoints src/gui



Author: dsandras
Date: Mon Jan  7 19:37:16 2008
New Revision: 5883
URL: http://svn.gnome.org/viewvc/ekiga?rev=5883&view=rev

Log:
Defer assistant and pref dialog creation until we actually request it. 
Patch from Steve Frecinaux, many thanks!


Modified:
   trunk/ChangeLog
   trunk/src/endpoints/ekiga.cpp
   trunk/src/endpoints/ekiga.h
   trunk/src/gui/assistant.cpp
   trunk/src/gui/callbacks.cpp
   trunk/src/gui/callbacks.h
   trunk/src/gui/conf.cpp
   trunk/src/gui/main.cpp

Modified: trunk/src/endpoints/ekiga.cpp
==============================================================================
--- trunk/src/endpoints/ekiga.cpp	(original)
+++ trunk/src/endpoints/ekiga.cpp	Mon Jan  7 19:37:16 2008
@@ -79,6 +79,8 @@
   call_number = 0;
 
   service_core = NULL;
+  assistant_window = NULL;
+  prefs_window = NULL;
 }
 
 
@@ -397,15 +399,19 @@
 
 
 GtkWidget *
-GnomeMeeting::GetPrefsWindow ()
+GnomeMeeting::GetPrefsWindow (bool create)
 {
+  if (!prefs_window && create)
+    prefs_window = gm_prefs_window_new ();
   return prefs_window;
 }
 
 
 GtkWidget *
-GnomeMeeting::GetAssistantWindow ()
+GnomeMeeting::GetAssistantWindow (bool create)
 {
+  if (!assistant_window && create)
+    assistant_window = ekiga_assistant_new (service_core);
   return assistant_window;
 }
 
@@ -443,8 +449,6 @@
   /* Build the GUI */
   gtk_window_set_default_icon_name (GM_ICON_LOGO);
   pc2phone_window = gm_pc2phone_window_new (*service_core);
-  prefs_window = gm_prefs_window_new ();  
-  assistant_window = ekiga_assistant_new (service_core);
   accounts_window = gm_accounts_window_new (*service_core);
 
   main_window = gm_main_window_new (*service_core);

Modified: trunk/src/endpoints/ekiga.h
==============================================================================
--- trunk/src/endpoints/ekiga.h	(original)
+++ trunk/src/endpoints/ekiga.h	Mon Jan  7 19:37:16 2008
@@ -157,14 +157,14 @@
    * BEHAVIOR     :  Returns a pointer to the preferences window GMObject.
    * PRE          :  /
    */
-  GtkWidget *GetPrefsWindow ();
+  GtkWidget *GetPrefsWindow (bool create = true);
  
   
   /* DESCRIPTION  :  /
    * BEHAVIOR     :  Returns a pointer to the assistant window.
    * PRE          :  /
    */
-  GtkWidget *GetAssistantWindow ();
+  GtkWidget *GetAssistantWindow (bool create = true);
 
   
   /* DESCRIPTION  :  /

Modified: trunk/src/gui/assistant.cpp
==============================================================================
--- trunk/src/gui/assistant.cpp	(original)
+++ trunk/src/gui/assistant.cpp	Mon Jan  7 19:37:16 2008
@@ -1075,7 +1075,6 @@
   GMManager *manager;
 
   GtkWidget *main_window;
-  GtkWidget *prefs_window;
 
   const int schema_version = MAJOR_VERSION * 1000
                            + MINOR_VERSION * 10

Modified: trunk/src/gui/callbacks.cpp
==============================================================================
--- trunk/src/gui/callbacks.cpp	(original)
+++ trunk/src/gui/callbacks.cpp	Mon Jan  7 19:37:16 2008
@@ -86,15 +86,37 @@
   return TRUE;
 }
 
+static void
+show_window (GtkWidget *window)
+{
+  if (!gnomemeeting_window_is_visible (window))
+    gnomemeeting_window_show (window);
+  else
+    gtk_window_present (GTK_WINDOW (window));
+}
 
 void
 show_window_cb (G_GNUC_UNUSED GtkWidget *widget,
 		gpointer data)
 {
-  if (!gnomemeeting_window_is_visible (GTK_WIDGET (data)))
-    gnomemeeting_window_show (GTK_WIDGET (data));
-  else
-    gtk_window_present (GTK_WINDOW (data));
+  show_window (GTK_WIDGET (data));
+}
+
+
+void
+show_assistant_window_cb (G_GNUC_UNUSED GtkWidget *widget,
+                          G_GNUC_UNUSED gpointer data)
+{
+  GtkWidget *window = GnomeMeeting::Process ()->GetAssistantWindow ();
+  show_window (window);
+}
+
+void
+show_prefs_window_cb (G_GNUC_UNUSED GtkWidget *widget,
+                      G_GNUC_UNUSED gpointer data)
+{
+  GtkWidget *window = GnomeMeeting::Process ()->GetPrefsWindow ();
+  show_window (window);
 }
 
 
@@ -244,6 +266,7 @@
 	       G_GNUC_UNUSED gpointer data)
 {
   GtkWidget *main_window = NULL;
+  GtkWidget *assistant_window = NULL;
   GtkWidget *prefs_window = NULL;
   GtkWidget *accounts_window = NULL;
 
@@ -255,11 +278,15 @@
   gdk_threads_enter ();
   
   main_window = GnomeMeeting::Process ()->GetMainWindow ();
-  prefs_window = GnomeMeeting::Process ()->GetPrefsWindow ();
+  assistant_window = GnomeMeeting::Process ()->GetAssistantWindow (false);
+  prefs_window = GnomeMeeting::Process ()->GetPrefsWindow (false);
   accounts_window = GnomeMeeting::Process ()->GetAccountsWindow ();
   
   gnomemeeting_window_hide (main_window);
-  gnomemeeting_window_hide (prefs_window);
+  if (assistant_window)
+    gnomemeeting_window_hide (assistant_window);
+  if (prefs_window)
+    gnomemeeting_window_hide (prefs_window);
   gnomemeeting_window_hide (accounts_window);
 
   while (gtk_events_pending ())

Modified: trunk/src/gui/callbacks.h
==============================================================================
--- trunk/src/gui/callbacks.h	(original)
+++ trunk/src/gui/callbacks.h	Mon Jan  7 19:37:16 2008
@@ -70,6 +70,11 @@
 void show_window_cb (GtkWidget *widget,
 		     gpointer data);
 
+void show_assistant_window_cb (GtkWidget *widget,
+                               gpointer   data);
+
+void show_prefs_window_cb (GtkWidget *widget,
+			   gpointer   data);
 
 /* DESCRIPTION  :  Simple wrapper that will call gnomemeeting_window_hide.
  * BEHAVIOR     :  Calls gnomemeeting_window_hide.

Modified: trunk/src/gui/conf.cpp
==============================================================================
--- trunk/src/gui/conf.cpp	(original)
+++ trunk/src/gui/conf.cpp	Mon Jan  7 19:37:16 2008
@@ -154,14 +154,9 @@
 static void
 manager_changed_nt (G_GNUC_UNUSED gpointer id,
 		    GmConfEntry *entry,
-		    gpointer data)
+		    G_GNUC_UNUSED gpointer data)
 {
-  g_return_if_fail (data != NULL);
-
-  
   if (gm_conf_entry_get_type (entry) == GM_CONF_STRING) {
-
-
     gdk_threads_enter ();
     GnomeMeeting::Process ()->DetectDevices ();
     gdk_threads_leave ();
@@ -177,16 +172,19 @@
 static void
 sound_events_list_changed_nt (G_GNUC_UNUSED gpointer id,
 			      GmConfEntry *entry,
-			      gpointer data)
-{ 
-  g_return_if_fail (data != NULL);
+			      G_GNUC_UNUSED gpointer data)
+{
+  GtkWidget *prefs_window;
 
   if (gm_conf_entry_get_type (entry) == GM_CONF_STRING
       || gm_conf_entry_get_type (entry) == GM_CONF_BOOL) {
    
-    gdk_threads_enter ();
-    gm_prefs_window_sound_events_list_build (GTK_WIDGET (data));
-    gdk_threads_leave ();
+    prefs_window = GnomeMeeting::Process ()->GetPrefsWindow (false);
+    if (prefs_window) {
+      gdk_threads_enter ();
+      gm_prefs_window_sound_events_list_build (prefs_window);
+      gdk_threads_leave ();
+    }
   }
 }
 
@@ -285,7 +283,6 @@
   GtkWidget *main_window = NULL;
   GtkWidget *prefs_window = NULL;
   
-  prefs_window = GnomeMeeting::Process ()->GetPrefsWindow ();
   main_window = GnomeMeeting::Process ()->GetMainWindow ();
 
 
@@ -329,11 +326,11 @@
 
   /* Notifiers to AUDIO_DEVICES_KEY */
   gm_conf_notifier_add (AUDIO_DEVICES_KEY "plugin", 
-			manager_changed_nt, prefs_window);
+			manager_changed_nt, NULL);
 
   /* Notifiers to VIDEO_DEVICES_KEY */
   gm_conf_notifier_add (VIDEO_DEVICES_KEY "plugin", 
-			manager_changed_nt, prefs_window);
+			manager_changed_nt, NULL);
 
 
   
@@ -344,34 +341,34 @@
   
   /* Notifiers for SOUND_EVENTS_KEY keys */
   gm_conf_notifier_add (SOUND_EVENTS_KEY "enable_incoming_call_sound", 
-			sound_events_list_changed_nt, prefs_window);
+			sound_events_list_changed_nt, NULL);
   
   gm_conf_notifier_add (SOUND_EVENTS_KEY "incoming_call_sound",
-			sound_events_list_changed_nt, prefs_window);
+			sound_events_list_changed_nt, NULL);
 
   gm_conf_notifier_add (SOUND_EVENTS_KEY "enable_ring_tone_sound", 
-			sound_events_list_changed_nt, prefs_window);
+			sound_events_list_changed_nt, NULL);
   
   gm_conf_notifier_add (SOUND_EVENTS_KEY "ring_tone_sound", 
-			sound_events_list_changed_nt, prefs_window);
+			sound_events_list_changed_nt, NULL);
   
   gm_conf_notifier_add (SOUND_EVENTS_KEY "enable_busy_tone_sound", 
-			sound_events_list_changed_nt, prefs_window);
+			sound_events_list_changed_nt, NULL);
   
   gm_conf_notifier_add (SOUND_EVENTS_KEY "busy_tone_sound",
-			sound_events_list_changed_nt, prefs_window);
+			sound_events_list_changed_nt, NULL);
   
   gm_conf_notifier_add (SOUND_EVENTS_KEY "enable_new_voicemail_sound", 
-			sound_events_list_changed_nt, prefs_window);
+			sound_events_list_changed_nt, NULL);
   
   gm_conf_notifier_add (SOUND_EVENTS_KEY "new_voicemail_sound",
-			sound_events_list_changed_nt, prefs_window);
+			sound_events_list_changed_nt, NULL);
 
   gm_conf_notifier_add (SOUND_EVENTS_KEY "enable_new_message_sound",
-			sound_events_list_changed_nt, prefs_window);
+			sound_events_list_changed_nt, NULL);
 
   gm_conf_notifier_add (SOUND_EVENTS_KEY "new_message_sound",
-			sound_events_list_changed_nt, prefs_window);
+			sound_events_list_changed_nt, NULL);
 
   
   /* Notifiers for the VIDEO_CODECS_KEY keys */

Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp	(original)
+++ trunk/src/gui/main.cpp	Mon Jan  7 19:37:16 2008
@@ -1221,8 +1221,6 @@
   GtkFrontend *gtk_frontend = NULL;
   
   GtkWidget *addressbook_window = NULL;
-  GtkWidget *assistant_window = NULL;
-  GtkWidget *prefs_window = NULL;
   GtkWidget *accounts_window = NULL;
   GtkWidget *pc2phone_window = NULL;
   
@@ -1235,8 +1233,6 @@
   services = GnomeMeeting::Process ()->GetServiceCore ();
   gtk_frontend = dynamic_cast<GtkFrontend *>(services->get ("gtk-frontend"));
   addressbook_window = GTK_WIDGET (gtk_frontend->get_addressbook_window ()); 
-  assistant_window = GnomeMeeting::Process ()->GetAssistantWindow ();
-  prefs_window = GnomeMeeting::Process ()->GetPrefsWindow ();
   accounts_window = GnomeMeeting::Process ()->GetAccountsWindow ();
   pc2phone_window = GnomeMeeting::Process ()->GetPC2PhoneWindow ();
 
@@ -1343,8 +1339,8 @@
       GTK_MENU_ENTRY("configuration_assistant", _("Configuration Assistant"),
 		     _("Run the configuration assistant"),
 		     NULL, 0, 
-		     GTK_SIGNAL_FUNC (show_window_cb),
-		     (gpointer) assistant_window, TRUE),
+		     G_CALLBACK (show_assistant_window_cb),
+		     NULL, TRUE),
 
       GTK_MENU_SEPARATOR,
       
@@ -1357,8 +1353,8 @@
       GTK_MENU_ENTRY("preferences", NULL,
 		     _("Change your preferences"), 
 		     GTK_STOCK_PREFERENCES, 'P',
-		     GTK_SIGNAL_FUNC (show_window_cb),
-		     (gpointer) prefs_window, TRUE),
+		     G_CALLBACK (show_prefs_window_cb),
+		     NULL, TRUE),
 
       GTK_MENU_NEW(_("_View")),
 
@@ -4263,7 +4259,6 @@
    * is a fatal error.
    */
   main_window = GnomeMeeting::Process ()->GetMainWindow ();
-  assistant_window = GnomeMeeting::Process ()->GetAssistantWindow ();
   GmMainWindow *mw = gm_mw_get_mw (main_window); //TODO no gm_mw_get_mw here
   Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore *> (mw->core.get ("call-core"));
   if (error == -1) {
@@ -4272,6 +4267,7 @@
         < 1000 * MAJOR_VERSION + 10 * MINOR_VERSION + BUILD_NUMBER) {
 
       gnomemeeting_conf_upgrade ();
+      assistant_window = GnomeMeeting::Process ()->GetAssistantWindow ();
       gtk_widget_show_all (assistant_window);
     }
     else {



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