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
| Fichier attaché | Taille |
|---|---|
| desktop-gadget.php_.txt | 10.05 Ko |
Commentaires récents
il y a 47 semaines 3 jours
il y a 48 semaines 2 jours
il y a 48 semaines 6 jours
il y a 51 semaines 2 jours
il y a 1 an 19 semaines
il y a 1 an 23 semaines
il y a 1 an 27 semaines
il y a 1 an 27 semaines
il y a 1 an 27 semaines
il y a 1 an 44 semaines