[gnome-menus/wip/gobject-review] libmenu, util: Rename GMenuTree:name to GMenuTree:menu-basename



commit db2b8418513345abd5a834bd1fd88c2955e4c92c
Author: Vincent Untz <vuntz gnome org>
Date:   Thu Jul 21 17:22:20 2011 +0200

    libmenu, util: Rename GMenuTree:name to GMenuTree:menu-basename
    
    This is a much clearer name for the property, else people might assume
    they can use a full path, or something that is not a basename.
    
    Note that a relative path will work, but that really should not be of
    much use, hence the choice of basename.

 libmenu/gmenu-tree.c   |   28 ++++++++++++++++------------
 libmenu/gmenu-tree.h   |    2 +-
 util/gnome-menus-ls.js |    2 +-
 3 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/libmenu/gmenu-tree.c b/libmenu/gmenu-tree.c
index b4c1f87..5132577 100644
--- a/libmenu/gmenu-tree.c
+++ b/libmenu/gmenu-tree.c
@@ -41,7 +41,7 @@ typedef struct GMenuTreeItem GMenuTreeItem;
 enum {
   PROP_0,
 
-  PROP_NAME,
+  PROP_MENU_BASENAME,
   PROP_FLAGS
 };
 
@@ -438,18 +438,21 @@ gmenu_tree_force_recanonicalize (GMenuTree *tree)
 
 /**
  * gmenu_tree_new:
- * @menu_file: Basename of menu file
+ * @menu_basename: Basename of menu file
  * @flags: Flags controlling menu content
  *
  * Returns: (transfer full): A new #GMenuTree instance
  */
 GMenuTree *
-gmenu_tree_new (const char     *name,
+gmenu_tree_new (const char     *menu_basename,
                 GMenuTreeFlags  flags)
 {
-  g_return_val_if_fail (name != NULL, NULL);
+  g_return_val_if_fail (menu_basename != NULL, NULL);
 
-  return g_object_new (GMENU_TYPE_TREE, "name", name, "flags", flags, NULL);
+  return g_object_new (GMENU_TYPE_TREE,
+                       "menu-basename", menu_basename,
+                       "flags", flags,
+                       NULL);
 }
 
 static void
@@ -462,7 +465,7 @@ gmenu_tree_set_property (GObject         *object,
 
   switch (prop_id)
     {
-    case PROP_NAME:
+    case PROP_MENU_BASENAME:
       self->basename = g_value_dup_string (value);
       break;
 
@@ -486,7 +489,7 @@ gmenu_tree_get_property (GObject         *object,
 
   switch (prop_id)
     {
-    case PROP_NAME:
+    case PROP_MENU_BASENAME:
       g_value_set_string (value, self->basename);
       break;
     case PROP_FLAGS:
@@ -531,14 +534,15 @@ gmenu_tree_class_init (GMenuTreeClass *klass)
   gobject_class->finalize = gmenu_tree_finalize;
 
   /**
-   * GMenuTree:name
+   * GMenuTree:menu-basename
    *
-   * The name of the menu file; must be a relative path.  See
-   * the Desktop Menu specification.
+   * The name of the menu file; must be a basename or a relative path. The file
+   * will be looked up in $XDG_CONFIG_DIRS/menus/. See the Desktop Menu
+   * specification.
    */
   g_object_class_install_property (gobject_class,
-                                   PROP_NAME,
-                                   g_param_spec_string ("name", "", "",
+                                   PROP_MENU_BASENAME,
+                                   g_param_spec_string ("menu-basename", "", "",
                                                         "applications.menu",
                                                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
   /**
diff --git a/libmenu/gmenu-tree.h b/libmenu/gmenu-tree.h
index 7ab872f..d166780 100644
--- a/libmenu/gmenu-tree.h
+++ b/libmenu/gmenu-tree.h
@@ -83,7 +83,7 @@ typedef enum
 GType gmenu_tree_flags_get_type (void);
 #define GMENU_TYPE_TREE_FLAGS (gmenu_tree_flags_get_type ())
 
-GMenuTree *gmenu_tree_new (const char     *menu_file,
+GMenuTree *gmenu_tree_new (const char     *menu_basename,
                            GMenuTreeFlags  flags);
 
 gboolean   gmenu_tree_load_sync (GMenuTree  *tree,
diff --git a/util/gnome-menus-ls.js b/util/gnome-menus-ls.js
index 7c37d9b..da5e11b 100755
--- a/util/gnome-menus-ls.js
+++ b/util/gnome-menus-ls.js
@@ -21,7 +21,7 @@
 
 var GMenu = imports.gi.GMenu;
 
-var tree = new GMenu.Tree({ name: "applications.menu", flags: 0 });
+var tree = new GMenu.Tree({ menu_basename: "applications.menu", flags: 0 });
 
 tree.load_sync();
 



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