[gnome-menus] Remove gmenu_tree_directory_get_tree()



commit 52f9f7017779b6691e2b3f46f6c24e37f219abbf
Author: Colin Walters <walters verbum org>
Date:   Sun Apr 17 11:22:32 2011 -0400

    Remove gmenu_tree_directory_get_tree()
    
    This causes a circular reference internally, and API consumers
    can just keep track of it easily enough externally.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=647968

 libmenu/gmenu-tree.c |   40 +---------------------------------------
 libmenu/gmenu-tree.h |    1 -
 2 files changed, 1 insertions(+), 40 deletions(-)
---
diff --git a/libmenu/gmenu-tree.c b/libmenu/gmenu-tree.c
index 1fd7e2c..37321e0 100644
--- a/libmenu/gmenu-tree.c
+++ b/libmenu/gmenu-tree.c
@@ -105,7 +105,7 @@ typedef struct
 {
   GMenuTreeDirectory directory;
 
-  GMenuTree *tree;
+  /* nothing yet */
 } GMenuTreeDirectoryRoot;
 
 struct GMenuTreeEntry
@@ -813,41 +813,6 @@ gmenu_tree_directory_get_menu_id (GMenuTreeDirectory *directory)
   return directory->name;
 }
 
-static void
-gmenu_tree_directory_set_tree (GMenuTreeDirectory *directory,
-			       GMenuTree          *tree)
-{
-  GMenuTreeDirectoryRoot *root;
-
-  g_assert (directory != NULL);
-  g_assert (directory->is_root);
-
-  root = (GMenuTreeDirectoryRoot *) directory;
-
-  root->tree = tree;
-}
-
-GMenuTree *
-gmenu_tree_directory_get_tree (GMenuTreeDirectory *directory)
-{
-  GMenuTreeDirectoryRoot *root;
-
-  g_return_val_if_fail (directory != NULL, NULL);
-
-  while (GMENU_TREE_ITEM (directory)->parent != NULL)
-    directory = GMENU_TREE_DIRECTORY (GMENU_TREE_ITEM (directory)->parent);
-
-  if (!directory->is_root)
-    return NULL;
-
-  root = (GMenuTreeDirectoryRoot *) directory;
-
-  if (root->tree)
-    g_object_ref (root->tree);
-
-  return root->tree;
-}
-
 gboolean
 gmenu_tree_directory_get_is_nodisplay (GMenuTreeDirectory *directory)
 {
@@ -4158,8 +4123,6 @@ gmenu_tree_build_from_layout (GMenuTree *tree,
                                allocated);
   if (tree->root)
     {
-      gmenu_tree_directory_set_tree (tree->root, tree);
-
       process_only_unallocated (tree, tree->root, allocated);
 
       /* process the layout info part that can move/remove items:
@@ -4184,7 +4147,6 @@ gmenu_tree_force_rebuild (GMenuTree *tree)
 {
   if (tree->root)
     {
-      gmenu_tree_directory_set_tree (tree->root, NULL);
       gmenu_tree_item_unref (tree->root);
       tree->root = NULL;
       g_clear_error (&tree->load_error);
diff --git a/libmenu/gmenu-tree.h b/libmenu/gmenu-tree.h
index 51a75de..f168c96 100644
--- a/libmenu/gmenu-tree.h
+++ b/libmenu/gmenu-tree.h
@@ -110,7 +110,6 @@ const char *gmenu_tree_directory_get_comment           (GMenuTreeDirectory *dire
 const char *gmenu_tree_directory_get_icon              (GMenuTreeDirectory *directory);
 const char *gmenu_tree_directory_get_desktop_file_path (GMenuTreeDirectory *directory);
 const char *gmenu_tree_directory_get_menu_id           (GMenuTreeDirectory *directory);
-GMenuTree  *gmenu_tree_directory_get_tree              (GMenuTreeDirectory *directory);
 
 gboolean gmenu_tree_directory_get_is_nodisplay (GMenuTreeDirectory *directory);
 



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