1 /* vi:set et ai sw=2 sts=2 ts=2: */ 2 /*- 3 * Copyright (c) 2009 Jannis Pohlmann <jannis@xfce.org> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General 16 * Public License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #if !defined (GARCON_INSIDE_GARCON_H) && !defined (GARCON_COMPILATION) 22 #error "Only <garcon/garcon.h> can be included directly. This file may disappear or change contents." 23 #endif 24 25 #ifndef __GARCON_MENU_NODE_H__ 26 #define __GARCON_MENU_NODE_H__ 27 28 #include <garcon/garcon.h> 29 30 G_BEGIN_DECLS 31 32 /* Types for the menu nodes */ 33 typedef enum 34 { 35 GARCON_MENU_NODE_TYPE_INVALID, 36 GARCON_MENU_NODE_TYPE_MENU, 37 GARCON_MENU_NODE_TYPE_NAME, 38 GARCON_MENU_NODE_TYPE_DIRECTORY, 39 GARCON_MENU_NODE_TYPE_DIRECTORY_DIR, 40 GARCON_MENU_NODE_TYPE_DEFAULT_DIRECTORY_DIRS, 41 GARCON_MENU_NODE_TYPE_APP_DIR, 42 GARCON_MENU_NODE_TYPE_DEFAULT_APP_DIRS, 43 GARCON_MENU_NODE_TYPE_ONLY_UNALLOCATED, 44 GARCON_MENU_NODE_TYPE_NOT_ONLY_UNALLOCATED, 45 GARCON_MENU_NODE_TYPE_DELETED, 46 GARCON_MENU_NODE_TYPE_NOT_DELETED, 47 GARCON_MENU_NODE_TYPE_INCLUDE, 48 GARCON_MENU_NODE_TYPE_EXCLUDE, 49 GARCON_MENU_NODE_TYPE_ALL, 50 GARCON_MENU_NODE_TYPE_FILENAME, 51 GARCON_MENU_NODE_TYPE_CATEGORY, 52 GARCON_MENU_NODE_TYPE_OR, 53 GARCON_MENU_NODE_TYPE_AND, 54 GARCON_MENU_NODE_TYPE_NOT, 55 GARCON_MENU_NODE_TYPE_MOVE, 56 GARCON_MENU_NODE_TYPE_OLD, 57 GARCON_MENU_NODE_TYPE_NEW, 58 GARCON_MENU_NODE_TYPE_DEFAULT_LAYOUT, 59 GARCON_MENU_NODE_TYPE_LAYOUT, 60 GARCON_MENU_NODE_TYPE_MENUNAME, 61 GARCON_MENU_NODE_TYPE_SEPARATOR, 62 GARCON_MENU_NODE_TYPE_MERGE, 63 GARCON_MENU_NODE_TYPE_MERGE_FILE, 64 GARCON_MENU_NODE_TYPE_MERGE_DIR, 65 GARCON_MENU_NODE_TYPE_DEFAULT_MERGE_DIRS, 66 } GarconMenuNodeType; 67 68 69 70 typedef enum 71 { 72 GARCON_MENU_LAYOUT_MERGE_MENUS, 73 GARCON_MENU_LAYOUT_MERGE_FILES, 74 GARCON_MENU_LAYOUT_MERGE_ALL, 75 } GarconMenuLayoutMergeType; 76 77 typedef enum 78 { 79 GARCON_MENU_MERGE_FILE_PATH, 80 GARCON_MENU_MERGE_FILE_PARENT, 81 } GarconMenuMergeFileType; 82 83 84 85 typedef union _GarconMenuNodeData GarconMenuNodeData; 86 typedef struct _GarconMenuNodeClass GarconMenuNodeClass; 87 typedef struct _GarconMenuNode GarconMenuNode; 88 89 #define GARCON_TYPE_MENU_NODE (garcon_menu_node_get_type ()) 90 #define GARCON_MENU_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GARCON_TYPE_MENU_NODE, GarconMenuNode)) 91 #define GARCON_MENU_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GARCON_TYPE_MENU_NODE, GarconMenuNodeClass)) 92 #define GARCON_IS_MENU_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GARCON_TYPE_MENU_NODE)) 93 #define GARCON_IS_MENU_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GARCON_TYPE_MENU_NODE) 94 #define GARCON_MENU_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GARCON_TYPE_MENU_NODE, GarconMenuNodeClass)) 95 96 GType garcon_menu_node_type_get_type (void); 97 GType garcon_menu_node_get_type (void) G_GNUC_CONST; 98 99 GarconMenuNode *garcon_menu_node_new (GarconMenuNodeType node_type) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; 100 GarconMenuNodeType garcon_menu_node_get_node_type (GarconMenuNode *node); 101 GarconMenuNode *garcon_menu_node_create (GarconMenuNodeType node_type, 102 gpointer first_value, 103 ...) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; 104 GarconMenuNode *garcon_menu_node_copy (GarconMenuNode *node, 105 gpointer data) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; 106 const gchar *garcon_menu_node_get_string (GarconMenuNode *node); 107 void garcon_menu_node_set_string (GarconMenuNode *node, 108 const gchar *value); 109 GarconMenuMergeFileType garcon_menu_node_get_merge_file_type (GarconMenuNode *node); 110 void garcon_menu_node_set_merge_file_type (GarconMenuNode *node, 111 GarconMenuMergeFileType type); 112 const gchar *garcon_menu_node_get_merge_file_filename (GarconMenuNode *node); 113 void garcon_menu_node_set_merge_file_filename (GarconMenuNode *node, 114 const gchar *filename); 115 116 GNode *garcon_menu_node_tree_get_child_node (GNode *tree, 117 GarconMenuNodeType type, 118 gboolean reverse); 119 GList *garcon_menu_node_tree_get_child_nodes (GNode *tree, 120 GarconMenuNodeType type, 121 gboolean reverse); 122 GList *garcon_menu_node_tree_get_string_children (GNode *tree, 123 GarconMenuNodeType type, 124 gboolean reverse); 125 gboolean garcon_menu_node_tree_get_boolean_child (GNode *tree, 126 GarconMenuNodeType type); 127 const gchar *garcon_menu_node_tree_get_string_child (GNode *tree, 128 GarconMenuNodeType type); 129 gboolean garcon_menu_node_tree_rule_matches (GNode *tree, 130 GarconMenuItem *item); 131 GarconMenuNodeType garcon_menu_node_tree_get_node_type (GNode *tree); 132 const gchar *garcon_menu_node_tree_get_string (GNode *tree); 133 void garcon_menu_node_tree_set_string (GNode *tree, 134 const gchar *value); 135 GarconMenuLayoutMergeType garcon_menu_node_tree_get_layout_merge_type (GNode *tree); 136 GarconMenuMergeFileType garcon_menu_node_tree_get_merge_file_type (GNode *tree); 137 const gchar *garcon_menu_node_tree_get_merge_file_filename (GNode *tree); 138 void garcon_menu_node_tree_set_merge_file_filename (GNode *tree, 139 const gchar *filename); 140 gint garcon_menu_node_tree_compare (GNode *tree, 141 GNode *other_tree); 142 GNode *garcon_menu_node_tree_copy (GNode *tree); 143 void garcon_menu_node_tree_free (GNode *tree); 144 void garcon_menu_node_tree_free_data (GNode *tree); 145 146 147 G_END_DECLS 148 149 #endif /* !__GARCON_MENU_NODE_H__ */ 150