vinagre r350 - in trunk: . data src
- From: jwendell svn gnome org
- To: svn-commits-list gnome org
- Subject: vinagre r350 - in trunk: . data src
- Date: Sat, 31 May 2008 17:58:55 +0000 (UTC)
Author: jwendell
Date: Sat May 31 17:58:55 2008
New Revision: 350
URL: http://svn.gnome.org/viewvc/vinagre?rev=350&view=rev
Log:
2008-05-31 Jonh Wendell <jwendell gnome org>
Fix bug #515816 - connect dialog should remember Host/Port address.
Also added options to connect in fullscreen, view only and with scaling
directly in the connection dialog.
Modified:
trunk/ChangeLog
trunk/data/vinagre.glade
trunk/data/vinagre.schemas.in
trunk/src/vinagre-connect.c
trunk/src/vinagre-connection.c
trunk/src/vinagre-connection.h
trunk/src/vinagre-prefs.c
trunk/src/vinagre-tab.c
Modified: trunk/data/vinagre.glade
==============================================================================
--- trunk/data/vinagre.glade (original)
+++ trunk/data/vinagre.glade Sat May 31 17:58:55 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.1 on Sun Feb 3 10:52:09 2008 -->
+<!--Generated with glade3 3.4.5 on Sat May 31 11:15:56 2008 -->
<glade-interface>
<widget class="GtkDialog" id="connect_dialog">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -34,21 +34,60 @@
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">1</property>
<property name="n_columns">4</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
- <placeholder/>
+ <widget class="GtkComboBoxEntry" id="host_entry">
+ <property name="width_request">250</property>
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes" comments="Tooltip for host entry in connect dialog">host or host:display or host::port</property>
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="comboboxentry-entry1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="activates_default">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
</child>
<child>
- <placeholder/>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label"> </property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">_Host:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">host_entry</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
</child>
<child>
<widget class="GtkButton" id="find_button">
+ <property name="visible">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="no_show_all">True</property>
<property name="label">gtk-find</property>
<property name="use_stock">True</property>
<property name="focus_on_click">False</property>
@@ -61,82 +100,100 @@
<property name="y_options"></property>
</packing>
</child>
+ </widget>
+ <packing>
+ <property name="padding">4</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Connection options</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">6</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table4">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
<child>
- <widget class="GtkSpinButton" id="port_entry">
+ <widget class="GtkCheckButton" id="scaling_check">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="activates_default">True</property>
- <property name="adjustment">5900 1 65535 1 10 10</property>
+ <property name="label" translatable="yes">_Scaling</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label4">
+ <widget class="GtkCheckButton" id="viewonly_check">
<property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Port:</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_View only</property>
<property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="host_entry">
+ <widget class="GtkCheckButton" id="fullscreen_check">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="activates_default">True</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Host:</property>
+ <property name="label" translatable="yes">_Full screen</property>
<property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label2">
+ <widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label"> </property>
</widget>
<packing>
- <property name="x_options">GTK_FILL</property>
+ <property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
- <property name="padding">6</property>
- <property name="position">2</property>
+ <property name="position">5</property>
</packing>
</child>
<child internal-child="action_area">
@@ -223,31 +280,27 @@
<placeholder/>
</child>
<child>
- <widget class="GtkCheckButton" id="save_password_check">
+ <widget class="GtkLabel" id="label19">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Remember this password</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Host:</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
+ <property name="mnemonic_widget">password_entry</property>
</widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
</child>
<child>
- <widget class="GtkLabel" id="host_label">
+ <widget class="GtkLabel" id="label21">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
+ <property name="label" translatable="yes">_Password:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">password_entry</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
<child>
@@ -267,28 +320,32 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label21">
+ <widget class="GtkLabel" id="host_label">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_Password:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">password_entry</property>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label19">
+ <widget class="GtkCheckButton" id="save_password_check">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Host:</property>
+ <property name="label" translatable="yes">_Remember this password</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">password_entry</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
</widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
</child>
</widget>
<packing>
@@ -507,38 +564,45 @@
<placeholder/>
</child>
<child>
- <widget class="GtkLabel" id="label16">
+ <widget class="GtkSpinButton" id="edit_bookmark_port_entry">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label"> </property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">5000 1 65535 1 10 10</property>
</widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
</child>
<child>
- <widget class="GtkLabel" id="label14">
+ <widget class="GtkEntry" id="edit_bookmark_host_entry">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Name:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">edit_bookmark_name_entry</property>
+ <property name="activates_default">True</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label13">
+ <widget class="GtkEntry" id="edit_bookmark_name_entry">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="is_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Host:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">edit_bookmark_host_entry</property>
+ <property name="activates_default">True</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
</packing>
</child>
<child>
@@ -557,46 +621,39 @@
</packing>
</child>
<child>
- <widget class="GtkEntry" id="edit_bookmark_name_entry">
+ <widget class="GtkLabel" id="label13">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="is_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="activates_default">True</property>
+ <property name="label" translatable="yes">_Host:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">edit_bookmark_host_entry</property>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="edit_bookmark_host_entry">
+ <widget class="GtkLabel" id="label14">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="activates_default">True</property>
+ <property name="label" translatable="yes">_Name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">edit_bookmark_name_entry</property>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
<child>
- <widget class="GtkSpinButton" id="edit_bookmark_port_entry">
+ <widget class="GtkLabel" id="label16">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="activates_default">True</property>
- <property name="adjustment">5000 1 65535 1 10 10</property>
+ <property name="label"> </property>
</widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
</child>
</widget>
<packing>
Modified: trunk/data/vinagre.schemas.in
==============================================================================
--- trunk/data/vinagre.schemas.in (original)
+++ trunk/data/vinagre.schemas.in Sat May 31 17:58:55 2008
@@ -73,5 +73,17 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/vinagre/history_size</key>
+ <applyto>/apps/vinagre/history_size</applyto>
+ <owner>vinagre</owner>
+ <type>int</type>
+ <default>15</default>
+ <locale name="C">
+ <short>Maximum number of history items in connect dialog</short>
+ <long>Specifies the maximum number of items in the host dropdown entry.</long>
+ </locale>
+ </schema>
+
</schemalist>
</gconfschemafile>
Modified: trunk/src/vinagre-connect.c
==============================================================================
--- trunk/src/vinagre-connect.c (original)
+++ trunk/src/vinagre-connect.c Sat May 31 17:58:55 2008
@@ -23,19 +23,157 @@
#include <glib.h>
#include <glade/glade.h>
#include <avahi-ui/avahi-ui.h>
+#include <string.h>
#include "vinagre-connect.h"
#include "vinagre-utils.h"
#include "vinagre-bookmarks.h"
+#include "vinagre-prefs.h"
typedef struct {
GladeXML *xml;
GtkWidget *dialog;
GtkWidget *host_entry;
- GtkWidget *port_entry;
GtkWidget *find_button;
+ GtkWidget *fullscreen_check;
+ GtkWidget *scaling_check;
+ GtkWidget *viewonly_check;
} VinagreConnectDialog;
+enum {
+ COLUMN_TEXT,
+ N_COLUMNS
+};
+
+static gchar*
+history_filename () {
+ return g_build_filename (g_get_user_config_dir (),
+ "vinagre",
+ "history",
+ NULL);
+}
+
+static GPtrArray *
+saved_history (void)
+{
+ gchar *filename, *file_contents = NULL;
+ gchar **history_from_file = NULL, **list;
+ gboolean success;
+ gint len;
+ GPtrArray *array;
+
+ array = g_ptr_array_new ();
+
+ filename = history_filename ();
+ success = g_file_get_contents (filename,
+ &file_contents,
+ NULL,
+ NULL);
+
+ if (success)
+ {
+ history_from_file = g_strsplit (file_contents, "\n", 0);
+ len = g_strv_length (history_from_file);
+ if (strlen (history_from_file[len-1]) == 0)
+ {
+ g_free (history_from_file[len-1]);
+ history_from_file[len-1] = NULL;
+ }
+
+ list = history_from_file;
+
+ while (*list != NULL)
+ g_ptr_array_add (array, *list++);
+ }
+
+ g_free (filename);
+ g_free (file_contents);
+ return array;
+}
+
+static void
+setup_combo (GtkWidget *combo)
+{
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkEntryCompletion *completion;
+ GPtrArray *history;
+ gint i, size;
+
+ store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING);
+
+ history = saved_history ();
+
+ g_object_get (vinagre_prefs_get_default (), "history-size", &size, NULL);
+ if (size <= 0)
+ size = G_MAXINT;
+
+ for (i=history->len-1; i>=0 && i>=(gint)history->len-size; i--)
+ {
+ GtkTreeIter iter;
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, COLUMN_TEXT, g_ptr_array_index (history, i), -1);
+ }
+ g_ptr_array_free (history, TRUE);
+
+ gtk_combo_box_set_model (GTK_COMBO_BOX (combo),
+ GTK_TREE_MODEL (store));
+ gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (combo),
+ 0);
+
+ completion = gtk_entry_completion_new ();
+ gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (store));
+ gtk_entry_completion_set_text_column (completion, 0);
+ gtk_entry_completion_set_inline_completion (completion, TRUE);
+ gtk_entry_set_completion (GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combo))), completion);
+ g_object_unref (completion);
+}
+
+void
+save_history (GtkWidget *combo) {
+ gchar *host;
+ GPtrArray *history;
+ guint i;
+ gchar *filename, *path;
+ GString *content;
+ GError *error = NULL;
+
+ host = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
+
+ history = saved_history ();
+ for (i=0; i<history->len; i++)
+ if (!g_strcmp0 (g_ptr_array_index (history, i), host))
+ {
+ g_ptr_array_remove_index (history, i);
+ break;
+ }
+
+ g_ptr_array_add (history, host);
+ content = g_string_new (NULL);
+
+ for (i=0; i<history->len; i++)
+ g_string_append_printf (content, "%s\n", g_ptr_array_index (history, i));
+
+ filename = history_filename ();
+ path = g_path_get_dirname (filename);
+ g_mkdir_with_parents (path, 0755);
+
+ g_file_set_contents (filename,
+ content->str,
+ -1,
+ &error);
+
+ g_free (filename);
+ g_free (path);
+ g_ptr_array_free (history, TRUE);
+ g_string_free (content, TRUE);
+
+ if (error) {
+ g_warning (_("Error while saving history file: %s"), error->message);
+ g_error_free (error);
+ }
+}
+
static void
vinagre_connect_find_button_cb (GtkButton *button,
VinagreConnectDialog *dialog)
@@ -56,11 +194,16 @@
if (gtk_dialog_run(GTK_DIALOG(d)) == GTK_RESPONSE_ACCEPT)
{
- gtk_entry_set_text (GTK_ENTRY (dialog->host_entry),
- aui_service_dialog_get_host_name(AUI_SERVICE_DIALOG(d)));
+ gchar *tmp;
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->port_entry),
- aui_service_dialog_get_port(AUI_SERVICE_DIALOG(d)));
+ tmp = g_strdup_printf ("%s::%d",
+ aui_service_dialog_get_host_name(AUI_SERVICE_DIALOG(d)),
+ aui_service_dialog_get_port(AUI_SERVICE_DIALOG(d)));
+
+ gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dialog->host_entry))),
+ tmp);
+
+ g_free (tmp);
}
gtk_widget_destroy (d);
@@ -70,8 +213,6 @@
{
VinagreConnection *conn = NULL;
gint result;
- const gchar *host;
- int port;
VinagreConnectDialog dialog;
dialog.xml = glade_xml_new (vinagre_utils_get_glade_filename (), NULL, NULL);
@@ -79,10 +220,13 @@
gtk_window_set_transient_for (GTK_WINDOW (dialog.dialog), GTK_WINDOW (window));
dialog.host_entry = glade_xml_get_widget (dialog.xml, "host_entry");
- dialog.port_entry = glade_xml_get_widget (dialog.xml, "port_entry");
dialog.find_button = glade_xml_get_widget (dialog.xml, "find_button");
+ dialog.fullscreen_check = glade_xml_get_widget (dialog.xml, "fullscreen_check");
+ dialog.viewonly_check = glade_xml_get_widget (dialog.xml, "viewonly_check");
+ dialog.scaling_check = glade_xml_get_widget (dialog.xml, "scaling_check");
+
+ setup_combo (dialog.host_entry);
- gtk_widget_show (dialog.find_button);
g_signal_connect (dialog.find_button,
"clicked",
G_CALLBACK (vinagre_connect_find_button_cb),
@@ -93,20 +237,33 @@
if (result == GTK_RESPONSE_OK)
{
- host = gtk_entry_get_text (GTK_ENTRY(dialog.host_entry));
- port = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog.port_entry));
+ gchar *host = NULL, *error_msg = NULL;
+ host = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog.host_entry));
gtk_widget_hide (GTK_WIDGET (dialog.dialog));
- conn = vinagre_bookmarks_exists (vinagre_bookmarks_get_default (),
- host,
- port);
- if (!conn)
+ if (!host || !g_strcmp0 (host, ""))
+ goto fail;
+
+ save_history (dialog.host_entry);
+
+ conn = vinagre_connection_new_from_string (host, &error_msg);
+ if (conn)
+ {
+ g_object_set (conn,
+ "scaling", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog.scaling_check)),
+ "view-only", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog.viewonly_check)),
+ "fullscreen", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog.fullscreen_check)),
+ NULL);
+ }
+ else
{
- conn = vinagre_connection_new ();
- vinagre_connection_set_host (conn, host);
- vinagre_connection_set_port (conn, port);
+ vinagre_utils_show_error (error_msg ? error_msg : _("Unknown error"),
+ GTK_WINDOW (window));
}
+fail:
+ g_free (host);
+ g_free (error_msg);
}
gtk_widget_destroy (dialog.dialog);
Modified: trunk/src/vinagre-connection.c
==============================================================================
--- trunk/src/vinagre-connection.c (original)
+++ trunk/src/vinagre-connection.c Sat May 31 17:58:55 2008
@@ -35,6 +35,9 @@
gchar *name;
gchar *password;
gchar *desktop_name;
+ gboolean view_only;
+ gboolean scaling;
+ gboolean fullscreen;
};
enum
@@ -47,7 +50,10 @@
PROP_PASSWORD,
PROP_DESKTOP_NAME,
PROP_BEST_NAME,
- PROP_ICON
+ PROP_ICON,
+ PROP_VIEW_ONLY,
+ PROP_SCALING,
+ PROP_FULLSCREEN
};
#define VINAGRE_CONNECTION_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VINAGRE_TYPE_CONNECTION, VinagreConnectionPrivate))
@@ -64,6 +70,9 @@
conn->priv->password = NULL;
conn->priv->name = NULL;
conn->priv->desktop_name = NULL;
+ conn->priv->view_only = FALSE;
+ conn->priv->scaling = FALSE;
+ conn->priv->fullscreen = FALSE;
}
static void
@@ -125,6 +134,18 @@
vinagre_connection_set_desktop_name (conn, g_value_get_string (value));
break;
+ case PROP_VIEW_ONLY:
+ vinagre_connection_set_view_only (conn, g_value_get_boolean (value));
+ break;
+
+ case PROP_SCALING:
+ vinagre_connection_set_scaling (conn, g_value_get_boolean (value));
+ break;
+
+ case PROP_FULLSCREEN:
+ vinagre_connection_set_fullscreen (conn, g_value_get_boolean (value));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -175,6 +196,18 @@
g_value_set_object (value, vinagre_connection_get_icon (conn));
break;
+ case PROP_VIEW_ONLY:
+ g_value_set_boolean (value, conn->priv->view_only);
+ break;
+
+ case PROP_SCALING:
+ g_value_set_boolean (value, conn->priv->scaling);
+ break;
+
+ case PROP_FULLSCREEN:
+ g_value_set_boolean (value, conn->priv->fullscreen);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -289,6 +322,39 @@
G_PARAM_STATIC_NICK |
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_BLURB));
+ g_object_class_install_property (object_class,
+ PROP_VIEW_ONLY,
+ g_param_spec_boolean ("view-only",
+ "View-only connection",
+ "Whether this connection is a view-only one",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB));
+ g_object_class_install_property (object_class,
+ PROP_SCALING,
+ g_param_spec_boolean ("scaling",
+ "Use scaling",
+ "Whether to use scaling on this connection",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB));
+ g_object_class_install_property (object_class,
+ PROP_FULLSCREEN,
+ g_param_spec_boolean ("fullscreen",
+ "Full screen connection",
+ "Whether this connection is a view-only one",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB));
}
@@ -589,4 +655,53 @@
return pixbuf;
}
+
+void
+vinagre_connection_set_view_only (VinagreConnection *conn,
+ gboolean value)
+{
+ g_return_if_fail (VINAGRE_IS_CONNECTION (conn));
+
+ conn->priv->view_only = value;
+}
+gboolean
+vinagre_connection_get_view_only (VinagreConnection *conn)
+{
+ g_return_val_if_fail (VINAGRE_IS_CONNECTION (conn), FALSE);
+
+ return conn->priv->view_only;
+}
+
+void
+vinagre_connection_set_scaling (VinagreConnection *conn,
+ gboolean value)
+{
+ g_return_if_fail (VINAGRE_IS_CONNECTION (conn));
+
+ conn->priv->scaling = value;
+}
+gboolean
+vinagre_connection_get_scaling (VinagreConnection *conn)
+{
+ g_return_val_if_fail (VINAGRE_IS_CONNECTION (conn), FALSE);
+
+ return conn->priv->scaling;
+}
+
+void
+vinagre_connection_set_fullscreen (VinagreConnection *conn,
+ gboolean value)
+{
+ g_return_if_fail (VINAGRE_IS_CONNECTION (conn));
+
+ conn->priv->fullscreen = value;
+}
+gboolean
+vinagre_connection_get_fullscreen (VinagreConnection *conn)
+{
+ g_return_val_if_fail (VINAGRE_IS_CONNECTION (conn), FALSE);
+
+ return conn->priv->fullscreen;
+}
+
/* vim: ts=8 */
Modified: trunk/src/vinagre-connection.h
==============================================================================
--- trunk/src/vinagre-connection.h (original)
+++ trunk/src/vinagre-connection.h Sat May 31 17:58:55 2008
@@ -92,6 +92,18 @@
GdkPixbuf* vinagre_connection_get_icon (VinagreConnection *conn);
+gboolean vinagre_connection_get_view_only (VinagreConnection *conn);
+void vinagre_connection_set_view_only (VinagreConnection *conn,
+ gboolean value);
+
+gboolean vinagre_connection_get_scaling (VinagreConnection *conn);
+void vinagre_connection_set_scaling (VinagreConnection *conn,
+ gboolean value);
+
+gboolean vinagre_connection_get_fullscreen (VinagreConnection *conn);
+void vinagre_connection_set_fullscreen (VinagreConnection *conn,
+ gboolean value);
+
G_END_DECLS
#endif /* __VINAGRE_CONNECTION_H__ */
Modified: trunk/src/vinagre-prefs.c
==============================================================================
--- trunk/src/vinagre-prefs.c (original)
+++ trunk/src/vinagre-prefs.c Sat May 31 17:58:55 2008
@@ -29,6 +29,7 @@
#define VM_STATUSBAR_VISIBLE VINAGRE_BASE_KEY "/statusbar_visible"
#define VM_SIDE_PANEL_VISIBLE VINAGRE_BASE_KEY "/side_pane_visible"
#define VM_SHOW_ACCELS VINAGRE_BASE_KEY "/show_accels"
+#define VM_HISTORY_SIZE VINAGRE_BASE_KEY "/history_size"
#define VM_WINDOW_STATE VINAGRE_BASE_KEY "/window_state"
#define VM_WINDOW_WIDTH VINAGRE_BASE_KEY "/window_width"
@@ -53,7 +54,8 @@
PROP_WINDOW_WIDTH,
PROP_WINDOW_HEIGHT,
PROP_SIDE_PANEL_SIZE,
- PROP_SHOW_ACCELS
+ PROP_SHOW_ACCELS,
+ PROP_HISTORY_SIZE
};
G_DEFINE_TYPE (VinagrePrefs, vinagre_prefs, G_TYPE_OBJECT);
@@ -231,6 +233,9 @@
case PROP_SHOW_ACCELS:
vinagre_prefs_set_bool (prefs, VM_SHOW_ACCELS, g_value_get_boolean (value));
break;
+ case PROP_HISTORY_SIZE:
+ vinagre_prefs_set_int (prefs, VM_HISTORY_SIZE, g_value_get_int (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -274,6 +279,9 @@
case PROP_SHOW_ACCELS:
g_value_set_boolean (value, vinagre_prefs_get_bool (prefs, VM_SHOW_ACCELS, TRUE));
break;
+ case PROP_HISTORY_SIZE:
+ g_value_set_int (value, vinagre_prefs_get_int (prefs, VM_HISTORY_SIZE, 15));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -362,6 +370,13 @@
"Whether we should show the menu accelerators (keyboard shortcuts)",
TRUE,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_HISTORY_SIZE,
+ g_param_spec_int ("history-size",
+ "History size",
+ "Max number of items in history dropdown entry",
+ 0, G_MAXINT, 15,
+ G_PARAM_READWRITE));
}
/* vim: ts=8 */
Modified: trunk/src/vinagre-tab.c
==============================================================================
--- trunk/src/vinagre-tab.c (original)
+++ trunk/src/vinagre-tab.c Sat May 31 17:58:55 2008
@@ -259,18 +259,35 @@
open_vnc (VinagreTab *tab)
{
gchar *port;
+ gboolean scaling, view_only, fullscreen;
port = g_strdup_printf ("%d", vinagre_connection_get_port (tab->priv->conn));
-
- if (!vnc_display_open_host (VNC_DISPLAY(tab->priv->vnc), vinagre_connection_get_host (tab->priv->conn), port))
- vinagre_utils_show_error (_("Error connecting to host."), NULL);
+ g_object_get (tab->priv->conn,
+ "view-only", &view_only,
+ "scaling", &scaling,
+ "fullscreen", &fullscreen,
+ NULL);
+
+ vinagre_tab_set_scaling (tab, scaling);
+ vinagre_tab_set_readonly (tab, view_only);
vnc_display_set_pointer_local (VNC_DISPLAY(tab->priv->vnc), TRUE);
vnc_display_set_keyboard_grab (VNC_DISPLAY(tab->priv->vnc), TRUE);
vnc_display_set_pointer_grab (VNC_DISPLAY(tab->priv->vnc), TRUE);
+ if (vnc_display_open_host (VNC_DISPLAY(tab->priv->vnc), vinagre_connection_get_host (tab->priv->conn), port))
+ {
+ gtk_widget_grab_focus (tab->priv->vnc);
+
+ if (fullscreen)
+ vinagre_window_toggle_fullscreen (tab->priv->window);
+ }
+ else
+ {
+ vinagre_utils_show_error (_("Error connecting to host."), NULL);
+ }
+
g_free (port);
- gtk_widget_grab_focus (tab->priv->vnc);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]