Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Settings
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
676
Issues
676
List
Boards
Labels
Service Desk
Milestones
Merge Requests
53
Merge Requests
53
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
Settings
Commits
de270ce6
Commit
de270ce6
authored
Dec 09, 2010
by
Bastien Nocera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
datetime: Add "Network Time" switch
And disable the date/time switches when turning NTP on/off.
parent
189766a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
21 deletions
+83
-21
panels/datetime/cc-datetime-panel.c
panels/datetime/cc-datetime-panel.c
+43
-2
panels/datetime/datetime.ui
panels/datetime/datetime.ui
+40
-19
No files found.
panels/datetime/cc-datetime-panel.c
View file @
de270ce6
...
...
@@ -261,6 +261,17 @@ set_timezone_cb (CcDateTimePanel *self,
}
}
static
void
set_using_ntp_cb
(
CcDateTimePanel
*
self
,
GError
*
error
)
{
/* TODO: display any error in a user friendly way */
if
(
error
)
{
g_warning
(
"Could not set system to use NTP: %s"
,
error
->
message
);
}
}
static
void
apply_button_clicked_cb
(
GtkButton
*
button
,
CcDateTimePanel
*
self
)
...
...
@@ -269,6 +280,7 @@ apply_button_clicked_cb (GtkButton *button,
guint
mon
,
y
,
d
;
time_t
unixtime
;
GDateTime
*
old_date
;
gboolean
using_ntp
;
old_date
=
priv
->
date
;
...
...
@@ -290,6 +302,9 @@ apply_button_clicked_cb (GtkButton *button,
{
set_system_timezone_async
(
priv
->
current_location
->
zone
,
(
GFunc
)
set_timezone_cb
,
self
,
NULL
);
}
using_ntp
=
gtk_switch_get_active
(
GTK_SWITCH
(
W
(
"network_time_switch"
)));
set_using_ntp_async
(
using_ntp
,
(
GFunc
)
set_using_ntp_cb
,
self
,
NULL
);
}
static
void
...
...
@@ -528,6 +543,16 @@ city_changed_cb (GtkComboBox *box,
inside
=
FALSE
;
}
static
void
update_widget_state_for_ntp
(
CcDateTimePanel
*
panel
,
gboolean
using_ntp
)
{
CcDateTimePanelPrivate
*
priv
=
panel
->
priv
;
gtk_widget_set_sensitive
(
W
(
"table1"
),
!
using_ntp
);
gtk_widget_set_sensitive
(
W
(
"table2"
),
!
using_ntp
);
}
static
void
month_year_changed
(
GtkWidget
*
widget
,
CcDateTimePanel
*
panel
)
...
...
@@ -592,6 +617,14 @@ change_time (GtkButton *button,
update_time
(
panel
);
}
static
void
change_ntp
(
GObject
*
gobject
,
GParamSpec
*
pspec
,
gpointer
user_data
)
{
update_widget_state_for_ntp
(
user_data
,
gtk_switch_get_active
(
GTK_SWITCH
(
gobject
)));
}
static
void
cc_date_time_panel_init
(
CcDateTimePanel
*
self
)
{
...
...
@@ -606,6 +639,7 @@ cc_date_time_panel_init (CcDateTimePanel *self)
GtkTreeModelFilter
*
city_modelfilter
;
GtkTreeModelSort
*
city_modelsort
;
guint
i
,
num_days
;
gboolean
using_ntp
;
int
ret
;
priv
=
self
->
priv
=
DATE_TIME_PANEL_PRIVATE
(
self
);
...
...
@@ -623,11 +657,18 @@ cc_date_time_panel_init (CcDateTimePanel *self)
return
;
}
/* set up network time button */
using_ntp
=
get_using_ntp
();
gtk_switch_set_active
(
GTK_SWITCH
(
W
(
"network_time_switch"
)),
using_ntp
);
update_widget_state_for_ntp
(
self
,
using_ntp
);
g_signal_connect
(
W
(
"network_time_switch"
),
"notify::active"
,
G_CALLBACK
(
change_ntp
),
self
);
/* set up time editing widgets */
for
(
i
=
0
;
i
<
G_N_ELEMENTS
(
buttons
);
i
++
)
{
g_signal_connect
(
W
(
buttons
[
i
]),
"clicked"
,
G_CALLBACK
(
change_time
),
self
);
g_signal_connect
(
W
(
buttons
[
i
]),
"clicked"
,
G_CALLBACK
(
change_time
),
self
);
}
/* set up date editing widgets */
...
...
panels/datetime/datetime.ui
View file @
de270ce6
...
...
@@ -13,7 +13,40 @@
<child>
<object
class=
"GtkVBox"
id=
"hbox"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"orientation"
>
vertical
</property>
<child>
<object
class=
"GtkHBox"
id=
"hbox2"
>
<property
name=
"visible"
>
True
</property>
<child>
<placeholder/>
</child>
<child>
<object
class=
"GtkLabel"
id=
"label3"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"xalign"
>
1
</property>
<property
name=
"label"
translatable=
"yes"
>
Network Time
</property>
</object>
<packing>
<property
name=
"position"
>
1
</property>
</packing>
</child>
<child>
<object
class=
"GtkSwitch"
id=
"network_time_switch"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"receives_default"
>
True
</property>
</object>
<packing>
<property
name=
"position"
>
2
</property>
<property
name=
"expand"
>
False
</property>
</packing>
</child>
</object>
<packing>
<property
name=
"position"
>
0
</property>
<property
name=
"padding"
>
6
</property>
</packing>
</child>
<child>
<object
class=
"GtkHBox"
id=
"vbox"
>
<property
name=
"visible"
>
True
</property>
...
...
@@ -109,18 +142,6 @@
<object
class=
"GtkVBox"
id=
"vbox4"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"orientation"
>
vertical
</property>
<child>
<object
class=
"GtkCheckButton"
id=
"check_auto_update"
>
<property
name=
"label"
translatable=
"yes"
>
Set time automatically
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"receives_default"
>
False
</property>
<property
name=
"draw_indicator"
>
True
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
<object
class=
"GtkAlignment"
id=
"alignment2"
>
<property
name=
"visible"
>
True
</property>
...
...
@@ -314,7 +335,7 @@
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"padding"
>
12
</property>
<property
name=
"position"
>
1
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
...
...
@@ -328,7 +349,7 @@
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"position"
>
3
</property>
<property
name=
"position"
>
2
</property>
</packing>
</child>
<child>
...
...
@@ -342,7 +363,7 @@
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"position"
>
4
</property>
<property
name=
"position"
>
3
</property>
</packing>
</child>
<child>
...
...
@@ -391,7 +412,7 @@
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"padding"
>
12
</property>
<property
name=
"position"
>
2
</property>
<property
name=
"position"
>
1
</property>
</packing>
</child>
</object>
...
...
@@ -402,7 +423,7 @@
</child>
</object>
<packing>
<property
name=
"position"
>
0
</property>
<property
name=
"position"
>
1
</property>
</packing>
</child>
<child>
...
...
@@ -426,7 +447,7 @@
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"position"
>
1
</property>
<property
name=
"position"
>
2
</property>
</packing>
</child>
</object>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment