For a while now I have wanted to make it easier for desktop applications to integrate more with social networks, enabling users to easily interact with their friends in many different contexts. Could be posting a status update based on the context they are in right now, commenting on a friends photo while browsing their Facebook photo album in Shotwell, etc. Let me introduce libgwibber!
A brief introduction to libgwibber, a library (C, vala, mono, and python) for using the Gwibber Service as well as provide some GTK widgets to easily embed into existing GTK applications. Bindings for as many languages as possible was very important to me, I really want to make it as easy as possible for any desktop application to use Gwibber as a desktop service.
The API currently provides access to the common things an application developer might care about:
- signals for service availability and account changes
- start and stop gwibber-service
- retrieving accounts
- toggling send_enabled status on an account
- looking up an account
- posting a status update
- URL shortening
- retrieving the version of the current running gwibber-service
I just finished porting the MeMenu from the Ayatana project to use libgwibber, which will be in the next release.
So far libgwibber-gtk includes just one widget, a posting entry. This widget includes:
- A TextView
- with an overlay character counter
- built in URL shortening
- integrated with NetworkManager, disabled when in offline mode
- includes toggle buttons for each account, connected to signals to track the current status globally
- Send button
Some examples of the Gwibber entry widget can already be found embedded in the Ubuntu Software Center and the Ubuntu One Music Store plugin in rhythmbox.
Other widgets I hope to add in the future include:
- stream view (message view of any stream)
- stream navigation
- friend browser (browse friends based on type of content, like friends with images that can be displayed in shotwell or f-spot)
- profile (view your own or someone else’s profile)
- comment (comment on various types of shared content, photos, links, etc)
- image uploader
I would love suggestions for these or others, please let me know!
Some GTK examples:
To build entry-c.c:
gcc `pkg-config --cflags gwibber-gtk` entry-c.c `pkg-config --libs gwibber-gtk` -o entry-c
To build entry-vala.vala:
valac --pkg gtk+-2.0 --pkg gwibber --pkg gwibber-gtk entry-vala.vala
To build entry-mono.cs
gmcs -target:exe -out:entry.exe -pkg:gwibber-gtk-sharp-0.0 entry-mono.cs
Nothing to build, so just run it with:
Here are some examples of using libgwibber with python and gobject introspection:
# Import Gwibber using introspection from gi.repository import Gwibber
# Get a service object service = Gwibber.Service()
# Get the current Gwibber version version = service.version()
# Make the Gwibber service refresh service.refresh()
# Post a status update to all your enabled accounts service.send_message("Something very interesting here, blah, blah, blah")
Some applications I would love to see use libgwibber:
Shotwell and F-Spot: Browse online photos from your social networks from right inside you existing photo library tool. Including the ability to comment, tag, like and share.
gnome-utils: Add image upload support to gnome-screenshot
Evolution: Display the last status update from a contact when viewing an email or browsing contacts.
GTG: Status updates when tasks are complete
I am generating gtk-doc docs for libgwibber, but they aren’t very useful yet. libgwibber is written in vala and I haven’t figured out a way to get docstrings to pass from vala to the generated C. If anyone knows how to do that, please let me know.
Hopefully people find libgwibber useful, please let me know if you have suggestions, bug reports, or want to contribute!