Initial German translation of the build tutorial
[anjuta.git] / plugins / am-project / plugin.c
blob0b3fc87a8cbe8ff9985bc7905f1265c6d5471e90
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3 plugin.c
4 Copyright (C) 2008 Sébastien Granjoux
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.
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.
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
21 #include <config.h>
22 #include <libanjuta/anjuta-debug.h>
23 #include <libanjuta/interfaces/ianjuta-project-backend.h>
25 #include "plugin.h"
26 #include "am-project.h"
29 #define ICON_FILE "am-project-plugin-48.png"
31 /* AnjutaPlugin functions
32 *---------------------------------------------------------------------------*/
34 static gboolean
35 activate_plugin (AnjutaPlugin *plugin)
37 DEBUG_PRINT ("AmpPlugin: Activating Anjuta am backend Plugin ...");
39 return TRUE;
42 static gboolean
43 deactivate_plugin (AnjutaPlugin *plugin)
45 DEBUG_PRINT ("AmpPlugin: Deacctivating Anjuta am backend Plugin ...");
46 return TRUE;
50 /* IAnjutaProjectBackend implementation
51 *---------------------------------------------------------------------------*/
53 static IAnjutaProject*
54 iproject_backend_new_project (IAnjutaProjectBackend* backend, GFile *file, GError** err)
56 IAnjutaProject *project;
57 IAnjutaLanguage* langman;
59 DEBUG_PRINT("create new amp project");
61 langman = anjuta_shell_get_interface (ANJUTA_PLUGIN (backend)->shell, IAnjutaLanguage, NULL);
62 project = (IAnjutaProject *)amp_project_new (file, langman, err);
64 return project;
67 static gint
68 iproject_backend_probe (IAnjutaProjectBackend* backend, GFile *directory, GError** err)
70 DEBUG_PRINT("probe amp project");
72 return amp_project_probe (directory, err);
75 static void
76 iproject_backend_iface_init(IAnjutaProjectBackendIface *iface)
78 iface->new_project = iproject_backend_new_project;
79 iface->probe = iproject_backend_probe;
82 /* GObject functions
83 *---------------------------------------------------------------------------*/
85 /* Used in dispose and finalize */
86 static gpointer parent_class;
88 static void
89 amp_plugin_instance_init (GObject *obj)
93 /* dispose is used to unref object created with instance_init */
95 static void
96 dispose (GObject *obj)
98 G_OBJECT_CLASS (parent_class)->dispose (obj);
101 /* finalize used to free object created with instance init */
103 static void
104 finalize (GObject *obj)
106 G_OBJECT_CLASS (parent_class)->finalize (obj);
109 static void
110 amp_plugin_class_init (GObjectClass *klass)
112 AnjutaPluginClass *plugin_class = ANJUTA_PLUGIN_CLASS (klass);
114 parent_class = g_type_class_peek_parent (klass);
116 plugin_class->activate = activate_plugin;
117 plugin_class->deactivate = deactivate_plugin;
118 klass->dispose = dispose;
119 klass->finalize = finalize;
122 /* AnjutaPlugin declaration
123 *---------------------------------------------------------------------------*/
125 ANJUTA_PLUGIN_BEGIN (AmpPlugin, amp_plugin);
126 ANJUTA_PLUGIN_ADD_INTERFACE (iproject_backend, IANJUTA_TYPE_PROJECT_BACKEND);
127 amp_project_register (module);
128 ANJUTA_PLUGIN_END;
130 ANJUTA_SIMPLE_PLUGIN (AmpPlugin, amp_plugin);