Commit 19f5e141 authored by David's avatar David

Ajout de la keyssh dans les paramètres par defaut possible

parent 80f2192d
......@@ -320,7 +320,7 @@
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">5</property>
<property name="n_rows">6</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkLabel" id="label1">
......@@ -336,8 +336,8 @@
<property name="label" translatable="yes">Other options</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
</packing>
</child>
<child>
......@@ -396,6 +396,7 @@
<widget class="GtkEntry" id="default_user">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip" translatable="yes">Name of the remote user</property>
<property name="invisible_char"></property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
......@@ -411,6 +412,7 @@
<widget class="GtkEntry" id="default_dir">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip" translatable="yes">Location of the remote folder</property>
<property name="invisible_char"></property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
......@@ -428,6 +430,7 @@
<widget class="GtkEntry" id="default_mountpoint">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip" translatable="yes">Local path to mount sshfs</property>
<property name="invisible_char"></property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
......@@ -445,6 +448,7 @@
<widget class="GtkEntry" id="default_options">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip" translatable="yes">Refer to "man sshfs"</property>
<property name="invisible_char"></property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
......@@ -454,6 +458,34 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
</packing>
</child>
<child>
<widget class="GtkFileChooserButton" id="default_keyssh">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip" translatable="yes">Your SSH key</property>
<property name="create_folders">False</property>
<property name="show_hidden">True</property>
<property name="title" translatable="yes">Select a file</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Private key</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
......@@ -1055,6 +1087,7 @@ Site : http://xsshfs.zici.fr
<property name="tooltip" translatable="yes">Your SSH key</property>
<property name="create_folders">False</property>
<property name="show_hidden">True</property>
<property name="title" translatable="yes">Select a file</property>
</widget>
<packing>
<property name="expand">True</property>
......
......@@ -29,6 +29,7 @@ my $params = {
'default_dir' => "",
'default_mountpoint' => $ENV{HOME},
'default_port' => 22,
'default_keyssh' => "",
'default_options' => "",
'opt_open_folder' => 1,
'opt_file_manager' => "/usr/bin/xdg-open",
......@@ -102,22 +103,24 @@ use vars qw($gladexml) ;
# On initialise la valeur de la variable quand l'arbre est créé
# dans le module principale
# Chargement des fichiers ini
# Préparation des .ini
if (! -d $params->{configDir}) {
mkdir $params->{configDir}
}
touch($params->{configParam});
touch($params->{configData});
my $configData = Config::Tiny->new;
$configData = Config::Tiny->read($params->{configData});
my $configParam = Config::Tiny->new;
$configData = Config::Tiny->read($params->{configData});
$configParam = Config::Tiny->read($params->{configParam});
############
# Programme principal
############
sub init {
if (! -d $params->{configDir}) {
mkdir $params->{configDir}
}
&touch($params->{configParam});
&touch($params->{configData});
# Démarage de l'interface graphique
$gladexml = $X::gladexml ;
# init des paramètres
......@@ -138,6 +141,9 @@ sub on_menu_param_activate {
$gladexml->get_widget('default_mountpoint')->set_text($params->{default_mountpoint});
$gladexml->get_widget('default_port')->set_value($params->{default_port});
$gladexml->get_widget('default_options')->set_text($params->{default_options});
if ($params->{default_keyssh}) {
$gladexml->get_widget('default_keyssh')->set_filename($params->{default_keyssh});
}
$gladexml->get_widget('opt_open_folder')->set_active($params->{opt_open_folder});
$gladexml->get_widget('opt_file_manager')->set_text($params->{opt_file_manager});
$gladexml->get_widget('opt_path_sshfs')->set_text($params->{opt_path_sshfs});
......@@ -246,11 +252,18 @@ sub on_bouton_ouvrir_clicked {
}
sub on_param_save_clicked{
debug("Sauvegarde de la configuration");
my $default_keyssh;
if ($gladexml->get_widget('default_keyssh')->get_filenames()) {
$default_keyssh = $gladexml->get_widget('default_keyssh')->get_filenames();
} else {
$default_keyssh = '';
}
$configParam->{"default"} = {
default_user => $gladexml->get_widget('default_user')->get_text(),
default_dir => $gladexml->get_widget('default_dir')->get_text(),
default_mountpoint => $gladexml->get_widget('default_mountpoint')->get_text(),
default_port => $gladexml->get_widget('default_port')->get_value(),
default_keyssh => $default_keyssh,
default_options => $gladexml->get_widget('default_options')->get_text()
};
$configParam->{"opt"} = {
......@@ -293,6 +306,9 @@ sub param_ini{
if ($configParam->{default}->{default_options}) {
$params->{default_options} = $configParam->{default}->{default_options};
}
if ($configParam->{default}->{default_keyssh}) {
$params->{default_keyssh} = $configParam->{default}->{default_keyssh};
}
$params->{opt_open_folder} = $configParam->{opt}->{opt_open_folder};
if ($configParam->{opt}->{opt_file_manager}) {
$params->{opt_file_manager} = $configParam->{opt}->{opt_file_manager};
......@@ -308,6 +324,9 @@ sub param_ini{
$gladexml->get_widget('dir')->set_text($params->{default_dir});
#$gladexml->get_widget('mountpoint')->set_text($params->{default_mountpoint});
$gladexml->get_widget('port')->set_value($params->{default_port});
if ($params->{default_keyssh}) {
$gladexml->get_widget('keyssh')->set_filename($params->{default_keyssh});
}
$gladexml->get_widget('options')->set_text($params->{default_options});
}
# Actualise la combobox de sauvegarde
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment