// ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- void tzn::beg() { DEBUGLOGB; tzn::end(); tzdb = tz_load_db(); if( tzdb ) { int tzh = 65535; int tzm = 65535; time_t ct = time(NULL); tm lt = *localtime(&ct); tzo = lt.tm_gmtoff; #if 0 strfmtdt(tzz, sizeof(tzz), "%z", <); strfmtdt(tzZ, sizeof(tzZ), "%Z", <); if( *tzz ) { sscanf(tzz, "%3d%2d", &tzh, &tzm); tzo = tzh*3600 + tzm*60; // # of seconds offset from utc } DEBUGLOGP("tzz=*%s*, tzZ=*%s*, tzh=%d, tzm=%d, tzo=%d\n", tzz, tzZ, tzh, tzm, tzo); #endif } DEBUGLOGE; }
static void cc_timezone_map_init (CcTimezoneMap *self) { CcTimezoneMapPrivate *priv; GError *err = NULL; priv = self->priv = TIMEZONE_MAP_PRIVATE (self); priv->orig_background = gdk_pixbuf_new_from_file (DATADIR "/bg.png", &err); if (!priv->orig_background) { g_warning ("Could not load background image: %s", (err) ? err->message : "Unknown error"); g_clear_error (&err); } priv->orig_color_map = gdk_pixbuf_new_from_file (DATADIR "/cc.png", &err); if (!priv->orig_color_map) { g_warning ("Could not load background image: %s", (err) ? err->message : "Unknown error"); g_clear_error (&err); } priv->tzdb = tz_load_db (); g_signal_connect (self, "button-press-event", G_CALLBACK (button_press_event), NULL); }
static void load_regions_model (GtkListStore *regions, GtkListStore *cities) { struct get_region_data data; TzDB *db; GHashTable *table; db = tz_load_db (); table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); data.table = table; data.region_store = regions; data.city_store = cities; g_ptr_array_foreach (db->locations, (GFunc) get_regions, &data); g_hash_table_destroy (table); tz_db_free (db); /* sort the models */ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (regions), REGION_COL_REGION_TRANSLATED, GTK_SORT_ASCENDING); }
static void load_regions_model (GtkListStore *cities) { TzDB *db; db = tz_load_db (); g_ptr_array_foreach (db->locations, (GFunc) load_cities, cities); tz_db_free (db); }
static void cc_timezone_map_init (CcTimezoneMap *self) { CcTimezoneMapPrivate *priv; GError *err = NULL; priv = self->priv = TIMEZONE_MAP_PRIVATE (self); priv->orig_background = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/bg.png", &err); if (!priv->orig_background) { g_warning ("Could not load background image: %s", (err) ? err->message : "Unknown error"); g_clear_error (&err); } priv->orig_background_dim = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/bg_dim.png", &err); if (!priv->orig_background_dim) { g_warning ("Could not load background image: %s", (err) ? err->message : "Unknown error"); g_clear_error (&err); } priv->orig_color_map = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/cc.png", &err); if (!priv->orig_color_map) { g_warning ("Could not load background image: %s", (err) ? err->message : "Unknown error"); g_clear_error (&err); } priv->pin = gdk_pixbuf_new_from_resource (DATETIME_RESOURCE_PATH "/pin.png", &err); if (!priv->pin) { g_warning ("Could not load pin icon: %s", (err) ? err->message : "Unknown error"); g_clear_error (&err); } priv->tzdb = tz_load_db (); /* gente addition */ /* g_signal_connect (self, "button-press-event", G_CALLBACK (button_press_event), NULL); */ }
ETzMap * e_tz_map_new (GstTool *tool) { ETzMap *tzmap; GPtrArray *locs; TzLocation *tzl; GtkWidget *location_combo; int i; tzmap = g_new0 (ETzMap, 1); tzmap->tool = GST_TOOL (tool); tzmap->tzdb = tz_load_db (); if (!tzmap->tzdb) g_error ("Unable to load system timezone database."); tzmap->map = e_map_new (); if (!tzmap->map) g_error ("Unable to create map widget."); gtk_widget_set_events (GTK_WIDGET (tzmap->map), gtk_widget_get_events (GTK_WIDGET (tzmap->map)) | GDK_LEAVE_NOTIFY_MASK | GDK_VISIBILITY_NOTIFY_MASK); locs = tz_get_locations (tzmap->tzdb); for (i = 0; i < locs->len; i++) { tzl = g_ptr_array_index (locs, i); e_map_add_point (tzmap->map, NULL, tzl->longitude, tzl->latitude, TZ_MAP_POINT_NORMAL_RGBA); } g_signal_connect (G_OBJECT (tzmap->map), "map-event", G_CALLBACK (map), tzmap); g_signal_connect (G_OBJECT (tzmap->map), "unmap-event", G_CALLBACK (unmap), tzmap); g_signal_connect(G_OBJECT (tzmap->map), "motion-notify-event", G_CALLBACK (motion), (gpointer) tzmap); g_signal_connect(G_OBJECT(tzmap->map), "button-press-event", G_CALLBACK (button_pressed), (gpointer) tzmap); g_signal_connect(G_OBJECT (tzmap->map), "enter-notify-event", G_CALLBACK (in_map), (gpointer) tzmap); g_signal_connect(G_OBJECT (tzmap->map), "leave-notify-event", G_CALLBACK (out_map), (gpointer) tzmap); location_combo = gst_dialog_get_widget (tzmap->tool->main_dialog, "location_combo"); g_signal_connect (G_OBJECT (location_combo), "changed", G_CALLBACK (update_map), (gpointer) tzmap); return tzmap; }