[maemo-commits] [maemo-commits] r14691 - in projects/haf/branches/hildon-control-panel/refactoring: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Nov 1 14:44:32 EET 2007
Author: lucasr
Date: 2007-11-01 14:44:30 +0200 (Thu, 01 Nov 2007)
New Revision: 14691

Modified:
   projects/haf/branches/hildon-control-panel/refactoring/ChangeLog
   projects/haf/branches/hildon-control-panel/refactoring/src/hcp-app-view.c
   projects/haf/branches/hildon-control-panel/refactoring/src/hcp-window.c
Log:
2007-10-01  Lucas Rocha  <lucas.rocha at nokia.com>

	* src/hcp-app-view.c (hcp_app_view_selection_changed_cb): emit
	focus-changed signal even if the widget is not properly allocated yet.
	* src/hcp-window.c (hcp_window_init, hcp_window_retrieve_state):
	correctly handle the case when there's no saved state yet to define
	the initial focused applet. Fixes: NB#72771.


Modified: projects/haf/branches/hildon-control-panel/refactoring/ChangeLog
===================================================================
--- projects/haf/branches/hildon-control-panel/refactoring/ChangeLog	2007-11-01 11:21:13 UTC (rev 14690)
+++ projects/haf/branches/hildon-control-panel/refactoring/ChangeLog	2007-11-01 12:44:30 UTC (rev 14691)
@@ -1,5 +1,13 @@
 2007-10-01  Lucas Rocha  <lucas.rocha at nokia.com>
 
+	* src/hcp-app-view.c (hcp_app_view_selection_changed_cb): emit
+	focus-changed signal even if the widget is not properly allocated yet.
+	* src/hcp-window.c (hcp_window_init, hcp_window_retrieve_state):
+	correctly handle the case when there's no saved state yet to define
+	the initial focused applet. Fixes: NB#72771.
+
+2007-10-01  Lucas Rocha  <lucas.rocha at nokia.com>
+
 	* configure.ac: release 2.0.0
 
 2007-10-01  Lucas Rocha  <lucas.rocha at nokia.com>

Modified: projects/haf/branches/hildon-control-panel/refactoring/src/hcp-app-view.c
===================================================================
--- projects/haf/branches/hildon-control-panel/refactoring/src/hcp-app-view.c	2007-11-01 11:21:13 UTC (rev 14690)
+++ projects/haf/branches/hildon-control-panel/refactoring/src/hcp-app-view.c	2007-11-01 12:44:30 UTC (rev 14691)
@@ -176,25 +176,25 @@
   allocation.y = widget->allocation.y + (row * row_height);
   allocation.height = row_height;
 
-  if (allocation.y < 0)
-    return;
-  
-  if (allocation.y < visible_y)
+  if (allocation.y >= 0)
   {
-    adj->value = allocation.y * (adj->upper - adj->lower)
-                                 / view->allocation.height;
+    if (allocation.y < visible_y)
+    {
+      adj->value = allocation.y * (adj->upper - adj->lower)
+                                   / view->allocation.height;
 
-    gtk_adjustment_value_changed (adj);
+      gtk_adjustment_value_changed (adj);
+    }
+    else if (allocation.y + allocation.height > 
+             visible_y + scrolled_window->allocation.height)
+    {
+      adj->value = (allocation.y + allocation.height
+             - scrolled_window->allocation.height) * (adj->upper - adj->lower)
+             / view->allocation.height;
+      
+      gtk_adjustment_value_changed (adj);
+    }
   }
-  else if (allocation.y + allocation.height > 
-           visible_y + scrolled_window->allocation.height)
-  {
-    adj->value = (allocation.y + allocation.height
-           - scrolled_window->allocation.height) * (adj->upper - adj->lower)
-           / view->allocation.height;
-    
-    gtk_adjustment_value_changed (adj);
-  }
 
   g_signal_emit (G_OBJECT (widget->parent), 
                  signals[SIGNAL_FOCUS_CHANGED], 

Modified: projects/haf/branches/hildon-control-panel/refactoring/src/hcp-window.c
===================================================================
--- projects/haf/branches/hildon-control-panel/refactoring/src/hcp-window.c	2007-11-01 11:21:13 UTC (rev 14690)
+++ projects/haf/branches/hildon-control-panel/refactoring/src/hcp-window.c	2007-11-01 12:44:30 UTC (rev 14691)
@@ -194,7 +194,7 @@
                                    HCP_STATE_GROUP,
                                    HCP_STATE_FOCUSED,
                                    &error);
-  
+
   if (error)
   {
     g_warning ("An error occured when reading application state: %s",
@@ -202,8 +202,16 @@
     goto cleanup;
   }
 
-  priv->saved_focused_filename = focused;
-
+  if (g_str_has_suffix (focused, ".so"))
+  {
+    priv->saved_focused_filename = focused;
+  }
+  else
+  {
+    priv->saved_focused_filename = NULL;
+    g_free (focused);
+  }
+	  
   scroll_value = g_key_file_get_integer (keyfile,
                                          HCP_STATE_GROUP,
                                          HCP_STATE_SCROLL_VALUE,
@@ -918,18 +926,6 @@
 
   hcp_window_retrieve_state (window);
 
-  if (priv->saved_focused_filename)
-  {
-    GHashTable *apps = NULL;
-
-    g_object_get (G_OBJECT (priv->al),
-                  "apps", &apps,
-                  NULL);
-
-    priv->focused_item = g_object_ref (g_hash_table_lookup (apps,
-                                              priv->saved_focused_filename));
-  }
-
   hcp_window_construct_ui (window);
 
   hcp_app_view_populate (HCP_APP_VIEW (priv->view), priv->al);
@@ -977,7 +973,7 @@
   {
     HCPProgram *program = hcp_program_get_instance ();
     HCPWindow *window = HCP_WINDOW (widget);
-    
+
     hcp_window_enforce_state (HCP_WINDOW (widget));
 
     if (program->execute == 1 && window->priv->focused_item) 


More information about the maemo-commits mailing list