Files
yellownotes/main.cpp
2025-11-27 09:43:32 +01:00

71 lines
1.4 KiB
C++

#include <iostream>
#include "gtkloader.h"
extern "C" {
#include "gtk-imports.h"
}
#include "yellownotes.h"
#include "info_over_me.h"
SIGNAL(YellowNotes, on_tray_activate, popupTrayMenu)
static void activate (GtkApplication* app, gpointer user_data)
{
GtkWidget *window;
YellowNotes *notes = YELLOWNOTES(user_data);
std::string img_file = notes->imageFile("yellownotes");
GtkStatusIcon *tray = gtk_status_icon_new_from_file(img_file.c_str());
g_signal_connect(tray, "activate", on_tray_activate, notes);
}
static int runMain(int argc, char **argv);
#ifdef _WIN32
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
return runMain(__argc, __argv);
}
#else
int main(int argc, char **argv)
{
return runMain(argv, argv);
}
#endif
int runMain(int argc, char **argv)
{
GtkLoader l;
InfoOverMe w;
srand(time(NULL)); // seed with current time
std::string my_path = w.containingFolder();
try {
l.loadGtk();
} catch(std::string msg) {
std::cerr << msg << std::endl;
}
GtkApplication *app;
int status;
app = gtk_application_new("org.gtk.example", G_APPLICATION_FLAGS_NONE);
YellowNotes notes(app);
g_signal_connect (app, "activate", activate, &notes);
status = g_application_run(app, argc, argv);
notes.loadNotes();
gtk_main();
g_object_unref (app);
return status;
}