diff --git a/source/ubinstall-gtk-region.c b/source/ubinstall-gtk-region.c index f08be53..cbb8b4c 100644 --- a/source/ubinstall-gtk-region.c +++ b/source/ubinstall-gtk-region.c @@ -1,5 +1,7 @@ #include "ubinstall-gtk.h" + #ifdef TIMEZONEMAP_INCLUDE #include "timezonemap/cc-timezone-map.h" +#endif int yon_region_save(main_window *widgets){ if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->RegionCombo))==-1){ @@ -19,6 +21,19 @@ int yon_region_save(main_window *widgets){ 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)); + char *timezone = yon_char_unite(region,"/",zone,NULL); + cc_timezone_map_set_timezone(CC_TIMEZONE_MAP(widgets->RegionMapTarget),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){ char *active = (char*)gtk_combo_box_get_active_id(self); active = yon_char_append("/usr/share/zoneinfo/",active); @@ -35,15 +50,19 @@ void on_region_changed(GtkComboBox *self, main_window *widgets){ free(active); } -void on_map_selection_changed(GtkWidget *,CcTimezoneLocation *location,main_window *); + #ifdef TIMEZONEMAP_INCLUDE void on_map_selection_changed(GtkWidget *,CcTimezoneLocation *location,main_window *widgets){ + if (!location) return; + g_signal_handlers_block_by_func(G_OBJECT(widgets->ZoneCombo),G_CALLBACK(on_zone_changed),widgets); char *zone = yon_char_new(cc_timezone_location_get_zone(location)); char *timezone = yon_char_divide_search(zone,"/",-1); gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),timezone); while(gtk_events_pending()) gtk_main_iteration(); gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),zone); -} + g_signal_handlers_unblock_by_func(G_OBJECT(widgets->ZoneCombo),G_CALLBACK(on_zone_changed),widgets); +} +#endif void yon_region_init(main_window *widgets){ #ifdef TIMEZONEMAP_INCLUDE diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 773d5fe..b8e855d 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -749,7 +749,10 @@ void yon_main_window_create(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->LocaleCell),"toggled",G_CALLBACK(on_locale_toggled),widgets); g_signal_connect(G_OBJECT(widgets->CancelInstallButton),"clicked",G_CALLBACK(on_page_cancel_clicked),widgets); + #ifdef TIMEZONEMAP_INCLUDE g_signal_connect(G_OBJECT(widgets->RegionCombo),"changed",G_CALLBACK(on_region_changed),widgets); + g_signal_connect(G_OBJECT(widgets->ZoneCombo),"changed",G_CALLBACK(on_zone_changed),widgets); + #endif g_signal_connect(G_OBJECT(widgets->RegionSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->RegionCombo); g_signal_connect(G_OBJECT(widgets->RegionSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->ZoneCombo); g_signal_connect(G_OBJECT(widgets->RegionSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->RegionMapBox); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 698d945..16eee29 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -1187,7 +1187,10 @@ void on_partition_changed(GtkWidget *self, main_window *widgets); void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_size, GtkComboBox *size_type); gboolean on_yon_exit(GtkWidget *, GdkEvent *, main_window *widgets); void on_locale_changed(GtkWidget *, main_window *); +#ifdef TIMEZONEMAP_INCLUDE void on_region_changed(GtkComboBox *self, main_window *widgets); +#endif +void on_zone_changed(GtkWidget *, main_window *widgets); void on_page_cancel_clicked(GtkWidget *, main_window *widgets); int yon_install_options_save(GtkWidget *device_tree, GtkWidget *part_tree, char *mode, main_window *widgets); void on_process_log_view(GtkWidget *, main_window *widgets);