~timezonemap-team/timezonemap/trunk

« back to all changes in this revision

Viewing changes to src/timezone-completion.c

  • Committer: Dmitrijs Ledkovs
  • Date: 2013-03-27 17:22:30 UTC
  • mfrom: (20.1.2 timezonemap-clickanywhere)
  • Revision ID: dmitrijs.ledkovs@canonical.com-20130327172230-v14b0lcoep1j11js
* Simplfy setting location
* Use latitude/longitude for local cities as well (LP: #892370)
* Add m4 directory to prevent aclocal from complaining.
* Include cities with greater than 15000 people locally.
* Add original timezone svg map, thanks to Otto for finding it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
532
532
 
533
533
    gchar * zone;
534
534
    gchar * country;
535
 
    g_object_get (loc, "zone", &zone, "country", &country, NULL);
 
535
    gchar * en_name; // FIXME: need something better for non-English locales 
 
536
    gdouble longitude;
 
537
    gdouble latitude;
 
538
    g_object_get (loc, "zone", &zone, "country", &country, "en_name", &en_name,
 
539
                  "longitude", &longitude, "latitude", &latitude,
 
540
                  NULL);
536
541
 
537
 
    /* FIXME: need something better than below for non-English locales */
538
 
    const gchar * last_bit = ((const gchar *)strrchr (zone, '/')) + 1;
539
 
    if (last_bit == NULL)
540
 
      last_bit = zone;
541
 
    gchar * name = g_strdup (last_bit);
542
 
    gchar * underscore;
543
 
    while ((underscore = strchr (name, '_'))) {
544
 
       *underscore = ' ';
545
 
    }
 
542
    gchar * longitude_s = g_strdup_printf ("%f", longitude);
 
543
    gchar * latitude_s=  g_strdup_printf ("%f", latitude);
546
544
 
547
545
    gtk_list_store_set (store, &iter,
548
 
                        CC_TIMEZONE_COMPLETION_ZONE, zone,
549
 
                        CC_TIMEZONE_COMPLETION_NAME, name,
 
546
                        CC_TIMEZONE_COMPLETION_ZONE, NULL,
 
547
                        CC_TIMEZONE_COMPLETION_NAME, en_name,
550
548
                        CC_TIMEZONE_COMPLETION_COUNTRY, country,
 
549
                        CC_TIMEZONE_COMPLETION_LONGITUDE, longitude_s,
 
550
                        CC_TIMEZONE_COMPLETION_LATITUDE, latitude_s,
551
551
                        -1);
552
552
 
553
 
    g_free (name);
 
553
    g_free (latitude_s);
 
554
    g_free (longitude_s);
 
555
    g_free (en_name);
 
556
    g_free (country);
554
557
    g_free (zone);
555
558
  }
556
559