datetime.c File Reference

#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <glib.h>
#include <gdk/gdkkeysyms.h>
#include <libergtk/ergtk.h>
#include "i18n.h"
#include "log.h"
#include "settings.h"
#include "settings_utils.h"
#include "settings_style.h"
#include "datetime_base.h"
#include "datetime.h"
Include dependency graph for datetime.c:

Go to the source code of this file.

Functions

static void locale_changed (void)
static gboolean on_button_focus_in (GtkWidget *widget, GdkEventFocus *event, gpointer data)
void load_datetime_settings ()
void save_datetime_settings ()
GtkWidget * create_datetime_window (GtkWidget *parent)
void datetime_set_main_focus (void)
void datetime_set_orientation (gboolean is_portrait)
static gboolean change_focus (gpointer data)

Variables

static DateTimeSettings g_settings
static DateTimeWidgets g_widgets
static GtkWidget * g_list_view = NULL
static GtkWidget * g_top_window = NULL

Function Documentation

static gboolean change_focus ( gpointer  data  )  [static]

Definition at line 184 of file datetime.c.

Referenced by on_button_focus_in().

00185 {
00186     gtk_widget_grab_focus(GTK_WIDGET(data));
00187     return FALSE; // once
00188 }

Here is the caller graph for this function:

GtkWidget* create_datetime_window ( GtkWidget *  parent  ) 

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

Definition at line 103 of file datetime.c.

References create_settingsview_for_type(), create_title(), datetime_base_create_widgets(), g_list_view, g_top_window, DateTimeWidgets::hidden_button, locale_changed(), LOGPRINTF, on_button_focus_in(), DateTimeWidgets::parent, SETTING_DATETIME, and WINDOW_BORDER_PADDING.

Referenced by create_concrete_win().

00104 {
00105     LOGPRINTF("entry");
00106     // create top window
00107     g_top_window = parent;
00108     gtk_window_maximize(GTK_WINDOW(parent));
00109     gtk_window_set_resizable(GTK_WINDOW(parent), FALSE);
00110     gtk_container_set_border_width(GTK_CONTAINER(parent),WINDOW_BORDER_PADDING  );
00111     gtk_window_set_modal(GTK_WINDOW(parent), TRUE);
00112 
00113     // top level vbox (vboxtop)
00114     GtkWidget* vboxtop = gtk_vbox_new(FALSE, 0);
00115     gtk_container_add(GTK_CONTAINER(parent), vboxtop);
00116 
00117     // add header container the title and subtitle of this settings page
00118     create_title(GTK_VBOX(vboxtop), _("Settings"), _("Time & Date"));
00119     
00120     // add the back/exit bar below the title 
00121     g_list_view = create_settingsview_for_type( SETTING_DATETIME );
00122     gtk_box_pack_start(GTK_BOX(vboxtop), g_list_view, FALSE, FALSE, 0); 
00123 
00124     // Time and date.
00125     datetime_base_create_widgets(&g_widgets, &g_settings);
00126     g_signal_connect(G_OBJECT(g_widgets.hidden_button),
00127                     "focus-in-event",
00128                     G_CALLBACK(on_button_focus_in),
00129                     (gpointer) NULL );
00130     gtk_box_pack_start(GTK_BOX(vboxtop), g_widgets.parent, FALSE, FALSE, 0);
00131 
00132     // Set the text.
00133     locale_changed();
00134 
00135     gtk_widget_grab_focus(g_list_view);
00136 
00137     gtk_widget_show_all(parent);
00138 
00139     return parent;
00140 }

Here is the call graph for this function:

Here is the caller graph for this function:

void datetime_set_main_focus ( void   ) 

Definition at line 142 of file datetime.c.

References DateTimeWidgets::timezone_button.

Referenced by setting_set_focus().

00143 {
00144     gtk_widget_grab_focus(GTK_WIDGET(g_widgets.timezone_button));
00145 }

Here is the caller graph for this function:

void datetime_set_orientation ( gboolean  is_portrait  ) 

Definition at line 147 of file datetime.c.

References DateTimeWidgets::is_portrait, and LOGPRINTF.

Referenced by on_changed_orientation().

00148 {
00149     LOGPRINTF("entry");
00150     g_widgets.is_portrait = is_portrait;
00151 }

Here is the caller graph for this function:

void load_datetime_settings (  ) 

Definition at line 69 of file datetime.c.

References datetime_base_load_datetime(), and LOGPRINTF.

Referenced by create_concrete_win().

00070 {
00071     LOGPRINTF("entry");
00072 
00073     datetime_base_load_datetime(&g_settings);
00074 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void locale_changed ( void   )  [static]

Definition at line 157 of file datetime.c.

References datetime_base_locale_changed(), DateTimeWidgets::label_date, DateTimeWidgets::label_date_desc, DateTimeWidgets::label_dst_desc, DateTimeWidgets::label_time, DateTimeWidgets::label_time_desc, DateTimeWidgets::label_timezone, DateTimeWidgets::label_timezone_desc, and LOGPRINTF.

Referenced by create_datetime_window().

00158 {
00159     LOGPRINTF("entry");
00160 
00161     // Timezone section.
00162     gtk_label_set_label(GTK_LABEL(g_widgets.label_timezone), _("Time Zone"));
00163     gtk_label_set_label(GTK_LABEL(g_widgets.label_timezone_desc),
00164             _("Tap on the up or down arrow to scroll through the time zones. "
00165               "Setting this to the area where you reside is essential for "
00166               "purchased content to work correctly."));
00167     gtk_label_set_label(GTK_LABEL(g_widgets.label_dst_desc),
00168             _("Check the box below if daylight saving time (DST) is currently "
00169               "in effect in your location."));
00170     
00171     // Time section.
00172     gtk_label_set_label(GTK_LABEL(g_widgets.label_time), _("Time"));
00173     gtk_label_set_label(GTK_LABEL(g_widgets.label_time_desc),
00174             _("Tap on the up or down arrow to scroll through the numbers."));
00175   
00176     // Date section.
00177     gtk_label_set_label(GTK_LABEL(g_widgets.label_date), _("Date"));
00178     gtk_label_set_label(GTK_LABEL(g_widgets.label_date_desc),
00179             _("Tap on the up or down arrow to scroll through the numbers."));
00180 
00181     datetime_base_locale_changed(&g_widgets, &g_settings);
00182 }

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean on_button_focus_in ( GtkWidget *  widget,
GdkEventFocus *  event,
gpointer  data 
) [static]

Definition at line 190 of file datetime.c.

References change_focus(), and g_list_view.

Referenced by create_datetime_window().

00193 {
00194     // timeout is needed, otherwise the year spin button does not 
00195     // update its cursor on focus out
00196     g_timeout_add(200, change_focus, (gpointer)g_list_view);
00197     return FALSE;
00198 }

Here is the call graph for this function:

Here is the caller graph for this function:

void save_datetime_settings (  ) 

Definition at line 76 of file datetime.c.

References datetime_base_save_datetime(), g_top_window, and LOGPRINTF.

Referenced by on_listview_row_activated().

00077 {
00078     LOGPRINTF("entry");
00079 
00080     if ( ! datetime_base_save_datetime(&g_widgets, &g_settings) )
00081     {
00082         LOGPRINTF("save datetime failed.");
00083         /* Create a messagebox. */
00084         GtkWidget *dialog = gtk_message_dialog_new(
00085                 GTK_WINDOW(g_top_window), 
00086                 GTK_DIALOG_MODAL,
00087                 GTK_MESSAGE_WARNING, 
00088                 GTK_BUTTONS_OK,
00089                 _("The date was not saved.") );
00090 
00091         gtk_dialog_run(GTK_DIALOG(dialog));
00092         gtk_widget_destroy(dialog);
00093     }
00094 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

GtkWidget* g_list_view = NULL [static]

Definition at line 53 of file datetime.c.

Referenced by create_datetime_window(), and on_button_focus_in().

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

Definition at line 50 of file datetime.c.

GtkWidget* g_top_window = NULL [static]

Definition at line 54 of file datetime.c.

Referenced by create_datetime_window(), and save_datetime_settings().

Definition at line 51 of file datetime.c.

Generated by  doxygen 1.6.2-20100208