1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3     plugin.h
4     Copyright (C) 2000 Naba Kumar
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
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19 */
20 
21 #ifndef __PLUGIN_H__
22 #define __PLUGIN_H__
23 
24 #include <libanjuta/anjuta-plugin.h>
25 #include <libanjuta/interfaces/ianjuta-buildable.h>
26 #include <libanjuta/interfaces/ianjuta-editor.h>
27 
28 #include "configuration-list.h"
29 #include "program.h"
30 
31 #define BUILDER_FILE PACKAGE_DATA_DIR "/glade/anjuta-build-basic-autotools-plugin.ui"
32 
33 extern GType basic_autotools_plugin_get_type (GTypeModule *module);
34 #define ANJUTA_TYPE_PLUGIN_BASIC_AUTOTOOLS         (basic_autotools_plugin_get_type (NULL))
35 #define ANJUTA_PLUGIN_BASIC_AUTOTOOLS(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJUTA_TYPE_PLUGIN_BASIC_AUTOTOOLS, BasicAutotoolsPlugin))
36 #define ANJUTA_PLUGIN_BASIC_AUTOTOOLS_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), ANJUTA_TYPE_PLUGIN_BASIC_AUTOTOOLS, BasicAutotoolsPluginClass))
37 #define ANJUTA_IS_PLUGIN_BASIC_AUTOTOOLS(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJUTA_TYPE_PLUGIN_BASIC_AUTOTOOLS))
38 #define ANJUTA_IS_PLUGIN_BASIC_AUTOTOOLS_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), ANJUTA_TYPE_PLUGIN_BASIC_AUTOTOOLS))
39 #define ANJUTA_PLUGIN_BASIC_AUTOTOOLS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ANJUTA_TYPE_PLUGIN_BASIC_AUTOTOOLS, BasicAutotoolsPluginClass))
40 
41 typedef struct _BasicAutotoolsPlugin BasicAutotoolsPlugin;
42 typedef struct _BasicAutotoolsPluginClass BasicAutotoolsPluginClass;
43 
44 struct _BasicAutotoolsPlugin{
45 	AnjutaPlugin parent;
46 
47 	/* Build contexts pool */
48 	GList *contexts_pool;
49 
50 	/* Watch IDs */
51 	gint fm_watch_id;
52 	gint pm_watch_id;
53 	gint project_root_watch_id;
54 	gint project_build_watch_id;
55 	gint editor_watch_id;
56 
57 	/* GSource ids */
58 	guint update_indicators_idle;
59 
60 	/* Watched values */
61 	GFile *fm_current_file;
62 	GFile *pm_current_file;
63 	GFile *current_editor_file;
64 	GFile *project_root_dir;
65 	GFile *project_build_dir;
66 	IAnjutaEditor *current_editor;
67 
68 	/* UI */
69 	gint build_merge_id;
70 	GtkActionGroup *build_action_group;
71 	GtkActionGroup *build_popup_action_group;
72 	GtkWidget *configuration_menu;
73 
74 	/* commands overrides */
75 	gchar *commands[IANJUTA_BUILDABLE_N_COMMANDS];
76 
77 	/* Build parameters */
78 	BuildConfigurationList *configurations;
79 
80 	/* Execution parameters */
81 	gchar *program_args;
82 	gboolean run_in_terminal;
83 	gchar *last_exec_uri;
84 
85 	/* Editors that have been created so far */
86 	GHashTable *editors_created;
87 
88 	/* Settings */
89 	GSettings *settings;
90 };
91 
92 struct _BasicAutotoolsPluginClass{
93 	AnjutaPluginClass parent_class;
94 };
95 
96 typedef struct _BuildContext BuildContext;
97 
98 BuildContext* build_get_context (BasicAutotoolsPlugin *plugin, const gchar *dir, gboolean with_view, gboolean check_passwd);
99 void build_context_destroy (BuildContext *context);
100 
101 void build_set_command_in_context (BuildContext* context, BuildProgram *prog);
102 gboolean build_execute_command_in_context (BuildContext* context, GError **err);
103 gboolean build_save_and_execute_command_in_context (BuildContext* context, GError **err);
104 const gchar *build_context_get_work_dir (BuildContext* context);
105 AnjutaPlugin *build_context_get_plugin (BuildContext* context);
106 
107 
108 void build_update_configuration_menu (BasicAutotoolsPlugin *plugin);
109 
110 #endif
111