The Facebook* Example Application for Moblin*

Tags:

Related Downloads

Introduction

This document contains in-depth information about the Facebook* example application for Moblin*.

Functional Description

This Facebook* example application provides a simple introduction to the steps involved in creating a well behaved Moblin* application.

This application demonstrates using WebKit*/GTK+* to create a simple Facebook* authentication tool.

Technical Description

The demo application is not ambitious and is focused on expository goals instead of providing the features that would be expected in a robust Facebook* client.

This item provides an example of how to utilize the Intel AppUp® C++ API.

Technical Implementation Summary

Makefile

The makefile compiles and links the app named facebook-demo-webkit against the shared object libraries that it depends upon. A shared library would be referred to as a Dynamic Link Library (DLL) in Microsoft Windows* parlance.

Note that we use a call to the pkg-config program instead of explicitly calling out the names and paths of the appropriate items required to resolve include and library dependencies from each package that we depend upon: libcurl (not used at present but would be needed for interacting with the Facebook* APIs), WebKit*, GTK+* and adpcore (which provides the code needed for authorization).

facebook-demo-webkit.cpp

The demo app is written using WebKit/GTK+ and GTK+.

The application's initialization sequence is as follows:

  • The UI is initialized.
  • The ADP Authorization system is initialized and confirms that the application is permitted to run. If the application is unauthorized or the ADP service isn't running an error dialog is presented to the user and the app terminates.
  • Generally, any failure modes will cause the invocation of the function display_error(), which will present a dialog that contains the error message harvested from the libraries we are using or an appropriate locally written error message derived from the problem at hand.
  • Once the initialization phase is complete the application loiters in gtk_main() awaiting user input.
  • The user is presented with a login dialog that WebKit* has collected from Facebook*'s web API during initialization. The user enters their credentials and either logs in or fails to login. If successful, the application harvests the session id but does nothing with it since it's just a demo app. Then it presents a GTK+ dialog box that reports success. The user can then close the app using the window manager.
  • Further details concerning each function in the demo app are in the code and comments, so please consult those for any specifics.
AttachmentSize
Download facebook-demo.zip13.47 KB
For more complete information about compiler optimizations, see our Optimization Notice.

Comments

Jeremy Wadsack's picture

This app has dependencies on libwebkit-dev and libcurl4-dev. To set up my fresh Ubuntu VM with dependencies I had to install these packages before it would build:

$ sudo aptitude install libwebkit-dev libcurl-dev

Jeremy Wadsack's picture

That libcurl lines was wrong. I used libcurl4:

$ sudo aptitude install libwebkit-dev libcurl4-dev