[maemo-commits] [maemo-commits] r10816 - in projects/haf/trunk/hildon-desktop: . libhildondesktop

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Mar 29 11:26:55 EEST 2007
Author: jobi
Date: 2007-03-29 11:26:54 +0300 (Thu, 29 Mar 2007)
New Revision: 10816

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.h
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c
Log:

2007-03-29  Johan Bilien  <johan.bilien at nokia.com>

	* libhildondesktop/hildon-desktop-home-item.[ch]:
	- removed hildon_desktop_home_item_save_position ()
	* libhildondesktop/hildon-home-area.c:
	- added private hildon_home_area_child_save_position ()



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-03-29 07:54:21 UTC (rev 10815)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-03-29 08:26:54 UTC (rev 10816)
@@ -1,5 +1,12 @@
 2007-03-29  Johan Bilien  <johan.bilien at nokia.com>
 
+	* libhildondesktop/hildon-desktop-home-item.[ch]:
+	- removed hildon_desktop_home_item_save_position ()
+	* libhildondesktop/hildon-home-area.c:
+	- added private hildon_home_area_child_save_position ()
+
+2007-03-29  Johan Bilien  <johan.bilien at nokia.com>
+
 	* libhildondesktop/hildon-desktop-home-item.c:
 	- never snap to outside the area
 	* libhildondesktop/hildon-home-window.c:

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c	2007-03-29 07:54:21 UTC (rev 10815)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c	2007-03-29 08:26:54 UTC (rev 10816)
@@ -966,11 +966,10 @@
       if (priv->drag_handle_window)
         gdk_window_raise (priv->drag_handle_window);
 
-      if (!priv->layout_mode_sucks && GTK_IS_BIN (applet) &&
-                                      GTK_BIN (applet)->child)
+      if (!priv->layout_mode_sucks && GTK_IS_WIDGET (GTK_BIN (applet)->child))
         {
-        gtk_widget_set_sensitive (GTK_BIN (applet)->child, TRUE);
-        gtk_widget_set_sensitive (GTK_BIN (applet)->child, FALSE);
+          gtk_widget_set_sensitive (GTK_BIN (applet)->child, TRUE);
+          gtk_widget_set_sensitive (GTK_BIN (applet)->child, FALSE);
         }
     }
 
@@ -1028,7 +1027,7 @@
            widget->allocation.height - APPLET_RESIZE_HANDLE_HEIGHT);
     }
 
-  if (GTK_BIN (applet) && GTK_BIN (applet)->child)
+  if (GTK_IS_WIDGET (GTK_BIN (applet)->child))
     gtk_widget_set_sensitive (GTK_BIN (applet)->child, FALSE);
 
   gdk_window_set_events (widget->window,
@@ -1067,7 +1066,7 @@
       priv->resize_handle_window = NULL;
     }
 
-  if (GTK_BIN (applet) && GTK_BIN (applet)->child)
+  if (GTK_IS_WIDGET (GTK_BIN (applet)->child))
     gtk_widget_set_sensitive (GTK_BIN (applet)->child, TRUE);
 
   gdk_window_remove_filter (GTK_WIDGET (applet)->window,
@@ -1585,43 +1584,6 @@
   return item;
 }
 
-void
-hildon_desktop_home_item_save_position (HildonDesktopHomeItem *applet,
-                                        GKeyFile *keyfile)
-{
-  HildonDesktopHomeItemPriv      *priv;
-  const gchar               *id;
-  g_return_if_fail (applet && keyfile);
-  
-  priv = HILDON_DESKTOP_HOME_ITEM_GET_PRIVATE (applet);
-
-  id = hildon_desktop_item_get_id (HILDON_DESKTOP_ITEM (applet));
-  g_return_if_fail (id);
-
-  g_key_file_set_integer (keyfile,
-                          id,
-                          HH_APPLET_KEY_X,
-                          GTK_WIDGET (applet)->allocation.x - 
-                          GTK_WIDGET (applet)->parent->allocation.x);
-
-  g_key_file_set_integer (keyfile,
-                          id,
-                          HH_APPLET_KEY_Y,
-                          GTK_WIDGET (applet)->allocation.y -
-                          GTK_WIDGET (applet)->parent->allocation.y);
-
-  g_key_file_set_integer (keyfile,
-                          id,
-                          HH_APPLET_KEY_WIDTH,
-                          GTK_WIDGET (applet)->allocation.width);
-
-  g_key_file_set_integer (keyfile,
-                          id,
-                          HH_APPLET_KEY_HEIGHT,
-                          GTK_WIDGET (applet)->allocation.height);
-
-}
-
 gboolean
 hildon_desktop_home_item_get_overlaps (HildonDesktopHomeItem *applet)
 {

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.h
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.h	2007-03-29 07:54:21 UTC (rev 10815)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.h	2007-03-29 08:26:54 UTC (rev 10816)
@@ -126,10 +126,6 @@
 GtkWidget *
 hildon_desktop_home_item_get_settings_menu_item (HildonDesktopHomeItem *applet);
 
-void        hildon_desktop_home_item_save_position
-                                                (HildonDesktopHomeItem *applet,
-                                                 GKeyFile         *keyfile);
-
 gboolean    hildon_desktop_home_item_get_overlaps
                                                 (HildonDesktopHomeItem *applet);
 

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c	2007-03-29 07:54:21 UTC (rev 10815)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c	2007-03-29 08:26:54 UTC (rev 10816)
@@ -773,6 +773,45 @@
   return priv->layout_mode;
 }
 
+static void
+hildon_home_area_child_save_position (GtkWidget *widget, GKeyFile *keyfile)
+{
+  const gchar  *id;
+  gint          x, y;
+
+  if (!HILDON_DESKTOP_IS_HOME_ITEM (widget))
+    return;
+
+  id = hildon_desktop_item_get_id (HILDON_DESKTOP_ITEM (widget));
+  g_return_if_fail (id);
+
+  gtk_container_child_get (GTK_CONTAINER (widget->parent), widget,
+                           "x", &x,
+                           "y", &y,
+                           NULL);
+
+  g_key_file_set_integer (keyfile,
+                          id,
+                          HH_APPLET_KEY_X,
+                          x);
+
+  g_key_file_set_integer (keyfile,
+                          id,
+                          HH_APPLET_KEY_Y,
+                          y);
+
+  g_key_file_set_integer (keyfile,
+                          id,
+                          HH_APPLET_KEY_WIDTH,
+                          widget->allocation.width);
+
+  g_key_file_set_integer (keyfile,
+                          id,
+                          HH_APPLET_KEY_HEIGHT,
+                          widget->allocation.height);
+
+}
+
 gint
 hildon_home_area_save_configuration (HildonHomeArea *area,
                                      const gchar *path,
@@ -788,7 +827,7 @@
   keyfile = g_key_file_new ();
 
   gtk_container_foreach (GTK_CONTAINER (area),
-                         (GtkCallback)hildon_desktop_home_item_save_position,
+                         (GtkCallback)hildon_home_area_child_save_position,
                          keyfile);
 
   file = fopen (path, "w");
@@ -934,33 +973,7 @@
           applets = g_list_remove (applets, applet);
         }
 
-#if 0
-      else
-        {
-          applet = hildon_desktop_home_item_new_with_plugin (groups[n_groups-1]);
-          if (applet)
-            {
-              gtk_fixed_put (GTK_FIXED (area),
-                             applet,
-                             x, 
-                             y);
 
-              gtk_widget_show (applet);
-              
-              g_signal_emit_by_name (G_OBJECT (area), "applet-added", applet);
-              if (priv->layout_mode)
-                {
-                  g_signal_emit_by_name (G_OBJECT (area), "layout-changed");
-                  hildon_desktop_home_item_set_layout_mode
-                      (HILDON_DESKTOP_HOME_ITEM (applet),
-                       TRUE);
-                }
-
-            }
-        }
-#endif
-      
-
       if (applet)
         {
           gtk_widget_set_size_request (applet, width, height);


More information about the maemo-commits mailing list