snippet-manager: Basic export feature done.
[anjuta.git] / plugins / dir-project / plugin.c
blobab9d8d6e540dfd6a56073c0ddf7aa2839a780576
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/gbf-project.h>
24 #include <libanjuta/interfaces/ianjuta-project-backend.h>
26 #include "plugin.h"
27 #include "dir-project.h"
30 #define ICON_FILE "dir-project-plugin-48.png"
32 /* AnjutaPlugin functions
33 *---------------------------------------------------------------------------*/
35 static gboolean
36 activate_plugin (AnjutaPlugin *plugin)
38 DEBUG_PRINT ("DirProjectPlugin: Activating Anjuta directory backend Plugin ...");
40 return TRUE;
43 static gboolean
44 deactivate_plugin (AnjutaPlugin *plugin)
46 DEBUG_PRINT ("DirProjectPlugin: Deacctivating Anjuta directory backend Plugin ...");
47 return TRUE;
51 /* IAnjutaProjectBackend implementation
52 *---------------------------------------------------------------------------*/
54 static IAnjutaProject*
55 iproject_backend_new_project (IAnjutaProjectBackend* backend, GError** err)
57 IAnjutaProject *project;
58 DEBUG_PRINT("create new directory project");
59 project = (IAnjutaProject *)(g_object_new (DIR_TYPE_PROJECT, NULL));
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);