Older blog entries for federico (starting at number 199)

Thu 2010/Jun/17

  • Custom prompt for jhbuild

    I used to have a hard time distinguishing jhbuild-controlled shells from normal shells. To help with this, I just pushed a small change to jhbuild. Now it sets an UNDER_JHBUILD environment variable, so your "jhbuild shell" can customize its prompt. You can add this to your .bashrc:

    if [ -n "$UNDER_JHBUILD" ]; then
        PS1="[jhbuild] $PS1"

    With this, my prompt now looks like this when I'm inside a jhbuild shell:

    [jhbuild] guanabana$

Syndicated 2010-06-17 12:15:00 from Federico Mena-Quintero - Activity Log

Wed 2010/Jun/09

  • Hack Week 2010 — Client-side awesome

    It is Hack Week this week, when all of Novell's hackers work on whatever project they want for the whole week.

    The infrastructure for Document-Centric GNOME is coming along just fine. The Zeitgeist hackers are kicking all sorts of ass with the engine and the activity journal — that's what lets you see your work in a nice timeline.

    Another part of the document-centric vision is to allow comfortable flow or circulation through your files, which is sorely missing right now.

    Placeless documents

    Let's say you open a document. It doesn't matter how you open it — by double-clicking on it in Nautilus, by clicking on an item in your activity-journal's timeline, or by a File/Open command. The document window you get is something like this:

    Normal document window

    This document window tells you the title or filename, but it does not let you see where the document is stored. It also does not let you access documents which may be near the place where the original document is stored.

    The user interface does not give you any hints about the place in which your document lives. Your document is effectively placeless, you have no way to orient yourself, and you have every reason to feel lost.

    What would Christopher Alexander do?

    A couple of months ago I wrote a little introduction to the work of Christopher Alexander, the architect behind the monumental book A Pattern Language and others.

    There are several patterns in A Pattern Language that deal with how you move from place to place and how you orient yourself, either in the city or in a building. To solve the problem of disorientation and placeless documents, I think we can grab ideas from these patterns:

    Main gateways. "Any part of a town - large or small - which is to be identified by its inhabitants as a precinct of some kind, will be reinforced, helped in its distinctness, marked, and made more vivid, if the paths which enter it are marked by gateways where they cross the boundary. [...] Mark every boundary in the city which has important human meaning - the boundary of a building cluster, a neighborhood, a precinct - by great gateways where the major entering paths cross the boundary."

    Circulation realms. "Lay out very large buildings and collections of small buildings so that one reaches a given point inside by passing through a sequence of realms, each marked by a gateway and becoming smaller and smaller, as one passes from each one, through a gateway, to the next. Choose the realms so that each one can be easily named, so that you can tell a person where to go, simply by telling him which realms to go through."

    The flow through rooms. "The movement between rooms is as important as the rooms themselves; and its arrangement has as much effect on social interaction in the rooms, as the interiors of the rooms. [...] As far as possible, avoid the use of corridors and passages. Instead, use public rooms and common rooms as rooms for movement and for gathering. To do this, place the common rooms to form a chain, or loop, so that it becomes possible to walk from room to room [...]"

    Circulation for your files

    File managers like Nautilus let you navigate down in the hierarchy of folders until you reach an actual document. But once you open a document window, you cannot navigate up to look for related files, or even to see the folder in which the document is stored. If you open the document with something other than the file manager, you will have a hard time knowing where the document is.

    We can solve this by adding a "Show folder" button to document windows, preferably so that it is close to the document's name or filename.

	      folder&dquot; button in document

    When you click on that "Show folder" button, it takes you to the document's parent folder. In turn, we can make folder windows in the file manager similar, with a "Show parent" button to go further up in the hierarchy.

	      parent&dquot; button in folder

    By adding a single button that is close to the document's or folder's name, we can let you navigate up in the hierarchy, just as you can currently navigate down with the file manager. This adds circulation and flow to your files.

    Name-able gateways

    Every time that I click on a PDF link while I'm browsing the web, the following happens:

    1. The PDF gets downloaded and put somewhere. Sometimes in /tmp, sometimes in ~/Downloads, depending on which button I click in Firefox's "what do you want to do with this file?" nag-window.

    2. Evince opens up to show me the PDF. In a few seconds I can tell if the PDF is something worth keeping.

    3. If I decide to keep or delete the PDF, I cannot move it easily to a good place or to the trash— I have no way to visit the PDF's parent folder so that I can drag it to another place. This would be solved with the "Show folder" button described above.

    4. For some reason, PDFs always seem to have terrible names: presentation.pdf, 2010.pdf, CiteSeer, I am looking at you. And yet there is no easy way to rename the document right there.

    This also happens when someone sends me an email attachment. They give it a crappy name, I want a better one, but there's no easy way to do it right there.

    In the mockup screenshots above, you can see that windows for documents and folders actually let you edit the filename right there. Instead of having a static filename in the title bar, you actually have a text entry that you can edit. If I could rename right from Evince as I view the PDF for the first time, my ~/Downloads folder would be a much friendlier place.

    This is akin to having physical gateways with big name tags. You always know where you are, and you always know that you can go to a place nearby.

    Client-side what?

    Unfortunately, window managers don't let you customize a window's title bars like that.

    The valiant Cody Russell has been working on the client-side-decorations branch of GTK+. With this, you would be able to have a toplevel window and decorate its frame yourself, without the window manager's intervention.

    Having control of a window's frame means that we can stick a GtkEntry there for the rename-able filenames, and a GtkButton for the "Show folder" action.

    (Yes, this would also let programmers add all sorts of crap to their windows, but apps will shitty UIs will just kill themselves.)

    However, having an application paint the window's frame by itself also means that it should paint it exactly in the same way the window manager would, or the window will look out of place.

    My Hack Week project is to rip the code from Metacity/Mutter that reads a window manager's theme, and paints the window frames, and make that code reusable for GTK+. This way document windows would look exactly like normal managed windows, but with the addition of the few extra controls we need.

Syndicated 2010-06-09 11:01:00 from Federico Mena-Quintero - Activity Log

Wed 2010/May/19

  • We live in a strange world where herds of cows hatch from tiny eggs.

    Cow beans

Syndicated 2010-05-19 11:40:00 from Federico Mena-Quintero - Activity Log

Mon 2010/Apr/26

  • This is the story of two little olives.
    Luciana and olives (1)

    Hello, my friend, what have you been doing?
    Luciana and olives (2)

    Let me tell you about my deadly battle with a fierce toothpick.
    Luciana and olives (3)

    Don't you say! How impressive, what valour!
    Luciana and olives (4)

    The toothpick was about this thick.
    Luciana and olives (5)

    Tell me no more, I can't bear to hear it!
    Luciana and olives (6)

    Now more than ever, we olives have to stand together.
    Luciana and olives (7)

    No more toothpicks, only red peppers will pierce our hearts!
    Luciana and olives (8)

    Script - Oralia
    Puppets - Luciana
    Photos - Federico

Syndicated 2010-04-26 12:45:00 from Federico Mena-Quintero - Activity Log

Thu 2010/Apr/22

  • Don't use padding

    This is how a GtkBox lays out its children. Yellow is the spacing that you specify in gtk_hbox_new() or gtk_vbox_new(). Beige is padding, which I'll convince you to set to zero. Orange is the actual child widgets inside the box.

    Box padding in GTK+

    (SVG source)

    In the first example, you see a box with a spacing of 2 (trust me, that yellow is 2 units). The children are thus uniformly spaced, and everything is nice and easy to understand.

    In the second example, you see a box with the same spacing of 2 units between children, but each child has a different padding. The leftmost child has a padding of 1 unit, which you see on both sides of that child. The second child has a padding of 2 units, the third child has a padding of 3 units, and the rightmost child has no padding. This is a big mess.

    Spacing is the uniform space that GtkBox puts between child widgets.

    Padding can be different for each child, and it gets applied on both sides of each child. So each child gets an allocation of at least (padding + requisition + padding).

    Other containers like GtkTable also have their own padding parameters for children (GtkTable lets you set different paddings in the X and Y directions).

    Summary: if you are using a padding different from zero, you are making a mistake in 99% of cases. Use a good spacing, and a padding of zero. Otherwise you make it really hard to align other widgets in the container hierarchy when someone else has to modify your code. If you really need padding, it's generally better to use a GtkAlignment around your widget and pad that instead of messing up the parent container.

    This has been a public service announcement.

Syndicated 2010-04-22 15:21:00 from Federico Mena-Quintero - Activity Log

18 Mar 2010 (updated 18 Mar 2010 at 23:12 UTC) »

Thu 2010/Mar/18

Syndicated 2010-03-18 14:35:00 (Updated 2010-03-18 23:12:14) from Federico Mena-Quintero - Activity Log

Fri 2010/Mar/05

  • Why are you reading, replying to, or posting in foundation-list? Why are you wasting your own time and eveyrone else's? Instead, go and make GNOME better. Fire up that text editor. If you don't "git push" today, your day was a waste of time.

Syndicated 2010-03-05 13:08:00 from Federico Mena-Quintero - Activity Log

190 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!