[gnome-menus] Lower gmenu_tree_item_get_parent to gmenu_tree_directory_get_parent



commit a2bda1462b6b46b1c8e47a19977f15c294226ef9
Author: Colin Walters <walters verbum org>
Date:   Sun Apr 17 08:58:19 2011 -0400

    Lower gmenu_tree_item_get_parent to gmenu_tree_directory_get_parent
    
    Introspection doesn't know about the GMenuTreeItem "subclassing",
    so we would have to duplicate the _get_parent method on all
    subclasses - but in practice it only seems to be used on directories,
    so just lower it there.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=647968

 libmenu/gmenu-tree.c  |    3 ++-
 libmenu/gmenu-tree.h  |    4 +---
 util/test-menu-spec.c |    2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/libmenu/gmenu-tree.c b/libmenu/gmenu-tree.c
index 129b3aa..fa70eb0 100644
--- a/libmenu/gmenu-tree.c
+++ b/libmenu/gmenu-tree.c
@@ -682,8 +682,9 @@ gmenu_tree_item_get_item_type (GMenuTreeItem *item)
 }
 
 GMenuTreeDirectory *
-gmenu_tree_item_get_parent (GMenuTreeItem *item)
+gmenu_tree_directory_get_parent (GMenuTreeDirectory *directory)
 {
+  GMenuTreeItem *item = (GMenuTreeItem*)directory;
   g_return_val_if_fail (item != NULL, NULL);
 
   return item->parent ? gmenu_tree_item_ref (item->parent) : NULL;
diff --git a/libmenu/gmenu-tree.h b/libmenu/gmenu-tree.h
index c297aea..4cbf61a 100644
--- a/libmenu/gmenu-tree.h
+++ b/libmenu/gmenu-tree.h
@@ -98,11 +98,9 @@ GMenuTreeDirectory *gmenu_tree_get_directory_from_path (GMenuTree  *tree,
 
 gpointer gmenu_tree_item_ref   (gpointer item);
 void     gmenu_tree_item_unref (gpointer item);
-
 GMenuTreeItemType   gmenu_tree_item_get_item_type   (GMenuTreeItem *item);
-GMenuTreeDirectory *gmenu_tree_item_get_parent (GMenuTreeItem *item);
-
 
+GMenuTreeDirectory *gmenu_tree_directory_get_parent    (GMenuTreeDirectory *directory);
 GSList     *gmenu_tree_directory_get_contents          (GMenuTreeDirectory *directory);
 const char *gmenu_tree_directory_get_name              (GMenuTreeDirectory *directory);
 const char *gmenu_tree_directory_get_comment           (GMenuTreeDirectory *directory);
diff --git a/util/test-menu-spec.c b/util/test-menu-spec.c
index c7b5d20..d21f78d 100644
--- a/util/test-menu-spec.c
+++ b/util/test-menu-spec.c
@@ -49,7 +49,7 @@ append_directory_path (GMenuTreeDirectory *directory,
 {
   GMenuTreeDirectory *parent;
 
-  parent = gmenu_tree_item_get_parent (GMENU_TREE_ITEM (directory));
+  parent = gmenu_tree_directory_get_parent (directory);
 
   if (!parent)
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]