1 /*
2  * Copyright 2017 LarsGit223
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef __WB_WORKBENCH_H__
20 #define __WB_WORKBENCH_H__
21 
22 #include <glib.h>
23 #include "wb_project.h"
24 #include "wb_monitor.h"
25 
26 typedef enum
27 {
28 	PROJECT_ENTRY_STATUS_UNKNOWN,
29 	PROJECT_ENTRY_STATUS_OK,
30 	PROJECT_ENTRY_STATUS_NOT_FOUND,
31 }PROJECT_ENTRY_STATUS;
32 
33 typedef struct S_WORKBENCH WORKBENCH;
34 
35 WORKBENCH *workbench_new(void);
36 void workbench_free(WORKBENCH *wb);
37 
38 gboolean workbench_is_empty(WORKBENCH *wb);
39 guint workbench_get_project_count(WORKBENCH *wb);
40 gboolean workbench_is_modified(WORKBENCH *wb);
41 
42 void workbench_set_rescan_projects_on_open(WORKBENCH *wb, gboolean value);
43 gboolean workbench_get_rescan_projects_on_open(WORKBENCH *wb);
44 void workbench_set_enable_live_update(WORKBENCH *wb, gboolean value);
45 gboolean workbench_get_enable_live_update(WORKBENCH *wb);
46 void workbench_set_expand_on_hover(WORKBENCH *wb, gboolean value);
47 gboolean workbench_get_expand_on_hover(WORKBENCH *wb);
48 void workbench_set_enable_tree_lines(WORKBENCH *wb, gboolean value);
49 gboolean workbench_get_enable_tree_lines(WORKBENCH *wb);
50 
51 WB_PROJECT *workbench_get_project_at_index(WORKBENCH *wb, guint index);
52 PROJECT_ENTRY_STATUS workbench_get_project_status_at_index(WORKBENCH *wb, guint index);
53 PROJECT_ENTRY_STATUS workbench_get_project_status_by_address(WORKBENCH *wb, WB_PROJECT *address);
54 gboolean workbench_add_project(WORKBENCH *wb, const gchar *filename);
55 gboolean workbench_remove_project_with_address(WORKBENCH *wb, WB_PROJECT *project);
56 WB_PROJECT *workbench_file_is_included (WORKBENCH *wb, const gchar *filename);
57 
58 void workbench_set_filename(WORKBENCH *wb, const gchar *filename);
59 const gchar *workbench_get_filename(WORKBENCH *wb);
60 gchar *workbench_get_name(WORKBENCH *wb);
61 WB_MONITOR *workbench_get_monitor(WORKBENCH *wb);
62 
63 gboolean workbench_save(WORKBENCH *wb, GError **error);
64 gboolean workbench_load(WORKBENCH *wb, const gchar *filename, GError **error);
65 
66 gboolean workbench_add_bookmark(WORKBENCH *wb, const gchar *filename);
67 gboolean workbench_remove_bookmark(WORKBENCH *wb, const gchar *filename);
68 gchar *workbench_get_bookmark_at_index (WORKBENCH *wb, guint index);
69 guint workbench_get_bookmarks_count(WORKBENCH *wb);
70 
71 void workbench_process_add_file_event(WORKBENCH *wb, WB_PROJECT *prj, WB_PROJECT_DIR *dir, const gchar *file);
72 void workbench_process_remove_file_event(WORKBENCH *wb, WB_PROJECT *prj, WB_PROJECT_DIR *dir, const gchar *file);
73 void workbench_enable_live_update(WORKBENCH *wb);
74 void workbench_disable_live_update(WORKBENCH *wb);
75 
76 #endif
77