[gtk+] Improve GtkApplication migration guide



commit 2b2e6074925d875133c6e3294de34e3f84fbf694
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 4 21:21:14 2011 -0500

    Improve GtkApplication migration guide
    
    As pointed out in bug 641517, the examples did not actually
    do the same.

 docs/reference/gtk/migrating-GtkApplication.xml |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/docs/reference/gtk/migrating-GtkApplication.xml b/docs/reference/gtk/migrating-GtkApplication.xml
index 712d521..a53f165 100644
--- a/docs/reference/gtk/migrating-GtkApplication.xml
+++ b/docs/reference/gtk/migrating-GtkApplication.xml
@@ -59,11 +59,21 @@ The same application using GtkApplication:
 static void
 activate (GtkApplication *app)
 {
+  GList *list;
   GtkWidget *window;
 
-  window = create_my_window ();
-  gtk_window_set_application (GTK_WINDOW (window), app);
-  gtk_widget_show (window);
+  list = gtk_application_get_windows (app);
+
+  if (list)
+    {
+      gtk_window_present (GTK_WINDOW (list->data));
+    }
+  else
+    {
+      window = create_my_window ();
+      gtk_window_set_application (GTK_WINDOW (window), app);
+      gtk_widget_show (window);
+    }
 }
 
 int



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