Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
thunar
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
Xfce
thunar
Commits
697e188d
Commit
697e188d
authored
2 years ago
by
Alexander Schwinn
Browse files
Options
Downloads
Patches
Plain Diff
Regression: Fix build with notifications disabled (Issue
#909
)
- Regression introduced by
d77eee4d
(Issue
#903
)
parent
3aa0e839
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#17758
passed
2 years ago
Stage: build
Stage: distcheck
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
thunar/thunar-notify.c
+61
-52
61 additions, 52 deletions
thunar/thunar-notify.c
with
61 additions
and
52 deletions
thunar/thunar-notify.c
+
61
−
52
View file @
697e188d
...
...
@@ -38,7 +38,14 @@
#ifdef HAVE_LIBNOTIFY
static
gboolean
thunar_notify_initted
=
FALSE
;
static
void
thunar_notify_undo_or_redo
(
ThunarJobOperation
*
operation
,
gboolean
undo
);
static
gboolean
thunar_notify_init
(
void
);
static
gchar
*
thunar_get_device_icon
(
ThunarDevice
*
device
);
static
void
thunar_notify_show
(
ThunarDevice
*
device
,
const
gchar
*
summary
,
const
gchar
*
message
);
static
gboolean
thunar_notify_device_readonly
(
ThunarDevice
*
device
);
static
void
thunar_notify_undo_or_redo
(
ThunarJobOperation
*
operation
,
gboolean
undo
);
...
...
@@ -160,8 +167,58 @@ thunar_notify_device_readonly (ThunarDevice *device)
return
readonly
;
}
static
void
thunar_notify_undo_or_redo
(
ThunarJobOperation
*
operation
,
gboolean
undo
)
{
NotifyNotification
*
notification
;
gchar
*
summary
;
gchar
*
message
;
gchar
*
icon_name
;
if
(
!
thunar_notify_init
())
return
;
/* prepare the notification args according to whether it's an undo operation
* or not, in which case it must be a redo operation */
if
(
undo
)
{
summary
=
g_strdup
(
_
(
"Undo performed"
));
message
=
g_strdup_printf
(
_
(
"%s operation was undone"
),
thunar_job_operation_get_kind_nick
(
operation
));
icon_name
=
g_strdup
(
"edit-undo-symbolic"
);
}
else
{
summary
=
g_strdup
(
_
(
"Redo performed"
));
message
=
g_strdup_printf
(
_
(
"%s operation was redone"
),
thunar_job_operation_get_kind_nick
(
operation
));
icon_name
=
g_strdup
(
"edit-redo-symbolic"
);
}
/* create notification */
#ifdef NOTIFY_CHECK_VERSION
#if NOTIFY_CHECK_VERSION (0, 7, 0)
notification
=
notify_notification_new
(
summary
,
message
,
icon_name
);
#else
notification
=
notify_notification_new
(
summary
,
message
,
icon_name
,
NULL
);
#endif
#else
notification
=
notify_notification_new
(
summary
,
message
,
icon_name
,
NULL
);
#endif
notify_notification_set_urgency
(
notification
,
NOTIFY_URGENCY_LOW
);
notify_notification_set_timeout
(
notification
,
NOTIFY_EXPIRES_DEFAULT
);
notify_notification_show
(
notification
,
NULL
);
g_free
(
summary
);
g_free
(
message
);
g_free
(
icon_name
);
}
#endif
/* HAVE_LIBNOTIFY */
void
...
...
@@ -307,66 +364,18 @@ thunar_notify_finish (ThunarDevice *device)
void
thunar_notify_undo
(
ThunarJobOperation
*
operation
)
{
if
(
!
thunar_notify_init
())
return
;
#ifdef HAVE_LIBNOTIFY
thunar_notify_undo_or_redo
(
operation
,
TRUE
);
#endif
}
void
thunar_notify_redo
(
ThunarJobOperation
*
operation
)
{
thunar_notify_undo_or_redo
(
operation
,
FALSE
);
}
static
void
thunar_notify_undo_or_redo
(
ThunarJobOperation
*
operation
,
gboolean
undo
)
{
#ifdef HAVE_LIBNOTIFY
NotifyNotification
*
notification
;
gchar
*
summary
;
gchar
*
message
;
gchar
*
icon_name
;
/* prepare the notification args according to whether it's an undo operation
* or not, in which case it must be a redo operation */
if
(
undo
)
{
summary
=
g_strdup
(
_
(
"Undo performed"
));
message
=
g_strdup_printf
(
_
(
"%s operation was undone"
),
thunar_job_operation_get_kind_nick
(
operation
));
icon_name
=
g_strdup
(
"edit-undo-symbolic"
);
}
else
{
summary
=
g_strdup
(
_
(
"Redo performed"
));
message
=
g_strdup_printf
(
_
(
"%s operation was redone"
),
thunar_job_operation_get_kind_nick
(
operation
));
icon_name
=
g_strdup
(
"edit-redo-symbolic"
);
}
/* create notification */
#ifdef NOTIFY_CHECK_VERSION
#if NOTIFY_CHECK_VERSION (0, 7, 0)
notification
=
notify_notification_new
(
summary
,
message
,
icon_name
);
#else
notification
=
notify_notification_new
(
summary
,
message
,
icon_name
,
NULL
);
#endif
#else
notification
=
notify_notification_new
(
summary
,
message
,
icon_name
,
NULL
);
#endif
notify_notification_set_urgency
(
notification
,
NOTIFY_URGENCY_LOW
);
notify_notification_set_timeout
(
notification
,
NOTIFY_EXPIRES_DEFAULT
);
notify_notification_show
(
notification
,
NULL
);
g_free
(
summary
);
g_free
(
message
);
g_free
(
icon_name
);
thunar_notify_undo_or_redo
(
operation
,
FALSE
);
#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