|
|
|
@ -1,6 +1,8 @@
|
|
|
|
#include "ubinstall-gtk.h"
|
|
|
|
#include "ubinstall-gtk.h"
|
|
|
|
|
|
|
|
// #define TIMEZONEMAP_INCLUDE
|
|
|
|
#ifdef TIMEZONEMAP_INCLUDE
|
|
|
|
#ifdef TIMEZONEMAP_INCLUDE
|
|
|
|
#include "timezonemap/cc-timezone-map.h"
|
|
|
|
#include "timezonemap/cc-timezone-map.h"
|
|
|
|
|
|
|
|
#include "timezonemap/tz.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
int yon_region_save(main_window *widgets){
|
|
|
|
int yon_region_save(main_window *widgets){
|
|
|
|
@ -21,22 +23,6 @@ int yon_region_save(main_window *widgets){
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef TIMEZONEMAP_INCLUDE
|
|
|
|
|
|
|
|
void on_map_selection_changed(GtkWidget *,CcTimezoneLocation *location,main_window *);
|
|
|
|
|
|
|
|
void on_zone_changed(GtkWidget *, main_window *widgets){
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->RegionMapTarget),G_CALLBACK(on_map_selection_changed),widgets);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *region = gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->RegionCombo));
|
|
|
|
|
|
|
|
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 *timezone = yon_char_unite(region,"/",zone,NULL);
|
|
|
|
|
|
|
|
cc_timezone_map_set_timezone(CC_TIMEZONE_MAP(widgets->RegionMapTarget),timezone);
|
|
|
|
|
|
|
|
free(timezone);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->RegionMapTarget),G_CALLBACK(on_map_selection_changed),widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 = (char*)gtk_combo_box_get_active_id(self);
|
|
|
|
active = yon_char_append("/usr/share/zoneinfo/",active);
|
|
|
|
active = yon_char_append("/usr/share/zoneinfo/",active);
|
|
|
|
@ -54,6 +40,20 @@ void on_region_changed(GtkComboBox *self, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef TIMEZONEMAP_INCLUDE
|
|
|
|
#ifdef TIMEZONEMAP_INCLUDE
|
|
|
|
|
|
|
|
void on_map_selection_changed(GtkWidget *,CcTimezoneLocation *location,main_window *);
|
|
|
|
|
|
|
|
void on_zone_changed(GtkWidget *, main_window *widgets){
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->RegionMapTarget),G_CALLBACK(on_map_selection_changed),widgets);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *region = gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->RegionCombo));
|
|
|
|
|
|
|
|
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 *timezone = yon_char_unite(region,"/",zone,NULL);
|
|
|
|
|
|
|
|
cc_timezone_map_set_timezone(CC_TIMEZONE_MAP(widgets->RegionMapTarget),timezone);
|
|
|
|
|
|
|
|
free(timezone);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->RegionMapTarget),G_CALLBACK(on_map_selection_changed),widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_map_selection_changed(GtkWidget *,CcTimezoneLocation *location,main_window *widgets){
|
|
|
|
void on_map_selection_changed(GtkWidget *,CcTimezoneLocation *location,main_window *widgets){
|
|
|
|
if (!location) return;
|
|
|
|
if (!location) return;
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->ZoneCombo),G_CALLBACK(on_zone_changed),widgets);
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->ZoneCombo),G_CALLBACK(on_zone_changed),widgets);
|
|
|
|
@ -65,13 +65,33 @@ void on_map_selection_changed(GtkWidget *,CcTimezoneLocation *location,main_wind
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->ZoneCombo),G_CALLBACK(on_zone_changed),widgets);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->ZoneCombo),G_CALLBACK(on_zone_changed),widgets);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_region_entry_changed(GtkWidget *, main_window *widgets){
|
|
|
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
int found = 0;
|
|
|
|
|
|
|
|
for_iter(widgets->RegionTimezoneCompletionList, &iter){
|
|
|
|
|
|
|
|
char *target, *timezone;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->RegionTimezoneCompletionList),&iter,0,&target,1,&timezone,-1);
|
|
|
|
|
|
|
|
char *target_entry = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->RegionEntry));
|
|
|
|
|
|
|
|
if (!strcmp(target,target_entry)){
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(widgets->RegionEntry),zone_parameter,yon_char_new(timezone));
|
|
|
|
|
|
|
|
#ifdef TIMEZONEMAP_INCLUDE
|
|
|
|
|
|
|
|
cc_timezone_map_set_timezone(CC_TIMEZONE_MAP(widgets->RegionMapTarget),timezone);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
found = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found){
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(widgets->RegionEntry),zone_parameter,NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_region_init(main_window *widgets){
|
|
|
|
void yon_region_init(main_window *widgets){
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->RegionCombo));
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->RegionCombo));
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->KeyboardNumLockCombo));
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->KeyboardNumLockCombo));
|
|
|
|
#ifdef TIMEZONEMAP_INCLUDE
|
|
|
|
#ifdef TIMEZONEMAP_INCLUDE
|
|
|
|
yon_debug_output("%s\n","TIMEZONEMAP enabled");
|
|
|
|
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->RegionMapBox));
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->RegionMapBox));
|
|
|
|
if (list){
|
|
|
|
if (list){
|
|
|
|
GList *iter;
|
|
|
|
GList *iter;
|
|
|
|
@ -87,7 +107,6 @@ void yon_region_init(main_window *widgets){
|
|
|
|
char *config_param = config(zone_parameter);
|
|
|
|
char *config_param = config(zone_parameter);
|
|
|
|
if (!yon_char_is_empty(config_param)){
|
|
|
|
if (!yon_char_is_empty(config_param)){
|
|
|
|
cc_timezone_map_set_timezone(CC_TIMEZONE_MAP(widgets->RegionMapTarget),config_param);
|
|
|
|
cc_timezone_map_set_timezone(CC_TIMEZONE_MAP(widgets->RegionMapTarget),config_param);
|
|
|
|
// cc_timezone_map_set_location(CC_TIMEZONE_MAP(widgets->RegionMapTarget),lon, lat);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
int size;
|
|
|
|
int size;
|
|
|
|
@ -98,6 +117,16 @@ void yon_region_init(main_window *widgets){
|
|
|
|
char *path = yon_char_append(zone_path,parsed[i]);
|
|
|
|
char *path = yon_char_append(zone_path,parsed[i]);
|
|
|
|
if (yon_file_is_directory(path)){
|
|
|
|
if (yon_file_is_directory(path)){
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->RegionCombo),parsed[i],_(parsed[i]));
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->RegionCombo),parsed[i],_(parsed[i]));
|
|
|
|
|
|
|
|
char *active = yon_char_append("/usr/share/zoneinfo/",parsed[i]);
|
|
|
|
|
|
|
|
int zone_size;
|
|
|
|
|
|
|
|
config_str zone_parsed = yon_file_ls(active,&zone_size);
|
|
|
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
for (int j=0;j<zone_size;j++){
|
|
|
|
|
|
|
|
char *zone_name = yon_char_unite(_(zone_parsed[j]),", ",_(parsed[i]), NULL);
|
|
|
|
|
|
|
|
char *zone_string = yon_char_unite(parsed[i],"/",zone_parsed[j], NULL);
|
|
|
|
|
|
|
|
gtk_list_store_append(widgets->RegionTimezoneCompletionList,&iter);
|
|
|
|
|
|
|
|
gtk_list_store_set(widgets->RegionTimezoneCompletionList,&iter,0,zone_name,1,zone_string,-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(path);
|
|
|
|
free(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|