[vinagre/plugin] Make VncTab work
- From: Jonh Wendell <jwendell src gnome org>
- To: svn-commits-list gnome org
- Subject: [vinagre/plugin] Make VncTab work
- Date: Sun, 12 Jul 2009 21:53:18 +0000 (UTC)
commit ee0b130fcd069b8505589ed697e7933ba754b5af
Author: Jonh Wendell <jwendell gnome org>
Date: Sun Jul 12 18:52:32 2009 -0300
Make VncTab work
plugins/vnc/vinagre-vnc-plugin.c | 10 ++++++++++
plugins/vnc/vinagre-vnc-tab.c | 23 +++++++++++++++--------
vinagre/vinagre-plugin.c | 26 ++++++++++++++++++++++++++
vinagre/vinagre-plugin.h | 7 +++++++
vinagre/vinagre-tab.c | 19 +++++++++++++------
5 files changed, 71 insertions(+), 14 deletions(-)
---
diff --git a/plugins/vnc/vinagre-vnc-plugin.c b/plugins/vnc/vinagre-vnc-plugin.c
index d4f2d27..4f22e89 100644
--- a/plugins/vnc/vinagre-vnc-plugin.c
+++ b/plugins/vnc/vinagre-vnc-plugin.c
@@ -24,6 +24,7 @@
#include "vinagre-vnc-plugin.h"
#include "vinagre-vnc-connection.h"
+#include "vinagre-vnc-tab.h"
#include <string.h>
#include <glib/gi18n-lib.h>
@@ -179,6 +180,14 @@ the_end:
}
+static GtkWidget *
+impl_new_tab (VinagrePlugin *plugin,
+ VinagreConnection *conn,
+ VinagreWindow *window)
+{
+ return vinagre_vnc_tab_new (conn, window);
+}
+
static void
vinagre_vnc_plugin_init (VinagreVncPlugin *plugin)
{
@@ -209,5 +218,6 @@ vinagre_vnc_plugin_class_init (VinagreVncPluginClass *klass)
plugin_class->new_connection = impl_new_connection;
plugin_class->new_connection_from_file = impl_new_connection_from_file;
plugin_class->get_mdns_service = impl_get_mdns_service;
+ plugin_class->new_tab = impl_new_tab;
}
/* vim: set ts=8: */
diff --git a/plugins/vnc/vinagre-vnc-tab.c b/plugins/vnc/vinagre-vnc-tab.c
index 25d6e9d..f884b66 100644
--- a/plugins/vnc/vinagre-vnc-tab.c
+++ b/plugins/vnc/vinagre-vnc-tab.c
@@ -53,6 +53,8 @@ enum
PROP_ORIGINAL_HEIGHT
};
+static void open_vnc (VinagreVncTab *vnc_tab);
+
static void
vinagre_vnc_tab_get_property (GObject *object,
guint prop_id,
@@ -181,6 +183,12 @@ vinagre_vnc_tab_dispose (GObject *object)
G_OBJECT_CLASS (vinagre_vnc_tab_parent_class)->dispose (object);
}
+static void
+vinagre_vnc_tab_constructed (GObject *object)
+{
+ open_vnc (VINAGRE_VNC_TAB (object));
+}
+
static void
vinagre_vnc_tab_class_init (VinagreVncTabClass *klass)
{
@@ -190,6 +198,7 @@ vinagre_vnc_tab_class_init (VinagreVncTabClass *klass)
object_class->finalize = vinagre_vnc_tab_finalize;
object_class->dispose = vinagre_vnc_tab_dispose;
object_class->get_property = vinagre_vnc_tab_get_property;
+ object_class->constructed = vinagre_vnc_tab_constructed;
tab_class->impl_get_tooltip = vnc_tab_get_tooltip;
tab_class->impl_get_connected_actions = vnc_get_connected_actions;
@@ -856,17 +865,15 @@ vinagre_vnc_tab_init (VinagreVncTab *vnc_tab)
}
GtkWidget *
-vinagre_vnc_tab_new (VinagreConnection *conn, VinagreWindow *window)
+vinagre_vnc_tab_new (VinagreConnection *conn,
+ VinagreWindow *window)
{
- VinagreVncTab *tab = g_object_new (VINAGRE_TYPE_VNC_TAB,
- "conn", conn,
- "window", window,
- NULL);
- open_vnc (tab);
- return GTK_WIDGET (tab);
+ return GTK_WIDGET (g_object_new (VINAGRE_TYPE_VNC_TAB,
+ "conn", conn,
+ "window", window,
+ NULL));
}
-
void
vinagre_vnc_tab_send_ctrlaltdel (VinagreVncTab *tab)
{
diff --git a/vinagre/vinagre-plugin.c b/vinagre/vinagre-plugin.c
index 89ba63b..776bc1e 100644
--- a/vinagre/vinagre-plugin.c
+++ b/vinagre/vinagre-plugin.c
@@ -76,6 +76,14 @@ default_new_connection (VinagrePlugin *plugin)
return NULL;
}
+static GtkWidget *
+default_new_tab (VinagrePlugin *plugin,
+ VinagreConnection *conn,
+ VinagreWindow *window)
+{
+ return NULL;
+}
+
static VinagreConnection *
default_new_connection_from_file (VinagrePlugin *plugin,
const gchar *data,
@@ -163,6 +171,7 @@ vinagre_plugin_class_init (VinagrePluginClass *klass)
klass->new_connection = default_new_connection;
klass->new_connection_from_file = default_new_connection_from_file;
klass->get_mdns_service = default_get_protocol;
+ klass->new_tab = default_new_tab;
klass->create_configure_dialog = create_configure_dialog;
klass->is_configurable = is_configurable;
@@ -454,4 +463,21 @@ vinagre_plugin_get_mdns_service (VinagrePlugin *plugin)
return VINAGRE_PLUGIN_GET_CLASS (plugin)->get_mdns_service (plugin);
}
+/**
+ * vinagre_plugin_new_tab
+ * @plugin: a #VinagreTab
+ *
+ *
+ * Returns: a subclass of the Tab class
+ */
+GtkWidget *
+vinagre_plugin_new_tab (VinagrePlugin *plugin,
+ VinagreConnection *conn,
+ VinagreWindow *window)
+{
+ g_return_val_if_fail (VINAGRE_IS_PLUGIN (plugin), NULL);
+
+ return VINAGRE_PLUGIN_GET_CLASS (plugin)->new_tab (plugin, conn, window);
+}
+
/* vim: set ts=8: */
diff --git a/vinagre/vinagre-plugin.h b/vinagre/vinagre-plugin.h
index 37a709f..5badbbb 100644
--- a/vinagre/vinagre-plugin.h
+++ b/vinagre/vinagre-plugin.h
@@ -82,6 +82,9 @@ struct _VinagrePluginClass
gboolean use_bookmarks,
gchar **error_msg);
const gchar *(*get_mdns_service) (VinagrePlugin *plugin);
+ GtkWidget *(*new_tab) (VinagrePlugin *plugin,
+ VinagreConnection *conn,
+ VinagreWindow *window);
/* Plugins should not override this, it's handled automatically by
the VinagrePluginClass */
@@ -123,6 +126,10 @@ VinagreConnection *vinagre_plugin_new_connection_from_file (VinagrePlugin *plugi
gchar **error_msg);
const gchar *vinagre_plugin_get_mdns_service (VinagrePlugin *plugin);
+GtkWidget *vinagre_plugin_new_tab (VinagrePlugin *plugin,
+ VinagreConnection *conn,
+ VinagreWindow *window);
+
/**
* VINAGRE_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, CODE):
*
diff --git a/vinagre/vinagre-tab.c b/vinagre/vinagre-tab.c
index ac14b24..a2e765e 100644
--- a/vinagre/vinagre-tab.c
+++ b/vinagre/vinagre-tab.c
@@ -32,6 +32,8 @@
#include "vinagre-utils.h"
#include "vinagre-prefs.h"
#include "view/autoDrawer.h"
+#include "vinagre-plugin.h"
+#include "vinagre-plugins-engine.h"
#define VINAGRE_TAB_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), VINAGRE_TYPE_TAB, VinagreTabPrivate))
@@ -443,14 +445,19 @@ vinagre_tab_init (VinagreTab *tab)
GtkWidget *
vinagre_tab_new (VinagreConnection *conn, VinagreWindow *window)
{
-/* switch (vinagre_connection_get_protocol (conn))
+ VinagrePlugin *plugin;
+ GtkWidget *tab;
+ const gchar *protocol = vinagre_connection_get_protocol (conn);
+
+ plugin = g_hash_table_lookup (vinagre_plugin_engine_get_plugins_by_protocol (vinagre_plugins_engine_get_default ()),
+ protocol);
+ if (!plugin)
{
- case VINAGRE_CONNECTION_PROTOCOL_VNC: return GTK_WIDGET (vinagre_vnc_tab_new (conn, window));
- default: g_assert_not_reached ();
+ g_warning (_("The protocol %s is not supported."), protocol);
+ return NULL;
}
-*/
-// TODO:
- return NULL;
+
+ return vinagre_plugin_new_tab (plugin, conn, window);
}
gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]