[vinagre] Make VNC plugin work on the new "Connect" dialog.



commit 155ff4c67ad78037ebc3ef8375c6966245a5c981
Author: Jonh Wendell <jwendell gnome org>
Date:   Wed Jul 22 16:56:49 2009 -0300

    Make VNC plugin work on the new "Connect" dialog.

 plugins/vnc/vinagre-vnc-connection.c |   20 +++++++++++++++
 plugins/vnc/vinagre-vnc-plugin.c     |   43 ++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/plugins/vnc/vinagre-vnc-connection.c b/plugins/vnc/vinagre-vnc-connection.c
index b4a4797..bdb2fcc 100644
--- a/plugins/vnc/vinagre-vnc-connection.c
+++ b/plugins/vnc/vinagre-vnc-connection.c
@@ -205,6 +205,25 @@ vnc_fill_conn_from_file (VinagreConnection *conn, GKeyFile *file)
 }
 
 static void
+vnc_parse_options_widget (VinagreConnection *conn, GtkWidget *widget)
+{
+  GtkWidget *view_only, *scaling;
+
+  view_only = g_object_get_data (G_OBJECT (widget), "view_only");
+  scaling = g_object_get_data (G_OBJECT (widget), "scaling");
+  if (!view_only || !scaling)
+    {
+      g_warning ("Wrong widget passed to vnc_parse_options_widget()");
+      return;
+    }
+
+  g_object_set (conn,
+		"view-only", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (view_only)),
+		"scaling", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scaling)),
+		NULL);
+}
+
+static void
 vinagre_vnc_connection_class_init (VinagreVncConnectionClass *klass)
 {
   GObjectClass* object_class = G_OBJECT_CLASS (klass);
@@ -221,6 +240,7 @@ vinagre_vnc_connection_class_init (VinagreVncConnectionClass *klass)
   parent_class->impl_parse_item  = vnc_parse_item;
   parent_class->impl_get_best_name = vnc_get_best_name;
   parent_class->impl_fill_conn_from_file = vnc_fill_conn_from_file;
+  parent_class->impl_parse_options_widget = vnc_parse_options_widget;
 
   g_object_class_install_property (object_class,
                                    PROP_DESKTOP_NAME,
diff --git a/plugins/vnc/vinagre-vnc-plugin.c b/plugins/vnc/vinagre-vnc-plugin.c
index 4f22e89..195e3ae 100644
--- a/plugins/vnc/vinagre-vnc-plugin.c
+++ b/plugins/vnc/vinagre-vnc-plugin.c
@@ -73,6 +73,18 @@ impl_get_protocol (VinagrePlugin *plugin)
   return "vnc";
 }
 
+static gchar **
+impl_get_public_description (VinagrePlugin *plugin)
+{
+  gchar **result = g_new (gchar *, 3);
+
+  result[0] = g_strdup ("VNC");
+  result[1] = g_strdup ("Access Unix/Linux, Windows and other machines.");
+  result[2] = NULL;
+
+  return result;
+}
+
 static const gchar *
 impl_get_mdns_service (VinagrePlugin *plugin)
 {
@@ -188,6 +200,35 @@ impl_new_tab (VinagrePlugin *plugin,
   return vinagre_vnc_tab_new (conn, window);
 }
 
+static GtkWidget *
+impl_get_connect_widget (VinagrePlugin *plugin)
+{
+  GtkWidget *box, *check, *label;
+  GtkTable  *table;
+
+  box = gtk_vbox_new (TRUE, 0);
+
+  label = gtk_label_new (_("<b>VNC Options</b>"));
+  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+  gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
+
+  table = GTK_TABLE (gtk_table_new (2, 2, FALSE));
+  label = gtk_label_new ("  ");
+  gtk_table_attach (table, label, 0, 1, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+  check = gtk_check_button_new_with_mnemonic ("_View only");
+  g_object_set_data (G_OBJECT (box), "view_only", check);
+  gtk_table_attach_defaults (table, check, 1, 2, 0, 1);
+
+  check = gtk_check_button_new_with_mnemonic ("_Scaling");
+  g_object_set_data (G_OBJECT (box), "scaling", check);
+  gtk_table_attach_defaults (table, check, 1, 2, 1, 2);
+
+  gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (table), TRUE, TRUE, 0);
+  return box;
+}
+
 static void
 vinagre_vnc_plugin_init (VinagreVncPlugin *plugin)
 {
@@ -215,9 +256,11 @@ vinagre_vnc_plugin_class_init (VinagreVncPluginClass *klass)
   plugin_class->update_ui  = impl_update_ui;
   plugin_class->get_context_group = impl_get_context_group;
   plugin_class->get_protocol  = impl_get_protocol;
+  plugin_class->get_public_description  = impl_get_public_description;
   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;
+  plugin_class->get_connect_widget = impl_get_connect_widget;
 }
 /* vim: set ts=8: */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]