Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Commit

Permalink
preferences store/reload
Browse files Browse the repository at this point in the history
  • Loading branch information
Jigoku committed Apr 19, 2015
1 parent 43fabd6 commit 482d971
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
36 changes: 34 additions & 2 deletions alluvion-gtk.pl
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ sub main {

# get top level objects
$window = $builder->get_object( 'window' );
$preferences = $builder->get_object( 'preferences' );
$filechooser = $builder->get_object( 'filechooserdialog' );

$builder->connect_signals( undef );
Expand Down Expand Up @@ -581,9 +580,41 @@ ($$$$$$)
}

sub on_menu_edit_preferences_activate {
$preferences->show; # not implemented
my $preferences = $builder->get_object( 'preferences' );

$builder->get_object( 'entry_timeout' )->set_text($settings{"timeout"});

if ($settings{"proxy_enabled"} eq 1) {
$builder->get_object( 'checkbutton_proxy' )->set_active(1);
} else {
$builder->get_object( 'checkbutton_proxy' )->set_active(0);
}

$builder->get_object( 'entry_proxy_addr' )->set_text($settings{"proxy_addr"});
$builder->get_object( 'entry_proxy_port' )->set_text($settings{"proxy_port"});

$preferences->run;
$preferences->hide;
}

sub on_button_pref_ok_clicked {
$settings{"timeout"} = $builder->get_object( 'entry_timeout' )->get_text();

if ($builder->get_object( 'checkbutton_proxy' )->get_active() == TRUE) {
$settings{"proxy_enabled"} = 1;
} else {
$settings{"proxy_enabled"} = 0;
}

$settings{"proxy_addr"} = $builder->get_object( 'entry_proxy_addr' )->get_text();
$settings{"proxy_port"} = $builder->get_object( 'entry_proxy_port' )->get_text();
}

sub on_button_pref_cancel_clicked {
$builder->get_object( 'preferences' )->hide;
}


sub on_about_clicked {
# launch about dialog
my $about = $builder->get_object( 'aboutdialog' );
Expand Down Expand Up @@ -640,6 +671,7 @@ sub on_combobox_subcategory_changed {
$subcategory_filter = $subcategory;
}


sub on_view_statusbar_toggled {
my $check = $builder->get_object( 'view_statusbar' );
my $statusbar = $builder->get_object( 'statusbar' );
Expand Down
8 changes: 6 additions & 2 deletions data/alluvion.glade
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ for making this possible.</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="icon">alluvion_48.png</property>
<property name="type_hint">dialog</property>
<property name="type_hint">utility</property>
<property name="transient_for">window</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
Expand All @@ -442,6 +442,7 @@ for making this possible.</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_button_pref_ok_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -456,6 +457,7 @@ for making this possible.</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_button_pref_cancel_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
Expand Down Expand Up @@ -503,6 +505,7 @@ for making this possible.</property>
<object class="GtkHBox" id="hbox_timeout">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkLabel" id="label_timeout">
<property name="visible">True</property>
Expand All @@ -516,10 +519,11 @@ for making this possible.</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spinbutton_timeout">
<object class="GtkEntry" id="entry_timeout">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
Expand Down

0 comments on commit 482d971

Please sign in to comment.