[vinagre] Added ability to use JPEG compression (lossy encoding). Closes #573272.



commit 328caeeb55ef0d28a5b838b7b4efe17030920277
Author: Jonh Wendell <jwendell gnome org>
Date:   Thu Oct 22 10:33:45 2009 -0300

    Added ability to use JPEG compression (lossy encoding). Closes #573272.

 plugins/vnc/vinagre-vnc-connection.c |    6 ++++--
 plugins/vnc/vinagre-vnc-plugin.c     |   12 ++++++++++--
 plugins/vnc/vinagre-vnc-tab.c        |    4 +++-
 3 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/plugins/vnc/vinagre-vnc-connection.c b/plugins/vnc/vinagre-vnc-connection.c
index 15183ea..fb4e78c 100644
--- a/plugins/vnc/vinagre-vnc-connection.c
+++ b/plugins/vnc/vinagre-vnc-connection.c
@@ -256,12 +256,13 @@ vnc_fill_conn_from_file (VinagreConnection *conn, GKeyFile *file)
 static void
 vnc_parse_options_widget (VinagreConnection *conn, GtkWidget *widget)
 {
-  GtkWidget *view_only, *scaling, *depth_combo;
+  GtkWidget *view_only, *scaling, *depth_combo, *lossy;
 
   view_only = g_object_get_data (G_OBJECT (widget), "view_only");
   scaling = g_object_get_data (G_OBJECT (widget), "scaling");
   depth_combo = g_object_get_data (G_OBJECT (widget), "depth_combo");
-  if (!view_only || !scaling || !depth_combo)
+  lossy = g_object_get_data (G_OBJECT (widget), "lossy");
+  if (!view_only || !scaling || !depth_combo || !lossy)
     {
       g_warning ("Wrong widget passed to vnc_parse_options_widget()");
       return;
@@ -271,6 +272,7 @@ vnc_parse_options_widget (VinagreConnection *conn, GtkWidget *widget)
 		"view-only", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (view_only)),
 		"scaling", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scaling)),
 		"depth-profile", gtk_combo_box_get_active (GTK_COMBO_BOX (depth_combo)),
+		"lossy-encoding", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (lossy)),
 		NULL);
 }
 
diff --git a/plugins/vnc/vinagre-vnc-plugin.c b/plugins/vnc/vinagre-vnc-plugin.c
index aee3e3f..e4ee0c7 100644
--- a/plugins/vnc/vinagre-vnc-plugin.c
+++ b/plugins/vnc/vinagre-vnc-plugin.c
@@ -355,7 +355,7 @@ impl_get_connect_widget (VinagrePlugin *plugin, VinagreConnection *conn)
   gtk_misc_set_padding (GTK_MISC (label), 0, 6);
   gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
 
-  table = GTK_TABLE (gtk_table_new (3, 2, FALSE));
+  table = GTK_TABLE (gtk_table_new (4, 2, FALSE));
   label = gtk_label_new ("  ");
   gtk_table_attach (table, label, 0, 1, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
 
@@ -373,6 +373,14 @@ impl_get_connect_widget (VinagrePlugin *plugin, VinagreConnection *conn)
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
 				  vinagre_vnc_connection_get_scaling (VINAGRE_VNC_CONNECTION (conn)));
 
+  check = gtk_check_button_new_with_mnemonic (_("_Use JPEG Compression"));
+  gtk_widget_set_tooltip_text (check, _("This might not work on all sort of VNC servers"));
+  g_object_set_data (G_OBJECT (box), "lossy", check);
+  gtk_table_attach_defaults (table, check, 1, 2, 2, 3);
+  if (VINAGRE_IS_VNC_CONNECTION (conn))
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
+				  vinagre_vnc_connection_get_lossy_encoding (VINAGRE_VNC_CONNECTION (conn)));
+
   depth_box = gtk_hbox_new (FALSE, 4);
   label = gtk_label_new_with_mnemonic (_("_Depth Color:"));
   gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
@@ -393,7 +401,7 @@ impl_get_connect_widget (VinagrePlugin *plugin, VinagreConnection *conn)
   g_object_set_data (G_OBJECT (box), "depth_combo", combo);
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
   gtk_box_pack_start (GTK_BOX (depth_box), GTK_WIDGET (combo), FALSE, FALSE, 0);
-  gtk_table_attach_defaults (table, depth_box, 1, 2, 2, 3);
+  gtk_table_attach_defaults (table, depth_box, 1, 2, 3, 4);
 
   gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (table), FALSE, FALSE, 0);
   return box;
diff --git a/plugins/vnc/vinagre-vnc-tab.c b/plugins/vnc/vinagre-vnc-tab.c
index 83adc2b..a60bd02 100644
--- a/plugins/vnc/vinagre-vnc-tab.c
+++ b/plugins/vnc/vinagre-vnc-tab.c
@@ -247,7 +247,7 @@ open_vnc (VinagreVncTab *vnc_tab)
 {
   gchar      *host, *port_str;
   gint       port, shared, fd, depth_profile;
-  gboolean   scaling, success;
+  gboolean   scaling, success, lossy_encoding;
   VncDisplay *vnc = VNC_DISPLAY (vnc_tab->priv->vnc);
   VinagreTab *tab = VINAGRE_TAB (vnc_tab);
 
@@ -258,6 +258,7 @@ open_vnc (VinagreVncTab *vnc_tab)
 		"shared", &shared,
 		"fd", &fd,
 		"depth-profile", &depth_profile,
+		"lossy-encoding", &lossy_encoding,
 		NULL);
 
   port_str = g_strdup_printf ("%d", port);
@@ -269,6 +270,7 @@ open_vnc (VinagreVncTab *vnc_tab)
   vnc_display_set_shared_flag (vnc, shared);
   vnc_display_set_force_size (vnc, !scaling);
   vnc_display_set_depth (vnc, depth_profile);
+  vnc_display_set_lossy_encoding (vnc, lossy_encoding);
 
   if (fd > 0)
     success = vnc_display_open_fd (vnc, fd);



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