3
* Copyright (C) 2015 Christian Hergert <christian@hergert.me>
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
10
* This program 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 General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
#include <girepository.h>
20
#include <glib/gi18n.h>
21
#include <libgit2-glib/ggit.h>
24
#include "gconstructor.h"
27
#include "ide-autotools-build-system.h"
28
#include "ide-autotools-project-miner.h"
29
#include "ide-c-language.h"
30
#include "ide-clang-service.h"
31
#include "ide-ctags-service.h"
32
#include "ide-devhelp-search-provider.h"
33
#include "ide-device-provider.h"
34
#include "ide-directory-build-system.h"
35
#include "ide-directory-vcs.h"
36
#include "ide-editorconfig-file-settings.h"
37
#include "ide-file-settings.h"
38
#include "ide-gca-service.h"
39
#include "ide-git-search-provider.h"
40
#include "ide-git-vcs.h"
41
#include "ide-gjs-script.h"
42
#include "ide-gsettings-file-settings.h"
43
#include "ide-html-language.h"
44
#include "ide-mingw-device-provider.h"
45
#include "ide-modelines-file-settings.h"
46
#include "ide-internal.h"
47
#include "ide-project-miner.h"
48
#include "ide-pygobject-script.h"
49
#include "ide-python-language.h"
50
#include "ide-search-provider.h"
51
#include "ide-vala-language.h"
52
#include "ide-xml-language.h"
54
#include "modeline-parser.h"
56
static gboolean gProgramNameRead;
57
static const gchar *gProgramName = "libide";
59
#if defined (G_HAS_CONSTRUCTORS)
60
# ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
61
# pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(ide_init_ctor)
63
G_DEFINE_CONSTRUCTOR(ide_init_ctor)
65
# error Your platform/compiler is missing constructor support
69
ide_get_program_name (void)
76
ide_set_program_name (const gchar *program_name)
80
g_warning (_("You must call %s() before using libide."), G_STRFUNC);
84
gProgramName = g_intern_string (program_name);
90
GgitFeatureFlags ggit_flags;
92
g_irepository_prepend_search_path (LIBDIR"/gnome-builder/girepository-1.0");
94
g_type_ensure (IDE_TYPE_CONTEXT);
95
g_type_ensure (IDE_TYPE_BUILD_SYSTEM);
96
g_type_ensure (IDE_TYPE_VCS);
98
g_io_extension_point_register (IDE_BUILD_SYSTEM_EXTENSION_POINT);
99
g_io_extension_point_register (IDE_DEVICE_PROVIDER_EXTENSION_POINT);
100
g_io_extension_point_register (IDE_FILE_SETTINGS_EXTENSION_POINT);
101
g_io_extension_point_register (IDE_LANGUAGE_EXTENSION_POINT);
102
g_io_extension_point_register (IDE_PROJECT_MINER_EXTENSION_POINT);
103
g_io_extension_point_register (IDE_SCRIPT_EXTENSION_POINT);
104
g_io_extension_point_register (IDE_SEARCH_PROVIDER_EXTENSION_POINT);
105
g_io_extension_point_register (IDE_SERVICE_EXTENSION_POINT);
106
g_io_extension_point_register (IDE_VCS_EXTENSION_POINT);
108
g_io_extension_point_implement (IDE_BUILD_SYSTEM_EXTENSION_POINT,
109
IDE_TYPE_AUTOTOOLS_BUILD_SYSTEM,
110
IDE_BUILD_SYSTEM_EXTENSION_POINT".autotools",
112
g_io_extension_point_implement (IDE_BUILD_SYSTEM_EXTENSION_POINT,
113
IDE_TYPE_DIRECTORY_BUILD_SYSTEM,
114
IDE_BUILD_SYSTEM_EXTENSION_POINT".directory",
117
g_io_extension_point_implement (IDE_DEVICE_PROVIDER_EXTENSION_POINT,
118
IDE_TYPE_MINGW_DEVICE_PROVIDER,
119
IDE_BUILD_SYSTEM_EXTENSION_POINT".mingw",
122
g_io_extension_point_implement (IDE_FILE_SETTINGS_EXTENSION_POINT,
123
IDE_TYPE_MODELINES_FILE_SETTINGS,
124
IDE_FILE_SETTINGS_EXTENSION_POINT".modelines",
126
g_io_extension_point_implement (IDE_FILE_SETTINGS_EXTENSION_POINT,
127
IDE_TYPE_EDITORCONFIG_FILE_SETTINGS,
128
IDE_FILE_SETTINGS_EXTENSION_POINT".editorconfig",
130
g_io_extension_point_implement (IDE_FILE_SETTINGS_EXTENSION_POINT,
131
IDE_TYPE_GSETTINGS_FILE_SETTINGS,
132
IDE_FILE_SETTINGS_EXTENSION_POINT".gsettings",
135
g_io_extension_point_implement (IDE_LANGUAGE_EXTENSION_POINT,
137
IDE_LANGUAGE_EXTENSION_POINT".c",
139
g_io_extension_point_implement (IDE_LANGUAGE_EXTENSION_POINT,
140
IDE_TYPE_HTML_LANGUAGE,
141
IDE_LANGUAGE_EXTENSION_POINT".html",
143
g_io_extension_point_implement (IDE_LANGUAGE_EXTENSION_POINT,
144
IDE_TYPE_PYTHON_LANGUAGE,
145
IDE_LANGUAGE_EXTENSION_POINT".python",
147
g_io_extension_point_implement (IDE_LANGUAGE_EXTENSION_POINT,
148
IDE_TYPE_XML_LANGUAGE,
149
IDE_LANGUAGE_EXTENSION_POINT".xml",
151
g_io_extension_point_implement (IDE_LANGUAGE_EXTENSION_POINT,
152
IDE_TYPE_VALA_LANGUAGE,
153
IDE_LANGUAGE_EXTENSION_POINT".vala",
156
g_io_extension_point_implement (IDE_PROJECT_MINER_EXTENSION_POINT,
157
IDE_TYPE_AUTOTOOLS_PROJECT_MINER,
158
IDE_PROJECT_MINER_EXTENSION_POINT".autotools",
161
g_io_extension_point_implement (IDE_SCRIPT_EXTENSION_POINT,
163
IDE_SCRIPT_EXTENSION_POINT".gjs",
166
g_io_extension_point_implement (IDE_SCRIPT_EXTENSION_POINT,
167
IDE_TYPE_PYGOBJECT_SCRIPT,
168
IDE_SCRIPT_EXTENSION_POINT".py",
171
g_io_extension_point_implement (IDE_SEARCH_PROVIDER_EXTENSION_POINT,
172
IDE_TYPE_DEVHELP_SEARCH_PROVIDER,
173
IDE_SEARCH_PROVIDER_EXTENSION_POINT".devhelp",
176
g_io_extension_point_implement (IDE_SEARCH_PROVIDER_EXTENSION_POINT,
177
IDE_TYPE_GIT_SEARCH_PROVIDER,
178
IDE_SEARCH_PROVIDER_EXTENSION_POINT".git",
181
g_io_extension_point_implement (IDE_SERVICE_EXTENSION_POINT,
182
IDE_TYPE_CLANG_SERVICE,
183
IDE_SERVICE_EXTENSION_POINT".clang",
185
g_io_extension_point_implement (IDE_SERVICE_EXTENSION_POINT,
186
IDE_TYPE_CTAGS_SERVICE,
187
IDE_SERVICE_EXTENSION_POINT".ctags",
189
g_io_extension_point_implement (IDE_SERVICE_EXTENSION_POINT,
190
IDE_TYPE_GCA_SERVICE,
191
IDE_SERVICE_EXTENSION_POINT".gca",
194
g_io_extension_point_implement (IDE_VCS_EXTENSION_POINT,
196
IDE_VCS_EXTENSION_POINT".git",
198
g_io_extension_point_implement (IDE_VCS_EXTENSION_POINT,
199
IDE_TYPE_DIRECTORY_VCS,
200
IDE_VCS_EXTENSION_POINT".directory",
203
modeline_parser_init ();
207
ggit_flags = ggit_get_features ();
209
if ((ggit_flags & GGIT_FEATURE_THREADS) == 0)
211
g_error (_("Builder requires libgit2-glib with threading support."));
215
if ((ggit_flags & GGIT_FEATURE_SSH) == 0)
217
g_error (_("Builder requires libgit2-glib with SSH support."));
221
_ide_thread_pool_init ();
223
_ide_battery_monitor_init ();