[vinagre/depth: 2/2] Added ability to change depth color. Closes #485204.



commit 400418f7fdb61941ea4fda2671744d77cbdf13c9
Author: Jonh Wendell <jwendell gnome org>
Date:   Fri Oct 2 09:46:35 2009 -0300

    Added ability to change depth color. Closes #485204.

 plugins/vnc/vinagre-vnc-connection.c |    6 ++++--
 plugins/vnc/vinagre-vnc-plugin.c     |   34 +++++++++++++++++++++++++++++-----
 plugins/vnc/vinagre-vnc-tab.c        |    4 +++-
 3 files changed, 36 insertions(+), 8 deletions(-)
---
diff --git a/plugins/vnc/vinagre-vnc-connection.c b/plugins/vnc/vinagre-vnc-connection.c
index d158b69..56256a0 100644
--- a/plugins/vnc/vinagre-vnc-connection.c
+++ b/plugins/vnc/vinagre-vnc-connection.c
@@ -236,11 +236,12 @@ vnc_fill_conn_from_file (VinagreConnection *conn, GKeyFile *file)
 static void
 vnc_parse_options_widget (VinagreConnection *conn, GtkWidget *widget)
 {
-  GtkWidget *view_only, *scaling;
+  GtkWidget *view_only, *scaling, *depth_combo;
 
   view_only = g_object_get_data (G_OBJECT (widget), "view_only");
   scaling = g_object_get_data (G_OBJECT (widget), "scaling");
-  if (!view_only || !scaling)
+  depth_combo = g_object_get_data (G_OBJECT (widget), "depth_combo");
+  if (!view_only || !scaling || !depth_combo)
     {
       g_warning ("Wrong widget passed to vnc_parse_options_widget()");
       return;
@@ -249,6 +250,7 @@ vnc_parse_options_widget (VinagreConnection *conn, GtkWidget *widget)
   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)),
+		"depth-profile", gtk_combo_box_get_active (GTK_COMBO_BOX (depth_combo)),
 		NULL);
 }
 
diff --git a/plugins/vnc/vinagre-vnc-plugin.c b/plugins/vnc/vinagre-vnc-plugin.c
index 16646d8..aee3e3f 100644
--- a/plugins/vnc/vinagre-vnc-plugin.c
+++ b/plugins/vnc/vinagre-vnc-plugin.c
@@ -340,20 +340,22 @@ impl_new_tab (VinagrePlugin *plugin,
 static GtkWidget *
 impl_get_connect_widget (VinagrePlugin *plugin, VinagreConnection *conn)
 {
-  GtkWidget *box, *check, *label;
+  GtkWidget *box, *check, *label, *combo, *depth_box;
   GtkTable  *table;
   gchar     *str;
+  gint      depth_profile;
 
-  box = gtk_vbox_new (TRUE, 0);
+  box = gtk_vbox_new (FALSE, 0);
 
   str = g_strdup_printf ("<b>%s</b>", _("VNC Options"));
   label = gtk_label_new (str);
   g_free (str);
   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);
+  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 (2, 2, FALSE));
+  table = GTK_TABLE (gtk_table_new (3, 2, FALSE));
   label = gtk_label_new ("  ");
   gtk_table_attach (table, label, 0, 1, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
 
@@ -371,7 +373,29 @@ 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)));
 
-  gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (table), TRUE, TRUE, 0);
+  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);
+  gtk_box_pack_start (GTK_BOX (depth_box), GTK_WIDGET (label), FALSE, FALSE, 0);
+
+  if (VINAGRE_IS_VNC_CONNECTION (conn))
+    depth_profile = vinagre_vnc_connection_get_depth_profile (VINAGRE_VNC_CONNECTION (conn));
+  else
+    depth_profile = 0;
+
+  combo = gtk_combo_box_new_text ();
+  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Use Server Settings"));
+  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("True Color (24 bits)"));
+  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("High Color (16 bits)"));
+  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Low Color (8 bits)"));
+  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Ultra Low Color (3 bits)"));
+  gtk_combo_box_set_active (GTK_COMBO_BOX (combo), depth_profile);
+  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_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 441d6ca..bb9bc63 100644
--- a/plugins/vnc/vinagre-vnc-tab.c
+++ b/plugins/vnc/vinagre-vnc-tab.c
@@ -240,7 +240,7 @@ static void
 open_vnc (VinagreVncTab *vnc_tab)
 {
   gchar      *host, *port_str;
-  gint       port, shared, fd;
+  gint       port, shared, fd, depth_profile;
   gboolean   scaling, success;
   VncDisplay *vnc = VNC_DISPLAY (vnc_tab->priv->vnc);
   VinagreTab *tab = VINAGRE_TAB (vnc_tab);
@@ -251,6 +251,7 @@ open_vnc (VinagreVncTab *vnc_tab)
 		"scaling", &scaling,
 		"shared", &shared,
 		"fd", &fd,
+		"depth-profile", &depth_profile,
 		NULL);
 
   port_str = g_strdup_printf ("%d", port);
@@ -261,6 +262,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);
 
   if (fd > 0)
     success = vnc_display_open_fd (vnc, fd);



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