forked from Yadciel/c_tray
Correcting the issues on Linux target
This commit is contained in:
@@ -42,7 +42,7 @@ else()
|
||||
ADD_DEFINITIONS(${APPINDICATOR_CFLAGS})
|
||||
LINK_DIRECTORIES(${APPINDICATOR_LIBRARY_DIRS})
|
||||
add_compile_definitions(TRAY_APPINDICATOR=1)
|
||||
list(APPEND src ${CMAKE_CURRENT_SOURCE_DIR}/tray_windows.c)
|
||||
list(APPEND src ${CMAKE_CURRENT_SOURCE_DIR}/tray_linux.c)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <libappindicator/app-indicator.h>
|
||||
#include "tray.h"
|
||||
|
||||
#define TRAY_APPINDICATOR_ID "tray-id"
|
||||
|
||||
@@ -40,7 +41,7 @@ static GtkMenuShell *_tray_menu(struct tray_menu *m) {
|
||||
return menu;
|
||||
}
|
||||
|
||||
static int tray_init(struct tray *tray) {
|
||||
int tray_init(struct tray *tray) {
|
||||
if (gtk_init_check(0, NULL) == FALSE) {
|
||||
return -1;
|
||||
}
|
||||
@@ -51,17 +52,17 @@ static int tray_init(struct tray *tray) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tray_loop(int blocking) {
|
||||
int tray_loop(int blocking) {
|
||||
gtk_main_iteration_do(blocking);
|
||||
return loop_result;
|
||||
}
|
||||
|
||||
static void tray_update(struct tray *tray) {
|
||||
void tray_update(struct tray *tray) {
|
||||
app_indicator_set_icon(indicator, tray->icon);
|
||||
// GTK is all about reference counting, so previous menu should be destroyed
|
||||
// here
|
||||
app_indicator_set_menu(indicator, GTK_MENU(_tray_menu(tray->menu)));
|
||||
}
|
||||
|
||||
static void tray_exit() { loop_result = -1; }
|
||||
void tray_exit() { loop_result = -1; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user