Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Alexander_Naumov:SLE12
vinagre
vinagre-bnc874407-add-advanced-options.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File vinagre-bnc874407-add-advanced-options.patch of Package vinagre
diff -ur vinagre-3.10.2.orig/plugins/rdp/vinagre-rdp-connection.c vinagre-3.10.2/plugins/rdp/vinagre-rdp-connection.c --- vinagre-3.10.2.orig/plugins/rdp/vinagre-rdp-connection.c 2013-07-30 02:43:09.000000000 -0500 +++ vinagre-3.10.2/plugins/rdp/vinagre-rdp-connection.c 2014-07-14 17:18:32.055878574 -0500 @@ -25,7 +25,13 @@ struct _VinagreRdpConnectionPrivate { - gint dummy; + gchar *custom_options; +}; + +enum +{ + PROP_0, + PROP_CUSTOM_OPTIONS }; #define VINAGRE_RDP_CONNECTION_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VINAGRE_TYPE_RDP_CONNECTION, VinagreRdpConnectionPrivate)) @@ -44,25 +50,99 @@ } static void +vinagre_rdp_connection_finalize (GObject *object) +{ + VinagreRdpConnection *conn = VINAGRE_RDP_CONNECTION (object); + + g_free (conn->priv->custom_options); + + G_OBJECT_CLASS (vinagre_rdp_connection_parent_class)->finalize (object); +} + +static void +vinagre_rdp_connection_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +{ + VinagreRdpConnection *conn; + + g_return_if_fail (VINAGRE_IS_RDP_CONNECTION (object)); + + conn = VINAGRE_RDP_CONNECTION (object); + + switch (prop_id) + { + case PROP_CUSTOM_OPTIONS: + vinagre_rdp_connection_set_custom_options (conn, g_value_get_string (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +vinagre_rdp_connection_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +{ + VinagreRdpConnection *conn; + + g_return_if_fail (VINAGRE_IS_RDP_CONNECTION (object)); + + conn = VINAGRE_RDP_CONNECTION (object); + + switch (prop_id) + { + case PROP_CUSTOM_OPTIONS: + g_value_set_string (value, conn->priv->custom_options); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void rdp_fill_writer (VinagreConnection *conn, xmlTextWriter *writer) { + VinagreRdpConnection *rdp_conn = VINAGRE_RDP_CONNECTION (conn); + VINAGRE_CONNECTION_CLASS (vinagre_rdp_connection_parent_class)->impl_fill_writer (conn, writer); + + if (rdp_conn->priv->custom_options && *rdp_conn->priv->custom_options) + xmlTextWriterWriteFormatElement (writer, BAD_CAST "custom_options", "%s", rdp_conn->priv->custom_options); } static void rdp_parse_item (VinagreConnection *conn, xmlNode *root) { + xmlNode *curr; + xmlChar *s_value; + VinagreRdpConnection *rdp_conn = VINAGRE_RDP_CONNECTION (conn); + VINAGRE_CONNECTION_CLASS (vinagre_rdp_connection_parent_class)->impl_parse_item (conn, root); + + for (curr = root->children; curr; curr = curr->next) + { + s_value = xmlNodeGetContent (curr); + + if (!xmlStrcmp(curr->name, BAD_CAST "custom_options")) + { + vinagre_rdp_connection_set_custom_options (rdp_conn, (const gchar *)s_value); + } + + xmlFree (s_value); + } } static void rdp_parse_options_widget (VinagreConnection *conn, GtkWidget *widget) { - GtkWidget *u_entry, *spin_button; + GtkWidget *u_entry, *spin_button, *custom_options; guint width, height; u_entry = g_object_get_data (G_OBJECT (widget), "username_entry"); - if (!u_entry) + custom_options = g_object_get_data (G_OBJECT (widget), "custom_options"); + if (!u_entry || !custom_options) { g_warning ("Wrong widget passed to rdp_parse_options_widget()"); return; @@ -101,6 +181,12 @@ vinagre_cache_prefs_set_integer ("rdp-connection", "height", height); vinagre_connection_set_height (conn, height); + + vinagre_cache_prefs_set_string ("rdp-connection", "custom-options", gtk_entry_get_text (GTK_ENTRY (custom_options))); + + g_object_set (conn, + "custom-options", gtk_entry_get_text (GTK_ENTRY (custom_options)), + NULL); } static void @@ -111,11 +197,24 @@ g_type_class_add_private (klass, sizeof (VinagreRdpConnectionPrivate)); + object_class->finalize = vinagre_rdp_connection_finalize; object_class->constructed = vinagre_rdp_connection_constructed; + object_class->get_property = vinagre_rdp_connection_get_property; + object_class->set_property = vinagre_rdp_connection_set_property; parent_class->impl_fill_writer = rdp_fill_writer; parent_class->impl_parse_item = rdp_parse_item; parent_class->impl_parse_options_widget = rdp_parse_options_widget; + + g_object_class_install_property (object_class, + PROP_CUSTOM_OPTIONS, + g_param_spec_string ("custom-options", + "Custom Options", + "custom options to pass to xfreerdp", + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); } VinagreConnection * @@ -124,4 +223,20 @@ return VINAGRE_CONNECTION (g_object_new (VINAGRE_TYPE_RDP_CONNECTION, NULL)); } +const gchar * +vinagre_rdp_connection_get_custom_options (VinagreRdpConnection *conn) +{ + return conn->priv->custom_options; +} + +void +vinagre_rdp_connection_set_custom_options (VinagreRdpConnection *conn, + const gchar *custom_options) +{ + g_return_if_fail (VINAGRE_IS_RDP_CONNECTION (conn)); + + g_free (conn->priv->custom_options); + conn->priv->custom_options = g_strdup (custom_options); +} + /* vim: set ts=8: */ diff -ur vinagre-3.10.2.orig/plugins/rdp/vinagre-rdp-connection.h vinagre-3.10.2/plugins/rdp/vinagre-rdp-connection.h --- vinagre-3.10.2.orig/plugins/rdp/vinagre-rdp-connection.h 2013-07-02 09:14:35.000000000 -0500 +++ vinagre-3.10.2/plugins/rdp/vinagre-rdp-connection.h 2014-07-14 17:18:32.056878574 -0500 @@ -53,6 +53,11 @@ VinagreConnection* vinagre_rdp_connection_new (void); +const gchar * vinagre_rdp_connection_get_custom_options (VinagreRdpConnection *conn); + +void vinagre_rdp_connection_set_custom_options (VinagreRdpConnection *conn, + const gchar *desktop_name); + G_END_DECLS #endif /* __VINAGRE_RDP_CONNECTION_H__ */ diff -ur vinagre-3.10.2.orig/plugins/rdp/vinagre-rdp-plugin.c vinagre-3.10.2/plugins/rdp/vinagre-rdp-plugin.c --- vinagre-3.10.2.orig/plugins/rdp/vinagre-rdp-plugin.c 2013-07-30 02:43:09.000000000 -0500 +++ vinagre-3.10.2/plugins/rdp/vinagre-rdp-plugin.c 2014-07-14 17:18:32.056878574 -0500 @@ -94,7 +94,7 @@ static GtkWidget * impl_get_connect_widget (VinagreProtocol *plugin, VinagreConnection *conn) { - GtkWidget *grid, *label, *u_entry, *spin_button; + GtkWidget *grid, *label, *u_entry, *spin_button, *custom_options; gchar *str; grid = gtk_grid_new (); @@ -158,6 +158,24 @@ gtk_label_set_mnemonic_widget (GTK_LABEL (label), spin_button); gtk_entry_set_activates_default (GTK_ENTRY (spin_button), TRUE); + /* custom options */ + label = gtk_label_new_with_mnemonic (_("_Advanced options:")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_grid_attach (GTK_GRID (grid), label, 0, 4, 1, 1); + gtk_widget_set_margin_left (label, 12); + + custom_options = gtk_entry_new (); + /* Translators: This is the tooltip for the custom options field in a RDP connection */ + gtk_widget_set_tooltip_text (custom_options, _("Optional. Additional parameters to pass to xfreerdp.")); + g_object_set_data (G_OBJECT (grid), "custom_options", custom_options); + gtk_grid_attach (GTK_GRID (grid), custom_options, 1, 4, 1, 1); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), custom_options); + str = g_strdup (VINAGRE_IS_CONNECTION (conn) ? + vinagre_rdp_connection_get_custom_options (VINAGRE_RDP_CONNECTION (conn)) : + vinagre_cache_prefs_get_string ("rdp-connection", "custom-options", "")); + gtk_entry_set_text (GTK_ENTRY (custom_options), str); + gtk_entry_set_activates_default (GTK_ENTRY (custom_options), TRUE); + g_free (str); return grid; } @@ -174,11 +192,6 @@ } static void -vinagre_rdp_plugin_class_finalize (VinagreRdpPluginClass *klass) -{ -} - -static void vinagre_rdp_plugin_class_init (VinagreRdpPluginClass *klass) { } diff -ur vinagre-3.10.2.orig/plugins/rdp/vinagre-rdp-tab.c vinagre-3.10.2/plugins/rdp/vinagre-rdp-tab.c --- vinagre-3.10.2.orig/plugins/rdp/vinagre-rdp-tab.c 2013-09-02 14:50:36.000000000 -0500 +++ vinagre-3.10.2/plugins/rdp/vinagre-rdp-tab.c 2014-07-14 17:19:16.572875665 -0500 @@ -91,16 +91,26 @@ { gchar **arg; const gchar *username; - gint i; + const gchar *custom_options; + gchar **custom_args = NULL; + gint custom_args_len; + gint i, j; GError *error = NULL; VinagreRdpTab *rdp_tab = VINAGRE_RDP_TAB (object); VinagreTab *tab = VINAGRE_TAB (object); VinagreConnection *conn = vinagre_tab_get_conn (tab); username = vinagre_connection_get_username (conn); - i = 0; + custom_options = vinagre_rdp_connection_get_custom_options (VINAGRE_RDP_CONNECTION (conn)); + if (custom_options) + custom_args = g_strsplit (custom_options, " ", 0); - arg = g_new (gchar *, 11); + i = j = custom_args_len = 0; + + if (custom_args) + custom_args_len = g_strv_length (custom_args); + + arg = g_new (gchar *, 11 + custom_args_len); arg[i++] = g_strdup ("xfreerdp"); arg[i++] = g_strdup ("-K"); @@ -122,9 +132,13 @@ arg[i++] = g_strdup (username); } + for (j = 0; j < custom_args_len; j++) + arg[i++] = g_strdup (custom_args[j]); + arg[i++] = g_strdup_printf ("%s:%d", vinagre_connection_get_host (conn), vinagre_connection_get_port (conn)); + arg[i++] = NULL; if (!g_spawn_async (NULL, @@ -152,6 +166,7 @@ _end: g_strfreev (arg); + g_strfreev (custom_args); return FALSE; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor