Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xfce4-screensaver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Apps
xfce4-screensaver
Commits
ce4d1059
Commit
ce4d1059
authored
11 years ago
by
Stefano Karapetsas
Browse files
Options
Downloads
Patches
Plain Diff
Show date and time in lock dialog
Closes
#18
https://github.com/mate-desktop/mate-screensaver/issues/18
parent
d5b35083
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
configure.ac
+1
-1
1 addition, 1 deletion
configure.ac
data/lock-dialog-default.ui
+60
-0
60 additions, 0 deletions
data/lock-dialog-default.ui
src/gs-lock-plug.c
+65
-0
65 additions, 0 deletions
src/gs-lock-plug.c
with
126 additions
and
1 deletion
configure.ac
+
1
−
1
View file @
ce4d1059
...
...
@@ -45,7 +45,7 @@ GLIB_GSETTINGS
# Dependencies
DBUS_REQUIRED_VERSION=0.30
GLIB_REQUIRED_VERSION=2.
15
.0
GLIB_REQUIRED_VERSION=2.
26
.0
X11_REQUIRED_VERSION=1.0
LIBMATE_MENU_REQUIRED_VERSION=1.5.0
MATE_DESKTOP_REQUIRED_VERSION=1.7.1
...
...
This diff is collapsed.
Click to expand it.
data/lock-dialog-default.ui
+
60
−
0
View file @
ce4d1059
...
...
@@ -48,6 +48,66 @@
<property
name=
"visible"
>
True
</property>
<property
name=
"homogeneous"
>
False
</property>
<property
name=
"spacing"
>
12
</property>
<child>
<object
class=
"GtkVBox"
id=
"vbox4"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"homogeneous"
>
False
</property>
<property
name=
"spacing"
>
0
</property>
<child>
<object
class=
"GtkLabel"
id=
"auth-time-label"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
<
span size="xx-large" weight="ultrabold"
>
%s
<
/span
>
</property>
<property
name=
"use_underline"
>
False
</property>
<property
name=
"use_markup"
>
True
</property>
<property
name=
"justify"
>
GTK_JUSTIFY_LEFT
</property>
<property
name=
"wrap"
>
False
</property>
<property
name=
"selectable"
>
False
</property>
<property
name=
"xalign"
>
0.5
</property>
<property
name=
"yalign"
>
0.5
</property>
<property
name=
"xpad"
>
0
</property>
<property
name=
"ypad"
>
0
</property>
<property
name=
"ellipsize"
>
PANGO_ELLIPSIZE_NONE
</property>
<property
name=
"width_chars"
>
-1
</property>
<property
name=
"single_line_mode"
>
False
</property>
<property
name=
"angle"
>
0
</property>
</object>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
</packing>
</child>
<child>
<object
class=
"GtkLabel"
id=
"auth-date-label"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
<
span size="large"
>
%s
<
/span
>
</property>
<property
name=
"use_underline"
>
False
</property>
<property
name=
"use_markup"
>
True
</property>
<property
name=
"justify"
>
GTK_JUSTIFY_LEFT
</property>
<property
name=
"wrap"
>
False
</property>
<property
name=
"selectable"
>
False
</property>
<property
name=
"xalign"
>
0.5
</property>
<property
name=
"yalign"
>
0.5
</property>
<property
name=
"xpad"
>
0
</property>
<property
name=
"ypad"
>
0
</property>
<property
name=
"ellipsize"
>
PANGO_ELLIPSIZE_NONE
</property>
<property
name=
"width_chars"
>
-1
</property>
<property
name=
"single_line_mode"
>
False
</property>
<property
name=
"angle"
>
0
</property>
</object>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
</packing>
</child>
</object>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
True
</property>
<property
name=
"fill"
>
True
</property>
</packing>
</child>
<child>
<object
class=
"GtkImage"
id=
"auth-face-image"
>
<property
name=
"visible"
>
True
</property>
...
...
This diff is collapsed.
Click to expand it.
src/gs-lock-plug.c
+
65
−
0
View file @
ce4d1059
...
...
@@ -93,6 +93,8 @@ struct GSLockPlugPrivate
GtkWidget
*
notebook
;
GtkWidget
*
auth_face_image
;
GtkWidget
*
auth_time_label
;
GtkWidget
*
auth_date_label
;
GtkWidget
*
auth_realname_label
;
GtkWidget
*
auth_username_label
;
GtkWidget
*
auth_prompt_label
;
...
...
@@ -124,6 +126,7 @@ struct GSLockPlugPrivate
guint
timeout
;
guint
datetime_timeout_id
;
guint
cancel_timeout_id
;
guint
auth_check_idle_id
;
guint
response_idle_id
;
...
...
@@ -288,6 +291,35 @@ set_status_text (GSLockPlug *plug,
}
}
static
void
date_time_update
(
GSLockPlug
*
plug
)
{
GDateTime
*
datetime
;
gchar
*
time
;
gchar
*
date
;
gchar
*
str
;
datetime
=
g_date_time_new_now_local
();
/* Translators: Time format, see https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format */
time
=
g_date_time_format
(
datetime
,
_
(
"%l:%M %p"
));
/* Translators: Date format, see https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format */
date
=
g_date_time_format
(
datetime
,
_
(
"%A, %B %e"
));
str
=
g_strdup_printf
(
"<span size=
\"
xx-large
\"
weight=
\"
ultrabold
\"
>%s</span>"
,
time
);
gtk_label_set_text
(
GTK_LABEL
(
plug
->
priv
->
auth_time_label
),
str
);
gtk_label_set_use_markup
(
GTK_LABEL
(
plug
->
priv
->
auth_time_label
),
TRUE
);
g_free
(
str
);
str
=
g_strdup_printf
(
"<span size=
\"
large
\"
>%s</span>"
,
date
);
gtk_label_set_markup
(
GTK_LABEL
(
plug
->
priv
->
auth_date_label
),
str
);
gtk_label_set_use_markup
(
GTK_LABEL
(
plug
->
priv
->
auth_date_label
),
TRUE
);
g_free
(
str
);
g_free
(
time
);
g_free
(
date
);
g_date_time_unref
(
datetime
);
}
void
gs_lock_plug_set_sensitive
(
GSLockPlug
*
plug
,
gboolean
sensitive
)
...
...
@@ -298,6 +330,16 @@ gs_lock_plug_set_sensitive (GSLockPlug *plug,
gtk_widget_set_sensitive
(
plug
->
priv
->
auth_action_area
,
sensitive
);
}
static
void
remove_datetime_timeout
(
GSLockPlug
*
plug
)
{
if
(
plug
->
priv
->
datetime_timeout_id
>
0
)
{
g_source_remove
(
plug
->
priv
->
datetime_timeout_id
);
plug
->
priv
->
datetime_timeout_id
=
0
;
}
}
static
void
remove_cancel_timeout
(
GSLockPlug
*
plug
)
{
...
...
@@ -1898,6 +1940,23 @@ create_page_one (GSLockPlug *plug)
vbox
=
gtk_vbox_new
(
FALSE
,
12
);
gtk_container_add
(
GTK_CONTAINER
(
align
),
vbox
);
vbox2
=
gtk_vbox_new
(
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
vbox2
,
FALSE
,
FALSE
,
0
);
str
=
g_strdup
(
"<span size=
\"
xx-large
\"
weight=
\"
ultrabold
\"
>%s</span>"
);
plug
->
priv
->
auth_time_label
=
gtk_label_new
(
str
);
g_free
(
str
);
gtk_misc_set_alignment
(
GTK_MISC
(
plug
->
priv
->
auth_time_label
),
0
.
5
,
0
.
5
);
gtk_label_set_use_markup
(
GTK_LABEL
(
plug
->
priv
->
auth_time_label
),
TRUE
);
gtk_box_pack_start
(
GTK_BOX
(
vbox2
),
plug
->
priv
->
auth_time_label
,
FALSE
,
FALSE
,
0
);
str
=
g_strdup
(
"<span size=
\"
large
\"
>%s</span>"
);
plug
->
priv
->
auth_date_label
=
gtk_label_new
(
str
);
g_free
(
str
);
gtk_misc_set_alignment
(
GTK_MISC
(
plug
->
priv
->
auth_date_label
),
0
.
5
,
0
.
5
);
gtk_label_set_use_markup
(
GTK_LABEL
(
plug
->
priv
->
auth_date_label
),
TRUE
);
gtk_box_pack_start
(
GTK_BOX
(
vbox2
),
plug
->
priv
->
auth_date_label
,
FALSE
,
FALSE
,
0
);
plug
->
priv
->
auth_face_image
=
gtk_image_new
();
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
plug
->
priv
->
auth_face_image
,
TRUE
,
TRUE
,
0
);
gtk_misc_set_alignment
(
GTK_MISC
(
plug
->
priv
->
auth_face_image
),
0
.
5
,
1
.
0
);
...
...
@@ -2063,6 +2122,8 @@ load_theme (GSLockPlug *plug)
plug
->
priv
->
auth_face_image
=
GTK_WIDGET
(
gtk_builder_get_object
(
builder
,
"auth-face-image"
));
plug
->
priv
->
auth_action_area
=
GTK_WIDGET
(
gtk_builder_get_object
(
builder
,
"auth-action-area"
));
plug
->
priv
->
auth_time_label
=
GTK_WIDGET
(
gtk_builder_get_object
(
builder
,
"auth-time-label"
));
plug
->
priv
->
auth_date_label
=
GTK_WIDGET
(
gtk_builder_get_object
(
builder
,
"auth-date-label"
));
plug
->
priv
->
auth_realname_label
=
GTK_WIDGET
(
gtk_builder_get_object
(
builder
,
"auth-realname-label"
));
plug
->
priv
->
auth_username_label
=
GTK_WIDGET
(
gtk_builder_get_object
(
builder
,
"auth-username-label"
));
plug
->
priv
->
auth_prompt_label
=
GTK_WIDGET
(
gtk_builder_get_object
(
builder
,
"auth-prompt-label"
));
...
...
@@ -2096,6 +2157,7 @@ load_theme (GSLockPlug *plug)
gtk_widget_set_no_show_all
(
plug
->
priv
->
auth_note_button
,
TRUE
);
}
date_time_update
(
plug
);
gtk_widget_show_all
(
lock_dialog
);
plug
->
priv
->
status_message_label
=
GTK_WIDGET
(
gtk_builder_get_object
(
builder
,
"status-message-label"
));
...
...
@@ -2158,8 +2220,10 @@ gs_lock_plug_init (GSLockPlug *plug)
create_page_one
(
plug
);
date_time_update
(
plug
);
gtk_widget_show_all
(
plug
->
priv
->
vbox
);
}
plug
->
priv
->
datetime_timeout_id
=
g_timeout_add_seconds
(
1
,
(
GSourceFunc
)
date_time_update
,
plug
);
if
(
plug
->
priv
->
note_text_view
!=
NULL
)
{
...
...
@@ -2324,6 +2388,7 @@ gs_lock_plug_finalize (GObject *object)
remove_response_idle
(
plug
);
remove_cancel_timeout
(
plug
);
remove_datetime_timeout
(
plug
);
#ifdef WITH_LIBNOTIFY
notify_uninit
();
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment