settings/src/iLiadDateTimeScreen.h File Reference

settings - Date time screen More...

#include <gtk/gtk.h>

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  gtk_datetime_screen
struct  tz_info
struct  tzhead

Defines

#define DATETIME_SCREEN_ITEM_SPACING   10
#define DATETIME_DISPLAY_SPACING   25
#define TIMEZONE_BUTTON_ITEM_SPACING   35
#define DATETIME_DISPLAY_HEIGHT   115
#define TIMEZONE_SELECTION_HEIGHT   425
#define DATETIME_SCREEN_ITEM_PADDING_TOP   10
#define DATETIME_SCREEN_ITEM_PADDING_BOTTOM   10
#define DATETIME_SCREEN_ITEM_PADDING_LEFT   13
#define DATETIME_SCREEN_ITEM_PADDING_RIGHT   13
#define TZ_BUTTON_WIDTH   100
#define TZ_BUTTON_HEIGHT   30
#define TOTAL_TIMEZONES   34
#define DATE_STRING_LENGTH   64
#define TZ_SETTING_FILE   "/mnt/settings/timezone"
#define TZ_FILES_DIR   "/usr/share/zoneinfo/Etc/"
#define TZ_FILE   "/etc/localtime"
#define DEFAULT_TIMEZONE_OFFSET   0
#define DEFAULT_TIMEZONE_NAME   "GMT+00:00"

Functions

GtkWidget * iLiad_date_time_create ()
void iLiad_date_time_set_text (void)
void iLiad_date_time_display_data (void)
void iLiad_date_time_handle_refresh (void)


Detailed Description

settings - Date time screen

Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.

User interface for user to set iLiad time

Definition in file iLiadDateTimeScreen.h.


Define Documentation

#define DATE_STRING_LENGTH   64

Definition at line 56 of file iLiadDateTimeScreen.h.

#define DATETIME_DISPLAY_HEIGHT   115

Definition at line 44 of file iLiadDateTimeScreen.h.

#define DATETIME_DISPLAY_SPACING   25

Definition at line 42 of file iLiadDateTimeScreen.h.

#define DATETIME_SCREEN_ITEM_PADDING_BOTTOM   10

Definition at line 48 of file iLiadDateTimeScreen.h.

#define DATETIME_SCREEN_ITEM_PADDING_LEFT   13

Definition at line 49 of file iLiadDateTimeScreen.h.

#define DATETIME_SCREEN_ITEM_PADDING_RIGHT   13

Definition at line 50 of file iLiadDateTimeScreen.h.

#define DATETIME_SCREEN_ITEM_PADDING_TOP   10

Definition at line 47 of file iLiadDateTimeScreen.h.

#define DATETIME_SCREEN_ITEM_SPACING   10

Definition at line 41 of file iLiadDateTimeScreen.h.

#define DEFAULT_TIMEZONE_NAME   "GMT+00:00"

Definition at line 63 of file iLiadDateTimeScreen.h.

#define DEFAULT_TIMEZONE_OFFSET   0

Definition at line 62 of file iLiadDateTimeScreen.h.

#define TIMEZONE_BUTTON_ITEM_SPACING   35

Definition at line 43 of file iLiadDateTimeScreen.h.

#define TIMEZONE_SELECTION_HEIGHT   425

Definition at line 45 of file iLiadDateTimeScreen.h.

#define TOTAL_TIMEZONES   34

Definition at line 55 of file iLiadDateTimeScreen.h.

#define TZ_BUTTON_HEIGHT   30

Definition at line 53 of file iLiadDateTimeScreen.h.

#define TZ_BUTTON_WIDTH   100

Definition at line 52 of file iLiadDateTimeScreen.h.

#define TZ_FILE   "/etc/localtime"

Definition at line 60 of file iLiadDateTimeScreen.h.

#define TZ_FILES_DIR   "/usr/share/zoneinfo/Etc/"

Definition at line 59 of file iLiadDateTimeScreen.h.

#define TZ_SETTING_FILE   "/mnt/settings/timezone"

Definition at line 58 of file iLiadDateTimeScreen.h.


Function Documentation

GtkWidget* iLiad_date_time_create (  ) 

Definition at line 97 of file iLiadDateTimeScreen.c.

00098 {
00099     GtkWidget* vbox;
00100     GtkWidget* settingitem;
00101     GtkWidget* background;
00102     GtkWidget* info;
00103     GtkWidget* selection;
00104 
00105     ST_LOGPRINTF("entry");
00106     g_datetime_screen = g_new0(gtk_datetime_screen, 1);
00107 
00108     vbox = gtk_vbox_new(FALSE, DATETIME_SCREEN_ITEM_SPACING);
00109     g_datetime_screen->top_vbox = vbox;
00110     
00111     settingitem = create_current_time_display();
00112     gtk_box_pack_start(GTK_BOX(vbox), settingitem, FALSE, FALSE, 0);
00113     g_datetime_screen->settingitem = settingitem;
00114 
00115     background = create_timezone_selection();
00116     gtk_box_pack_start(GTK_BOX(vbox), background, FALSE, FALSE, 0);
00117     g_datetime_screen->timezones = background;
00118 
00119     // selection group not part of widget hierarchy
00120     selection = ergtk_selection_group_new(g_datetime_screen->button_timezones);
00121     ergtk_selection_group_set_details(ERGTK_SELECTION_GROUP(selection), 1, 1);
00122     g_signal_connect(G_OBJECT(selection), "selection-update", G_CALLBACK(on_selection_update), NULL);
00123     g_datetime_screen->selection = selection;
00124  
00125     info = gtk_infoitem_new(FALSE);
00126     gtk_box_pack_start(GTK_BOX(vbox), info, FALSE, FALSE, 0);
00127     g_datetime_screen->infoitem = info;
00128 
00129     // Show widgets
00130     gtk_widget_show(vbox);
00131     return vbox;
00132 }

Here is the call graph for this function:

void iLiad_date_time_display_data ( void   ) 

Definition at line 347 of file iLiadDateTimeScreen.c.

00348 {
00349     int i = 0;
00350     
00351     ST_LOGPRINTF("entry");
00352 
00353     g_current_tz_offset = get_current_tz_offset();
00354 
00355     for (i=0; i<TOTAL_TIMEZONES; i++)
00356     {
00357         if (timezones[i].tzoffset == g_current_tz_offset)
00358         {
00359             break;
00360         }
00361     }
00362 
00363     GtkToggleButton* button_to_be_active = g_datetime_screen->button_timezones[i];
00364     gtk_toggle_button_set_active(button_to_be_active, TRUE);
00365 }

Here is the call graph for this function:

void iLiad_date_time_handle_refresh ( void   ) 

Definition at line 367 of file iLiadDateTimeScreen.c.

00368 {
00369     GtkWidget* background;
00370     GtkWidget* info;
00371     GtkWidget* selection;
00372     GtkWidget* vbox = g_datetime_screen->top_vbox;
00373 
00374     ST_LOGPRINTF("entry");
00375 
00376     if (g_datetime_screen->timezones)
00377     {
00378         gtk_widget_destroy(g_datetime_screen->timezones);
00379         g_datetime_screen->timezones = NULL;
00380     }
00381 
00382     if (g_datetime_screen->selection)
00383     {
00384         gtk_object_destroy(GTK_OBJECT(g_datetime_screen->selection));
00385         g_datetime_screen->selection = NULL;
00386     }
00387 
00388     if (g_datetime_screen->infoitem)
00389     {
00390         gtk_widget_destroy(g_datetime_screen->infoitem);
00391         g_datetime_screen->infoitem = NULL;
00392     }
00393 
00394     background = create_timezone_selection();
00395     gtk_box_pack_start(GTK_BOX(vbox), background, FALSE, FALSE, 0);
00396     g_datetime_screen->timezones = background;
00397 
00398     // selection group not part of widget hierarchy
00399     selection = ergtk_selection_group_new(g_datetime_screen->button_timezones);
00400     ergtk_selection_group_set_details(ERGTK_SELECTION_GROUP(selection), 1, 1);
00401     g_signal_connect(G_OBJECT(selection), "selection-update", G_CALLBACK(on_selection_update), NULL);
00402     g_datetime_screen->selection = selection;
00403 
00404     info = gtk_infoitem_new(FALSE);
00405     gtk_box_pack_start(GTK_BOX(vbox), info, FALSE, FALSE, 0);
00406     g_datetime_screen->infoitem = info;
00407 
00408     // Refresh the text displayed on the widget
00409     g_current_tz_offset = -1;
00410     iLiad_date_time_set_text();
00411 
00412     // Set the selected button and update current time
00413     iLiad_date_time_display_data();
00414 }

Here is the call graph for this function:

void iLiad_date_time_set_text ( void   ) 

Definition at line 301 of file iLiadDateTimeScreen.c.

00302 {
00303     ST_LOGPRINTF("entry");
00304     if (g_datetime_screen->settingitem)
00305     {
00306         gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_datetime_screen->settingitem),
00307                 _("Time Selection"));
00308         
00309         gtk_label_set_text(GTK_LABEL(g_datetime_screen->label_show_time_prompt),
00310                 _("The current time and date on your iLiad is:"));
00311 
00312         if (g_current_tz_offset != -1)
00313         {
00314             iLiad_update_datetime(g_current_tz_offset);
00315         }
00316     }
00317 
00318     if (g_datetime_screen->timezones)
00319     {
00320         gtk_label_set_text(GTK_LABEL(g_datetime_screen->label_timezone_prompt),
00321                 _("To change the clock, select your current date and time from the list below."));
00322 
00323         // set label text for the first possible date
00324         time_t tm = g_utc_time + timezones[0].tzoffset;
00325         char buf[DATE_STRING_LENGTH];
00326         /* TRANSLATORS: This is a date and time format specifier, according to the strftime(3) man page.
00327            The corresponding string should be something like Monday, July 30 2007. */
00328         // xgettext:no-c-format
00329         strftime(buf, DATE_STRING_LENGTH, _("%A, %x"), gmtime(&tm));  // xgettext:no-c-format
00330         gtk_label_set_text(GTK_LABEL(g_datetime_screen->label_possible_date[0]), buf);
00331 
00332         // set label text for the second possible date
00333         tm = g_utc_time + timezones[g_date_boundary].tzoffset;
00334         // xgettext:no-c-format
00335         strftime(buf, DATE_STRING_LENGTH, _("%A, %x"), gmtime(&tm));  // xgettext:no-c-format
00336         gtk_label_set_text(GTK_LABEL(g_datetime_screen->label_possible_date[1]), buf);
00337     }
00338 
00339     if (g_datetime_screen->infoitem)
00340     {
00341         // set help text
00342         gtk_infoitem_set_text(GTK_INFOITEM(g_datetime_screen->infoitem),
00343                 _("You can set your date and time by connecting to iDS. Afterwards you can use this page to update the time for your current timezone."));
00344     }
00345 }

Here is the call graph for this function:


Generated on Sun Dec 14 17:17:10 2008 by  doxygen 1.5.6