Powerapplet_tray-2.5 with low battery warnings and shutdown

Miscellaneous tools
Post Reply
Message
Author
User avatar
pemasu
Posts: 5474
Joined: Wed 08 Jul 2009, 12:26
Location: Finland

Powerapplet_tray-2.5 with low battery warnings and shutdown

#1 Post by pemasu »

Powerapplet_tray-2.5 with extra functions.

I decided to test if I could add to the existing C source code Xdialog and alarm sound warning when Battery is discharging at 10 % level and shutdown when battery level is 5 %.

I think that my small additions were succesful without C coding knowledge.

So...at 10 % discharging level you should get Xdialog warning of low battery and also short alarm sound. Those will repeat about once a minute. At 5 % discharging level the wmpoweroff will be executed and computer will shutdown.....with saving and with normal shutdown process.

I needed alternative to the vattery-acpitool because it has not been reliable for me after several suspends to the ram and waking up. The Vattery tray app has been there but the certain battery level operations has not been performed.
I decided to test something else....
Attachments
powerapplet_tray-2.5-with-extras.pet
(5.08 KiB) Downloaded 637 times
powerapplet_tray-2.5-extras-source.tar.gz
(8.71 KiB) Downloaded 491 times

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#2 Post by Argolance »

Bonjour,
Trying to compile Powerapplet_tray-2.5 using source files (including "compile" file) given above, I get these messages in console :shock: :cry: :

Code: Select all

/tmp/cczVuJ6I.o: In function `Update':
powerapplet_tray.c:(.text+0x4a4): undefined reference to `gtk_status_icon_get_blinking'
powerapplet_tray.c:(.text+0x4be): undefined reference to `gtk_status_icon_set_blinking'
powerapplet_tray.c:(.text+0x4ed): undefined reference to `gtk_status_icon_set_from_pixbuf'
powerapplet_tray.c:(.text+0x513): undefined reference to `gtk_status_icon_set_from_pixbuf'
powerapplet_tray.c:(.text+0x539): undefined reference to `gtk_status_icon_set_from_pixbuf'
powerapplet_tray.c:(.text+0x55f): undefined reference to `gtk_status_icon_set_from_pixbuf'
powerapplet_tray.c:(.text+0x585): undefined reference to `gtk_status_icon_set_from_pixbuf'
/tmp/cczVuJ6I.o:powerapplet_tray.c:(.text+0x5a1): more undefined references to `gtk_status_icon_set_from_pixbuf' follow
/tmp/cczVuJ6I.o: In function `Update':
powerapplet_tray.c:(.text+0x691): undefined reference to `gtk_status_icon_set_blinking'
powerapplet_tray.c:(.text+0x7d6): undefined reference to `gtk_status_icon_set_tooltip'
/tmp/cczVuJ6I.o: In function `create_tray_icon':
powerapplet_tray.c:(.text+0x839): undefined reference to `gtk_status_icon_new'
powerapplet_tray.c:(.text+0x858): undefined reference to `g_type_check_instance_cast'
powerapplet_tray.c:(.text+0x884): undefined reference to `g_signal_connect_data'
powerapplet_tray.c:(.text+0x89e): undefined reference to `g_type_check_instance_cast'
powerapplet_tray.c:(.text+0x8ca): undefined reference to `g_signal_connect_data'
powerapplet_tray.c:(.text+0x8d6): undefined reference to `gdk_pixbuf_new_from_xpm_data'
powerapplet_tray.c:(.text+0x8e7): undefined reference to `gdk_pixbuf_new_from_xpm_data'
powerapplet_tray.c:(.text+0x8f8): undefined reference to `gdk_pixbuf_new_from_xpm_data'
powerapplet_tray.c:(.text+0x909): undefined reference to `gdk_pixbuf_new_from_xpm_data'
powerapplet_tray.c:(.text+0x91a): undefined reference to `gdk_pixbuf_new_from_xpm_data'
/tmp/cczVuJ6I.o:powerapplet_tray.c:(.text+0x92b): more undefined references to `gdk_pixbuf_new_from_xpm_data' follow
/tmp/cczVuJ6I.o: In function `create_tray_icon':
powerapplet_tray.c:(.text+0x9be): undefined reference to `gtk_status_icon_set_from_pixbuf'
powerapplet_tray.c:(.text+0x9d3): undefined reference to `gtk_status_icon_set_tooltip'
powerapplet_tray.c:(.text+0x9e8): undefined reference to `gtk_status_icon_set_visible'
/tmp/cczVuJ6I.o: In function `main':
powerapplet_tray.c:(.text+0xc76): undefined reference to `gtk_init'
powerapplet_tray.c:(.text+0xc9c): undefined reference to `gtk_timeout_add'
powerapplet_tray.c:(.text+0xcad): undefined reference to `gtk_main'
collect2: ld returned 1 exit status
strip: 'powerapplet_tray': No such file
Script completed hit RETURN to close window.
What's wrong?
Thanks.
Cordialement.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#3 Post by Argolance »

Bonsoir,
I finally found what's wrong!
The "compile" file must be modified this way:

Code: Select all

gcc -Wl,--no-as-needed `pkg-config --cflags --libs gtk+-2.0` powerapplet_tray.c -o powerapplet_tray
instead of:

Code: Select all

gcc `pkg-config --cflags --libs gtk+-2.0` powerapplet_tray.c -o powerapplet_tray
Cordialement.

Post Reply