diff --git a/source/ubl-settings-datetime.c b/source/ubl-settings-datetime.c
index 0ef7363..30d9f8b 100644
--- a/source/ubl-settings-datetime.c
+++ b/source/ubl-settings-datetime.c
@@ -53,7 +53,7 @@ void yon_save_parameters(main_window *widgets){
const char *zone = gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->ZoneCombo));
if (!yon_char_is_empty(region)&&!yon_char_is_empty(zone)){
- char *zone_parameter = yon_char_unite(region,"/",zone,NULL);
+ char *zone_parameter = yon_char_unite((char*)region,"/",(char*)zone,NULL);
yon_config_register(ZONE_parameter,ZONE_parameter_command,zone_parameter);
free(zone_parameter);
}
@@ -67,40 +67,52 @@ void yon_save_parameters(main_window *widgets){
}
void on_config_save(GtkWidget *, main_window *widgets){
- main_config.load_mode=3;
+ main_config.save_config=2;
yon_save_parameters(widgets);
yon_save_proceed(NULL,YON_CONFIG_BOTH,config_get_global_command,NULL);
}
void on_config_save_global(GtkWidget *, main_window *widgets){
- main_config.load_mode=0;
+ main_config.save_config=0;
yon_save_parameters(widgets);
- yon_save_proceed(NULL,YON_CONFIG_BOTH,config_get_global_command,NULL);
+ yon_save_proceed(NULL,YON_CONFIG_GLOBAL,config_get_global_command,NULL);
}
void on_config_save_local(GtkWidget *, main_window *widgets){
- main_config.load_mode=1;
+ main_config.save_config=1;
yon_save_parameters(widgets);
- yon_save_proceed(NULL,YON_CONFIG_BOTH,config_get_global_command,NULL);
+ yon_save_proceed(NULL,YON_CONFIG_LOCAL,config_get_global_command,NULL);
}
void on_config_save_custom(GtkWidget *, main_window *widgets){
- main_config.load_mode=3;
+ main_config.save_config=3;
yon_save_parameters(widgets);
- yon_save_proceed(NULL,YON_CONFIG_BOTH,config_get_global_command,NULL);
+ yon_save_proceed(NULL,YON_CONFIG_CUSTOM,config_get_global_command,NULL);
}
void on_config_load_global(){
+ main_config.load_mode=1;
+ textdomain(template_ui_LocaleName);
+ yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
+ textdomain(LocaleName);
yon_load_proceed(YON_CONFIG_GLOBAL);
}
void on_config_load_local(){
+ main_config.load_mode=0;
+ textdomain(template_ui_LocaleName);
+ yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
+ textdomain(LocaleName);
yon_load_proceed(YON_CONFIG_LOCAL);
}
void on_config_load_custom(){
+ main_config.load_mode=2;
+ textdomain(template_ui_LocaleName);
+ yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
+ textdomain(LocaleName);
yon_load_proceed(YON_CONFIG_CUSTOM);
}
@@ -139,6 +151,31 @@ void yon_load_proceed(YON_CONFIG_TYPE type){
}
}
+void on_save_done(main_window *widgets, config_str output, int size){
+ char *final_output = yon_char_parsed_to_string(output,size,"");
+ if (final_output){
+ printf("%s\n",final_output);
+ free(final_output);
+ }
+ yon_char_parsed_free(output,size);
+ yon_interface_update(widgets);
+ textdomain(template_ui_LocaleName);
+ switch (main_config.save_config){
+ case 0:
+ yon_ubl_status_box_render(GLOBAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
+ break;
+ case 1:
+ yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
+ break;
+ case 2:
+ case 3:
+ yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
+ break;
+ }
+ textdomain(LocaleName);
+
+}
+
void yon_interface_update(main_window *widgets){
char *ntp = config(NTPSERVERS_parameter);
char *zone = config(ZONE_parameter);
@@ -180,7 +217,7 @@ void yon_interface_update(main_window *widgets){
GDateTime *datetime = g_date_time_new_now_local();
char *time = g_date_time_format(datetime,"%H %M");
- char *date = g_date_time_format(datetime,"%Y:%m:%d");
+ char *date = g_date_time_format(datetime,"%Y.%m.%d");
gtk_calendar_select_month(GTK_CALENDAR(widgets->DateCalendar),g_date_time_get_month(datetime),g_date_time_get_year(datetime));
gtk_calendar_select_day(GTK_CALENDAR(widgets->DateCalendar),g_date_time_get_day_of_month(datetime));
@@ -241,7 +278,7 @@ void *yon_sync_thread_start(void *arg){
struct datetime_arg *data = (struct datetime_arg*)arg;
char *command_time = time_sync_command(data->time);
char *command_date = date_sync_command(data->date);
- char *command = yon_char_unite(command_time,"; ",command_date,NULL);
+ char *command = yon_char_unite(command_date,"; ",command_time,NULL);
free(command_time);
free(command_date);
if (system(yon_debug_output("%s\n",command))){
@@ -264,7 +301,7 @@ void on_sync_clicked(GtkWidget *, main_window *widgets){
data->time=time;
if (!yon_char_is_empty(date)){
int size;
- config_str parsed = yon_char_parse((char*)date,&size,":");
+ config_str parsed = yon_char_parse((char*)date,&size,".");
data->date=yon_char_parsed_to_string(parsed,size,"");
yon_char_parsed_free(parsed,size);
}
@@ -325,7 +362,7 @@ void on_date_accept(GtkWidget *,main_window *widgets){
char *ye_str = yon_char_from_int(year);
char *mo_str = yon_char_from_int(++month);
char *da_str = yon_char_from_int(day);
- char *date = yon_char_unite(ye_str,":",month<10?"0":"",mo_str,":",day<10?"0":"",da_str,NULL);
+ char *date = yon_char_unite(ye_str,".",month<10?"0":"",mo_str,".",day<10?"0":"",da_str,NULL);
gtk_entry_set_text(GTK_ENTRY(widgets->DateEntry),date);
gtk_popover_popdown(GTK_POPOVER(widgets->DatePopover));
free(date);
@@ -436,6 +473,7 @@ void yon_main_window_complete(main_window *widgets){
yon_load_proceed(YON_CONFIG_LOCAL);
yon_interface_update(widgets);
+ yon_save_window_set_postsave_function(on_save_done,widgets);
}
int main(int argc, char *argv[]){
diff --git a/source/ubl-settings-datetime.h b/source/ubl-settings-datetime.h
index eef5b5e..dad2bdb 100644
--- a/source/ubl-settings-datetime.h
+++ b/source/ubl-settings-datetime.h
@@ -44,8 +44,8 @@
#define ZONE_parameter "ZONE"
#define ZONE_parameter_command "ubconfig --source global get clock ZONE"
-#define time_sync_command(time) yon_char_unite("date +%T -s \"",time,"\"",NULL)
-#define date_sync_command(date) yon_char_unite("date +%Y%m%d -s \"",date,"\"",NULL)
+#define time_sync_command(time) yon_char_unite("pkexec date +%H:%M:%S -s \"",time,"\"",NULL)
+#define date_sync_command(date) yon_char_unite("pkexec date +%Y%m%d -s \"",date,"\"",NULL)
#define hardware_datetime_sync_command "hwclock --systohc"
@@ -59,6 +59,7 @@ char *local;
typedef struct {
template_config_fields
+ int save_config;
char *ntp_default;
} config;
@@ -141,4 +142,5 @@ void on_date_cancel(GtkWidget *, main_window *widgets);
config_str yon_char_parsed_sort(config_str parsed, int size);
-int yon_char_parsed_compare(const void *a, const void *b);
\ No newline at end of file
+int yon_char_parsed_compare(const void *a, const void *b);
+void on_save_done(main_window *widgets, config_str output, int size);
\ No newline at end of file
diff --git a/ubl-settings-datetime.css b/ubl-settings-datetime.css
index 526a8f8..f60dc43 100644
--- a/ubl-settings-datetime.css
+++ b/ubl-settings-datetime.css
@@ -20,58 +20,84 @@
border-color:alpha(@theme_text_color, 0.01);
}
-.menuitemtop{
-margin-bottom:0px;
-}
-.menuitemtop *{
-margin:2px 2px 0 2px;
-padding: 5px 10px 3px 5px;
-}
-.menuitemmiddle *{
-margin:0 2px 0 2px;
-padding: 3px 10px 3px 5px;
-}
-.menuitembottom *{
-margin:0 2px 2px 2px;
-padding: 3px 10px 5px 5px;
-}
-.menuitemtop:hover {
-background:@theme_bg_color;
-border-color:inherit;
-border-left-width:inherit;
-border-right-width:inherit;
-}
-.menuitemmiddle:hover {
-background:@theme_bg_color;
-border-color:inherit;
-border-left-width:inherit;
-border-right-width:inherit;
-}
-.menuitembottom:hover {
-background:@theme_bg_color;
-border-color:inherit;
-border-left-width:inherit;
-border-right-width:inherit;
-
-}
-.menuitemtop:hover* {
-margin:2px 2px 0 2px;
-padding: 5px 10px 3px 5px;
-background:@theme_selected_bg_color;
-border-radius:2px;
-}
-.menuitemmiddle:hover* {
-margin:0 2px 0 2px;
-padding: 3px 10px 3px 5px;
-background:@theme_selected_bg_color;
-border-radius:2px;
-}
-.menuitembottom:hover* {
-margin:0 2px 2px 2px;
-padding: 3px 10px 5px 5px;
-background:@theme_selected_bg_color;
-border-radius:2px;
-}
+.menuitembottom{
+ margin-top:0px;
+ margin-bottom:4px;
+ border-color:inherit;
+ border-left-width:inherit;
+ border-right-width:inherit;
+ }
+ .menuitemmiddle{
+ margin-top:0px;
+ margin-bottom:0px;
+ border-color:inherit;
+ border-left-width:inherit;
+ border-right-width:inherit;
+ }
+
+ .menuitemtop{
+ margin-bottom:0px;
+ border-color:inherit;
+ border-top-width:inherit;
+ border-left-width:inherit;
+ border-right-width:inherit;
+ }
+ .menuitemtop>*{
+ margin:2px 2px 0 2px;
+ padding: 3px 10px 3px 5px;
+ border:transparent;
+ }
+ .menuitemmiddle>*{
+ margin:0 2px 0 2px;
+ padding: 3px 10px 3px 5px;
+ border:transparent;
+ }
+ .menuitembottom>*{
+ margin:0 2px 2px 2px;
+ padding: 3px 10px 3px 5px;
+ }
+ .menuitemtop:hover {
+ background:@theme_base_color;
+ border-color:inherit;
+ border-top-width:inherit;
+ border-left-width:inherit;
+ border-right-width:inherit;
+ }
+ .menuitemmiddle:hover {
+ background:@theme_base_color;
+ border-color:inherit;
+ border-left-width:inherit;
+ border-right-width:inherit;
+ }
+ .menuitembottom:hover {
+ background:@theme_base_color;
+ border-color:inherit;
+ border-bottom-width:0px;
+ border-left-width:inherit;
+ border-right-width:inherit;
+
+ }
+ .menuitemtop:hover>* {
+ margin:2px 2px 0 2px;
+ padding: 3px 10px 3px 5px;
+ /* padding: 5px 0 3px 5px; */
+ background:@theme_selected_bg_color;
+ border-radius:2px;
+ }
+ .menuitemmiddle:hover>* {
+ margin:0 2px 0px 2px;
+ padding: 3px 10px 3px 5px;
+ /* padding: 3px 0px 3px 5px; */
+ background:@theme_selected_bg_color;
+ border-radius:2px;
+ }
+ .menuitembottom:hover>* {
+ margin:0 2px 2px 2px;
+ padding: 3px 10px 3px 5px;
+ /* padding: 3px 0px 5px 5px; */
+ background:@theme_selected_bg_color;
+ border-radius:2px;
+ }
.noborder{
border:none;
diff --git a/ubl-settings-datetime.glade b/ubl-settings-datetime.glade
index 74fb941..73a483f 100644
--- a/ubl-settings-datetime.glade
+++ b/ubl-settings-datetime.glade
@@ -26,10 +26,6 @@
- False
+ True
True
0
@@ -434,7 +430,7 @@ Format: DD.MM.YYYY
False
- False
+ True
True
end
2
@@ -444,7 +440,7 @@ Format: DD.MM.YYYY
True
False
- Zone:
+ Zone:
0