The DesktopGadget is a small window moving around you desktop screen ; it's a container widget
and is able to contains usefull object for short information or notification.
DesktopGadget is :
The most interesting part of code is at the end and show you how it's very easy to add some gadgets :
<?php
# include some classes code before ...
# an example gadget (it's just a gtkWidget)
class ClockGadget extends GtkLabel{
protected $timeout_id;
protected $format;
public function __construct($format = 'd/m - H:i:s'){
parent::__construct();
$this->format=$format;
$this->timeout_id = Gtk::timeout_add(1000, array($this, 'on_timeout'));
$this->modify_font(new PangoFontDescription('Sans 7'));
$this->on_timeout();
}
public function on_timeout(){
$this->set_text(date($this->format));
return true;
}
}
$gadget = new DesktopGadget($title='Desktop Gadget');
$gadget->pack_start($clock = new ClockGadget());
Gtk::main();
?>You should have write acces to directory where this script is running to save gadget position.
source code is provided as a link below for free as LGPL licence ; also available here
| Anhang | Größe |
|---|---|
| desktop-gadget.php_.txt | 10.05 KB |
Neueste Kommentare
vor 47 Wochen 3 Tage
vor 48 Wochen 2 Tage
vor 48 Wochen 6 Tage
vor 51 Wochen 2 Tage
vor 1 Jahr 19 Wochen
vor 1 Jahr 23 Wochen
vor 1 Jahr 27 Wochen
vor 1 Jahr 27 Wochen
vor 1 Jahr 27 Wochen
vor 1 Jahr 44 Wochen