[ekiga/ds-gtk-application] EkigaApp: Moved assistant display for newer releases to GtkApplication.



commit 6500b189cd498e2056c3f79e234be368a3510a54
Author: Damien Sandras <dsandras beip be>
Date:   Sun Feb 9 13:36:38 2014 +0100

    EkigaApp: Moved assistant display for newer releases to GtkApplication.

 lib/engine/gui/gtk-frontend/assistant-window.cpp |    5 ++-
 lib/engine/gui/gtk-frontend/assistant-window.h   |    3 +-
 lib/engine/gui/gtk-frontend/ekiga-app.cpp        |   34 ++++++++++++++++-----
 lib/engine/gui/gtk-frontend/ekiga-app.h          |    2 +
 src/main.cpp                                     |   13 --------
 5 files changed, 33 insertions(+), 24 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/assistant-window.cpp 
b/lib/engine/gui/gtk-frontend/assistant-window.cpp
index 9b3e85a..7175fe5 100644
--- a/lib/engine/gui/gtk-frontend/assistant-window.cpp
+++ b/lib/engine/gui/gtk-frontend/assistant-window.cpp
@@ -858,18 +858,19 @@ assistant_window_key_press_cb (GtkWidget *widget,
 
 
 GtkWidget *
-assistant_window_new (Ekiga::ServiceCorePtr service_core)
+assistant_window_new (GmApplication *app)
 {
   AssistantWindow *assistant;
 
   assistant = ASSISTANT_WINDOW (g_object_new (ASSISTANT_WINDOW_TYPE, NULL));
+  Ekiga::ServiceCorePtr core = gm_application_get_core (app);
 
   /* FIXME: move this into the caller */
   g_signal_connect (assistant, "key-press-event",
                     G_CALLBACK (assistant_window_key_press_cb), NULL);
 
   boost::signals2::connection conn;
-  assistant->priv->bank = service_core->get<Opal::Bank> ("opal-account-store");
+  assistant->priv->bank = core->get<Opal::Bank> ("opal-account-store");
 
   return GTK_WIDGET (assistant);
 }
diff --git a/lib/engine/gui/gtk-frontend/assistant-window.h b/lib/engine/gui/gtk-frontend/assistant-window.h
index 567bbcc..4ce3763 100644
--- a/lib/engine/gui/gtk-frontend/assistant-window.h
+++ b/lib/engine/gui/gtk-frontend/assistant-window.h
@@ -41,6 +41,7 @@
 #define __ASSISTANT_WINDOW_H__
 
 #include <gtk/gtk.h>
+#include "ekiga-app.h"
 
 G_BEGIN_DECLS
 
@@ -70,7 +71,7 @@ struct _AssistantWindow {
 typedef GtkAssistantClass AssistantWindowClass;
 
 GType assistant_window_get_type   ();
-GtkWidget* assistant_window_new (Ekiga::ServiceCorePtr core);
+GtkWidget* assistant_window_new (GmApplication *app);
 
 G_END_DECLS
 
diff --git a/lib/engine/gui/gtk-frontend/ekiga-app.cpp b/lib/engine/gui/gtk-frontend/ekiga-app.cpp
index 79face8..60bf3b5 100644
--- a/lib/engine/gui/gtk-frontend/ekiga-app.cpp
+++ b/lib/engine/gui/gtk-frontend/ekiga-app.cpp
@@ -160,8 +160,6 @@ window_activated (GSimpleAction *action,
                   gpointer app)
 {
   GmApplication *self = GM_APPLICATION (app);
-  GtkWindow *window = NULL;
-  GmWindow *parent = NULL;
 
   g_return_if_fail (self && self->priv->core);
 
@@ -187,12 +185,8 @@ window_activated (GSimpleAction *action,
   else if (!g_strcmp0 (g_action_get_name (G_ACTION (action)), "accounts"))
     gm_application_show_accounts_window (self);
 
-  else if (!g_strcmp0 (g_action_get_name (G_ACTION (action)), "assistant")) {
-
-    window = GTK_WINDOW (assistant_window_new (self->priv->core));
-    gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (parent));
-    gtk_window_present (window);
-  }
+  else if (!g_strcmp0 (g_action_get_name (G_ACTION (action)), "assistant"))
+    gm_application_show_assistant_window (self);
 }
 
 static GActionEntry app_entries[] =
@@ -237,6 +231,13 @@ ekiga_main (int argc,
   app->priv->dbus_component = ekiga_dbus_component_new (app);
 #endif
 
+  boost::shared_ptr<Ekiga::Settings> general_settings (new Ekiga::Settings (GENERAL_SCHEMA));
+  const int schema_version = MAJOR_VERSION * 1000 + MINOR_VERSION * 10 + BUILD_NUMBER;
+  if (general_settings->get_int ("version") < schema_version) {
+    gm_application_show_assistant_window (app);
+    general_settings->set_int ("version", schema_version);
+  }
+
   core->close ();
   g_application_run (G_APPLICATION (app), argc, argv);
 
@@ -793,3 +794,20 @@ gm_application_show_accounts_window (GmApplication *self)
 
   gtk_window_present (GTK_WINDOW (accounts_window_new (self)));
 }
+
+
+void
+gm_application_show_assistant_window (GmApplication *self)
+{
+  GtkWindow *parent = NULL;
+  GtkWindow *window = NULL;
+
+  g_return_if_fail (GM_IS_APPLICATION (self));
+
+  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GM_TYPE_APPLICATION, GmApplicationPrivate);
+  parent = gtk_application_get_active_window (GTK_APPLICATION (self));
+
+  window = GTK_WINDOW (assistant_window_new (self));
+  gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (parent));
+  gtk_window_present (window);
+}
diff --git a/lib/engine/gui/gtk-frontend/ekiga-app.h b/lib/engine/gui/gtk-frontend/ekiga-app.h
index a38393c..02006c2 100644
--- a/lib/engine/gui/gtk-frontend/ekiga-app.h
+++ b/lib/engine/gui/gtk-frontend/ekiga-app.h
@@ -97,6 +97,8 @@ void gm_application_show_addressbook_window (GmApplication *app);
 
 void gm_application_show_accounts_window (GmApplication *app);
 
+void gm_application_show_assistant_window (GmApplication *app);
+
 /* GObject boilerplate */
 #define GM_TYPE_APPLICATION (gm_application_get_type ())
 
diff --git a/src/main.cpp b/src/main.cpp
index b54ee96..23c7a92 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -150,20 +150,7 @@ main (int argc,
 #endif
 
   std::cout << "FIXME" << std::endl << std::flush;
-  /*
-  boost::shared_ptr<Ekiga::Settings> general_settings (new Ekiga::Settings (GENERAL_SCHEMA));
 
-  const int schema_version = MAJOR_VERSION * 1000
-                             + MINOR_VERSION * 10
-                             + BUILD_NUMBER;
-  int crt_version = general_settings->get_int ("version");
-  if (crt_version < schema_version) {
-
-    gtk_widget_show_all (GTK_WIDGET (gtk_frontend->build_assistant_window ()));
-
-    general_settings->set_int ("version", schema_version);
-  }
-*/
 
   ekiga_main (argc, argv);
 


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