fixes to gtk tray program

This commit is contained in:
Jaromil 2013-09-08 16:40:29 +02:00
parent 8f25001f57
commit 40832cc01d
2 changed files with 9 additions and 12 deletions

View File

@ -1,7 +1,7 @@
all: all:
gcc -I. `pkg-config --cflags libnotify gtk+-2.0` $(CFLAGS) -c tomb-gtk-tray.c gcc -I. `pkg-config --cflags libnotify gtk+-3.0` $(CFLAGS) -c tomb-gtk-tray.c
gcc tomb-gtk-tray.o `pkg-config --libs libnotify gtk+-2.0` -o tomb-gtk-tray gcc tomb-gtk-tray.o `pkg-config --libs libnotify gtk+-3.0` -o tomb-gtk-tray
clean: clean:
rm *.o tomb-gtk-tray rm *.o tomb-gtk-tray

View File

@ -64,23 +64,20 @@ int main(int argc, char **argv) {
char tomb_file[512]; char tomb_file[512];
char tooltip[256]; char tooltip[256];
gtk_set_locale(); // gtk_set_locale();
gtk_init(&argc, &argv); gtk_init(&argc, &argv);
// get the information from commandline // get the information from commandline
if(argc<2) { if(argc<2) {
fprintf(stderr, "error: need at least one argument, the path to a dm-crypt device mapper\n"); fprintf(stderr, "error: need at least one argument, the name of an open tomb.\n");
exit(1); exit(1);
} else { } else {
// TODO: check if mapper really exists // TODO: check if mapper really exists
snprintf(mapper,255, "%s", argv[1]); snprintf(mapper,255, "%s", argv[1]);
} }
if(argc<3) sprintf(filename, "unknown"); snprintf(filename,255, "%s", argv[1]);
else snprintf(filename,255, "%s", argv[2]); snprintf(mountpoint,255, "/media/%s.tomb", argv[1]);
if(argc<4) sprintf(mountpoint,"unknown");
else snprintf(mountpoint,255, "%s", argv[3]);
// libnotify // libnotify
notify_init("Tomb"); notify_init("Tomb");
@ -91,7 +88,7 @@ int main(int argc, char **argv) {
// gtk_status_icon_set_name(status_tomb, "tomb"); // gtk_status_icon_set_name(status_tomb, "tomb");
gtk_status_icon_set_title(status_tomb, "Tomb"); gtk_status_icon_set_title(status_tomb, "Tomb");
snprintf(tooltip,255,"%s",mountpoint); snprintf(tooltip,255,"%s",filename);
gtk_status_icon_set_tooltip_text (status_tomb, tooltip); gtk_status_icon_set_tooltip_text (status_tomb, tooltip);
// LEFT click menu // LEFT click menu
@ -181,7 +178,7 @@ gboolean cb_view(GtkWidget *w, GdkEvent *e) {
map[c] = buf; map[c] = buf;
close(pipefd[0]); close(pipefd[0]);
map[c] = 0; map[c] = 0;
execlp("tomb-open", "tomb-open", map, (char*)NULL); execlp("xdg-open", "xdg-open", map, (char*)NULL);
_exit(1); _exit(1);
} }
close(pipefd[0]); // close unused read end close(pipefd[0]); // close unused read end
@ -293,7 +290,7 @@ gboolean cb_about(GtkWidget *w, GdkEvent *e) {
"Asbesto Molesto - http://freaknet.org/asbesto", "Asbesto Molesto - http://freaknet.org/asbesto",
NULL}; NULL};
GtkWidget *dialog = gtk_about_dialog_new(); GtkWidget *dialog = gtk_about_dialog_new();
gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(dialog), "Tomb GTK Tray"); // gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(dialog), "Tomb GTK Tray");
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), "1.4"); gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), "1.4");
gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog), gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog),
"(C)2007-2013 Jaromil @ Dyne.org Foundation"); "(C)2007-2013 Jaromil @ Dyne.org Foundation");