Re: GTK+ replacements for libgnomeui widgets



On Tue, 2004-05-25 at 01:08 +0200, Sven Neumann wrote:
> Hi,
> 
> "James M. Cape" <jcape ignore-your tv> writes:
> 
> > On Mon, 2004-05-24 at 16:23 -0500, James M. Cape wrote:
> > > As I said on #gtk-devel today, I've written some replacements for the
> > > GnomeFileEntry and GnomePixmapEntry widgets in libgnomeui for possible
> > > inclusion in GTK+ 2.6: EscoFileChooserEntry and EscoImageButton.
> > 
> > I was just thinking that perhaps the EscoImageButton might be made into
> > a more generic EscoFileChooserButton which used the user-set preview
> > widget as the button contents. The EscoImageButton could then be either
> > a subclass or a simple convenience function which filled in the
> > appropriate preview stuff and did the scaling and such. The code would
> > be much cleaner, but I'm not sure how useful random file buttons are in
> > real applications.
> 
> Well, the GnomePixmapEntry widget has always been a usability
> nightmare and I strongly hope that no such widget will ever make it
> into GTK+. If you want users to choose an icon, then present them with
> a set of icons, not with a file chooser widget. The user shouldn't
> have to care about the location of the icon/image file on disk.

I agree with this sentiment, but there are cases (such as gdmphotosetup,
the panel background picker, and the evolution contact editor) where
there is no central repository of images or (currently) reasonable place
to start looking. Also, the user may very well want to use random image
file X (say I want "/mnt/smbserver1/Images/someimg.png"), there's no way
for GTK+ to do that currently. In those cases, a plain file-chooser is
definitely preferred over nothing :-).

http://esco.mine.nu/sshots/gnome-icon-entry-patched-5.png
http://esco.mine.nu/sshots/gnome-icon-entry-patched-6.png
http://esco.mine.nu/sshots/egg-image-chooser-3.png
http://esco.mine.nu/sshots/egg-image-chooser-4.png

The plan I had was to do a GtkImageChooserIface, with implementing
Widget, Dialog, and Button widgets. The basic API was:

GtkImageChooser {
   methods:
	add_group;
	remove_group;
	select_group;
	select_image; /* takes filename or category name */
    properties:
	"groups" /* all groups */
	"group" /* current group */
	"image-name" /* absolute filename or icon name */
	"show-custom" /* bool, show file chooser pseudo-group */
    signals:
	"group-changed"
	"activate"
}

GtkImageChooserGroup
{
    properties:
	gchar *name;
	union {
	    GdkPixbuf *pixbuf;
	    gchar *name;
	} icon; /* for the pulldown */
	GHashTable *categories;
	GHashTable *directories;
	gboolean icon_is_pixbuf:1;
    methods:
	add_category;
	remove_category;
	add_directory;
	remove_directory;
	set_icon_from_pixbuf;
	set_icon_from_name;
	set_icon_from_stock;
	list_categories;
	list_directories;
}

The sticky part of doing an ImageChooser like those above is handling
directories with lots of large images (e.g. /usr/share/backgrounds), the
best option is for which some kind of of simple thumbnailing API to work
with GdkPixbuf & ~/.thumbnails, e.g.:

GdkPixbuf *gdk_pixbuf_thumbnail_new (const gchar *filename);
void gdk_pixbuf_thumbnail_save (const gchar *filename, GdkPixbuf
*pixbuf);

But that improved UI may not make 2.6 there isn't an icon container
widget available.

-- 
Peace,

    Jim Cape
    http://ignore-your.tv

    "We still name our military helicopter gunships after victims
     of genocide. Nobody bats an eyelash about that: Blackhawk.
     Apache. And Comanche. If the Luftwaffe named its military
     helicopters Jew and Gypsy, I suppose people would notice."
       -- Noam Chomsky, "Propaganda and the Public Mind"

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]