[OTR-dev] A few UI patches

Gabriel Schulhof nix at go-nix.ca
Sun Jul 29 12:37:02 EDT 2007


Hi!

I maintain a port of pidgin and pidgin-otr for Internet tablets. From a
UI point of view, this means a mouse that cannot move but only click and
drag, no right-click (but there's tap-and-hold), and no keyboard (except
on-screen via GTK input methods).

I have created a few UI patches for pidgin-otr. My main motivation is,
of course, to make pidgin-otr usable on Internet tablets, however, I
believe that some of my modifications are useful/good-looking enough to
be considered for pidgin-otr on the desktop. I have lightly tested these
patches both on the desktop and on the Internet tablet.

The patches are available in the directory at
ftp://go-nix.ca/incoming/pidgin-otr-patches/

Brief per-patch explanations:

otr-button.diff:
  - Replace the button that goes into the conversation window with a
GtkFrame containing two buttons: The original button on top, and a
button labelled "Actions..." below it. The original button's behaviour
is unchanged. The "Actions..." button causes the right-click menu to be
popped up. In this sense, it behaves a little bit like a GtkOptionMenu.

otr-clist-to-treeview.diff:
  - Remove the deprecated GtkCList widget and replace it with a
GtkTreeView. This change allows for several UI "spruce-ups":
    - You can use pixbufs (same as those used on the button) to
illustrate the current status for each fingerprint in the list (instead
of mere text like "Private", "Not private", etc.)
    - You can use checkboxes to indicate whether the fingerprint is
verified (again, instead of mere text like "Yes" and "No")

To make it possible to use the same pixbufs in both the button and the
tree view, I had to move the xpm static data from gtk-dialogs.c to
gtk-ui.c and create a function that converts the static data to a
GdkPixbuf. The otr_icon function then uses this new function (whose
prototype is in gtk-ui.h, now included from gtk-dialog.h) to create the
GtkImage as before.

A side effect of this is that these pixbufs can now be used to make the
four "Verify fingerprint", "Start private connection", etc. buttons look
better by putting an image on them. I used the following images:

"Start private connection" TRUST_PRIVATE
"End private connection" TRUST_FINISHED
"Verify fingerprint" GTK_STOCK_YES
"Forget fingerprint" GTK_STOCK_DELETE

otr-explanation-via-imhtml.diff:
- Replace the GtkExpander-within-GtkExpander arrangement with only the
outer GtkExpander, and render the inner GtkExpander as a link inside
GtkIMHTML markup. IOW, there is now only one expander containing a
scrolled window with a GtkIMHTML inside. The IMHTML widget contains the
initial explanation, plus a link labelled "+ Explain further". When
clicked, the url-clicked handler deletes all text starting with the "+"
and up to the end of the GtkIMHTML and replaces it with a link labelled
"- Hide explanation" and the longer explanation. URLs in the longer
explanation are opened in the Web browser via purple_notify_uri as
before. When the user clicks "- Hide explanation" it toggles back to "+
Explain further".
Caveat: The long explanation causes the imhtml to scroll to the end.
There is code in place to put "- Hide explanation" and the beginning of
the long explanation to the top of the imhtml when the user clicks "+
Explain further". This code works in 2.0.2, but there has been a
regression since then whereby pidgin seems to ignore the
GTK_IMHTML_NO_SCROLL flag in the gtk_imhtml_append_text call. I posted a
bug about it: http://developer.pidgin.im/ticket/2315

otr-generate-key-via-thread.diff:
- Do not freeze Pidgin while generating a key. GLib provides several
preprocessor directives which can bracket code that uses threads so
that, if compiled, it's very, very likely to also work at runtime.
pidgin-otr already has a mechanism for blocking the generate() function
so that it only returns after the key is done. Unfortunately, the key is
generated on the main thread, blocking the GMain event handling code. I
have pushed the function onto a new GThread. I use the main loop to tell
the main thread that generation is complete in the following way: The
new GThread adds an idle handler to the main context and quits. The idle
handler, which runs in the main thread, toggles a boolean variable and
removes itself from the list of sources. The boolean variable then
unblocks the code as before. The upshot is that Pidgin remains
responsive while a key is being generated.
Caveat: 
- The user can quit Pidgin while a key is being generated. This causes a
segfault. Not a typical use case though, I would think.
- Cannot start a private conversation while a key is being generated
because gcrypt fails with some assertion

otr-pidgin-frames-and-spacings:
- Make the plugin configure dialog look more like Pidgin's own
preferences dialog. I have replaced the GtkFrame widgets used to enclose
the various groups of settings with pidgin_make_frame. I have also
replaced numerous hard-coded border widths and spacings with Pidgin's
#defined spacing and border width values PIDGIN_HIG_BORDER,
PIDGIN_HIG_CAT_SPACE, and PIDGIN_HIG_BOX_SPACE.

In addition to the above changes, I have, in some places changed the
arrangement of widgets a little bit (cleaning things up, perhaps). For
example, instead of a GtkHBox with two empty labels with the aim of
centering a widget between them, I used a GtkAlignment.

I have created a demo of my changes:
http://www.youtube.com/watch?v=zPtnlqEZPeY

Please let me know what you think!



Gabriel




More information about the OTR-dev mailing list