1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
plugin.c
Copyright (C) 2009 Sébastien Granjoux
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/interfaces/ianjuta-project-backend.h>
#include "plugin.h"
#include "dir-project.h"
#define ICON_FILE "dir-project-plugin-48.png"
/* AnjutaPlugin functions
*---------------------------------------------------------------------------*/
static gboolean
activate_plugin (AnjutaPlugin *plugin)
{
DEBUG_PRINT ("DirProjectPlugin: Activating Anjuta directory backend Plugin ...");
return TRUE;
}
static gboolean
deactivate_plugin (AnjutaPlugin *plugin)
{
DEBUG_PRINT ("DirProjectPlugin: Deacctivating Anjuta directory backend Plugin ...");
return TRUE;
}
/* IAnjutaProjectBackend implementation
*---------------------------------------------------------------------------*/
static IAnjutaProject*
iproject_backend_new_project (IAnjutaProjectBackend* backend, GFile *file, GError** err)
{
IAnjutaProject *project;
DEBUG_PRINT("create new directory project");
project = (IAnjutaProject *)dir_project_new (file, err);
return project;
}
static gint
iproject_backend_probe (IAnjutaProjectBackend* backend, GFile *directory, GError** err)
{
DEBUG_PRINT("probe directory project");
return dir_project_probe (directory, err);
}
static void
iproject_backend_iface_init(IAnjutaProjectBackendIface *iface)
{
iface->new_project = iproject_backend_new_project;
iface->probe = iproject_backend_probe;
}
/* GObject functions
*---------------------------------------------------------------------------*/
/* Used in dispose and finalize */
static gpointer parent_class;
static void
dir_project_plugin_instance_init (GObject *obj)
{
}
/* dispose is used to unref object created with instance_init */
static void
dispose (GObject *obj)
{
G_OBJECT_CLASS (parent_class)->dispose (obj);
}
/* finalize used to free object created with instance init */
static void
finalize (GObject *obj)
{
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
static void
dir_project_plugin_class_init (GObjectClass *klass)
{
AnjutaPluginClass *plugin_class = ANJUTA_PLUGIN_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
plugin_class->activate = activate_plugin;
plugin_class->deactivate = deactivate_plugin;
klass->dispose = dispose;
klass->finalize = finalize;
}
/* AnjutaPlugin declaration
*---------------------------------------------------------------------------*/
ANJUTA_PLUGIN_BEGIN (DirProjectPlugin, dir_project_plugin);
ANJUTA_PLUGIN_ADD_INTERFACE (iproject_backend, IANJUTA_TYPE_PROJECT_BACKEND);
ANJUTA_PLUGIN_END;
ANJUTA_SIMPLE_PLUGIN (DirProjectPlugin, dir_project_plugin);
|