Hildon Desktop Widgets by Dimitry Pastushenko
Click here to load reader
-
Upload
ashley-walker -
Category
Technology
-
view
1.176 -
download
1
Transcript of Hildon Desktop Widgets by Dimitry Pastushenko
![Page 1: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/1.jpg)
Discover MaemoSanta Clara, CA Dec 09
Hildon Desktop Widgets
Dmitry Pastushenko
![Page 2: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/2.jpg)
Discover MaemoSanta Clara, CA Dec 09
Agenda
•Hildon Desktop Home Widgets
•Widget Packaging
•Widget Declaration and Definition
•Widget API
•Hands-on
•Summary
![Page 3: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/3.jpg)
Discover MaemoSanta Clara, CA Dec 09
Hildon Desktop Widgets
4 Desktops, 3200x424 pixels total space
![Page 4: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/4.jpg)
Discover MaemoSanta Clara, CA Dec 09
Example Widget
•Calculates random numbers in 0-1000 range every second
•Changes color of generated number every 1/3 of a second
•Implements settings dialog
•Preserves battery life
![Page 5: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/5.jpg)
Discover MaemoSanta Clara, CA Dec 09
Widget Debian
Package
•
Shared Library•
/usr/lib/hildon-desktop/libwidgetexample.so
•
Desktop File•
/usr/share/applications/hildon-home/widget-example.desktop
•
Data (Resources)•
/usr/share/…
![Page 6: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/6.jpg)
Discover MaemoSanta Clara, CA Dec 09
Desktop file (widget-example.desktop)
[Desktop Entry]
Name=Widget Example
Comment=Widget Example
Type=default
X-Path=libwidgetexample.so
X-Multiple-Instances=false
![Page 7: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/7.jpg)
Discover MaemoSanta Clara, CA Dec 09
WidgetExample
Dependency
![Page 8: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/8.jpg)
Discover MaemoSanta Clara, CA Dec 09
GObject
Library
•
Cornerstone of GNOME and is used throughout GTK+, Pango, and most higher-level GNOME libraries
•
Provides transparent cross-language interoperability
•
Provides a portable object system
![Page 9: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/9.jpg)
Discover MaemoSanta Clara, CA Dec 09
WidgetExample
Class Diagram
![Page 10: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/10.jpg)
Discover MaemoSanta Clara, CA Dec 09
Widget Declaration, Part 1typedef
struct
_WidgetExample
WidgetExample;typedef
struct
_WidgetExampleClass
WidgetExampleClass;typedef
struct
_WidgetExamplePrivate
WidgetExamplePrivate;
struct
_WidgetExample
{ /* instance */ HDHomePluginItem
item; /* superclass
instance */WidgetExamplePrivate
*priv; /* private data */};
struct
_WidgetExampleClass
{ /* class */HDHomePluginItemClass
parent_class; /* superclass
*/};
GType
widget_example_get_type
(void);
![Page 11: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/11.jpg)
Discover MaemoSanta Clara, CA Dec 09
Widget Declaration, Part 2#define TYPE_WIDGET_EXAMPLE (widget_example_get_type
())#define WIDGET_EXAMPLE(obj) \(G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_WIDGET_EXAMPLE, WidgetExample))
#define WIDGET_EXAMPLE_CLASS(klass) \(G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_WIDGET_EXAMPLE, WidgetExampleClass))
#define IS_WIDGET_EXAMPLE(obj) \( G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_WIDGET_EXAMPLE) )
#define IS_WIDGET_EXAMPLE_CLASS(klass) \( G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_WIDGET_EXAMPLE) )
#define WIDGET_EXAMPLE_GET_CLASS(obj) \( G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_WIDGET_EXAMPLE, WidgetExampleClass) )
#define WIDGET_EXAMPLE_GET_PRIVATE(obj) \( G_TYPE_INSTANCE_GET_PRIVATE (obj, TYPE_WIDGET_EXAMPLE, WidgetExamplePrivate) )
![Page 12: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/12.jpg)
Discover MaemoSanta Clara, CA Dec 09
Widget Definition & Mandatory Methods•
HD_DEFINE_PLUGIN_MODULE (WidgetExample, widget_example, \HD_TYPE_HOME_PLUGIN_ITEM);
•
static void widget_example_class_init
(WidgetExampleClass
*class)•
Object Initialization –
override GObject::dispose, GtkWindow::realize, GtkWindow::expose_event
•
Register private data
•
static void widget_example_class_finalize
(WidgetExampleClass
*class) •
Object Destruction
•
static void widget_example_init
(WidgetExample
* applet) •
Initialize all public and private members of instance to default
values•
Create UI•
Subscribe on signals
![Page 13: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/13.jpg)
Discover MaemoSanta Clara, CA Dec 09
Call Flow
![Page 14: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/14.jpg)
Discover MaemoSanta Clara, CA Dec 09
Summary•
Follow Nokia’s UI guideline•
Should provide most crucial features•
Use semitransparent background, if applicable•
Events should be initiated on release•
Never exceed half of desktop space
•
Preserve battery life•
On current display signal •
Device inactivity state signal
•
Applet is a plug-in -
don’t forget to yield
•
Threads are allowed, but drawing should be done from main loop
![Page 15: Hildon Desktop Widgets by Dimitry Pastushenko](https://reader038.fdocuments.us/reader038/viewer/2022100600/5554aff3b4c905fd608b54fb/html5/thumbnails/15.jpg)
Discover MaemoSanta Clara, CA Dec 09
Q&A