4 * Copyright (C) 2002-2005 - Paolo Maggi
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, or (at your option)
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 St, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include <string.h> /* For strlen */
26 #include <glib/gi18n-lib.h>
30 #include <glib-object.h>
32 #include "rb-plugin.h"
35 #include "rb-dialog.h"
38 #define RB_TYPE_SAMPLE_PLUGIN (rb_sample_plugin_get_type ())
39 #define RB_SAMPLE_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_SAMPLE_PLUGIN, RBSamplePlugin))
40 #define RB_SAMPLE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_SAMPLE_PLUGIN, RBSamplePluginClass))
41 #define RB_IS_SAMPLE_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_SAMPLE_PLUGIN))
42 #define RB_IS_SAMPLE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_SAMPLE_PLUGIN))
43 #define RB_SAMPLE_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_SAMPLE_PLUGIN, RBSamplePluginClass))
48 } RBSamplePluginPrivate
;
53 RBSamplePluginPrivate
*priv
;
58 RBPluginClass parent_class
;
59 } RBSamplePluginClass
;
62 G_MODULE_EXPORT GType
register_rb_plugin (GTypeModule
*module
);
63 GType
rb_sample_plugin_get_type (void) G_GNUC_CONST
;
67 static void rb_sample_plugin_init (RBSamplePlugin
*plugin
);
68 static void rb_sample_plugin_finalize (GObject
*object
);
69 static void impl_activate (RBPlugin
*plugin
, RBShell
*shell
);
70 static void impl_deactivate (RBPlugin
*plugin
, RBShell
*shell
);
72 RB_PLUGIN_REGISTER(RBSamplePlugin
, rb_sample_plugin
)
73 #define RB_SAMPLE_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), RB_TYPE_SAMPLE_PLUGIN, RBSamplePluginPrivate))
77 rb_sample_plugin_class_init (RBSamplePluginClass
*klass
)
79 GObjectClass
*object_class
= G_OBJECT_CLASS (klass
);
80 RBPluginClass
*plugin_class
= RB_PLUGIN_CLASS (klass
);
82 object_class
->finalize
= rb_sample_plugin_finalize
;
84 plugin_class
->activate
= impl_activate
;
85 plugin_class
->deactivate
= impl_deactivate
;
87 g_type_class_add_private (object_class
, sizeof (RBSamplePluginPrivate
));
91 rb_sample_plugin_init (RBSamplePlugin
*plugin
)
93 plugin
->priv
= RB_SAMPLE_PLUGIN_GET_PRIVATE (plugin
);
95 rb_debug ("RBSamplePlugin initialising");
99 rb_sample_plugin_finalize (GObject
*object
)
102 RBSamplePlugin *plugin = RB_SAMPLE_PLUGIN (object);
104 rb_debug ("RBSamplePlugin finalising");
106 G_OBJECT_CLASS (rb_sample_plugin_parent_class
)->finalize (object
);
112 impl_activate (RBPlugin
*plugin
,
115 rb_error_dialog (NULL
, _("Sample Plugin"), "Sample plugin activated, with shell %p", shell
);
119 impl_deactivate (RBPlugin
*plugin
,
122 rb_error_dialog (NULL
, _("Sample Plugin"), "Sample plugin deactivated");