~ubuntu-branches/ubuntu/dapper/gworldclock/dapper

« back to all changes in this revision

Viewing changes to zones.h

  • Committer: Bazaar Package Importer
  • Author(s): Drew Parsons
  • Date: 2003-12-23 15:31:20 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20031223153120-1drxus7uk82vk4by
Tags: 1.3-2
Build-depends: libxml2-dev. Closes: #224865.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* functions related to selecting time zones */
 
2
 
 
3
#ifndef GWORLDCLOCK_ZONES
 
4
#define GWORLDCLOCK_ZONES
 
5
 
 
6
#include <gtk/gtk.h>
 
7
 
 
8
static const gchar *ZONE_TABLE="/usr/share/zoneinfo/zone.tab";
 
9
static const gchar *COUNTRY_TABLE="/usr/share/zoneinfo/iso3166.tab";
 
10
 
 
11
static const gchar *continents[] = 
 
12
{ "Africa",
 
13
  "Americas",
 
14
  "Antarctica",
 
15
  "Arctic Ocean",
 
16
  "Asia",
 
17
  "Atlantic Ocean",
 
18
  "Australia",
 
19
  "Europe",
 
20
  "Indian Ocean",
 
21
  "Pacific Ocean" };
 
22
 
 
23
/* Keep this number up to date with the number of continents in the
 
24
   array above.  Not that the number of continents on Earth is going
 
25
   to change, but you know.  */ 
 
26
 
 
27
static const gint Ncontinents = 10;  
 
28
 
 
29
 
 
30
typedef struct NameCodeType {
 
31
  gchar *name;
 
32
  gchar *code;  /* actually only 2 characters needed, but 3 would be better */
 
33
} NameCodeType;
 
34
 
 
35
typedef struct AddZoneStruct 
 
36
{
 
37
  GObject *clocklist;
 
38
  GtkWidget *countryCList;
 
39
  GtkWidget *regionCList;
 
40
  GtkWidget *DescriptionEntry;
 
41
  GtkWidget *TZEntry;
 
42
  GString *continent;
 
43
  GString *country;
 
44
} AddZoneStruct;
 
45
 
 
46
 
 
47
 
 
48
void DeleteZone( gpointer clocklist );
 
49
 
 
50
/*  Save list of time zones to configfile */
 
51
gint SaveZones(gpointer clocklist);
 
52
 
 
53
/* Handle "rows_reordered" signal, indicating the rows in the clock have been
 
54
   moved */
 
55
/* Note this callback function does not get  called for some reason,
 
56
   I don't know why.  A bug in GTK+ ? 
 
57
   You will have to save the reordered list by hand for the time being.
 
58
*/
 
59
void registerReorderedRows( GtkTreeModel* clocklistModel,
 
60
                             GtkTreePath *arg1,
 
61
                             GtkTreeIter *arg2,
 
62
                             gpointer new_order,
 
63
                            gpointer user_data);
 
64
 
 
65
gint CodeInList(gchar *code, GSList *List);
 
66
 
 
67
GSList* AddNameCodeEntry(gchar *code, gchar *name, GSList *List);
 
68
 
 
69
void  ClearNameCodeList(GSList **List);
 
70
 
 
71
/* for given continent, find corresponding countries as identified in ZONE_TABLE
 
72
   and prepare list of country name using COUNTRY_TABLE
 
73
*/
 
74
GSList* FetchCountries(gchar *continent);
 
75
 
 
76
/* from given country code ("*country"), find list of regions in ZONE_TABLE */
 
77
/* input: country is the two-letter country code from ISO3166 */
 
78
GSList* FetchRegions(gchar *country);
 
79
 
 
80
void UpdateCountries(GtkWidget *ContinentCList,
 
81
                     gint row,
 
82
                     gint column,
 
83
                     GdkEventButton *event,
 
84
                     gpointer ZoneData);
 
85
 
 
86
/*  Why does the scroll box get larger when you keep selecting a country?? */
 
87
void UpdateRegions(GtkWidget *CountryCList,
 
88
                   gint row,
 
89
                   gint column,
 
90
                   GdkEventButton *event,
 
91
                   gpointer ZoneData);
 
92
 
 
93
void SelectRegion(GtkWidget *RegionCList,
 
94
                  gint row,
 
95
                  gint column,
 
96
                  GdkEventButton *event,
 
97
                  gpointer ZoneData);
 
98
 
 
99
/* when left mouse button is double-clicked,
 
100
   send "key-pressed-event" to one of the Entry boxes 
 
101
   which will be handled by adding the given zone.
 
102
   We're assuming here that "select-row" preceded the double-click event */
 
103
gint ButtonPressedInRegionList(GtkWidget *regionlist, 
 
104
                               GdkEventButton *event, gpointer ZoneData);
 
105
 
 
106
/* zones are selected according to the method used in tzselect:
 
107
   First the continent is chosen, then, if necessary, the country is chosen,
 
108
   with countries being identified from the two-letter code in the
 
109
   entries of  [/usr/share/zoneinfo/]zone.tab (and country names taken from 
 
110
   iso3166.tab)  Then the region (or city) of that country is identified, from 
 
111
   zone.tab.
 
112
*/
 
113
void  PrepareZoneNotes(GtkWidget **ZoneNotes, AddZoneStruct *Zone);
 
114
 
 
115
void AddZoneToList(GtkWidget *w, gpointer NewZone);
 
116
 
 
117
void AddZone( gpointer clocklist );
 
118
 
 
119
void WriteZoneDescription(GtkDialog *dialog, gint responseId, gpointer Zone);
 
120
 
 
121
void ChangeZoneDescription(gpointer clocklist);
 
122
 
 
123
#endif