Fixed savng double click switch without changes

pull/80/head
parent e61af7f7c5
commit c508703bfb

@ -1,5 +1,10 @@
#include "ubl-settings-manager.h"
gboolean on_settings_doubleckick_switched(GtkWidget *, int state,settings_window *window){
window->doubleclick = state;
return 0;
}
gboolean on_settings_size_changed(GtkRange* , GtkScrollType* , gdouble value, settings_window *window){
long val = (long)value;
int size = val-val%8;
@ -23,8 +28,9 @@ void on_settings_accept(GtkWidget *, settings_window *window){
if (cur_theme)
yon_window_config_add_instant_parameter(theme_parameter,settings_section,cur_theme,YON_TYPE_STRING);
int double_click = gtk_switch_get_active(GTK_SWITCH(window->DoubleClickSwitch));
yon_window_config_add_instant_parameter(double_click_parameter,settings_section,&double_click,YON_TYPE_INT);
if (window->doubleclick>-1){
yon_window_config_add_instant_parameter(double_click_parameter,settings_section,&window->doubleclick,YON_TYPE_INT);
}
yon_interface_update(widgets);
on_subwindow_close(window->Window);
}
@ -42,7 +48,10 @@ settings_window *yon_settings_window_new(){
window->SectionsConfigurationButton = yon_gtk_builder_get_widget(builder,"SectionsConfigurationButton");
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
window->doubleclick = -1;
g_signal_connect(G_OBJECT(window->DoubleClickSwitch),"state-set",G_CALLBACK(on_settings_doubleckick_switched),window);
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_settings_accept),window);
g_signal_connect(G_OBJECT(window->SizeSlider),"change-value",G_CALLBACK(on_settings_size_changed),window);
@ -66,10 +75,10 @@ settings_window *yon_settings_window_new(){
on_settings_size_changed(NULL,NULL,window->icon_size,window);
int double_click_activate;
if (!yon_window_config_get_parameter(settings_section,double_click_parameter,&double_click_activate,YON_TYPE_BOOLEAN)){
double_click_activate=0;
}
if (yon_window_config_get_parameter(settings_section,double_click_parameter,&double_click_activate,YON_TYPE_BOOLEAN)){
window->doubleclick=double_click_activate;
gtk_switch_set_active(GTK_SWITCH(window->DoubleClickSwitch),double_click_activate);
}
return window;
}

@ -208,6 +208,7 @@ typedef struct {
GtkWidget *CancelButton;
GtkWidget *AcceptButton;
int doubleclick;
int icon_size;
} settings_window;
@ -256,4 +257,5 @@ GtkWidget *yon_config_chooser_new( char*);
void yon_config_chooser_update(GtkWidget *root);
void yon_config_chooser_save(GtkWidget *root);
void on_main_exit(GtkWidget *, GdkEvent *, main_window *widgets);
gboolean on_settings_doubleckick_switched(GtkWidget *, int state,settings_window *window);
#endif
Loading…
Cancel
Save