configure: fix build of vala plugin
[anjuta.git] / plugins / dir-project / plugin.c
bloba69e7e9f7fb0a7745e7dec5efa00aee40d8bbcc2
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3 plugin.c
4 Copyright (C) 2009 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 "dir-project.h"
29 #define ICON_FILE "dir-project-plugin-48.png"
31 /* AnjutaPlugin functions
32 *---------------------------------------------------------------------------*/
34 static gboolean
35 activate_plugin (AnjutaPlugin *plugin)
37 DEBUG_PRINT ("DirProjectPlugin: Activating Anjuta directory backend Plugin ...");
39 return TRUE;
42 static gboolean
43 deactivate_plugin (AnjutaPlugin *plugin)
45 DEBUG_PRINT ("DirProjectPlugin: Deacctivating Anjuta directory 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 DEBUG_PRINT("create new directory project");
59 project = (IAnjutaProject *)dir_project_new (file, err);
61 return project;
64 static gint
65 iproject_backend_probe (IAnjutaProjectBackend* backend, GFile *directory, GError** err)
67 DEBUG_PRINT("probe directory project");
69 return dir_project_probe (directory, err);
72 static void
73 iproject_backend_iface_init(IAnjutaProjectBackendIface *iface)
75 iface->new_project = iproject_backend_new_project;
76 iface->probe = iproject_backend_probe;
79 /* GObject functions
80 *---------------------------------------------------------------------------*/
82 /* Used in dispose and finalize */
83 static gpointer parent_class;
85 static void
86 dir_project_plugin_instance_init (GObject *obj)
90 /* dispose is used to unref object created with instance_init */
92 static void
93 dispose (GObject *obj)
95 G_OBJECT_CLASS (parent_class)->dispose (obj);
98 /* finalize used to free object created with instance init */
100 static void
101 finalize (GObject *obj)
103 G_OBJECT_CLASS (parent_class)->finalize (obj);
106 static void
107 dir_project_plugin_class_init (GObjectClass *klass)
109 AnjutaPluginClass *plugin_class = ANJUTA_PLUGIN_CLASS (klass);
111 parent_class = g_type_class_peek_parent (klass);
113 plugin_class->activate = activate_plugin;
114 plugin_class->deactivate = deactivate_plugin;
115 klass->dispose = dispose;
116 klass->finalize = finalize;
119 /* AnjutaPlugin declaration
120 *---------------------------------------------------------------------------*/
122 ANJUTA_PLUGIN_BEGIN (DirProjectPlugin, dir_project_plugin);
123 ANJUTA_PLUGIN_ADD_INTERFACE (iproject_backend, IANJUTA_TYPE_PROJECT_BACKEND);
124 ANJUTA_PLUGIN_END;
126 ANJUTA_SIMPLE_PLUGIN (DirProjectPlugin, dir_project_plugin);