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
61943aa4
Commit
61943aa4
authored
7 years ago
by
Jesse Lawson
Committed by
GitHub
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete example.c
parent
b7fec21c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
93 deletions
+0
-93
example.c
example.c
+0
-93
No files found.
example.c
deleted
100644 → 0
View file @
b7fec21c
#include <stdio.h>
#include <string.h>
#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
)
{
printf
(
"toggle cb
\n
"
);
item
->
checked
=
!
item
->
checked
;
tray_update
(
&
tray
);
}
static
void
hello_cb
(
struct
tray_menu
*
item
)
{
(
void
)
item
;
printf
(
"hello cb
\n
"
);
if
(
strcmp
(
tray
.
icon
,
TRAY_ICON1
)
==
0
)
{
tray
.
icon
=
TRAY_ICON2
;
}
else
{
tray
.
icon
=
TRAY_ICON1
;
}
tray_update
(
&
tray
);
}
static
void
quit_cb
(
struct
tray_menu
*
item
)
{
(
void
)
item
;
printf
(
"quit cb
\n
"
);
tray_exit
();
}
static
void
submenu_cb
(
struct
tray_menu
*
item
)
{
(
void
)
item
;
printf
(
"submenu: clicked on %s
\n
"
,
item
->
text
);
tray_update
(
&
tray
);
}
// Test tray init
static
struct
tray
tray
=
{
.
icon
=
TRAY_ICON1
,
.
menu
=
(
struct
tray_menu
[]){
{.
text
=
"Hello"
,
.
cb
=
hello_cb
},
{.
text
=
"Checked"
,
.
checked
=
1
,
.
cb
=
toggle_cb
},
{.
text
=
"Disabled"
,
.
disabled
=
1
},
{.
text
=
"-"
},
{.
text
=
"SubMenu"
,
.
submenu
=
(
struct
tray_menu
[]){
{.
text
=
"FIRST"
,
.
checked
=
1
,
.
cb
=
submenu_cb
},
{.
text
=
"SECOND"
,
.
submenu
=
(
struct
tray_menu
[]){
{.
text
=
"THIRD"
,
.
submenu
=
(
struct
tray_menu
[]){
{.
text
=
"7"
,
.
cb
=
submenu_cb
},
{.
text
=
"-"
},
{.
text
=
"8"
,
.
cb
=
submenu_cb
},
{.
text
=
NULL
}}},
{.
text
=
"FOUR"
,
.
submenu
=
(
struct
tray_menu
[]){
{.
text
=
"5"
,
.
cb
=
submenu_cb
},
{.
text
=
"6"
,
.
cb
=
submenu_cb
},
{.
text
=
NULL
}}},
{.
text
=
NULL
}}},
{.
text
=
NULL
}}},
{.
text
=
"-"
},
{.
text
=
"Quit"
,
.
cb
=
quit_cb
},
{.
text
=
NULL
}},
};
int
main
()
{
if
(
tray_init
(
&
tray
)
<
0
)
{
printf
(
"failed to create tray
\n
"
);
return
1
;
}
while
(
tray_loop
(
1
)
==
0
)
{
printf
(
"iteration
\n
"
);
}
return
0
;
}
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