3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "eggtrayicon.h"
24 char* playing[2] = {&buf[0], &buf[500]};
28 // this gets called regularly by gtk
30 ticker(GtkWidget *widget) {
34 if (widget->window == NULL) {
38 fd = fopen(TMP_FILE, "r");
42 len = fread(playing[playing_i], 1, 499, fd);
44 playing[playing_i][len] = 0;
46 if(strcmp(playing[playing_i], playing[1 - playing_i])) {
47 gtk_label_set_text(GTK_LABEL(widget), playing[playing_i]);
50 playing_i = 1 - playing_i;
52 // gtk_widget_queue_draw(widget);
58 main(int argc, char *argv[]) {
64 gtk_init(&argc, &argv);
67 label = gtk_label_new("initializing...");
68 egg = egg_tray_icon_new("what's this string do?");
69 // nest and display the widget
70 gtk_container_add(GTK_CONTAINER(egg), label);
71 gtk_widget_show_all(GTK_WIDGET(egg));
73 // initialize and start ticker
76 g_timeout_add(1000, (GSourceFunc) ticker, (gpointer) label);