Snapshot
Background Dialog with fewer than 10 photos
Background Dialog with 10 or more photos
Background Color selection dialogOverview
The background applet is used to control the background color and image settings. It pulls in all the images cached by moblin-media and allows the user to scroll through them and set the background image with a single click. If the first entry: "Solid Color Background" is selected the background will be a single solid color instead of an image. This color is set by clicking the "Background Color" button and selecting one with the color picker dialog.
If the available images are less than ten in number, the images can be traversed simply via the moko finger scroller. If there are ten or more images, a quickjump scrollbar will appear on the right side of the dialog. This is helpful in quickly moving through large photo collections as the moko finger scroller can only move through about 10 per second. The first button will jump the list to the first photo, and the last button to the last.
Files Needed
- /usr/lib/moblin-applets/libhcpcommon.so
- all control panel applets need this
- /usr/lib/hildon-control-panel/background.so
- The applet library
- /usr/share/applications/hildon-control-panel/background.desktop
- The applet descriptor, tells mobile-basic-flash to create a shortcut in "Settings"
- /usr/share/moblin-applets/glade/background.glade
- Glade XML file describing the dialog
- /usr/bin/moblin-settings-daemon
- Handles loading the background image and color at GUI start by reading the gconf settings
- /usr/share/gconf/schemas/desktop_moblin_background.schemas
- Default values for the background image and color
Applet Design
Image Selection
The GUI is defined primarily within a glade XML file, but at runtime the scrolled window which surrounds the treeview of thumbnail images is replaced with a moko finger scroller. In order to populate this window the applet reads in the moblin-media thumbnail cache at this location:/home/ume/.moblin-media/thumbnails/largest
Moblin media saves thumbnail images as png files with a filename format which encodes the location of the original image:
"<hexdata>?dir?subdir1?subdir2?...?subdirN?filename.jpg.png"
If the hex data is trimmed off, the '?'s are replaced with '/'s, and the .png extention removed, the original's file path can be reconstructed. A smaller thumbnail is then generated from the original file and it along with the file type and dimensions are added to the background treeview for selection.
Gconf settings
Once the image and color selections are made, they are communicated to the desktop manager, mobile-basic-flash, via the setting of a series of gconf keys. These keys were copied from their gnome counterparts in /desktop/gnome and placed under a new gconf dir, /desktop/moblin (note that some older versions of the desktop manager use the gnome keys):- /desktop/moblin/background/picture_filename
- The absolute path of the background image, (NULL) if none.
- /desktop/moblin/background/primary_color
- The hex RGB value of the background color, e.g. #000000
The desktop manager registers gconf callbacks on each of these keys to be notified when they are changed. Therefore the background should change immediately when the image selection or color changes.
Tips and Tricks
How can I change the background image from the command line?
Open a terminal session on the device as user "ume" with one of the following methods:
- Shortcut key: shift-ctrl-t (default buttons applet setting)
- Click the shortcut at: Accessories->Terminal
- ssh to the device over the network: ssh -l ume devicename_or_ip
This should instantly change the background to the new image file.
How can I change the background color from the command line?
Open a terminal session on the device as user "ume" with one of the following methods:
- Shortcut key: shift-ctrl-t (default buttons applet setting)
- Click the shortcut at: Accessories->Terminal
- ssh to the device over the network: ssh -l ume devicename_or_ip
This should instantly change the background color.
Is there a way I can create a slideshow of images in the background?
You could set up a little script which reads in a directory of photos and loops through them every foew seconds
LIST=`find /home/ume -name \*.JPG`
GKEY=/desktop/moblin/background/picture_filename
while [ 1 ]
do
for i in $LIST; do
gconftool-2 --type "string" --set "$GKEY" "$i"
sleep 5
done
done
Code Reuse
This applet is a minimized version of gnome-control-center's background applet- Gnome Control Center 1:2.18.1-0ubuntu2
- Download at: http://packages.ubuntu.com/feisty/gnome-control-center
