[vinagre] Vinagre Plugin Support
- From: Jonh Wendell <jwendell src gnome org>
- To: svn-commits-list gnome org
- Subject: [vinagre] Vinagre Plugin Support
- Date: Mon, 27 Jul 2009 12:01:26 +0000 (UTC)
commit 7cb774ad6ae55bd562685094a27d6d196b7d5677
Author: Jorge Pereira <jpereira gnome org>
Date: Mon Jul 6 23:52:14 2009 -0300
Vinagre Plugin Support
vinagre/vinagre-enums.c | 30 ++++
vinagre/vinagre-enums.h | 18 ++
vinagre/vinagre-object-module.c | 343 ++++++++++++++++++++++++++++++++++++++
vinagre/vinagre-object-module.h | 94 +++++++++++
vinagre/vinagre-plugin-info.h | 52 ++++++
vinagre/vinagre-plugin.h | 230 +++++++++++++++++++++++++
vinagre/vinagre-plugins-engine.c | 144 ++++++++--------
vinagre/vinagre-utils.c | 13 ++
vinagre/vinagre-utils.h | 2 +
9 files changed, 854 insertions(+), 72 deletions(-)
---
diff --git a/vinagre/vinagre-enums.c b/vinagre/vinagre-enums.c
new file mode 100644
index 0000000..df69d8b
--- /dev/null
+++ b/vinagre/vinagre-enums.c
@@ -0,0 +1,30 @@
+
+/* Generated data (by glib-mkenums) */
+
+#include <glib-object.h>
+#include "vinagre-enums.h"
+
+
+/* enumerations from "../vinagre/vinagre-connection.h" */
+#include "../vinagre/vinagre-connection.h"
+static const GEnumValue _vinagre_connection_protocol_values[] = {
+ { VINAGRE_CONNECTION_PROTOCOL_VNC, "VINAGRE_CONNECTION_PROTOCOL_VNC", "vnc" },
+ { VINAGRE_CONNECTION_PROTOCOL_RDP, "VINAGRE_CONNECTION_PROTOCOL_RDP", "rdp" },
+ { VINAGRE_CONNECTION_PROTOCOL_INVALID, "VINAGRE_CONNECTION_PROTOCOL_INVALID", "invalid" },
+ { 0, NULL, NULL }
+};
+
+GType
+vinagre_connection_protocol_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type)
+ type = g_enum_register_static ("VinagreConnectionProtocol", _vinagre_connection_protocol_values);
+
+ return type;
+}
+
+
+/* Generated data ends here */
+
diff --git a/vinagre/vinagre-enums.h b/vinagre/vinagre-enums.h
new file mode 100644
index 0000000..eb1f3be
--- /dev/null
+++ b/vinagre/vinagre-enums.h
@@ -0,0 +1,18 @@
+
+/* Generated data (by glib-mkenums) */
+
+#ifndef __VINAGRE_ENUMS_H__
+#define __VINAGRE_ENUMS_H__ 1
+
+G_BEGIN_DECLS
+
+
+/* --- ../vinagre/vinagre-connection.h --- */
+#define VINAGRE_TYPE_CONNECTION_PROTOCOL vinagre_connection_protocol_get_type()
+GType vinagre_connection_protocol_get_type (void);
+G_END_DECLS
+
+#endif /* __VINAGRE_ENUMS_H__ */
+
+/* Generated data ends here */
+
diff --git a/vinagre/vinagre-object-module.c b/vinagre/vinagre-object-module.c
new file mode 100644
index 0000000..36a0bfb
--- /dev/null
+++ b/vinagre/vinagre-object-module.c
@@ -0,0 +1,343 @@
+/*
+ * vinagre-object-module.c
+ * This file is part of vinagre
+ *
+ * Copyright (C) 2005 - Paolo Maggi
+ * Copyright (C) 2008 - Jesse van den Kieboom
+ *
+ * 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., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* This is a modified version of ephy-module.c from Epiphany source code.
+ * Here the original copyright assignment:
+ *
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ * Copyright (C) 2003, 2004 Christian Persch
+ *
+ */
+
+/*
+ * Modified by the vinagre Team, 2005. See the AUTHORS file for a
+ * list of people on the vinagre Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id: vinagre-module.c 6314 2008-06-05 12:57:53Z pborelli $
+ */
+
+#include "config.h"
+
+#include "vinagre-object-module.h"
+#include "vinagre-debug.h"
+
+typedef GType (*VinagreObjectModuleRegisterFunc) (GTypeModule *);
+
+enum {
+ PROP_0,
+ PROP_MODULE_NAME,
+ PROP_PATH,
+ PROP_TYPE_REGISTRATION,
+ PROP_RESIDENT
+};
+
+struct _VinagreObjectModulePrivate
+{
+ GModule *library;
+
+ GType type;
+ gchar *path;
+ gchar *module_name;
+ gchar *type_registration;
+
+ gboolean resident;
+};
+
+G_DEFINE_TYPE (VinagreObjectModule, vinagre_object_module, G_TYPE_TYPE_MODULE);
+
+static gboolean
+vinagre_object_module_load (GTypeModule *gmodule)
+{
+ VinagreObjectModule *module = VINAGRE_OBJECT_MODULE (gmodule);
+ VinagreObjectModuleRegisterFunc register_func;
+ gchar *path;
+
+ vinagre_debug_message (DEBUG_PLUGINS, "Loading %s module from %s",
+ module->priv->module_name, module->priv->path);
+
+ path = g_module_build_path (module->priv->path, module->priv->module_name);
+ g_return_val_if_fail (path != NULL, FALSE);
+ vinagre_debug_message (DEBUG_PLUGINS, "Module filename: %s", path);
+
+ module->priv->library = g_module_open (path,
+ G_MODULE_BIND_LAZY);
+ g_free (path);
+
+ if (module->priv->library == NULL)
+ {
+ g_warning ("%s: %s", module->priv->module_name, g_module_error());
+
+ return FALSE;
+ }
+
+ /* extract symbols from the lib */
+ if (!g_module_symbol (module->priv->library, module->priv->type_registration,
+ (void *) ®ister_func))
+ {
+ g_warning ("%s: %s", module->priv->module_name, g_module_error());
+ g_module_close (module->priv->library);
+
+ return FALSE;
+ }
+
+ /* symbol can still be NULL even though g_module_symbol
+ * returned TRUE */
+ if (register_func == NULL)
+ {
+ g_warning ("Symbol '%s' should not be NULL", module->priv->type_registration);
+ g_module_close (module->priv->library);
+
+ return FALSE;
+ }
+
+ module->priv->type = register_func (gmodule);
+
+ if (module->priv->type == 0)
+ {
+ g_warning ("Invalid object contained by module %s", module->priv->module_name);
+ return FALSE;
+ }
+
+ if (module->priv->resident)
+ {
+ g_module_make_resident (module->priv->library);
+ }
+
+ return TRUE;
+}
+
+static void
+vinagre_object_module_unload (GTypeModule *gmodule)
+{
+ VinagreObjectModule *module = VINAGRE_OBJECT_MODULE (gmodule);
+
+ vinagre_debug_message (DEBUG_PLUGINS, "Unloading %s", module->priv->path);
+
+ g_module_close (module->priv->library);
+
+ module->priv->library = NULL;
+ module->priv->type = 0;
+}
+
+static void
+vinagre_object_module_init (VinagreObjectModule *module)
+{
+ vinagre_debug_message (DEBUG_PLUGINS, "VinagreObjectModule %p initialising", module);
+
+ module->priv = G_TYPE_INSTANCE_GET_PRIVATE (module,
+ VINAGRE_TYPE_OBJECT_MODULE,
+ VinagreObjectModulePrivate);
+}
+
+static void
+vinagre_object_module_finalize (GObject *object)
+{
+ VinagreObjectModule *module = VINAGRE_OBJECT_MODULE (object);
+
+ vinagre_debug_message (DEBUG_PLUGINS, "VinagreObjectModule %p finalising", module);
+
+ g_free (module->priv->path);
+ g_free (module->priv->module_name);
+ g_free (module->priv->type_registration);
+
+ G_OBJECT_CLASS (vinagre_object_module_parent_class)->finalize (object);
+}
+
+static void
+vinagre_object_module_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ VinagreObjectModule *module = VINAGRE_OBJECT_MODULE (object);
+
+ switch (prop_id)
+ {
+ case PROP_MODULE_NAME:
+ g_value_set_string (value, module->priv->module_name);
+ break;
+ case PROP_PATH:
+ g_value_set_string (value, module->priv->path);
+ break;
+ case PROP_TYPE_REGISTRATION:
+ g_value_set_string (value, module->priv->type_registration);
+ break;
+ case PROP_RESIDENT:
+ g_value_set_boolean (value, module->priv->resident);
+ break;
+ default:
+ g_return_if_reached ();
+ }
+}
+
+static void
+vinagre_object_module_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ VinagreObjectModule *module = VINAGRE_OBJECT_MODULE (object);
+
+ switch (prop_id)
+ {
+ case PROP_MODULE_NAME:
+ module->priv->module_name = g_value_dup_string (value);
+ g_type_module_set_name (G_TYPE_MODULE (object),
+ module->priv->module_name);
+ break;
+ case PROP_PATH:
+ module->priv->path = g_value_dup_string (value);
+ break;
+ case PROP_TYPE_REGISTRATION:
+ module->priv->type_registration = g_value_dup_string (value);
+ break;
+ case PROP_RESIDENT:
+ module->priv->resident = g_value_get_boolean (value);
+ break;
+ default:
+ g_return_if_reached ();
+ }
+}
+
+static void
+vinagre_object_module_class_init (VinagreObjectModuleClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (klass);
+
+ object_class->set_property = vinagre_object_module_set_property;
+ object_class->get_property = vinagre_object_module_get_property;
+ object_class->finalize = vinagre_object_module_finalize;
+
+ module_class->load = vinagre_object_module_load;
+ module_class->unload = vinagre_object_module_unload;
+
+ g_object_class_install_property (object_class,
+ PROP_MODULE_NAME,
+ g_param_spec_string ("module-name",
+ "Module Name",
+ "The module to load for this object",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (object_class,
+ PROP_PATH,
+ g_param_spec_string ("path",
+ "Path",
+ "The path to use when loading this module",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (object_class,
+ PROP_TYPE_REGISTRATION,
+ g_param_spec_string ("type-registration",
+ "Type Registration",
+ "The name of the type registration function",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (object_class,
+ PROP_RESIDENT,
+ g_param_spec_boolean ("resident",
+ "Resident",
+ "Whether the module is resident",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_type_class_add_private (klass, sizeof (VinagreObjectModulePrivate));
+}
+
+VinagreObjectModule *
+vinagre_object_module_new (const gchar *module_name,
+ const gchar *path,
+ const gchar *type_registration,
+ gboolean resident)
+{
+ return (VinagreObjectModule *)g_object_new (VINAGRE_TYPE_OBJECT_MODULE,
+ "module-name",
+ module_name,
+ "path",
+ path,
+ "type-registration",
+ type_registration,
+ "resident",
+ resident,
+ NULL);
+}
+
+GObject *
+vinagre_object_module_new_object (VinagreObjectModule *module,
+ const gchar *first_property_name,
+ ...)
+{
+ va_list var_args;
+ GObject *result;
+
+ g_return_val_if_fail (module->priv->type != 0, NULL);
+
+ vinagre_debug_message (DEBUG_PLUGINS, "Creating object of type %s",
+ g_type_name (module->priv->type));
+
+ va_start (var_args, first_property_name);
+ result = g_object_new_valist (module->priv->type, first_property_name, var_args);
+ va_end (var_args);
+
+ return result;
+}
+
+const gchar *
+vinagre_object_module_get_path (VinagreObjectModule *module)
+{
+ g_return_val_if_fail (VINAGRE_IS_OBJECT_MODULE (module), NULL);
+
+ return module->priv->path;
+}
+
+const gchar *
+vinagre_object_module_get_module_name (VinagreObjectModule *module)
+{
+ g_return_val_if_fail (VINAGRE_IS_OBJECT_MODULE (module), NULL);
+
+ return module->priv->module_name;
+}
+
+const gchar *
+vinagre_object_module_get_type_registration (VinagreObjectModule *module)
+{
+ g_return_val_if_fail (VINAGRE_IS_OBJECT_MODULE (module), NULL);
+
+ return module->priv->type_registration;
+}
+
+GType
+vinagre_object_module_get_object_type (VinagreObjectModule *module)
+{
+ g_return_val_if_fail (VINAGRE_IS_OBJECT_MODULE (module), 0);
+
+ return module->priv->type;
+}
diff --git a/vinagre/vinagre-object-module.h b/vinagre/vinagre-object-module.h
new file mode 100644
index 0000000..9b4d9b8
--- /dev/null
+++ b/vinagre/vinagre-object-module.h
@@ -0,0 +1,94 @@
+/*
+ * vinagre-object-module.h
+ * This file is part of vinagre
+ *
+ * Copyright (C) 2005 - Paolo Maggi
+ * Copyright (C) 2008 - Jesse van den Kieboom
+ *
+ * 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., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* This is a modified version of vinagre-module.h from Epiphany source code.
+ * Here the original copyright assignment:
+ *
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ * Copyright (C) 2003, 2004 Christian Persch
+ *
+ */
+
+/*
+ * Modified by the vinagre Team, 2005. See the AUTHORS file for a
+ * list of people on the vinagre Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id: vinagre-module.h 6263 2008-05-05 10:52:10Z sfre $
+ */
+
+#ifndef __VINAGRE_OBJECT_MODULE_H__
+#define __VINAGRE_OBJECT_MODULE_H__
+
+#include <glib-object.h>
+#include <gmodule.h>
+#include <stdarg.h>
+
+G_BEGIN_DECLS
+
+#define VINAGRE_TYPE_OBJECT_MODULE (vinagre_object_module_get_type ())
+#define VINAGRE_OBJECT_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VINAGRE_TYPE_OBJECT_MODULE, VinagreObjectModule))
+#define VINAGRE_OBJECT_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VINAGRE_TYPE_OBJECT_MODULE, VinagreObjectModuleClass))
+#define VINAGRE_IS_OBJECT_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VINAGRE_TYPE_OBJECT_MODULE))
+#define VINAGRE_IS_OBJECT_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VINAGRE_TYPE_OBJECT_MODULE))
+#define VINAGRE_OBJECT_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), VINAGRE_TYPE_OBJECT_MODULE, VinagreObjectModuleClass))
+
+typedef struct _VinagreObjectModule VinagreObjectModule;
+typedef struct _VinagreObjectModulePrivate VinagreObjectModulePrivate;
+
+struct _VinagreObjectModule
+{
+ GTypeModule parent;
+
+ VinagreObjectModulePrivate *priv;
+};
+
+typedef struct _VinagreObjectModuleClass VinagreObjectModuleClass;
+
+struct _VinagreObjectModuleClass
+{
+ GTypeModuleClass parent_class;
+
+ /* Virtual class methods */
+ void (* garbage_collect) ();
+};
+
+GType vinagre_object_module_get_type (void) G_GNUC_CONST;
+
+VinagreObjectModule *vinagre_object_module_new (const gchar *module_name,
+ const gchar *path,
+ const gchar *type_registration,
+ gboolean resident);
+
+GObject *vinagre_object_module_new_object (VinagreObjectModule *module,
+ const gchar *first_property_name,
+ ...);
+
+GType vinagre_object_module_get_object_type (VinagreObjectModule *module);
+const gchar *vinagre_object_module_get_path (VinagreObjectModule *module);
+const gchar *vinagre_object_module_get_module_name (VinagreObjectModule *module);
+const gchar *vinagre_object_module_get_type_registration (VinagreObjectModule *module);
+
+G_END_DECLS
+
+#endif
diff --git a/vinagre/vinagre-plugin-info.h b/vinagre/vinagre-plugin-info.h
new file mode 100644
index 0000000..43f8c27
--- /dev/null
+++ b/vinagre/vinagre-plugin-info.h
@@ -0,0 +1,52 @@
+/*
+ * vinagre-plugin-info.h
+ * This file is part of vinagre
+ *
+ * Copyright (C) 2009 Jorge Pereira <jorge jorgepereira com br>
+ *
+ * vinagre-plugin-info.h 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.
+ *
+ * vinagre-plugin-info.h 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __VINAGRE_PLUGIN_INFO_H__
+#define __VINAGRE_PLUGIN_INFO_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define VINAGRE_TYPE_PLUGIN_INFO (vinagre_plugin_info_get_type ())
+#define VINAGRE_PLUGIN_INFO(obj) ((VinagrePluginInfo *) (obj))
+
+typedef struct _VinagrePluginInfo VinagrePluginInfo;
+
+GType vinagre_plugin_info_get_type (void) G_GNUC_CONST;
+
+gboolean vinagre_plugin_info_is_active (VinagrePluginInfo *info);
+gboolean vinagre_plugin_info_is_available (VinagrePluginInfo *info);
+gboolean vinagre_plugin_info_is_configurable (VinagrePluginInfo *info);
+
+const gchar *vinagre_plugin_info_get_module_name (VinagrePluginInfo *info);
+
+const gchar *vinagre_plugin_info_get_name (VinagrePluginInfo *info);
+const gchar *vinagre_plugin_info_get_description (VinagrePluginInfo *info);
+const gchar *vinagre_plugin_info_get_icon_name (VinagrePluginInfo *info);
+const gchar **vinagre_plugin_info_get_authors (VinagrePluginInfo *info);
+const gchar *vinagre_plugin_info_get_website (VinagrePluginInfo *info);
+const gchar *vinagre_plugin_info_get_copyright (VinagrePluginInfo *info);
+const gchar *vinagre_plugin_info_get_version (VinagrePluginInfo *info);
+
+G_END_DECLS
+
+#endif /* __VINAGRE_PLUGIN_INFO_H__ */
+
diff --git a/vinagre/vinagre-plugin.h b/vinagre/vinagre-plugin.h
new file mode 100644
index 0000000..5a1cdf8
--- /dev/null
+++ b/vinagre/vinagre-plugin.h
@@ -0,0 +1,230 @@
+/*
+ * vinagre-plugin.h
+ * This file is part of vinagre
+ *
+ * Copyright (C) 2009 Jorge Pereira <jorge jorgepereira com br>
+ *
+ * vinagre-plugin.h 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.
+ *
+ * vinagre-plugin.h 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __VINAGRE_PLUGIN_H__
+#define __VINAGRE_PLUGIN_H__
+
+#include <glib-object.h>
+
+#include <vinagre/vinagre-window.h>
+#include <vinagre/vinagre-debug.h>
+
+/* TODO: add a .h file that includes all the .h files normally needed to
+ * develop a plugin */
+
+G_BEGIN_DECLS
+
+/*
+ * Type checking and casting macros
+ */
+#define VINAGRE_TYPE_PLUGIN (vinagre_plugin_get_type())
+#define VINAGRE_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), VINAGRE_TYPE_PLUGIN, VinagrePlugin))
+#define VINAGRE_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), VINAGRE_TYPE_PLUGIN, VinagrePluginClass))
+#define VINAGRE_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), VINAGRE_TYPE_PLUGIN))
+#define VINAGRE_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VINAGRE_TYPE_PLUGIN))
+#define VINAGRE_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), VINAGRE_TYPE_PLUGIN, VinagrePluginClass))
+
+/*
+ * Main object structure
+ */
+typedef struct _VinagrePlugin VinagrePlugin;
+
+struct _VinagrePlugin
+{
+ GObject parent;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _VinagrePluginClass VinagrePluginClass;
+
+struct _VinagrePluginClass
+{
+ GObjectClass parent_class;
+
+ /* Virtual public methods */
+
+ void (*activate) (VinagrePlugin *plugin,
+ VinagreWindow *window);
+ void (*deactivate) (VinagrePlugin *plugin,
+ VinagreWindow *window);
+
+ void (*update_ui) (VinagrePlugin *plugin,
+ VinagreWindow *window);
+
+ GtkWidget *(*create_configure_dialog)
+ (VinagrePlugin *plugin);
+
+ /* Plugins should not override this, it's handled automatically by
+ the VinagrePluginClass */
+ gboolean (*is_configurable)
+ (VinagrePlugin *plugin);
+
+ /* Padding for future expansion */
+ void (*_vinagre_reserved1) (void);
+ void (*_vinagre_reserved2) (void);
+ void (*_vinagre_reserved3) (void);
+ void (*_vinagre_reserved4) (void);
+};
+
+/*
+ * Public methods
+ */
+GType vinagre_plugin_get_type (void) G_GNUC_CONST;
+
+gchar *vinagre_plugin_get_install_dir (VinagrePlugin *plugin);
+gchar *vinagre_plugin_get_data_dir (VinagrePlugin *plugin);
+
+void vinagre_plugin_activate (VinagrePlugin *plugin,
+ VinagreWindow *window);
+void vinagre_plugin_deactivate (VinagrePlugin *plugin,
+ VinagreWindow *window);
+
+void vinagre_plugin_update_ui (VinagrePlugin *plugin,
+ VinagreWindow *window);
+
+gboolean vinagre_plugin_is_configurable (VinagrePlugin *plugin);
+GtkWidget *vinagre_plugin_create_configure_dialog
+ (VinagrePlugin *plugin);
+
+/**
+ * VINAGRE_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, CODE):
+ *
+ * Utility macro used to register plugins with additional code.
+ */
+#define VINAGRE_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, CODE) \
+ G_DEFINE_DYNAMIC_TYPE_EXTENDED (PluginName, \
+ plugin_name, \
+ VINAGRE_TYPE_PLUGIN, \
+ 0, \
+ GTypeModule *module G_GNUC_UNUSED = type_module; /* back compat */ \
+ CODE) \
+ \
+/* This is not very nice, but G_DEFINE_DYNAMIC wants it and our old macro \
+ * did not support it */ \
+static void \
+plugin_name##_class_finalize (PluginName##Class *klass) \
+{ \
+} \
+ \
+ \
+G_MODULE_EXPORT GType \
+register_vinagre_plugin (GTypeModule *type_module) \
+{ \
+ plugin_name##_register_type (type_module); \
+ \
+ return plugin_name##_get_type(); \
+}
+
+/**
+ * VINAGRE_PLUGIN_REGISTER_TYPE(PluginName, plugin_name):
+ *
+ * Utility macro used to register plugins.
+ */
+#define VINAGRE_PLUGIN_REGISTER_TYPE(PluginName, plugin_name) \
+ VINAGRE_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, ;)
+
+/**
+ * VINAGRE_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE):
+ *
+ * Utility macro used to register gobject types in plugins with additional code.
+ *
+ * Deprecated: use G_DEFINE_DYNAMIC_TYPE_EXTENDED instead
+ */
+#define VINAGRE_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE) \
+ \
+static GType g_define_type_id = 0; \
+ \
+GType \
+object_name##_get_type (void) \
+{ \
+ return g_define_type_id; \
+} \
+ \
+static void object_name##_init (ObjectName *self); \
+static void object_name##_class_init (ObjectName##Class *klass); \
+static gpointer object_name##_parent_class = NULL; \
+static void object_name##_class_intern_init (gpointer klass) \
+{ \
+ object_name##_parent_class = g_type_class_peek_parent (klass); \
+ object_name##_class_init ((ObjectName##Class *) klass); \
+} \
+ \
+GType \
+object_name##_register_type (GTypeModule *type_module) \
+{ \
+ GTypeModule *module G_GNUC_UNUSED = type_module; /* back compat */ \
+ static const GTypeInfo our_info = \
+ { \
+ sizeof (ObjectName##Class), \
+ NULL, /* base_init */ \
+ NULL, /* base_finalize */ \
+ (GClassInitFunc) object_name##_class_intern_init, \
+ NULL, \
+ NULL, /* class_data */ \
+ sizeof (ObjectName), \
+ 0, /* n_preallocs */ \
+ (GInstanceInitFunc) object_name##_init \
+ }; \
+ \
+ g_define_type_id = g_type_module_register_type (type_module, \
+ PARENT_TYPE, \
+ #ObjectName, \
+ &our_info, \
+ 0); \
+ \
+ CODE \
+ \
+ return g_define_type_id; \
+}
+
+
+/**
+ * VINAGRE_PLUGIN_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE):
+ *
+ * Utility macro used to register gobject types in plugins.
+ *
+ * Deprecated: use G_DEFINE_DYNAMIC instead
+ */
+#define VINAGRE_PLUGIN_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE) \
+ VINAGRE_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, ;)
+
+/**
+ * VINAGRE_PLUGIN_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init):
+ *
+ * Utility macro used to register interfaces for gobject types in plugins.
+ */
+#define VINAGRE_PLUGIN_IMPLEMENT_INTERFACE(object_name, TYPE_IFACE, iface_init) \
+ const GInterfaceInfo object_name##_interface_info = \
+ { \
+ (GInterfaceInitFunc) iface_init, \
+ NULL, \
+ NULL \
+ }; \
+ \
+ g_type_module_add_interface (type_module, \
+ g_define_type_id, \
+ TYPE_IFACE, \
+ &object_name##_interface_info);
+
+G_END_DECLS
+
+#endif /* __VINAGRE_PLUGIN_H__ */
diff --git a/vinagre/vinagre-plugins-engine.c b/vinagre/vinagre-plugins-engine.c
index dc10499..68f85ef 100644
--- a/vinagre/vinagre-plugins-engine.c
+++ b/vinagre/vinagre-plugins-engine.c
@@ -31,7 +31,7 @@
#include "vinagre-plugin.h"
#include "vinagre-debug.h"
#include "vinagre-app.h"
-#include "vinagre-prefs-manager.h"
+//#include "vinagre-prefs-manager.h"
#include "vinagre-plugin-loader.h"
#include "vinagre-object-module.h"
#include "vinagre-dirs.h"
@@ -91,7 +91,7 @@ load_dir_real (VinagrePluginsEngine *engine,
g_return_val_if_fail (dir != NULL, TRUE);
- gedit_debug_message (DEBUG_PLUGINS, "DIR: %s", dir);
+ vinagre_debug_message (DEBUG_PLUGINS, "DIR: %s", dir);
d = g_dir_open (dir, 0, &error);
if (!d)
@@ -129,27 +129,27 @@ load_plugin_info (VinagrePluginsEngine *engine,
{
VinagrePluginInfo *info;
- info = _gedit_plugin_info_new (filename);
+ info = _vinagre_plugin_info_new (filename);
if (info == NULL)
return TRUE;
/* If a plugin with this name has already been loaded
* drop this one (user plugins override system plugins) */
- if (vinagre_plugins_engine_get_plugin_info (engine, gedit_plugin_info_get_module_name (info)) != NULL)
+ if (vinagre_plugins_engine_get_plugin_info (engine, vinagre_plugin_info_get_module_name (info)) != NULL)
{
- gedit_debug_message (DEBUG_PLUGINS, "Two or more plugins named '%s'. "
+ vinagre_debug_message (DEBUG_PLUGINS, "Two or more plugins named '%s'. "
"Only the first will be considered.\n",
- gedit_plugin_info_get_module_name (info));
+ vinagre_plugin_info_get_module_name (info));
- _gedit_plugin_info_unref (info);
+ _vinagre_plugin_info_unref (info);
return TRUE;
}
engine->priv->plugin_list = g_list_prepend (engine->priv->plugin_list, info);
- gedit_debug_message (DEBUG_PLUGINS, "Plugin %s loaded", info->name);
+ vinagre_debug_message (DEBUG_PLUGINS, "Plugin %s loaded", info->name);
return TRUE;
}
@@ -160,7 +160,7 @@ load_all_plugins (VinagrePluginsEngine *engine)
const gchar *pdirs_env = NULL;
/* load user plugins */
- plugin_dir = gedit_dirs_get_user_plugins_dir ();
+ plugin_dir = vinagre_dirs_get_user_plugins_dir ();
if (g_file_test (plugin_dir, G_FILE_TEST_IS_DIR))
{
load_dir_real (engine,
@@ -175,7 +175,7 @@ load_all_plugins (VinagrePluginsEngine *engine)
/* load system plugins */
pdirs_env = g_getenv ("VINAGRE_PLUGINS_PATH");
- gedit_debug_message (DEBUG_PLUGINS, "VINAGRE_PLUGINS_PATH=%s", pdirs_env);
+ vinagre_debug_message (DEBUG_PLUGINS, "VINAGRE_PLUGINS_PATH=%s", pdirs_env);
if (pdirs_env != NULL)
{
@@ -200,7 +200,7 @@ load_all_plugins (VinagrePluginsEngine *engine)
}
else
{
- plugin_dir = gedit_dirs_get_vinagre_plugins_dir ();
+ plugin_dir = vinagre_dirs_get_vinagre_plugins_dir ();
load_dir_real (engine,
plugin_dir,
@@ -260,11 +260,11 @@ add_loader (VinagrePluginsEngine *engine,
static void
vinagre_plugins_engine_init (VinagrePluginsEngine *engine)
{
- gedit_debug (DEBUG_PLUGINS);
+ vinagre_debug (DEBUG_PLUGINS);
if (!g_module_supported ())
{
- g_warning ("gedit is not able to initialize the plugins engine.");
+ g_warning ("vinagre is not able to initialize the plugins engine.");
return;
}
@@ -290,7 +290,7 @@ loader_garbage_collect (const char *id,
LoaderInfo *info)
{
if (info->loader)
- gedit_plugin_loader_garbage_collect (info->loader);
+ vinagre_plugin_loader_garbage_collect (info->loader);
}
void
@@ -307,14 +307,14 @@ vinagre_plugins_engine_finalize (GObject *object)
VinagrePluginsEngine *engine = VINAGRE_PLUGINS_ENGINE (object);
GList *item;
- gedit_debug (DEBUG_PLUGINS);
+ vinagre_debug (DEBUG_PLUGINS);
/* Firs deactivate all plugins */
for (item = engine->priv->plugin_list; item; item = item->next)
{
VinagrePluginInfo *info = VINAGRE_PLUGIN_INFO (item->data);
- if (gedit_plugin_info_is_active (info))
+ if (vinagre_plugin_info_is_active (info))
vinagre_plugins_engine_deactivate_plugin_real (engine, info);
}
@@ -326,7 +326,7 @@ vinagre_plugins_engine_finalize (GObject *object)
{
VinagrePluginInfo *info = VINAGRE_PLUGIN_INFO (item->data);
- _gedit_plugin_info_unref (info);
+ _vinagre_plugin_info_unref (info);
}
g_list_free (engine->priv->plugin_list);
@@ -385,9 +385,9 @@ load_loader (VinagrePluginsEngine *engine,
base = g_path_get_basename (filename);
/* for now they are all resident */
- module = gedit_object_module_new (base,
+ module = vinagre_object_module_new (base,
path,
- "register_gedit_plugin_loader",
+ "register_vinagre_plugin_loader",
TRUE);
g_free (base);
@@ -404,8 +404,8 @@ load_loader (VinagrePluginsEngine *engine,
/* get the exported type and check the name as exported by the
* loader interface */
- type = gedit_object_module_get_object_type (module);
- id = gedit_plugin_loader_type_get_id (type);
+ type = vinagre_object_module_get_object_type (module);
+ id = vinagre_plugin_loader_type_get_id (type);
add_loader (engine, id, module);
g_type_module_unuse (G_TYPE_MODULE (module));
@@ -420,7 +420,7 @@ ensure_loader (LoaderInfo *info)
{
/* create a new loader object */
VinagrePluginLoader *loader;
- loader = (VinagrePluginLoader *)gedit_object_module_new_object (info->module, NULL);
+ loader = (VinagrePluginLoader *)vinagre_object_module_new_object (info->module, NULL);
if (loader == NULL || !VINAGRE_IS_PLUGIN_LOADER (loader))
{
@@ -453,7 +453,7 @@ get_plugin_loader (VinagrePluginsEngine *engine,
{
gchar *loader_dir;
- loader_dir = gedit_dirs_get_gedit_plugin_loaders_dir ();
+ loader_dir = vinagre_dirs_get_vinagre_plugin_loaders_dir ();
/* loader could not be found in the hash, try to find it by
scanning */
@@ -495,7 +495,7 @@ vinagre_plugins_engine_get_default (void)
const GList *
vinagre_plugins_engine_get_plugin_list (VinagrePluginsEngine *engine)
{
- gedit_debug (DEBUG_PLUGINS);
+ vinagre_debug (DEBUG_PLUGINS);
return engine->priv->plugin_list;
}
@@ -504,7 +504,7 @@ static gint
compare_plugin_info_and_name (VinagrePluginInfo *info,
const gchar *module_name)
{
- return strcmp (gedit_plugin_info_get_module_name (info), module_name);
+ return strcmp (vinagre_plugin_info_get_module_name (info), module_name);
}
VinagrePluginInfo *
@@ -528,14 +528,14 @@ save_active_plugin_list (VinagrePluginsEngine *engine)
{
VinagrePluginInfo *info = (VinagrePluginInfo *) l->data;
- if (gedit_plugin_info_is_active (info))
+ if (vinagre_plugin_info_is_active (info))
{
active_plugins = g_slist_prepend (active_plugins,
- (gpointer)gedit_plugin_info_get_module_name (info));
+ (gpointer)vinagre_plugin_info_get_module_name (info));
}
}
- gedit_prefs_manager_set_active_plugins (active_plugins);
+// AQUI: vinagre_prefs_manager_set_active_plugins (active_plugins);
g_slist_free (active_plugins);
}
@@ -547,10 +547,10 @@ load_plugin (VinagrePluginsEngine *engine,
VinagrePluginLoader *loader;
gchar *path;
- if (gedit_plugin_info_is_active (info))
+ if (vinagre_plugin_info_is_active (info))
return TRUE;
- if (!gedit_plugin_info_is_available (info))
+ if (!vinagre_plugin_info_is_available (info))
return FALSE;
loader = get_plugin_loader (engine, info);
@@ -565,7 +565,7 @@ load_plugin (VinagrePluginsEngine *engine,
path = g_path_get_dirname (info->file);
g_return_val_if_fail (path != NULL, FALSE);
- info->plugin = gedit_plugin_loader_load (loader, info, path);
+ info->plugin = vinagre_plugin_loader_load (loader, info, path);
g_free (path);
@@ -587,44 +587,44 @@ vinagre_plugins_engine_activate_plugin_real (VinagrePluginsEngine *engine,
return;
/* activate plugin for all windows */
- const GList *wins = gedit_app_get_windows (gedit_app_get_default ());
+ const GList *wins = vinagre_app_get_windows (vinagre_app_get_default ());
for (; wins != NULL; wins = wins->next)
- gedit_plugin_activate (info->plugin, VINAGRE_WINDOW (wins->data));
+ vinagre_plugin_activate (info->plugin, VINAGRE_WINDOW (wins->data));
}
gboolean
vinagre_plugins_engine_activate_plugin (VinagrePluginsEngine *engine,
VinagrePluginInfo *info)
{
- gedit_debug (DEBUG_PLUGINS);
+ vinagre_debug (DEBUG_PLUGINS);
g_return_val_if_fail (info != NULL, FALSE);
- if (!gedit_plugin_info_is_available (info))
+ if (!vinagre_plugin_info_is_available (info))
return FALSE;
- if (gedit_plugin_info_is_active (info))
+ if (vinagre_plugin_info_is_active (info))
return TRUE;
g_signal_emit (engine, signals[ACTIVATE_PLUGIN], 0, info);
- if (gedit_plugin_info_is_active (info))
+ if (vinagre_plugin_info_is_active (info))
save_active_plugin_list (engine);
- return gedit_plugin_info_is_active (info);
+ return vinagre_plugin_info_is_active (info);
}
static void
call_plugin_deactivate (VinagrePlugin *plugin,
VinagreWindow *window)
{
- gedit_plugin_deactivate (plugin, window);
+ vinagre_plugin_deactivate (plugin, window);
/* ensure update of ui manager, because we suspect it does something
with expected static strings in the type module (when unloaded the
strings don't exist anymore, and ui manager updates in an idle
func) */
- gtk_ui_manager_ensure_update (gedit_window_get_ui_manager (window));
+ gtk_ui_manager_ensure_update (vinagre_window_get_ui_manager (window));
}
static void
@@ -634,11 +634,11 @@ vinagre_plugins_engine_deactivate_plugin_real (VinagrePluginsEngine *engine,
const GList *wins;
VinagrePluginLoader *loader;
- if (!gedit_plugin_info_is_active (info) ||
- !gedit_plugin_info_is_available (info))
+ if (!vinagre_plugin_info_is_active (info) ||
+ !vinagre_plugin_info_is_available (info))
return;
- wins = gedit_app_get_windows (gedit_app_get_default ());
+ wins = vinagre_app_get_windows (vinagre_app_get_default ());
for (; wins != NULL; wins = wins->next)
call_plugin_deactivate (info->plugin, VINAGRE_WINDOW (wins->data));
@@ -648,8 +648,8 @@ vinagre_plugins_engine_deactivate_plugin_real (VinagrePluginsEngine *engine,
/* find the loader and tell it to gc and unload the plugin */
loader = get_plugin_loader (engine, info);
- gedit_plugin_loader_garbage_collect (loader);
- gedit_plugin_loader_unload (loader, info);
+ vinagre_plugin_loader_garbage_collect (loader);
+ vinagre_plugin_loader_unload (loader, info);
info->plugin = NULL;
}
@@ -658,18 +658,18 @@ gboolean
vinagre_plugins_engine_deactivate_plugin (VinagrePluginsEngine *engine,
VinagrePluginInfo *info)
{
- gedit_debug (DEBUG_PLUGINS);
+ vinagre_debug (DEBUG_PLUGINS);
g_return_val_if_fail (info != NULL, FALSE);
- if (!gedit_plugin_info_is_active (info))
+ if (!vinagre_plugin_info_is_active (info))
return TRUE;
g_signal_emit (engine, signals[DEACTIVATE_PLUGIN], 0, info);
- if (!gedit_plugin_info_is_active (info))
+ if (!vinagre_plugin_info_is_active (info))
save_active_plugin_list (engine);
- return !gedit_plugin_info_is_active (info);
+ return !vinagre_plugin_info_is_active (info);
}
void
@@ -679,7 +679,7 @@ vinagre_plugins_engine_activate_plugins (VinagrePluginsEngine *engine,
GSList *active_plugins = NULL;
GList *pl;
- gedit_debug (DEBUG_PLUGINS);
+ vinagre_debug (DEBUG_PLUGINS);
g_return_if_fail (VINAGRE_IS_PLUGINS_ENGINE (engine));
g_return_if_fail (VINAGRE_IS_WINDOW (window));
@@ -687,7 +687,7 @@ vinagre_plugins_engine_activate_plugins (VinagrePluginsEngine *engine,
/* the first time, we get the 'active' plugins from gconf */
if (engine->priv->activate_from_prefs)
{
- active_plugins = gedit_prefs_manager_get_active_plugins ();
+//AQUI active_plugins = vinagre_prefs_manager_get_active_plugins ();
}
for (pl = engine->priv->plugin_list; pl; pl = pl->next)
@@ -696,17 +696,17 @@ vinagre_plugins_engine_activate_plugins (VinagrePluginsEngine *engine,
if (engine->priv->activate_from_prefs &&
g_slist_find_custom (active_plugins,
- gedit_plugin_info_get_module_name (info),
+ vinagre_plugin_info_get_module_name (info),
(GCompareFunc)strcmp) == NULL)
continue;
/* If plugin is not active, don't try to activate/load it */
if (!engine->priv->activate_from_prefs &&
- !gedit_plugin_info_is_active (info))
+ !vinagre_plugin_info_is_active (info))
continue;
if (load_plugin (engine, info))
- gedit_plugin_activate (info->plugin,
+ vinagre_plugin_activate (info->plugin,
window);
}
@@ -717,7 +717,7 @@ vinagre_plugins_engine_activate_plugins (VinagrePluginsEngine *engine,
engine->priv->activate_from_prefs = FALSE;
}
- gedit_debug_message (DEBUG_PLUGINS, "End");
+ vinagre_debug_message (DEBUG_PLUGINS, "End");
/* also call update_ui after activation */
vinagre_plugins_engine_update_plugins_ui (engine, window);
@@ -729,7 +729,7 @@ vinagre_plugins_engine_deactivate_plugins (VinagrePluginsEngine *engine,
{
GList *pl;
- gedit_debug (DEBUG_PLUGINS);
+ vinagre_debug (DEBUG_PLUGINS);
g_return_if_fail (VINAGRE_IS_PLUGINS_ENGINE (engine));
g_return_if_fail (VINAGRE_IS_WINDOW (window));
@@ -739,14 +739,14 @@ vinagre_plugins_engine_deactivate_plugins (VinagrePluginsEngine *engine,
VinagrePluginInfo *info = (VinagrePluginInfo*)pl->data;
/* check if the plugin is actually active */
- if (!gedit_plugin_info_is_active (info))
+ if (!vinagre_plugin_info_is_active (info))
continue;
/* call deactivate for the plugin for this window */
- gedit_plugin_deactivate (info->plugin, window);
+ vinagre_plugin_deactivate (info->plugin, window);
}
- gedit_debug_message (DEBUG_PLUGINS, "End");
+ vinagre_debug_message (DEBUG_PLUGINS, "End");
}
void
@@ -755,7 +755,7 @@ vinagre_plugins_engine_update_plugins_ui (VinagrePluginsEngine *engine,
{
GList *pl;
- gedit_debug (DEBUG_PLUGINS);
+ vinagre_debug (DEBUG_PLUGINS);
g_return_if_fail (VINAGRE_IS_PLUGINS_ENGINE (engine));
g_return_if_fail (VINAGRE_IS_WINDOW (window));
@@ -765,11 +765,11 @@ vinagre_plugins_engine_update_plugins_ui (VinagrePluginsEngine *engine,
{
VinagrePluginInfo *info = (VinagrePluginInfo*)pl->data;
- if (!gedit_plugin_info_is_active (info))
+ if (!vinagre_plugin_info_is_active (info))
continue;
- gedit_debug_message (DEBUG_PLUGINS, "Updating UI of %s", info->name);
- gedit_plugin_update_ui (info->plugin, window);
+ vinagre_debug_message (DEBUG_PLUGINS, "Updating UI of %s", info->name);
+ vinagre_plugin_update_ui (info->plugin, window);
}
}
@@ -782,11 +782,11 @@ vinagre_plugins_engine_configure_plugin (VinagrePluginsEngine *engine,
GtkWindowGroup *wg;
- gedit_debug (DEBUG_PLUGINS);
+ vinagre_debug (DEBUG_PLUGINS);
g_return_if_fail (info != NULL);
- conf_dlg = gedit_plugin_create_configure_dialog (info->plugin);
+ conf_dlg = vinagre_plugin_create_configure_dialog (info->plugin);
g_return_if_fail (conf_dlg != NULL);
gtk_window_set_transient_for (GTK_WINDOW (conf_dlg),
parent);
@@ -812,24 +812,24 @@ vinagre_plugins_engine_active_plugins_changed (VinagrePluginsEngine *engine)
GSList *active_plugins;
GList *pl;
- gedit_debug (DEBUG_PLUGINS);
+ vinagre_debug (DEBUG_PLUGINS);
- active_plugins = gedit_prefs_manager_get_active_plugins ();
+//AQUI active_plugins = vinagre_prefs_manager_get_active_plugins ();
for (pl = engine->priv->plugin_list; pl; pl = pl->next)
{
VinagrePluginInfo *info = (VinagrePluginInfo*)pl->data;
- if (!gedit_plugin_info_is_available (info))
+ if (!vinagre_plugin_info_is_available (info))
continue;
to_activate = (g_slist_find_custom (active_plugins,
- gedit_plugin_info_get_module_name (info),
+ vinagre_plugin_info_get_module_name (info),
(GCompareFunc)strcmp) != NULL);
- if (!gedit_plugin_info_is_active (info) && to_activate)
+ if (!vinagre_plugin_info_is_active (info) && to_activate)
g_signal_emit (engine, signals[ACTIVATE_PLUGIN], 0, info);
- else if (gedit_plugin_info_is_active (info) && !to_activate)
+ else if (vinagre_plugin_info_is_active (info) && !to_activate)
g_signal_emit (engine, signals[DEACTIVATE_PLUGIN], 0, info);
}
@@ -840,7 +840,7 @@ vinagre_plugins_engine_active_plugins_changed (VinagrePluginsEngine *engine)
void
vinagre_plugins_engine_rescan_plugins (VinagrePluginsEngine *engine)
{
- gedit_debug (DEBUG_PLUGINS);
+ vinagre_debug (DEBUG_PLUGINS);
load_all_plugins (engine);
}
diff --git a/vinagre/vinagre-utils.c b/vinagre/vinagre-utils.c
index c779816..90af8b8 100644
--- a/vinagre/vinagre-utils.c
+++ b/vinagre/vinagre-utils.c
@@ -480,5 +480,18 @@ vinagre_utils_parse_boolean (const gchar* value)
return FALSE;
}
+GtkWidget *
+vinagre_gtk_button_new_with_stock_icon (const gchar *label,
+ const gchar *stock_id)
+{
+ GtkWidget *button;
+
+ button = gtk_button_new_with_mnemonic (label);
+ gtk_button_set_image (GTK_BUTTON (button),
+ gtk_image_new_from_stock (stock_id,
+ GTK_ICON_SIZE_BUTTON));
+
+ return button;
+}
/* vim: set ts=8: */
diff --git a/vinagre/vinagre-utils.h b/vinagre/vinagre-utils.h
index a164fd1..e10126f 100644
--- a/vinagre/vinagre-utils.h
+++ b/vinagre/vinagre-utils.h
@@ -73,5 +73,7 @@ void vinagre_utils_help_about (GtkWindow *window);
gboolean vinagre_utils_parse_boolean (const gchar* value);
+GtkWidget *vinagre_gtk_button_new_with_stock_icon (const gchar *label,
+ const gchar *stock_id);
#endif /* __VINAGRE_UTILS_H__ */
/* vim: set ts=8: */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]