1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
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
22 #include <libanjuta/anjuta-debug.h>
23 #include <libanjuta/interfaces/ianjuta-project-backend.h>
26 #include "dir-project.h"
29 #define ICON_FILE "dir-project-plugin-48.png"
31 /* AnjutaPlugin functions
32 *---------------------------------------------------------------------------*/
35 activate_plugin (AnjutaPlugin
*plugin
)
37 DEBUG_PRINT ("DirProjectPlugin: Activating Anjuta directory backend Plugin ...");
43 deactivate_plugin (AnjutaPlugin
*plugin
)
45 DEBUG_PRINT ("DirProjectPlugin: Deacctivating Anjuta directory backend Plugin ...");
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
);
65 iproject_backend_probe (IAnjutaProjectBackend
* backend
, GFile
*directory
, GError
** err
)
67 DEBUG_PRINT("probe directory project");
69 return dir_project_probe (directory
, err
);
73 iproject_backend_iface_init(IAnjutaProjectBackendIface
*iface
)
75 iface
->new_project
= iproject_backend_new_project
;
76 iface
->probe
= iproject_backend_probe
;
80 *---------------------------------------------------------------------------*/
82 /* Used in dispose and finalize */
83 static gpointer parent_class
;
86 dir_project_plugin_instance_init (GObject
*obj
)
90 /* dispose is used to unref object created with instance_init */
93 dispose (GObject
*obj
)
95 G_OBJECT_CLASS (parent_class
)->dispose (obj
);
98 /* finalize used to free object created with instance init */
101 finalize (GObject
*obj
)
103 G_OBJECT_CLASS (parent_class
)->finalize (obj
);
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
);
126 ANJUTA_SIMPLE_PLUGIN (DirProjectPlugin
, dir_project_plugin
);