[maemo-commits] [maemo-commits] r12234 - in projects/haf/trunk/hildon-desktop: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Jun 11 19:21:17 EEST 2007
Author: jobi
Date: 2007-06-11 19:21:14 +0300 (Mon, 11 Jun 2007)
New Revision: 12234

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/src/hd-home-window.c
   projects/haf/trunk/hildon-desktop/src/hd-home-window.h
Log:

2007-06-11  Johan Bilien  <johan.bilien at nokia.com>

	* src/hd-home-window.c:
	- register the lowmem signal from libosso and act accordingly
	- register the hw_screen_off signal from libosso and act
	accordingly (tell the applets they are in the background)
	Fixes: NB#54896



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-06-11 15:41:19 UTC (rev 12233)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-06-11 16:21:14 UTC (rev 12234)
@@ -1,6 +1,14 @@
 2007-06-11  Johan Bilien  <johan.bilien at nokia.com>
 
 	* src/hd-home-window.c:
+	- register the lowmem signal from libosso and act accordingly
+	- register the hw_screen_off signal from libosso and act
+	accordingly (tell the applets they are in the background)
+	Fixes: NB#54896
+
+2007-06-11  Johan Bilien  <johan.bilien at nokia.com>
+
+	* src/hd-home-window.c:
 	- add _cancel_note_show/hide to show the background loading progress
 	- show the note if the loading did not complete within 1s
 	- do not apply if the background if it was cancelled from the note.
@@ -36,7 +44,7 @@
 
 2007-06-08  Lucas Rocha  <lucas.rocha at nokia.com>
 
-	* libhildondesktop/hildon-desktop-plugin.h: added a tiny line of code to 
+	* libhildondesktop/hildon-desktop-plugin.h: added a tiny line of code to
 	avoid certain build warnings in plugin macros.
 
 2007-06-08  Moises Martinez  <moises.martinez at nokia.com>

Modified: projects/haf/trunk/hildon-desktop/src/hd-home-window.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-home-window.c	2007-06-11 15:41:19 UTC (rev 12233)
+++ projects/haf/trunk/hildon-desktop/src/hd-home-window.c	2007-06-11 16:21:14 UTC (rev 12234)
@@ -110,7 +110,7 @@
   HDHomeBackground *background;
   HDHomeBackground *previous_background;
 
-  gboolean          is_inactive;
+  gboolean          screen_is_off;
 
   gboolean          selecting_applets;
   guint             save_area_timeout;
@@ -250,8 +250,8 @@
                            gboolean             background);
 
 static void
-hd_home_window_system_inactivity (HDHomeWindow     *window,
-                                  gboolean              is_inactive);
+hd_home_window_screen_off (HDHomeWindow     *window,
+                           gboolean          is_off);
 
 static void
 hd_home_window_area_add (HDHomeWindow *window);
@@ -320,7 +320,7 @@
   window_class->layout_mode_accept = hd_home_window_layout_mode_accept;
   window_class->layout_mode_cancel = hd_home_window_layout_mode_cancel;
   window_class->background         = hd_home_window_background;
-  window_class->system_inactivity  = hd_home_window_system_inactivity;
+  window_class->screen_off         = hd_home_window_screen_off;
 
   pspec = g_param_spec_pointer ("osso-context",
                                 "Osso Context",
@@ -359,10 +359,10 @@
                 1,
                 G_TYPE_BOOLEAN);
 
-  g_signal_new ("system-inactivity",
+  g_signal_new ("screen-off",
                 G_OBJECT_CLASS_TYPE (object_class),
                 G_SIGNAL_RUN_FIRST,
-                G_STRUCT_OFFSET (HDHomeWindowClass, system_inactivity),
+                G_STRUCT_OFFSET (HDHomeWindowClass, screen_off),
                 NULL,
                 NULL,
                 g_cclosure_marshal_VOID__BOOLEAN,
@@ -1453,7 +1453,32 @@
 }
 
 #ifdef HAVE_LIBOSSO
+
 static void
+hd_home_window_osso_lowmem_cb (osso_hw_state_t *state,
+                               gpointer         window)
+{
+  g_return_if_fail (state);
+
+  g_signal_emit_by_name (G_OBJECT (window),
+                         "lowmem",
+                         state->memory_low_ind);
+
+}
+
+static void
+hd_home_window_osso_display_state_cb (osso_display_state_t      state,
+                                      gpointer                  window)
+{
+  g_return_if_fail (state);
+
+  g_signal_emit_by_name (G_OBJECT (window),
+                         "screen-off",
+                         state == OSSO_DISPLAY_OFF);
+
+}
+
+static void
 hd_home_window_set_osso_context (HDHomeWindow *window,
                                  osso_context_t *osso_context)
 {
@@ -1465,9 +1490,20 @@
 
   if (priv->osso_context != osso_context)
   {
+    osso_hw_state_t hs = { 0 };
+
     priv->osso_context = osso_context;
     g_object_notify (G_OBJECT (window), "osso-context");
 
+    osso_hw_set_display_event_cb (osso_context,
+                                  hd_home_window_osso_display_state_cb,
+                                  window);
+
+    hs.memory_low_ind = TRUE;
+    osso_hw_set_event_cb (osso_context,
+                          &hs,
+                          hd_home_window_osso_lowmem_cb,
+                          window);
   }
 }
 #endif
@@ -1594,7 +1630,7 @@
   area = GTK_BIN (window)->child;
   g_return_if_fail (HILDON_IS_HOME_AREA (area));
 
-  if (!priv->is_inactive)
+  if (!priv->screen_is_off)
     {
 
       /* If we were in layout mode and went to background, we need
@@ -1616,8 +1652,8 @@
 }
 
 static void
-hd_home_window_system_inactivity (HDHomeWindow         *window,
-                                  gboolean              is_inactive)
+hd_home_window_screen_off (HDHomeWindow         *window,
+                           gboolean              is_off)
 {
   HDHomeWindowPrivate  *priv = HD_HOME_WINDOW_GET_PRIVATE (window);
   GtkWidget            *area;
@@ -1625,11 +1661,11 @@
   area = GTK_BIN (window)->child;
   g_return_if_fail (HILDON_IS_HOME_AREA (area));
 
-  priv->is_inactive = is_inactive;
+  priv->screen_is_off = is_off;
 
   gtk_container_foreach (GTK_CONTAINER (area),
                          (GtkCallback)hildon_desktop_home_item_set_is_background,
-                         (gpointer)is_inactive);
+                         (gpointer)is_off);
 
 }
 
@@ -1791,7 +1827,7 @@
 static void
 hd_home_window_layout_mode_activate (HDHomeWindow *window)
 {
-  GtkWidget    *area = GTK_BIN (window)->child; 
+  GtkWidget    *area = GTK_BIN (window)->child;
 
   g_return_if_fail (HILDON_IS_HOME_AREA (area));
 

Modified: projects/haf/trunk/hildon-desktop/src/hd-home-window.h
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-home-window.h	2007-06-11 15:41:19 UTC (rev 12233)
+++ projects/haf/trunk/hildon-desktop/src/hd-home-window.h	2007-06-11 16:21:14 UTC (rev 12234)
@@ -52,7 +52,7 @@
 
   void    (* background)        (HDHomeWindow *window, gboolean is_background);
   void    (* lowmem)            (HDHomeWindow *window, gboolean is_lowmem);
-  void    (* system_inactivity) (HDHomeWindow *window, gboolean is_inactive);
+  void    (* screen_off       ) (HDHomeWindow *window, gboolean is_off);
   void    (* layout_mode_accept)(HDHomeWindow *window);
   void    (* layout_mode_cancel)(HDHomeWindow *window);
   void    (* io_error)          (HDHomeWindow *window, GError *error);


More information about the maemo-commits mailing list