Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
bitmask-vpn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vladimir KozLove
bitmask-vpn
Commits
c9751aa9
Unverified
Commit
c9751aa9
authored
6 years ago
by
meskio
Browse files
Options
Downloads
Patches
Plain Diff
[bug] let's not delete the icons until they are not used anymore
parent
44a63863
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vendor/github.com/getlantern/systray/systray_linux.c
+13
-6
13 additions, 6 deletions
vendor/github.com/getlantern/systray/systray_linux.c
with
13 additions
and
6 deletions
vendor/github.com/getlantern/systray/systray_linux.c
+
13
−
6
View file @
c9751aa9
...
...
@@ -8,6 +8,7 @@
static
AppIndicator
*
global_app_indicator
;
static
GtkWidget
*
global_tray_menu
=
NULL
;
static
GList
*
global_menu_items
=
NULL
;
static
char
temp_file_name
[
PATH_MAX
]
=
""
;
typedef
struct
{
GtkWidget
*
menu_item
;
...
...
@@ -35,10 +36,20 @@ int nativeLoop(void) {
return
0
;
}
void
_unlink_temp_file
()
{
if
(
strlen
(
temp_file_name
)
!=
0
)
{
int
ret
=
unlink
(
temp_file_name
);
if
(
ret
==
-
1
)
{
printf
(
"failed to remove temp icon file %s: %s
\n
"
,
temp_file_name
,
strerror
(
errno
));
}
temp_file_name
[
0
]
=
'\0'
;
}
}
// runs in main thread, should always return FALSE to prevent gtk to execute it again
gboolean
do_set_icon
(
gpointer
data
)
{
GBytes
*
bytes
=
(
GBytes
*
)
data
;
char
*
temp_file
_name
=
malloc
(
PATH_MAX
);
_unlink_
temp_file
(
);
strcpy
(
temp_file_name
,
"/tmp/systray_XXXXXX"
);
int
fd
=
mkstemp
(
temp_file_name
);
if
(
fd
==
-
1
)
{
...
...
@@ -55,11 +66,6 @@ gboolean do_set_icon(gpointer data) {
}
app_indicator_set_icon_full
(
global_app_indicator
,
temp_file_name
,
""
);
app_indicator_set_attention_icon_full
(
global_app_indicator
,
temp_file_name
,
""
);
int
ret
=
unlink
(
temp_file_name
);
if
(
ret
==
-
1
)
{
printf
(
"failed to remove temp icon file %s: %s
\n
"
,
temp_file_name
,
strerror
(
errno
));
}
g_bytes_unref
(
bytes
);
return
FALSE
;
}
...
...
@@ -147,6 +153,7 @@ gboolean do_show_menu_item(gpointer data) {
// runs in main thread, should always return FALSE to prevent gtk to execute it again
gboolean
do_quit
(
gpointer
data
)
{
_unlink_temp_file
();
// app indicator doesn't provide a way to remove it, hide it as a workaround
app_indicator_set_status
(
global_app_indicator
,
APP_INDICATOR_STATUS_PASSIVE
);
gtk_main_quit
();
...
...
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