Merge pull request 'Buttons minimum size' (#177) from YanTheKaller/ubl-settings-datetime:master into master

Reviewed-on: #177
pull/189/head v2.21
Dmitry Razumov 7 months ago
commit ed80d31f51

@ -160,6 +160,18 @@ msgstr "ММ-ДД-ГГГГ"
msgid "Stopped" msgid "Stopped"
msgstr "Остановлен" msgstr "Остановлен"
msgid "Argentina"
msgstr "Аргентина"
msgid "Kentucky"
msgstr "Кентукки"
msgid "Currie"
msgstr "Карри"
msgid "Kosrae"
msgstr "Косраэ"
msgid "Abidjan" msgid "Abidjan"
msgstr "Абиджан" msgstr "Абиджан"
@ -1204,7 +1216,7 @@ msgstr "Норонья"
msgid "North" msgid "North"
msgstr "Север" msgstr "Север"
msgid "North_Dokota" msgid "North_Dakota"
msgstr "Северная Докота" msgstr "Северная Докота"
msgid "Nouakchott" msgid "Nouakchott"

@ -307,8 +307,8 @@ void on_date_clicked(GtkWidget *,main_window *widgets){
} }
void on_region_changed(GtkComboBox *self, main_window *widgets){ void on_region_changed(GtkComboBox *self, main_window *widgets){
char *active = (char*)gtk_combo_box_get_active_id(self); char *active_name = (char*)gtk_combo_box_get_active_id(self);
active = yon_char_append("/usr/share/zoneinfo/",active); char *active = yon_char_append("/usr/share/zoneinfo/",active_name);
int size; int size;
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo)); gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo));
if (yon_file_is_directory(active)){ if (yon_file_is_directory(active)){
@ -316,12 +316,23 @@ void on_region_changed(GtkComboBox *self, main_window *widgets){
config_str parsed_sorted = yon_char_parsed_sort(parsed,size); config_str parsed_sorted = yon_char_parsed_sort(parsed,size);
yon_char_parsed_free(parsed,size); yon_char_parsed_free(parsed,size);
for (int i=0;i<size;i++){ for (int i=0;i<size;i++){
if (strstr(parsed_sorted[i],"GMT")){ char *name_string = NULL;
char *temp = yon_char_unite("UTC",parsed_sorted[i]+3," (",parsed_sorted[i],")",NULL); if (strstr(parsed_sorted[i],"GMT")){
free(parsed_sorted[i]); char *temp = yon_char_unite("UTC",parsed_sorted[i]+3," (",parsed_sorted[i],")",NULL);
parsed_sorted[i]=temp; free(parsed_sorted[i]);
} parsed_sorted[i]=temp;
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo),parsed_sorted[i],_(parsed_sorted[i])); } else if (strcmp(active_name,"Etc")){
char *zonereg = yon_char_unite(active,"/",parsed_sorted[i],NULL);
if (g_setenv("TZ",zonereg,1)){
time_t curtime = time(NULL);
struct tm *local = localtime(&curtime);
char *hour_str = yon_char_from_long(local->tm_gmtoff/3600);
name_string = yon_char_unite("(UTC ",local->tm_gmtoff>0?"+":"",strlen(hour_str)<2&&local->tm_gmtoff!=0?"0":"",hour_str,") ",_(parsed_sorted[i]),NULL);
free(hour_str);
free(zonereg);
}
}
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo),parsed_sorted[i],name_string?name_string:_(parsed_sorted[i]));
} }
if (size) yon_char_parsed_free(parsed_sorted,size); if (size) yon_char_parsed_free(parsed_sorted,size);
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ZoneCombo),0); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ZoneCombo),0);
@ -531,7 +542,10 @@ void config_init(){
if (size>0){ if (size>0){
if (strcmp(parsed[0],"(null)\n")){ if (strcmp(parsed[0],"(null)\n")){
yon_char_remove_last_symbol(parsed[0],'\n'); yon_char_remove_last_symbol(parsed[0],'\n');
main_config.ntp_default = parsed[0]; if (strstr(parsed[0],"[")&&strstr(parsed[0],"]"))
main_config.ntp_default = strstr(parsed[0],"] ")+2;
else
main_config.ntp_default = parsed[0];
} }
} }
} }
@ -566,7 +580,6 @@ void yon_main_window_complete(main_window **window){
widgets->DateCalendar = yon_gtk_builder_get_widget(builder,"DateCalendar"); widgets->DateCalendar = yon_gtk_builder_get_widget(builder,"DateCalendar");
widgets->DateCancelButton = yon_gtk_builder_get_widget(builder,"DateCancelButton"); widgets->DateCancelButton = yon_gtk_builder_get_widget(builder,"DateCancelButton");
widgets->DateAcceptButton = yon_gtk_builder_get_widget(builder,"DateAcceptButton"); widgets->DateAcceptButton = yon_gtk_builder_get_widget(builder,"DateAcceptButton");
widgets->zone_list = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1")); widgets->zone_list = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1"));
} }
// Signal configuration // Signal configuration
@ -699,6 +712,7 @@ int main(int argc, char *argv[]){
yon_ubl_setup_arguments(argc,argv,&unfound,&size,NULL); yon_ubl_setup_arguments(argc,argv,&unfound,&size,NULL);
gtk_init(&argc,&argv); gtk_init(&argc,&argv);
template_main_window *widgets = yon_ubl_window_setup(); template_main_window *widgets = yon_ubl_window_setup();
yon_root_button_setup((template_main_window*)widgets,argv,argc);
yon_main_window_complete((main_window**)&widgets); yon_main_window_complete((main_window**)&widgets);
if (getuid()!=0){ if (getuid()!=0){
textdomain(template_ui_LocaleName); textdomain(template_ui_LocaleName);

@ -6,6 +6,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <libintl.h> #include <libintl.h>
#include <getopt.h> #include <getopt.h>
#include <time.h>
#include <libintl.h> #include <libintl.h>
#include <libublsettings.h> #include <libublsettings.h>
#include <libublsettings-gtk3.h> #include <libublsettings-gtk3.h>
@ -15,7 +16,7 @@
#endif #endif
#include "ubl-strings.h" #include "ubl-strings.h"
#define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечениерограммы_и_утилиты/Все/ubl-settings-TEMPLATE" #define WIKI_LINK "https://wiki.ublinux.com/Software/Programs_and_utilities/All/ubl-settings-datetime"
#define _(String) gettext(String) #define _(String) gettext(String)

@ -134,4 +134,9 @@ border-color:alpha(@theme_text_color, 0.01);
.marginright image{ .marginright image{
margin-right: 2px; margin-right: 2px;
}
button {
min-width: 26px;
min-height: 24px;
} }
Loading…
Cancel
Save