Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
TimeManager
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Schedules
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
linux-tools
TimeManager
Commits
a680b7c0
Commit
a680b7c0
authored
Aug 13, 2019
by
Carit Zhu
🎱
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete timemanager.ui and adjust the layout for tool
parent
5748a635
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
388 deletions
+39
-388
main.c
main.c
+39
-10
timemanager.ui
timemanager.ui
+0
-378
No files found.
main.c
View file @
a680b7c0
...
...
@@ -172,6 +172,7 @@ static void timezone_init(GtkWidget *window_vbox) {
GtkCellRenderer
*
cell
=
NULL
;
/* Timezone */
GtkWidget
*
align_timezone
=
gtk_alignment_new
(
0
.
5
,
0
.
5
,
0
,
0
);;
GtkWidget
*
timezone_hbox
=
gtk_hbox_new
(
TRUE
,
2
);
GtkWidget
*
label_timezone
=
gtk_label_new
(
"TimeZone:"
);
...
...
@@ -180,7 +181,8 @@ static void timezone_init(GtkWidget *window_vbox) {
combo_timezone
=
gtk_combo_box_new
();
gtk_box_pack_start
(
GTK_BOX
(
timezone_hbox
),
combo_timezone
,
FALSE
,
FALSE
,
3
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
timezone_hbox
),
FALSE
,
FALSE
,
5
);
gtk_container_add
(
GTK_CONTAINER
(
align_timezone
),
timezone_hbox
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
align_timezone
),
FALSE
,
FALSE
,
5
);
FILE
*
fp
=
popen
(
"timedatectl list-timezones"
,
"r"
);
...
...
@@ -273,11 +275,20 @@ static void date_init(GtkEntry *entry_date, GtkEntry *entry_hour, GtkEntry *entr
}
static
int
date_widget_init
(
GtkWidget
*
window_vbox
)
{
GtkWidget
*
align_date
;
GtkWidget
*
align_hour
;
GtkWidget
*
align_minute
;
GtkWidget
*
align_second
;
GtkWidget
*
combo_hour
;
GtkWidget
*
combo_minute
;
GtkWidget
*
combo_second
;
gchar
text
[
3
]
=
{
0
};
align_date
=
gtk_alignment_new
(
0
.
5
,
0
.
5
,
0
,
0
);
align_hour
=
gtk_alignment_new
(
0
.
5
,
0
.
5
,
0
,
0
);
align_minute
=
gtk_alignment_new
(
0
.
5
,
0
.
5
,
0
,
0
);
align_second
=
gtk_alignment_new
(
0
.
5
,
0
.
5
,
0
,
0
);
/* Date */
GtkWidget
*
date_hbox
=
gtk_hbox_new
(
TRUE
,
2
);
...
...
@@ -291,7 +302,8 @@ static int date_widget_init(GtkWidget *window_vbox) {
}
gtk_box_pack_start
(
GTK_BOX
(
date_hbox
),
entry_date
,
FALSE
,
FALSE
,
3
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
date_hbox
),
FALSE
,
FALSE
,
5
);
gtk_container_add
(
GTK_CONTAINER
(
align_date
),
date_hbox
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
align_date
),
FALSE
,
FALSE
,
5
);
/* Time */
GtkWidget
*
hour_hbox
=
gtk_hbox_new
(
TRUE
,
2
);
...
...
@@ -314,13 +326,15 @@ static int date_widget_init(GtkWidget *window_vbox) {
entry_hour
=
(
GTK_BIN
(
combo_hour
)
->
child
);
gtk_box_pack_start
(
GTK_BOX
(
hour_hbox
),
combo_hour
,
FALSE
,
FALSE
,
3
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
hour_hbox
),
FALSE
,
FALSE
,
5
);
gtk_container_add
(
GTK_CONTAINER
(
align_hour
),
hour_hbox
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
align_hour
),
FALSE
,
FALSE
,
5
);
/* Minute */
GtkWidget
*
label_blank1
=
gtk_label_new
(
""
);
gtk_box_pack_start
(
GTK_BOX
(
minute_hbox
),
label_blank1
,
FALSE
,
FALSE
,
3
);
GtkWidget
*
label_minute
=
gtk_label_new
(
"M:"
);
gtk_label_set_justify
(
GTK_LABEL
(
label_minute
),
GTK_JUSTIFY_RIGHT
);
gtk_box_pack_start
(
GTK_BOX
(
minute_hbox
),
label_minute
,
FALSE
,
FALSE
,
3
);
combo_minute
=
gtk_combo_box_text_new_with_entry
();
...
...
@@ -332,13 +346,15 @@ static int date_widget_init(GtkWidget *window_vbox) {
entry_minute
=
(
GTK_BIN
(
combo_minute
)
->
child
);
gtk_box_pack_start
(
GTK_BOX
(
minute_hbox
),
combo_minute
,
FALSE
,
FALSE
,
3
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
minute_hbox
),
FALSE
,
FALSE
,
5
);
gtk_container_add
(
GTK_CONTAINER
(
align_minute
),
minute_hbox
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
align_minute
),
FALSE
,
FALSE
,
5
);
/* Second */
GtkWidget
*
label_blank2
=
gtk_label_new
(
""
);
gtk_box_pack_start
(
GTK_BOX
(
second_hbox
),
label_blank2
,
FALSE
,
FALSE
,
3
);
GtkWidget
*
label_second
=
gtk_label_new
(
"S:"
);
gtk_label_set_justify
(
GTK_LABEL
(
label_second
),
GTK_JUSTIFY_RIGHT
);
gtk_box_pack_start
(
GTK_BOX
(
second_hbox
),
label_second
,
FALSE
,
FALSE
,
3
);
combo_second
=
gtk_combo_box_text_new_with_entry
();
...
...
@@ -350,7 +366,8 @@ static int date_widget_init(GtkWidget *window_vbox) {
entry_second
=
(
GTK_BIN
(
combo_second
)
->
child
);
gtk_box_pack_start
(
GTK_BOX
(
second_hbox
),
combo_second
,
FALSE
,
FALSE
,
3
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
second_hbox
),
FALSE
,
FALSE
,
5
);
gtk_container_add
(
GTK_CONTAINER
(
align_second
),
second_hbox
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
align_second
),
FALSE
,
FALSE
,
5
);
date_init
(
GTK_ENTRY
(
entry_date
),
GTK_ENTRY
(
entry_hour
),
GTK_ENTRY
(
entry_minute
),
GTK_ENTRY
(
entry_second
));
...
...
@@ -374,10 +391,12 @@ static int date_widget_init(GtkWidget *window_vbox) {
int
main
(
int
argc
,
char
**
argv
)
{
GtkWidget
*
window
;
GtkWidget
*
align_window
;
gtk_init
(
&
argc
,
&
argv
);
window
=
gtk_window_new
(
GTK_WINDOW_TOPLEVEL
);
align_window
=
gtk_alignment_new
(
0
.
5
,
0
.
5
,
0
,
0
);
gtk_window_set_title
(
GTK_WINDOW
(
window
),
"Date & Time"
);
gtk_window_set_position
(
GTK_WINDOW
(
window
),
GTK_WIN_POS_CENTER
);
...
...
@@ -385,24 +404,34 @@ int main(int argc, char **argv) {
/* Create vbox for whole style(vertical) */
GtkWidget
*
window_vbox
=
gtk_vbox_new
(
TRUE
,
2
);
GtkWidget
*
date_time_vbox
=
gtk_vbox_new
(
TRUE
,
2
);
/* Date */
date_widget_init
(
window
_vbox
);
date_widget_init
(
date_time
_vbox
);
/* Timezone */
get_time_date_status
();
timezone_init
(
window_vbox
);
timezone_init
(
date_time_vbox
);
gtk_container_add
(
GTK_CONTAINER
(
align_window
),
date_time_vbox
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
align_window
),
FALSE
,
FALSE
,
0
);
/* OK and Cancel */
GtkWidget
*
align_button
=
gtk_alignment_new
(
0
.
5
,
0
.
5
,
0
,
0
);
GtkWidget
*
button_hbox
=
gtk_hbox_new
(
TRUE
,
2
);
GtkWidget
*
button_ok
=
gtk_button_new_with_label
(
"Ok"
);
GtkWidget
*
button_cancel
=
gtk_button_new_with_label
(
"Cancel"
);
gtk_box_pack_start
(
GTK_BOX
(
button_hbox
),
button_ok
,
TRUE
,
TRUE
,
50
);
gtk_box_pack_start
(
GTK_BOX
(
button_hbox
),
button_cancel
,
TRUE
,
TRUE
,
50
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
button_hbox
),
FALSE
,
FALSE
,
5
);
gtk_widget_set_size_request
(
button_ok
,
120
,
60
);
gtk_widget_set_size_request
(
button_cancel
,
120
,
60
);
//gtk_widget_set_size_request(button_hbox, 240, 80);
gtk_box_pack_start
(
GTK_BOX
(
button_hbox
),
button_ok
,
FALSE
,
FALSE
,
50
);
gtk_box_pack_start
(
GTK_BOX
(
button_hbox
),
button_cancel
,
FALSE
,
FALSE
,
50
);
gtk_container_add
(
GTK_CONTAINER
(
align_button
),
button_hbox
);
gtk_box_pack_start
(
GTK_BOX
(
window_vbox
),
GTK_WIDGET
(
align_button
),
FALSE
,
FALSE
,
2
);
g_signal_connect
(
button_ok
,
GTK_EVENT_CLICKED
,
G_CALLBACK
(
button_handler
),
"ok"
);
g_signal_connect
(
button_cancel
,
GTK_EVENT_CLICKED
,
G_CALLBACK
(
button_handler
),
"cancel"
);
...
...
timemanager.ui
deleted
100644 → 0
View file @
5748a635
This diff is collapsed.
Click to expand it.
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