[gnome-control-center/wip/datetime-panel: 8/15] datetime: set spin buttons to the current time at startup
- From: Thomas Wood <thos src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/datetime-panel: 8/15] datetime: set spin buttons to the current time at startup
- Date: Mon, 28 Jun 2010 17:09:46 +0000 (UTC)
commit 12083b85b5351d42fcec5043793083db41d8cb48
Author: Thomas Wood <thomas wood intel com>
Date: Thu Jun 10 11:41:40 2010 +0100
datetime: set spin buttons to the current time at startup
panels/datetime/cc-datetime-panel.c | 15 ++++++++++++++-
panels/datetime/datetime.ui | 21 +++++++++++++++++++++
2 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index 4d0aeab..fa18c91 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -136,10 +136,13 @@ static void
cc_date_time_panel_init (CcDateTimePanel *self)
{
CcDateTimePanelPrivate *priv;
- gchar *objects[] = { "datetime-panel", NULL };
+ gchar *objects[] = { "datetime-panel", "adjustment_min", "adjustment_hour",
+ "adjustment_sec", NULL };
GtkWidget *widget;
GError *err = NULL;
GDate *date;
+ struct tm *ltime;
+ time_t t;
priv = self->priv = DATE_TIME_PANEL_PRIVATE (self);
@@ -174,6 +177,16 @@ cc_date_time_panel_init (CcDateTimePanel *self)
g_date_get_year (date));
update_time (self);
+
+ t = time (NULL);
+ ltime = localtime (&t);
+
+ widget = (GtkWidget *) gtk_builder_get_object (priv->builder, "spin_hour");
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), ltime->tm_hour);
+ widget = (GtkWidget *) gtk_builder_get_object (priv->builder, "spin_minute");
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), ltime->tm_min);
+ widget = (GtkWidget *) gtk_builder_get_object (priv->builder, "spin_second");
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), ltime->tm_sec);
}
void
diff --git a/panels/datetime/datetime.ui b/panels/datetime/datetime.ui
index c75b204..9e09681 100644
--- a/panels/datetime/datetime.ui
+++ b/panels/datetime/datetime.ui
@@ -117,6 +117,7 @@
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
<property name="width_chars">2</property>
+ <property name="adjustment">adjustment_hour</property>
</object>
<packing>
<property name="position">0</property>
@@ -128,6 +129,7 @@
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
<property name="width_chars">2</property>
+ <property name="adjustment">adjustment_min</property>
</object>
<packing>
<property name="position">1</property>
@@ -139,6 +141,7 @@
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
<property name="width_chars">2</property>
+ <property name="adjustment">adjustment_sec</property>
</object>
<packing>
<property name="position">2</property>
@@ -225,4 +228,22 @@
</object>
</child>
</object>
+ <object class="GtkAdjustment" id="adjustment_hour">
+ <property name="upper">23</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ <property name="page_size">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_min">
+ <property name="upper">60</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ <property name="page_size">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_sec">
+ <property name="upper">60</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ <property name="page_size">10</property>
+ </object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]