26
26
#include <gmodule.h>
28
28
#include <vinagre/vinagre-debug.h>
29
#include <vinagre/vinagre-cache-prefs.h>
30
31
#include "vinagre-ssh-plugin.h"
31
32
#include "vinagre-ssh-connection.h"
32
33
#include "vinagre-ssh-tab.h"
35
#ifdef VINAGRE_ENABLE_AVAHI
36
#include <avahi-ui/avahi-ui.h>
37
#include <avahi-common/malloc.h>
34
40
#define VINAGRE_SSH_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), VINAGRE_TYPE_SSH_PLUGIN, VinagreSshPluginPrivate))
36
42
VINAGRE_PLUGIN_REGISTER_TYPE(VinagreSshPlugin, vinagre_ssh_plugin)
115
121
G_OBJECT_CLASS (vinagre_ssh_plugin_parent_class)->finalize (object);
125
impl_get_connect_widget (VinagrePlugin *plugin, VinagreConnection *conn)
127
GtkWidget *box, *label, *u_box, *u_entry;
130
box = gtk_vbox_new (FALSE, 0);
132
str = g_strdup_printf ("<b>%s</b>", _("SSH Options"));
133
label = gtk_label_new (str);
135
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
136
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
137
gtk_misc_set_padding (GTK_MISC (label), 0, 6);
138
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
140
u_box = gtk_hbox_new (FALSE, 4);
141
label = gtk_label_new (" ");
142
gtk_box_pack_start (GTK_BOX (u_box), label, FALSE, FALSE, 0);
144
label = gtk_label_new_with_mnemonic (_("_Username:"));
145
gtk_box_pack_start (GTK_BOX (u_box), label, FALSE, FALSE, 0);
147
u_entry = gtk_entry_new ();
148
/* Translators: This is the tooltip for the username field in a SSH connection */
149
gtk_widget_set_tooltip_text (u_entry, _("Optional. If blank, your username will be used. Also, it can be supplied in the Machine field above, in the form username@hostname."));
150
g_object_set_data (G_OBJECT (box), "username_entry", u_entry);
151
gtk_box_pack_start (GTK_BOX (u_box), u_entry, TRUE, TRUE, 5);
152
gtk_label_set_mnemonic_widget (GTK_LABEL (label), u_entry);
153
str = g_strdup (VINAGRE_IS_CONNECTION (conn) ?
154
vinagre_connection_get_username (conn) :
155
vinagre_cache_prefs_get_string ("ssh-connection", "username", ""));
156
gtk_entry_set_text (GTK_ENTRY (u_entry), str);
157
gtk_entry_set_activates_default (GTK_ENTRY (u_entry), TRUE);
160
gtk_box_pack_start (GTK_BOX (box), u_box, TRUE, TRUE, 0);
165
ssh_parse_mdns_dialog (VinagrePlugin *plugin,
166
GtkWidget *connect_widget,
169
#ifdef VINAGRE_ENABLE_AVAHI
170
const AvahiStringList *txt;
173
for (txt = aui_service_dialog_get_txt_data (AUI_SERVICE_DIALOG (dialog)); txt; txt = txt->next)
177
if (avahi_string_list_get_pair ((AvahiStringList*) txt, &key, &value, NULL) < 0)
180
if (strcmp(key, "u") == 0)
189
GtkEntry *u_entry = g_object_get_data (G_OBJECT (connect_widget), "username_entry");
192
gtk_entry_set_text (u_entry, u);
194
g_warning ("Wrong widget passed to ssh_parse_mdns_dialog()");
119
202
vinagre_ssh_plugin_class_init (VinagreSshPluginClass *klass)