GNOME

Infect your application with Parasite!

Parasite

Ever find yourself stuck debugging an application because the UI is just doing something weird that you can’t track down? Maybe a widget isn’t appearing correctly, or you just need more information about the overall structure and logging statements aren’t doing you much good. Debugging complex UIs can be a pain.

We’ve had some real challenges at VMware, due to the complexity of our applications. It was enough to drive me mad one day, so rather than write more logging statements, I wrote Parasite.

Parasite is a debugging tool that David Trowbridge and I have been working on to give developers an interactive view of their entire application’s UI. It provides a number of really useful features, including:

  • See the entire widget hierarchy of your UI.
  • Watch properties update live.
  • Modify existing properties on a widget.
  • View all registered GtkActions.
  • Toggle GTK+’s debugging of graphic updates.
  • Inject custom code while the application is running.

Yes, you can inject new code into an application. With Python. Parasite runs in-process as a GTK+ module, so it has access to some internals of your application. We provide a Python shell equipped with PyGTK support for creating and modifying your UI on-the-fly, regardless of the language it was written in. Handy when you want to test out new concepts for a UI without writing new C code.

David has a nice screencast available showing some of what Parasite can do.

For more information on Parasite, including screenshots, a mailing list, and where to get the source code, see the Parasite homepage.

Infect your application with Parasite! Read More »

Time to rethink GTK+ Tab Dragging

I’ve been planning on adding tab drag-and-drop functionality to VMware Workstation 6.0. Rather than implementing this ability from scratch (which I did with Gaim, and would rather not do again), I took the sane approach and started investigating the GTK+ 2.10 API for GtkNotebook tab drag-and-drop.

This is functionality that many applications have had to implement themselves, so it’s great that support had finally gone into GTK+ 2.10. So I must wonder, with all the various applications that would benefit from this new API, how did we get it so wrong?

Now, before I continue, let me say that I applaud the effort in getting this into GTK+ in the first place. Reordering tabs looks smooth, it’s only one API call, and the basics are trivial. Where this all falls down is when you try to do anything complicated with it, and by complicated I mean anything beyond a simple text editor.

Before starting, I investigated how many projects were using this API. A quick Google Code search shows that almost nobody does, aside from maybe the tab reordering API. I did find this list of complaints, which I remember reading before. I won’t repeat everything on this list, but I will list what I’ve ran into, and how I think we can improve this API.

Global functions are very bad. (Bug 386935)

In order to allow for a tab to be dragged out and form a new window, the application must call gtk_notebook_set_window_creation_hook and pass a callback function. When a tab marked as detachable is dragged to the root window, this function will be called. It is expected that the function create a new window, position it as per the x and y coordinates of the drop (if it so desires), show it, and return the resulting notebook. GTK+ will then add the tab to that notebook.

While useful, this suffers from a major design flaw. You can’t set a window creation hook per-notebook. You get exactly one window creation hook function, which must be responsible for any and all notebooks in the program. The hook function can only distinguish between them using the notebook’s group ID.

For smaller programs, this isn’t a huge limitation. Simple text editors and the like only need one function. However, imagine if your application has multiple notebooks that each need to be dragged, and imagine if the code for those notebooks are in two separate parts of the tree. Maybe you have a nice separation of the different parts of the project. Regardless, now you have to have one common function that knows about both and handles their window creations.

The problem gets far worse for applications separated into different libraries, or those using widget utility libraries. Two separate libraries both providing a notebook with drag-and-drop with their own window creation won’t be able to set up a hook. They would require that the main application handle determining the group IDs of the notebook widgets they care about and then calling the proper functions in the libraries. While doable, it’s a horrible burden on the application, and it doesn’t always work.

Of course, the whole thing completely breaks down when you’re writing a plugin with a notebook rather than an application. The plugin won’t be able to offer its own window creation, due to possible conflicts with the main application and other plugins.

The solution, of course, is to have per-notebook window creation hooks. GTK+ could attempt to call one of these and then fall back to the global hook, if it exists. If calling the global hook, GTK+ could spit out a warning informing the user that the program should be upgraded to the new API and that the existing method is deprecated.

Rather than functions, though, a signal handler may make more sense. It could use a collector and call the handlers until it finds one that returns a GtkNotebook. I could see this being useful if a widget component library (as part of a larger project) provides a default window creation handler that the calling application wants to override for a specific case.

Numeric group IDs lead to namespace collisions. (Bug 386930)

Right now, in order to indicate which notebooks are compatible for drag-and-drop operations, each GtkNotebook gets a group ID. This is an unsigned integer with absolutely no rules on how an ID should be picked. This is very dangerous, as it could cause namespace collisions in larger applications, resulting in tabs being droppable onto incompatible notebooks. This could easily crash such applications.

There’s no reason for us to be using integers. Take a look at GtkRadioButton. They also have groups, but they work a bit differently. The first GtkRadioButton defines the group, and the rest get passed that as the group identifier. In gtkmm, you actually have a Gtk::RadioButtonGroup object that you simply instantiate and then pass to each radio button.

Now, in any well-designed program, there should be only one place creating the notebook for a certain type of window, and usually that’s the only type of notebook capable of accepting tabs from the same class of notebook. So, why not do something like what gtkmm does and have some sort of static object that represents that group, define it once, and pass it to each notebook? This is guaranteed to be unique, and solves the namespace collision issue.

Signals need to be more clear. (Bug 386943)

You can determine if a page was added to a notebook or removed from it, but there’s no clear way of determining if it was due to an API call, or a drag-and-drop operation. We worked around it in VMware Workstation, but it would have been very helpful to know precisely that a page was added due to drag-and-drop. Same with the removed signal. I know they wanted to condense the signals and figured it would work in all cases, but it doesn’t, so please, give us some more specific signals!

Drop operations should be able to be programatically rejected. (Bug 386950)

There are times when you want to allow a tab to be draggable, but want to reject it in notebooks under certain circumstances. For example, in VMware Workstation, we have the “Home” tab. I would like to be able to drag this to empty windows, but if that window has a “Home” tab already, I want to reject the drag. To my knowledge, there is no way to do this currently.

Detaching tabs into new windows requires a drag to the desktop. (Bug 360225)

In most any program with tab drag-and-drop, you can drag a tab off into any area not in the tab bar and it will detach into a new window. With the GTK+ tab dragging, you have to actually drag it to the root desktop. Even dragging off into another window isn’t good enough. This sucks. Let’s fix this properly. We’re not doing anybody any favors.

I’m missing a few annoyances I ran into, but I’ll be blogging about them separately once I remember.

So, to recap, I believe we should:

  • Deprecate gtk_notebook_set_window_creation_hook and add a new create_window signal, returning a GtkNotebook.
  • Ditch the numeric group IDs and use some sort of identifier object or generic pointer to a static variable and pass that in instead.
  • Add new signals or something telling us specifically how the tab was added/removed.
  • Provide a way to reject a tab drop on a particular notebook programatically.
  • Call the window creation hook any time the tab is dragged off the tab portion of the notebook.

It would be great to see these things fixed so that more applications can actually use this API without major headaches. Anyone up for the task?

I plan to put up a new post soon giving a couple of tips for using the current API.

Update: Bugs have been filed for the above. They’re in the topic headers.

Time to rethink GTK+ Tab Dragging Read More »

New libnotify, notification-daemon and notify-python releases

I’m very tired, so I’ll keep this brief.

I just put out libnotify 0.4.0, notification-daemon 0.3.5, and notify-python 0.1.0 releases. Most of the really annoying bugs people have reported have been fixed. More information is available on the news post.

I made a decision that will be unpopular to some, and I expect some disagreement on it. notification-daemon 0.3.5 does not ship with the Bubble theme. A large number of the problems people have reported to me on IRC and in e-mail centered around this theme, and until I have the time to give it the attention it needs, I’m removing it from the default install. It’s still in SVN and the tarball, and development will resume on it at a later date. However, I want to give people the best out-of-the-box experience as possible, and the Bubble theme currently makes that hard. If people want to chip in and help, you’re more than welcome.

Aside from that, it’s a very good release and I highly recommend people update. As always, please make sure to report bugs.

I have a couple of neat things I plan to work on. One is a little event notifier for scheduled events on online calendars (30Boxes.com to start). This will be using the new libnotify Python bindings. If it proves useful, I hope to add Google Calendar support as well. I’ll make some sort of announcement once I get a prototype working.

New libnotify, notification-daemon and notify-python releases Read More »

Taggable Desktop


Luis: You wanted a taggable desktop? Oh, okay.

Announcing Leaftag, our desktop tagging framework. This is an evolution of the original prototype we created, originally named fstaglib (isn’t leaftag just so much better?).

The main part of Leaftag is a library called (oddly enough) libleaftag, which interfaces with the tag database. It’s GObject-based, and the API is quite small. It can tag anything with a URI.

There’s tagutils, a small app used for working with tags and files. It is able to tag and untag files, list all known tags, list all files with a specified tag, and manipulate tag properties (such as icons and descriptions). It also includes some symlinks that provide shortcuts to common tagutils functions (tag, untag, tagls, tags, and tagprop).

leaftag-python contains Python bindings for libleaftag. It simplifies the already simple libleaftag library.

And then there’s leaftag-gnome, which will contain all future GNOME support for tagging. Currently, it supports only a Deskbar handler. Future releases will hopefully include Nautilus search integration and property pages.

Now, it’s important to point out that the screenshots on my previous blog entry are of the old implementation, and have not been ported over to Leaftag yet. This is largely due to lack of time as of late (because of Galago and VMware Server work, on my part), but it’s also because we want to re-implement this correctly. In the meantime, we’re hoping additional apps will start supporting this.

This is the first public release of the Leaftag framework, so please report any bugs to us. In time, after a server migration, I plan to put together a dedicated Leaftag site and bug tracker.

Taggable Desktop Read More »

Pretty new notifications… And a release!

I’ve been inspired by the December GNOME mockups. A lot of them are quite nice, and in the area of notifications, it had some good ideas on sprucing up the look and feel. So I present to you, notification-daemon v0.3.4!

Along with the usual assortment of bug fixes, I’ve improved the style quite a bit. There’s now a countdown timer on notifications with actions, a close button, themed urgency-based stripes, and actual buttons.

Before After
Old urgency stripesOld icons and actions New urgency stripesNew icons and actions

Pretty new notifications… And a release! Read More »

A few project updates

I’ve been putting off several posts for a few days now, due to just being busy with things. So, here we go.

Notification Framework

I just put out a couple of good releases of notification-daemon and libnotify. A few days ago, I released version 0.3.2 of both components, and tonight I put out notification-daemon v0.3.3, which contains a few nice bug fixes such as a fix to prevent notifications when the screen saver is active or when something is running full-screen. The style of the notifications has been changed to resemble the look from notification-daemon v0.2.x. It now supports theme engines, so that other looks can be developed. The protocol has improved and stabilised a bit, and the API and general code of both components have been cleaned up, thanks to J5’s work.

Galago

Galago’s been on hold lately due to work and trying to get the new notification-daemon and libnotify ready for distros. Development has picked up again, and I’m hoping I have very little to do before I can put out the 0.5.0 releases of all the components. Finally, libgalago will be GLib/GObject-based, and the API will be a lot more sane. Plus, Python bindings! Yay!

Oh, and I’m moving to Trac for our bug tracking (see trac.galago-project.org). This is real nice, because I can now reference bugs in commit messages and they’ll close automatically with the commit message. It’s also quite clean and easy to use. I’m slowly moving some bugs over, but I’ll continue to monitor the bugzilla for a while.

Leaftag

Remember those screenshots of our tag integration I posted? It too has been on hold, but it’s far from vaporware. We’re calling it leaftag, and I think our logo is somewhat cute :). I have very little left to do before the library is released, and I should be able to redo the Nautilus support quickly. I’ve been using the tagging almost every day. Now I just need to find the time to get this ready. Maybe at one of these upcoming hackfests I’ve been doing (and really hope to do more) with friends.

VMware

Busy busy busy, but good. I’m working on some pretty exciting stuff. More about this later 🙂

Oh, and someone needs to remind me to put up a picture of our cool new Workstation 5.5 sweaters featuring Mario!

A few project updates Read More »

Tagging and the GNOME Desktop

Just a little preview. It’s not done yet, but will be shortly. What you see below is a small python module, a useful command line utility (well, that’s not shown, but if you check the gallery these are in there will be a full-size screenshot showing one), and plugins for Nautilus, GNOME-VFS, and Deskbar. There are plans for Beagle support in the near future, and to make the system more robust.

Stay tuned. There should be a release soon.

Tags in Nautilus lists

Tags in Nautilus lists

tags URI

Deskbar Integration 1

Deskbar Integration 2

Tagging and the GNOME Desktop Read More »

Goings Ons

Hard Day in GNOME

All day long, people have been talking on IRC about the Novell lay-offs. It’s been sad to see, and as hard as it was for the people who were let go, I’m sure it was just as hard for those that had to let people go. My condolences to everyone who’s been affected by this.

I’ve talked to a few people individually about this, but it’s been recommended to me by a couple of people that perhaps using Planet GNOME would be the best way to reach everyone interested…

I’d like to offer to anyone affected by this who is looking for a job to send me your resume if you’re interested in a job at VMware. I can make sure it goes to a human being who will actually read it, rather than in some queue somewhere. We’re looking for good people, and the company is nice to work at. Although the Palo Alto offices are where all the interesting things happen for the Linux desktop development, some jobs are available at our new Cambridge office. So if you’re looking for a fun job where you can do interesting work with good people, and this interests you, even a little, we can try to get the ball rolling. To everyone else, best of luck. I don’t doubt that you will all find good jobs soon, and everyone appreciates what has been done so far by everyone in the Ximian team.

Nokia 770

My Nokia 770 came today. I haven’t had much time to play with it, but it’s quite nice so far. Cute little device, and I’m eager to hack on it. I have a couple of games I’ve written or PDAs that I hope to port. Taco would be fun to port to it, if it had cairo (which I don’t believe it does? Correct me if I’m wrong!).

Galago

A lot of work has been done in Galago SVN the past couple of weeks. A lot of the code has been cleaned up and the API is in the process of being fine-tuned. Python bindings are being written. libgalago is moving to glib. All neat stuff. I’ll post more when I get closer to being finished, but this is very cool:

for service in galago.core_get_services():
    print service.get_name()
    for account in service.get_accounts():
        print account.get_username()

Just so easy. That’s not the final API, though. The core_get_services() part will change. Anyhow, fun stuff.

Goings Ons Read More »

Chippy’s first Boston trip

I’m finally heading to the Boston GNOME Summit! I’ve wanted to go for years, and people have asked me to attend, but due to school and such it was just never possible. However, this year VMware is sending a few of us to go. Alex Graveley, Philip Langdale, my girlfriend Jamie, and myself are all going, and will be there Friday night.

We might give a small talk on our experience in integrating our product with the GNOME desktop, and I’ve been asked by a few people to give a quick talk and demo of Galago with Tomboy, Beagle, Gaim and Evolution integration (and hopefully Gossip at that point too).

I look forward to going and meeting all these great people who I’ve only talked to through IRC and e-mail. It should be a fun weekend.

Chippy’s first Boston trip Read More »

Scroll to Top