* src/hildon-stackable-window.c (hildon_stackable_window_go_home): Fix compilation...
authorAlberto Garcia <agarcia@igalia.com>
Thu, 19 Jun 2008 09:37:36 +0000 (09:37 +0000)
committerAlberto Garcia <agarcia@igalia.com>
Thu, 19 Jun 2008 09:37:36 +0000 (09:37 +0000)
ChangeLog
src/hildon-stackable-window.c

index 7f8e560..65146f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-19  Alberto Garcia  <agarcia@igalia.com>
+
+       * src/hildon-stackable-window.c
+       (hildon_stackable_window_go_home): Fix compilation warning
+       (get_last_window): Minor optimizations
+
 2008-06-18  Alberto Garcia  <agarcia@igalia.com>
 
        * src/hildon-stackable-window.c: Fixed typos in doc
index 4473dd3..1f7d6a9 100644 (file)
@@ -92,21 +92,22 @@ get_window_list                                 (GtkWidget *widget)
 static GtkWidget*
 get_last_window                                 (GtkWidget *widget)
 {
-    GtkWidget *retval;
+    GtkWidget *retval = NULL;
     GSList *windows = get_window_list (widget);
+    GSList *last = NULL;
 
     g_return_val_if_fail (windows != NULL, NULL);
 
-    retval = GTK_WIDGET (g_slist_last (windows)->data);
-
-    if (retval == widget)
+    /* Go to the end of the window list */
+    while (windows->next != NULL)
     {
-        gint l = g_slist_length (windows);
-        retval = GTK_WIDGET (g_slist_nth_data (windows, l - 2));
+        last = windows;
+        windows = windows->next;
     }
-    else
+
+    if ((windows->data == widget) && (last != NULL))
     {
-        retval = NULL;
+        retval = GTK_WIDGET (last->data);
     }
 
     return retval;
@@ -246,5 +247,5 @@ hildon_stackable_window_go_home                 (HildonStackableWindow *self)
     }
 
     if (!GTK_WIDGET_VISIBLE (rootwin))
-        gtk_widget_show (rootwin);
+        gtk_widget_show (GTK_WIDGET (rootwin));
 }