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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Jul 31 15:00:49 EEST 2007
Author: jobi
Date: 2007-07-31 15:00:45 +0300 (Tue, 31 Jul 2007)
New Revision: 12953

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/src/hd-app-menu-tree.c
Log:

2007-07-31  Johan Bilien  <johan.bilien at nokia.com>

	* src/hd-app-menu-tree.c:
	- set the cursor to the previous one when deleting
	a category. Fixes: NB#63457



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-07-31 12:00:11 UTC (rev 12952)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-07-31 12:00:45 UTC (rev 12953)
@@ -1,7 +1,14 @@
+2007-07-31  Johan Bilien  <johan.bilien at nokia.com>
+
+	* src/hd-app-menu-tree.c:
+	- set the cursor to the previous one when deleting
+	a category. Fixes: NB#63457
+
 2007-07-31  Karoliina Salminen <karoliina.t.salminen at nokia.com>
 
-	* libhildondesktop/libhildonmenu.c: line 645: fixed signedness compilation 
-	warning which occurs on newer gcc compilers. Added cast to (gchar *) to key.
+	* libhildondesktop/libhildonmenu.c: line 645: fixed signedness
+	compilation warning which occurs on newer gcc compilers. Added
+	cast to (gchar *) to key.
 
 2007-07-30  Lucas Rocha  <lucas.rocha at nokia.com>
 

Modified: projects/haf/trunk/hildon-desktop/src/hd-app-menu-tree.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-app-menu-tree.c	2007-07-31 12:00:11 UTC (rev 12952)
+++ projects/haf/trunk/hildon-desktop/src/hd-app-menu-tree.c	2007-07-31 12:00:45 UTC (rev 12953)
@@ -108,6 +108,7 @@
   GtkWidget            *content_pane;
 
   GtkWidget            *empty_label;
+  GtkWidget            *content_scrolled_window;
 
   GtkTreeSelection     *navigation_selection;
   GtkTreeSelection     *content_selection;
@@ -170,8 +171,8 @@
   HDAppMenuTreePrivate *priv;
   GObject              *object;
   GtkTreeViewColumn    *column;
+  GtkCellRenderer      *renderer;
   GtkWidget            *scrolled_window;
-  GtkCellRenderer      *renderer;
   const GtkTargetEntry  target_entries =
   {"HD_APP_MENU_ITEM", GTK_TARGET_SAME_APP, 0x42124212};
 
@@ -308,14 +309,16 @@
   priv->content_selection =
       gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->content_pane));
 
-  scrolled_window = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
-                                  "visible", TRUE,
-                                  "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
-                                  "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
-                                  "child", priv->content_pane,
-                                  NULL);
+  priv->content_scrolled_window =
+      g_object_new (GTK_TYPE_SCROLLED_WINDOW,
+                    "visible", TRUE,
+                    "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
+                    "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
+                    "child", priv->content_pane,
+                    NULL);
 
-  gtk_paned_add2 (GTK_PANED (object), scrolled_window);
+  gtk_paned_add2 (GTK_PANED (object), priv->content_scrolled_window);
+  g_object_ref (priv->content_scrolled_window);
 
   return object;
 
@@ -463,17 +466,18 @@
 
   if (gtk_tree_model_get_iter_first (priv->content_model, &iter))
   {
-    if (priv->content_pane->parent != GTK_WIDGET (tree))
+    if (priv->content_scrolled_window->parent != GTK_WIDGET (tree))
     {
       gtk_container_remove (GTK_CONTAINER (tree), priv->empty_label);
-      gtk_paned_add2 (GTK_PANED (tree), priv->content_pane);
+      gtk_paned_add2 (GTK_PANED (tree), priv->content_scrolled_window);
     }
   }
   else
   {
     if (priv->empty_label->parent != GTK_WIDGET (tree))
     {
-      gtk_container_remove (GTK_CONTAINER (tree), priv->content_pane);
+      gtk_container_remove (GTK_CONTAINER (tree),
+                            priv->content_scrolled_window);
       gtk_paned_add2 (GTK_PANED (tree), priv->empty_label);
     }
   }
@@ -847,6 +851,19 @@
   return valid_location;
 }
 
+static void
+hd_app_menu_tree_navigation_row_deleted (HDAppMenuTree *tree,
+                                         GtkTreePath   *path)
+{
+  HDAppMenuTreePrivate *priv = tree->priv;
+
+  gtk_tree_path_prev (path);
+  gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->navigation_pane),
+                            path,
+                            NULL,
+                            FALSE);
+}
+
 void
 hd_app_menu_tree_set_model (HDAppMenuTree *tree, GtkTreeModel *model)
 {
@@ -881,6 +898,7 @@
 
     priv->navigation_model = gtk_tree_model_filter_new (priv->model, NULL);
 
+
     gtk_tree_model_filter_set_visible_func (
                            GTK_TREE_MODEL_FILTER (priv->navigation_model),
                            (GtkTreeModelFilterVisibleFunc)
@@ -896,7 +914,11 @@
                               FALSE);
 
     gtk_tree_path_free (path);
+    g_signal_connect_swapped (priv->navigation_model, "row-deleted",
+                              G_CALLBACK (hd_app_menu_tree_navigation_row_deleted),
+                              tree);
 
+
   }
 
   g_object_notify (G_OBJECT (tree), "model");


More information about the maemo-commits mailing list