예제 #1
0
        public com.canonical.dbusmenu.MenuItem[] GetGroupProperties(int[] ids,
                                                                    string[] propertyNames)
        {
#if DEBUG
            Console.WriteLine("GetGroupProperties - ids:{0}, propertyNames:{1}",
                              string.Join(", ", ids), string.Join(", ", propertyNames));
#endif
            if (propertyNames.Length == 0)
            {
                propertyNames = DefaultMenuItemProxy.GetAllDisplayNames();
            }
            var itemList = new List <com.canonical.dbusmenu.MenuItem>();
            foreach (var id in ids)
            {
                var item     = mMenuItemList[id];
                var menuItem = new com.canonical.dbusmenu.MenuItem();
                menuItem.id         = id;
                menuItem.properties = new Dictionary <string, object>();
                foreach (var property in propertyNames)
                {
                    try {
                        var value = item.GetValue(property);
                        if (!DefaultMenuItemProxy.IsDefaultValue(property, value))
                        {
                            menuItem.properties.Add(property, value);
                        }
                    } catch (Exception ex) {
                        Debug.Fail(ex.ToString());
                    }
                }
                itemList.Add(menuItem);
            }

            return(itemList.ToArray());
        }
예제 #2
0
        public void GetLayout(int parentId, int recursionDepth, string[] propertyNames,
                              out uint revision, out MenuItemLayout layout)
        {
#if DEBUG
            Console.WriteLine("GetLayout - parentId:{0}, " +
                              "recursionDepth:{1}, propertyNames:{2}",
                              parentId, recursionDepth,
                              string.Join(", ", propertyNames));
#endif
            if (propertyNames.Length == 0)
            {
                propertyNames = DefaultMenuItemProxy.GetAllDisplayNames();
            }

            revision = mRevision;

            var item = mMenuItemList[parentId];
            layout = CreateMenuItemLayout(item, 0, recursionDepth, propertyNames);
        }