Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tray
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
tray
Commits
3bfe7aa5
Commit
3bfe7aa5
authored
Jan 09, 2017
by
Serge A. Zaitsev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed init status on macos, moved tray icon paths to #ifdef block
parent
7911e64b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
example.c
example.c
+15
-10
tray.h
tray.h
+1
-1
No files found.
example.c
View file @
3bfe7aa5
...
...
@@ -3,6 +3,17 @@
#include "tray.h"
#if TRAY_APPINDICATOR
#define TRAY_ICON1 "indicator-messages"
#define TRAY_ICON2 "indicator-messages-new"
#elif TRAY_APPKIT
#define TRAY_ICON1 "icon.png"
#define TRAY_ICON2 "icon.png"
#elif TRAY_WINAPI
#define TRAY_ICON1 "icon.ico"
#define TRAY_ICON2 "icon.ico"
#endif
static
struct
tray
tray
;
static
void
toggle_cb
(
struct
tray_menu
*
item
)
{
...
...
@@ -13,10 +24,10 @@ static void toggle_cb(struct tray_menu *item) {
static
void
hello_cb
(
struct
tray_menu
*
item
)
{
printf
(
"hello cb
\n
"
);
if
(
strcmp
(
tray
.
icon
,
"indicator-messages"
)
==
0
)
{
tray
.
icon
=
"indicator-messages-new"
;
if
(
strcmp
(
tray
.
icon
,
TRAY_ICON1
)
==
0
)
{
tray
.
icon
=
TRAY_ICON2
;
}
else
{
tray
.
icon
=
"indicator-messages"
;
tray
.
icon
=
TRAY_ICON1
;
}
tray_update
(
&
tray
);
}
...
...
@@ -27,6 +38,7 @@ static void quit_cb(struct tray_menu *item) {
}
static
struct
tray
tray
=
{
.
icon
=
TRAY_ICON1
,
.
menu
=
(
struct
tray_menu
[]){{
"Hello"
,
0
,
0
,
hello_cb
,
NULL
},
{
"Checked"
,
0
,
1
,
toggle_cb
,
NULL
},
{
"Disabled"
,
1
,
0
,
NULL
,
NULL
},
...
...
@@ -36,13 +48,6 @@ static struct tray tray = {
};
int
main
(
int
argc
,
char
*
argv
[])
{
#if TRAY_APPINDICATOR
tray
.
icon
=
"indicator-messages-new"
;
#elif TRAY_COCOA
tray
.
icon
=
"icon.png"
;
#elif TRAY_WINAPI
tray
.
icon
=
"icon.ico"
;
#endif
if
(
tray_init
(
&
tray
)
<
0
)
{
printf
(
"failed to create tray
\n
"
);
return
1
;
...
...
tray.h
View file @
3bfe7aa5
...
...
@@ -108,7 +108,7 @@ static int tray_init(struct tray *tray) {
tray_update
(
tray
);
[
NSApp
activateIgnoringOtherApps
:
YES
];
return
-
1
;
return
0
;
}
static
int
tray_loop
(
int
blocking
)
{
...
...
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