1 /* 2 Kickshaw - A Menu Editor for Openbox 3 4 Copyright (c) 2010–2018 Marcus Schätzle 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License along 17 with Kickshaw. If not, see http://www.gnu.org/licenses/. 18 */ 19 20 #ifndef __definitions_and_enumerations_h 21 #define __definitions_and_enumerations_h 22 23 // action option combo 24 enum { ACTION_OPTION_COMBO_ITEM, NUMBER_OF_ACTION_OPTION_COMBO_ELEMENTS }; 25 // new action option grid/table widgets 26 enum { INSIDE_MENU_LABEL, INSIDE_MENU_CHECK_BUTTON, INCLUDING_ACTION_LABEL, INCLUDING_ACTION_CHECK_BUTTON, 27 NEW_ACTION_OPTION_COMBO_BOX, ACTION_OPTION_DONE, ACTION_OPTION_CANCEL, NUMBER_OF_NEW_ACTION_OPTION_WIDGETS }; 28 // actions 29 enum { EXECUTE, EXIT, RECONFIGURE, RESTART, SESSIONLOGOUT, NUMBER_OF_ACTIONS }; 30 // add buttons 31 enum { MENU, PIPE_MENU, ITEM, SEPARATOR, ACTION_OR_OPTION, NUMBER_OF_ADD_BUTTONS }; 32 // ancestor visibility 33 enum { NONE_OR_VISIBLE_ANCESTOR, INVISIBLE_ANCESTOR, INVISIBLE_ORPHANED_ANCESTOR }; 34 // columns 35 enum { COL_MENU_ELEMENT, COL_TYPE, COL_VALUE, COL_MENU_ID, COL_EXECUTE, COL_ELEMENT_VISIBILITY, NUMBER_OF_COLUMNS }; 36 // entry fields 37 enum { MENU_ELEMENT_ENTRY, ICON_PATH_ENTRY, MENU_ID_OR_VALUE_ENTRY, EXECUTE_ENTRY, NUMBER_OF_ENTRY_FIELDS }; 38 // execute options 39 enum { PROMPT, COMMAND, STARTUPNOTIFY, SN_OR_PROMPT = 2, NUMBER_OF_EXECUTE_OPTS }; 40 // expansion statuses 41 enum { AT_LEAST_ONE_IS_EXPANDED, AT_LEAST_ONE_IMD_CH_IS_EXP, AT_LEAST_ONE_IS_COLLAPSED, NUMBER_OF_EXPANSION_STATUSES }; 42 // find entry buttons 43 enum { CLOSE, BACK, FORWARD, NUMBER_OF_FIND_ENTRY_BUTTONS }; 44 // invalid icon images 45 enum { INVALID_PATH_ICON, INVALID_FILE_ICON, NUMBER_OF_INVALID_ICON_IMGS }; 46 // invalid icon image statuses 47 enum { NONE_OR_NORMAL, INVALID_PATH, INVALID_FILE }; 48 // menu bar items file and edit 49 enum { MB_NEW, MB_OPEN, MB_SAVE, MB_SAVE_AS, MB_SEPARATOR_FILE, MB_QUIT, NUMBER_OF_FILE_MENU_ITEMS}; 50 enum { MB_MOVE_TOP, MB_MOVE_UP, MB_MOVE_DOWN, MB_MOVE_BOTTOM, MB_SEPARATOR_EDIT1, MB_REMOVE, MB_REMOVE_ALL_CHILDREN, 51 MB_SEPARATOR_EDIT2, MB_VISUALISE, MB_VISUALISE_RECURSIVELY, NUMBER_OF_EDIT_MENU_ITEMS }; 52 // menu bar items view and options 53 enum { SHOW_MENU_ID_COL, SHOW_EXECUTE_COL, SHOW_ELEMENT_VISIBILITY_COL_ACTVTD, SHOW_ELEMENT_VISIBILITY_COL_KEEP_HIGHL, 54 SHOW_ELEMENT_VISIBILITY_COL_DONT_KEEP_HIGHL, SHOW_ICONS, SET_OFF_SEPARATORS, DRAW_ROWS_IN_ALT_COLOURS, 55 SHOW_TREE_LINES, NO_GRID_LINES, SHOW_GRID_HOR, SHOW_GRID_VER, BOTH, CREATE_BACKUP_BEFORE_OVERWRITING_MENU, 56 SORT_EXECUTE_AND_STARTUPN_OPTIONS, NOTIFY_ABOUT_EXECUTE_OPT_CONVERSIONS, NUMBER_OF_VIEW_AND_OPTIONS }; 57 // move row 58 enum { TOP, UP, DOWN, BOTTOM }; 59 // startupnotify options 60 enum { ENABLED, NAME, WM_CLASS, ICON, NUMBER_OF_STARTUPNOTIFY_OPTS }; 61 // toolbar buttons 62 enum { TB_NEW, TB_OPEN, TB_SAVE, TB_SAVE_AS, TB_MOVE_UP, TB_MOVE_DOWN, TB_REMOVE, 63 TB_FIND, TB_EXPAND_ALL, TB_COLLAPSE_ALL, TB_QUIT, NUMBER_OF_TB_BUTTONS }; 64 // treestore elements 65 enum { TS_ICON_IMG, TS_ICON_IMG_STATUS, TS_ICON_MODIFICATION_TIME, TS_ICON_PATH, TS_MENU_ELEMENT, 66 TS_TYPE, TS_VALUE, TS_MENU_ID, TS_EXECUTE, TS_ELEMENT_VISIBILITY, NUMBER_OF_TS_ELEMENTS }; 67 // text fields 68 enum { ICON_PATH_TXT, MENU_ELEMENT_TXT, TYPE_TXT, VALUE_TXT, MENU_ID_TXT, 69 EXECUTE_TXT, ELEMENT_VISIBILITY_TXT, NUMBER_OF_TXT_FIELDS }; 70 // renderer for treeview 71 enum { TXT_RENDERER, EXCL_TXT_RENDERER, PIXBUF_RENDERER, BOOL_RENDERER, NUMBER_OF_RENDERERS }; 72 // for highlighting of entry borders 73 enum { MENU_ELEMENT_ENTRY_HL, ICON_PATH_ENTRY_HL, MENU_ID_OR_VALUE_ENTRY_HL, EXECUTE_ENTRY_HL, FIND_ENTRY_HL, 74 PROMPT_ENTRY_HL, COMMAND_ENTRY_HL, NAME_ENTRY_HL, WM_CLASS_ENTRY_HL, ICON_ENTRY_HL, NUMBER_OF_HIGHLIGHTED_WIDGETS }; 75 enum { EVENTBOX, ALIGNMENT, NUMBER_OF_SUBWIDGETS_FOR_HIGHLIGHTING }; 76 77 #define KICKSHAW_VERSION "0.5.26" 78 #define TREEVIEW_COLUMN_OFFSET NUMBER_OF_TS_ELEMENTS - NUMBER_OF_COLUMNS 79 #define FREE_AND_REASSIGN(string, new_value) { g_free (string); string = new_value; } 80 #define NOT_NULL_AND_NOT_EMPTY(string) (string && *string) 81 #define STREQ(string1, string2) (g_strcmp0 ((string1), (string2)) == 0) 82 83 typedef struct { 84 gchar *lock_file_path; 85 FILE *lock_file; 86 87 GtkWidget *window; 88 GtkWidget *subbox; 89 90 GtkWidget *mb_file_menu_items[NUMBER_OF_FILE_MENU_ITEMS]; 91 GtkWidget *mb_edit; 92 GtkWidget *mb_edit_menu_items[NUMBER_OF_EDIT_MENU_ITEMS]; 93 GtkWidget *mb_search; 94 GtkWidget *mb_expand_all_nodes, *mb_collapse_all_nodes; 95 GtkWidget *mb_options; 96 97 GtkWidget *mb_view_and_options[NUMBER_OF_VIEW_AND_OPTIONS]; 98 #if !(GTK_CHECK_VERSION(2,16,0)) 99 gchar *menu_item_txts[NUMBER_OF_VIEW_AND_OPTIONS]; 100 #endif 101 102 GtkToolItem *tb[NUMBER_OF_TB_BUTTONS]; 103 104 GtkWidget *button_box; 105 GtkWidget *add_image; 106 GtkWidget *bt_bar_label; 107 GtkWidget *bt_add[NUMBER_OF_ADD_BUTTONS]; 108 GtkWidget *bt_add_action_option_label; 109 110 GtkWidget *change_values_label; 111 112 GtkWidget *action_option_box, *action_option_box_alignment; 113 GtkWidget *new_action_option_table, *new_action_option_table_alignment; 114 GtkWidget *new_action_option_widgets[NUMBER_OF_NEW_ACTION_OPTION_WIDGETS]; 115 GtkListStore *action_option_combo_box_liststore; 116 GtkTreeModel *action_option_combo_box_model; 117 GtkWidget *mandatory, *mandatory_alignment; 118 GtkWidget *options_table; 119 GtkWidget *suboptions_table, *suboptions_table_alignment; 120 gchar *options_label_txts[NUMBER_OF_EXECUTE_OPTS]; 121 GtkWidget *options_labels[NUMBER_OF_EXECUTE_OPTS], *options_fields[NUMBER_OF_EXECUTE_OPTS]; 122 GtkWidget *suboptions_labels[NUMBER_OF_STARTUPNOTIFY_OPTS], *suboptions_fields[NUMBER_OF_STARTUPNOTIFY_OPTS]; 123 124 gchar *actions[NUMBER_OF_ACTIONS]; 125 gchar *execute_options[NUMBER_OF_EXECUTE_OPTS]; 126 gchar *execute_displayed_txts[NUMBER_OF_EXECUTE_OPTS]; 127 128 gchar *startupnotify_options[NUMBER_OF_STARTUPNOTIFY_OPTS]; 129 gchar *startupnotify_displayed_txts[NUMBER_OF_STARTUPNOTIFY_OPTS]; 130 131 GtkWidget *separator_change_values_label_top, *separator_change_values_label_bottom; 132 GtkWidget *separator_change_values_buttons_box, *change_values_buttons_box; 133 134 GtkWidget *find_box; 135 GtkWidget *find_entry_buttons[NUMBER_OF_FIND_ENTRY_BUTTONS]; 136 GtkWidget *find_entry; 137 GtkWidget *find_in_columns[NUMBER_OF_COLUMNS - 1], *find_in_all_columns; 138 GtkWidget *find_match_case, *find_regular_expression; 139 GString *search_term; // = automatically NULL 140 GList *rows_with_found_occurrences; // = automatically NULL 141 142 GtkWidget *treeview; 143 GtkTreeStore *treestore; 144 GtkTreeModel *model; 145 GtkTreeIter iter; 146 gchar *column_header_txts[NUMBER_OF_COLUMNS]; 147 GtkTreeViewColumn *columns[NUMBER_OF_COLUMNS]; 148 GtkCellRenderer *renderers[NUMBER_OF_RENDERERS]; 149 150 gchar *txt_fields[NUMBER_OF_TXT_FIELDS]; // = automatically NULL 151 152 GtkTargetEntry enable_list[3]; 153 154 GtkWidget *entry_table; 155 GtkWidget *entry_labels[NUMBER_OF_ENTRY_FIELDS], *entry_fields[NUMBER_OF_ENTRY_FIELDS]; 156 GtkWidget *icon_chooser, *remove_icon; 157 GtkWidget *icon_buttons_box, *icon_box; 158 159 GtkWidget *highlighted_widgets[NUMBER_OF_HIGHLIGHTED_WIDGETS][NUMBER_OF_SUBWIDGETS_FOR_HIGHLIGHTING]; 160 GdkColor bg_normal_entry_eventbox; 161 162 GSList *source_paths; // = automatically NULL 163 164 GSList *change_values_user_settings; // = automatically NULL 165 166 GtkWidget *statusbar; 167 gboolean statusbar_msg_shown; // = automatically FALSE 168 #if !(GTK_CHECK_VERSION(2,22,0)) 169 guint message_ID; 170 #endif 171 172 gchar *icon_theme_name; // = automatically NULL 173 gchar *font_desc; 174 guint font_size; // = automatically 0 175 176 GdkPixbuf *invalid_icon_imgs[NUMBER_OF_INVALID_ICON_IMGS]; // = automatically NULL 177 178 gchar *filename; // = automatically NULL 179 180 // = automatically NULL 181 GSList *menu_ids; 182 GSList *rows_with_icons; 183 184 gboolean change_done; // = automatically FALSE 185 gboolean autosort_options; // = automatically FALSE 186 187 gint handler_id_row_selected, 188 handler_id_action_option_combo_box, handler_id_action_option_button_clicked, 189 handler_id_show_or_hide_startupnotify_options, 190 handler_id_find_in_columns[NUMBER_OF_COLUMNS], 191 handler_id_entry_fields[NUMBER_OF_ENTRY_FIELDS], 192 handler_id_including_action_check_button; 193 } ks_data; 194 195 #endif 196