|
|
|
|
@ -57,12 +57,27 @@ void on_zone_changed(GtkWidget *, main_window *widgets){
|
|
|
|
|
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);
|
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->RegionEntry),G_CALLBACK(on_region_entry_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);
|
|
|
|
|
if (!yon_char_is_empty(timezone)) free(timezone);
|
|
|
|
|
|
|
|
|
|
timezone = (char*)cc_timezone_location_get_zone(location);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
for_iter(widgets->RegionTimezoneCompletionList,&iter){
|
|
|
|
|
char *render, *tz;
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->RegionTimezoneCompletionList),&iter,0,&render,1,&tz,-1);
|
|
|
|
|
if (!strcmp(timezone,tz)){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->RegionEntry),render);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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->RegionEntry),G_CALLBACK(on_region_entry_changed),widgets);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|