[vinagre] Make add/edit bookmarks based on plugins.
- From: Jonh Wendell <jwendell src gnome org>
- To: svn-commits-list gnome org
- Subject: [vinagre] Make add/edit bookmarks based on plugins.
- Date: Mon, 27 Jul 2009 12:04:43 +0000 (UTC)
commit 59731805533cb624be8fae194e91015ac53d9afa
Author: Jonh Wendell <jwendell gnome org>
Date: Fri Jul 24 11:14:33 2009 -0300
Make add/edit bookmarks based on plugins.
data/vinagre.glade | 367 ++++++++++++++++++++--------------------
vinagre/vinagre-bookmarks-ui.c | 74 +++++----
2 files changed, 225 insertions(+), 216 deletions(-)
---
diff --git a/data/vinagre.glade b/data/vinagre.glade
index 5aee924..cd03522 100644
--- a/data/vinagre.glade
+++ b/data/vinagre.glade
@@ -503,240 +503,237 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">2</property>
<child>
- <widget class="GtkLabel" id="label15">
+ <widget class="GtkVBox" id="main_box">
<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</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">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkTable" id="table2">
- <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_columns">3</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
+ <property name="orientation">vertical</property>
<child>
- <widget class="GtkLabel" id="label16">
+ <widget class="GtkHBox" id="hbox1">
<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>
+ <child>
+ <widget class="GtkLabel" id="label15">
+ <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</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">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="protocol_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label"><small>(Type: <i>VNC</i>)</small></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="x_options"></property>
- <property name="y_options"></property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label14">
+ <widget class="GtkTable" id="table2">
<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">_Name:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">edit_bookmark_name_entry</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label16">
+ <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"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label14">
+ <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">_Name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">edit_bookmark_name_entry</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label13">
+ <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">_Host:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">edit_bookmark_host_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>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="edit_bookmark_name_entry">
+ <property name="width_request">250</property>
+ <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="invisible_char">●</property>
+ <property name="activates_default">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <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="tooltip" translatable="yes">host or host:display or host::port</property>
+ <property name="invisible_char">●</property>
+ <property name="activates_default">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>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label13">
+ <widget class="GtkLabel" id="label7">
<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">_Host:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">edit_bookmark_host_entry</property>
+ <property name="label" translatable="yes"><b>Options</b></property>
+ <property name="use_markup">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">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">6</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="edit_bookmark_name_entry">
- <property name="width_request">250</property>
+ <widget class="GtkHBox" id="hbox2">
<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>
+ <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"> </property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="fullscreen_check">
+ <property name="label" translatable="yes">_Full screen</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="edit_bookmark_host_entry">
+ <widget class="GtkVBox" id="plugin_options_vbox">
<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="tooltip" translatable="yes">host or host:display or host::port</property>
- <property name="activates_default">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
</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="position">4</property>
</packing>
</child>
<child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label7">
- <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>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="table5">
- <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="GtkLabel" id="label11">
+ <widget class="GtkLabel" id="label10">
<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"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkCheckButton" id="edit_fullscreen_check">
- <property name="label" translatable="yes">_Full screen</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkCheckButton" id="edit_viewonly_check">
- <property name="label" translatable="yes">_View only</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</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>
- </packing>
- </child>
- <child>
- <widget class="GtkCheckButton" id="edit_scaling_check">
- <property name="label" translatable="yes">_Scaling</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Folder</b></property>
+ <property name="use_markup">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>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">6</property>
+ <property name="position">5</property>
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">5</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label10">
- <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>Folder</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">6</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="folder_box">
- <property name="visible">True</property>
- <child>
- <widget class="GtkLabel" id="label22">
+ <widget class="GtkHBox" id="folder_box">
<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>
+ <child>
+ <widget class="GtkLabel" id="label22">
+ <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="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
+ <property name="position">6</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
</widget>
<packing>
- <property name="position">7</property>
+ <property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
diff --git a/vinagre/vinagre-bookmarks-ui.c b/vinagre/vinagre-bookmarks-ui.c
index d457d23..d4b16be 100644
--- a/vinagre/vinagre-bookmarks-ui.c
+++ b/vinagre/vinagre-bookmarks-ui.c
@@ -25,6 +25,8 @@
#include "vinagre-bookmarks-ui.h"
#include "vinagre-utils.h"
#include "vinagre-bookmarks-tree.h"
+#include "vinagre-plugin.h"
+#include "vinagre-plugins-engine.h"
static void
control_save_button_visibility (GtkEntry *ed, GtkWidget *bt)
@@ -122,23 +124,25 @@ show_dialog_conn (VinagreBookmarks *book,
gchar *str, *host, *error_str, *protocol;
gint port;
GladeXML *xml;
- GtkWidget *dialog, *host_entry, *name_entry;
- GtkWidget *fs_check, *sc_check, *vo_check;
- GtkWidget *box, *tree, *save_button;
+ GtkWidget *dialog, *host_entry, *name_entry, *fs_check;
+ GtkWidget *folder_box, *tree, *save_button, *plugin_box;
+ GtkWidget *plugin_options, *protocol_label;
VinagreConnection *conn;
const gchar *name;
+ VinagrePlugin *plugin;
+ gchar **props;
xml = glade_xml_new (vinagre_utils_get_glade_filename (),
"bookmarks_add_edit_conn_dialog",
NULL);
- dialog = glade_xml_get_widget (xml, "bookmarks_add_edit_conn_dialog");
- name_entry = glade_xml_get_widget (xml, "edit_bookmark_name_entry");
- host_entry = glade_xml_get_widget (xml, "edit_bookmark_host_entry");
- fs_check = glade_xml_get_widget (xml, "edit_fullscreen_check");
- sc_check = glade_xml_get_widget (xml, "edit_scaling_check");
- vo_check = glade_xml_get_widget (xml, "edit_viewonly_check");
- box = glade_xml_get_widget (xml, "folder_box");
- save_button= glade_xml_get_widget (xml, "save_button");
+ dialog = glade_xml_get_widget (xml, "bookmarks_add_edit_conn_dialog");
+ name_entry = glade_xml_get_widget (xml, "edit_bookmark_name_entry");
+ host_entry = glade_xml_get_widget (xml, "edit_bookmark_host_entry");
+ fs_check = glade_xml_get_widget (xml, "fullscreen_check");
+ folder_box = glade_xml_get_widget (xml, "folder_box");
+ plugin_box = glade_xml_get_widget (xml, "plugin_options_vbox");
+ save_button = glade_xml_get_widget (xml, "save_button");
+ protocol_label = glade_xml_get_widget (xml, "protocol_label");
gtk_window_set_transient_for (GTK_WINDOW (dialog), window);
conn = vinagre_bookmarks_entry_get_conn (entry);
@@ -146,27 +150,34 @@ show_dialog_conn (VinagreBookmarks *book,
str = vinagre_connection_get_best_name (conn);
gtk_entry_set_text (GTK_ENTRY (name_entry), str);
gtk_editable_set_position (GTK_EDITABLE (name_entry), -1);
+ g_signal_connect (name_entry, "changed", G_CALLBACK (control_save_button_visibility), save_button);
g_free (str);
str = vinagre_connection_get_string_rep (conn, FALSE);
gtk_entry_set_text (GTK_ENTRY (host_entry), str);
g_free (str);
-/*
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fs_check),
vinagre_connection_get_fullscreen (conn));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sc_check),
- vinagre_connection_get_scaling (conn));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vo_check),
- vinagre_connection_get_view_only (conn));
-*/
- g_signal_connect (name_entry, "changed", G_CALLBACK (control_save_button_visibility), save_button);
+ plugin = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
+ vinagre_connection_get_protocol (conn));
+ plugin_options = vinagre_plugin_get_connect_widget (plugin, conn);
+ if (plugin_options)
+ gtk_box_pack_start (GTK_BOX (plugin_box), plugin_options, TRUE, TRUE, 0);
+ else
+ gtk_widget_hide (plugin_box);
+
+ props = vinagre_plugin_get_public_description (plugin);
+ str = g_strdup_printf (_("<small>(Protocol: <i>%s</i>)</small>"), props[0]);
+ gtk_label_set_markup (GTK_LABEL (protocol_label), str);
+ g_free (str);
+ g_strfreev (props);
tree = vinagre_bookmarks_tree_new ();
vinagre_bookmarks_tree_select_entry (VINAGRE_BOOKMARKS_TREE (tree),
vinagre_bookmarks_entry_get_parent (entry));
- gtk_box_pack_end (GTK_BOX (box), tree, TRUE, TRUE, 0);
+ gtk_box_pack_end (GTK_BOX (folder_box), tree, TRUE, TRUE, 0);
gtk_widget_show_all (dialog);
@@ -190,7 +201,7 @@ show_dialog_conn (VinagreBookmarks *book,
name);
if (existing_entry && existing_entry != entry)
{
- gchar *str = g_strdup_printf (_("The name \"%s\" is already used in this folder. Please use a different name."), name);
+ str = g_strdup_printf (_("The name \"%s\" is already used in this folder. Please use a different name."), name);
vinagre_utils_show_error (_("Invalid name for this item"),
str,
GTK_WINDOW (dialog));
@@ -214,17 +225,18 @@ show_dialog_conn (VinagreBookmarks *book,
break;
}
- vinagre_connection_set_name (conn, name);
- vinagre_connection_set_host (conn, host);
- vinagre_connection_set_port (conn, port);
-/*
- vinagre_connection_set_view_only (conn,
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vo_check)));
- vinagre_connection_set_scaling (conn,
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (sc_check)));
-*/
- vinagre_connection_set_fullscreen (conn,
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fs_check)));
+ g_object_set (conn,
+ "name", name,
+ "host", host,
+ "port", port,
+ "fullscreen", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fs_check)),
+ NULL);
+
+ if (plugin_options)
+ vinagre_connection_parse_options_widget (conn, plugin_options);
+
+ g_free (protocol);
+ g_free (host);
if (!is_add)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]