[gnome-menus/wip-gobject-rebase2: 1/5] gmenu_tree_entry_get_parent: New function



commit 689b05bc4b63c7b4ceda49bf83a6fbaba6b96797
Author: Colin Walters <walters verbum org>
Date:   Mon Apr 18 15:36:01 2011 -0400

    gmenu_tree_entry_get_parent: New function
    
    Earlier we moved this down to GMenuTreeDirectory, but it turns
    out gnome-shell does expect to be able to get the parent of a
    GMenuTreeEntry.  In the future I want to nuke that code, but
    for now just readd this functionality.

 libmenu/gmenu-tree.c |    9 +++++++++
 libmenu/gmenu-tree.h |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libmenu/gmenu-tree.c b/libmenu/gmenu-tree.c
index 37321e0..cc27c4e 100644
--- a/libmenu/gmenu-tree.c
+++ b/libmenu/gmenu-tree.c
@@ -730,6 +730,15 @@ gmenu_tree_directory_get_parent (GMenuTreeDirectory *directory)
   return item->parent ? gmenu_tree_item_ref (item->parent) : NULL;
 }
 
+GMenuTreeDirectory *
+gmenu_tree_entry_get_parent (GMenuTreeEntry *entry)
+{
+  GMenuTreeItem *item = (GMenuTreeItem*)entry;
+  g_return_val_if_fail (item != NULL, NULL);
+
+  return item->parent ? gmenu_tree_item_ref (item->parent) : NULL;
+}
+
 static void
 gmenu_tree_item_set_parent (GMenuTreeItem      *item,
 			    GMenuTreeDirectory *parent)
diff --git a/libmenu/gmenu-tree.h b/libmenu/gmenu-tree.h
index f168c96..061cc6d 100644
--- a/libmenu/gmenu-tree.h
+++ b/libmenu/gmenu-tree.h
@@ -118,6 +118,7 @@ char *gmenu_tree_directory_make_path (GMenuTreeDirectory *directory,
 
 
 GDesktopAppInfo *gmenu_tree_entry_get_app_info       (GMenuTreeEntry *entry);
+GMenuTreeDirectory *gmenu_tree_entry_get_parent      (GMenuTreeEntry *entry);
 
 const char *gmenu_tree_entry_get_desktop_file_path (GMenuTreeEntry *entry);
 const char *gmenu_tree_entry_get_desktop_file_id   (GMenuTreeEntry *entry);



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