Re: Notes from GTK+ BOF

On Tue, 2004-06-29 at 18:45 +0200, Owen Taylor wrote:
> We had a GTK+ BOF today (2004-06-29) at GUADEC.


>  Various picker buttons / entries were discussed:
>   File/Directory picker. There was some considerably discussion
>   of whether such a beast was an actually a good idea; it seems
>   that at least *some* apps do genuinely need file and 
>   directory selection, and we're better off providing a widget
>   to do it well than have everybody do it themselves badly. 
>   James Cape was nominated in absentia to write up his work
>   as a proposal and send it to gtk-devel-list

Righteo, man, righteo!

EscoFileChooserButton is the current classname.

    - GtkFileChooser + std. constructors (new, new_with_filesystem).
    - "title" property (for dialog).
    - "active" property (for visibility of dialog).

    - Similar to GtkComboBox(Entry), only with a dialog behind the
button instead of a pulldown
    - Varies by file-chooser action (on-the-fly):
	+ GtkToggleButton w/ a basename label and the stock "open" icon for
	    [ thefile.txt       | o ]
	+ _GtkFileChooserEntry w/ the "open" icon togglebutton for SAVE/CREATE.
	    [_thefile.txt______][ o ]

    - Autocomplete using _GtkFileChooserEntry.
    - clicking togglebutton/"active" property opens
    - proper signal filtering (update-preview always, others on

    - Use of a custom-GtkComboBox (with _GtkFileChooserEntry) instead of
entry/button to display a history (and rename to GtkFileChooserCombo

Currently the sources for this are in

in src/esco-ui/escofilechooserbutton.[c,h].


And so long as I'm at it: I've got GdkPixbuf-loader-based thumbnailing
using the fd.o thumbnailing standard working at

GLib-level MD5 API:

struct _EggMd5Digest
  guchar  digest[16];

EggMd5Digest *egg_str_get_md5_digest (const gchar	 *contents);
gchar	     *egg_str_get_md5_str    (const gchar	 *contents);

EggMd5Digest *egg_md5_str_to_digest  (const gchar	 *str_digest);
gchar	     *egg_md5_digest_to_str  (const EggMd5Digest *md5_digest);

EggMd5Digest *egg_md5_digest_dup     (const EggMd5Digest *src);
#define	      egg_md5_digest_free    g_free

guint	      egg_md5_digest_hash   (gconstpointer	  digest);
gboolean      egg_md5_digest_equal  (gconstpointer	  digest1,
				     gconstpointer	  digest2);

GdkPixbuf-level thumbnai/metadatal API:

typedef enum /* <prefix=EGG_PIXBUF_THUMB> */

/* Convenience API, handles loading/creation/auto-failure-saving */
GdkPixbuf *egg_pixbuf_get_thumbnail_for_file (const gchar
					      EggPixbufThumbSize   size,
					      GError             **error);

/* Just reads/checks the appropriate ~/.thumbnails/blah.png */
GdkPixbuf *egg_pixbuf_load_thumbnail  (const gchar        *uri,
				       gint64              mtime,
				       EggPixbufThumbSize  size);

/* Saves a pixbuf w/ previously-set URI/mtime metadata */
gboolean   egg_pixbuf_save_thumbnail  (GdkPixbuf    *thumbnail,
				       GError      **error,
gboolean   egg_pixbuf_save_thumbnailv (GdkPixbuf  *thumbnail,
			               gchar     **keys,
			               gchar     **values,
			               GError    **error);

/* Failed thumbnail handling */
/* Reads propriatary data from thumbnail file to fill @error */
gboolean egg_pixbuf_has_failed_thumbnail  (const gchar  *uri,
					   gint64        mtime,
					   GError      **error);
/* Saves propriatary failure data from @error */
void     egg_pixbuf_save_failed_thumbnail (const gchar  *uri,
					   gint64        mtime,
					   const GError *error);

/* Scales an existing pixbuf and adds required metadata */
GdkPixbuf *egg_pixbuf_create_thumbnail   (GdkPixbuf          *pixbuf,
					  const gchar        *uri,
					  gint64              mtime,
					  EggPixbufThumbSize  size);

/* Adds metadata via gdk_pixbuf_set_option() */
gboolean   egg_pixbuf_add_thumbnail_data (GdkPixbuf          *pixbuf,
					  const gchar        *uri,
					  gint64              mtime,
					  EggPixbufThumbSize  size);
/* Checks if a pixbuf has required metadata */
gboolean   egg_pixbuf_has_thumbnail_data (GdkPixbuf          *pixbuf);

/* Metadata accessors -- wrappers around gdk_pixbuf_(get/set)_option()
EggPixbufThumbSize    egg_pixbuf_get_thumb_size (GdkPixbuf
gboolean	      egg_pixbuf_set_thumb_size (GdkPixbuf          *thumbnail,
						 EggPixbufThumbSize  size);

G_CONST_RETURN gchar *egg_pixbuf_get_thumb_uri (GdkPixbuf   *thumbnail);
gboolean	      egg_pixbuf_set_thumb_uri (GdkPixbuf   *thumbnail,
						const gchar *uri);
G_CONST_RETURN gchar *egg_pixbuf_get_thumb_mime_type (GdkPixbuf
gboolean	      egg_pixbuf_set_thumb_mime_type (GdkPixbuf   *thumbnail,
						      const gchar *mime_type);
G_CONST_RETURN gchar *egg_pixbuf_get_thumb_description (GdkPixbuf
gboolean	      egg_pixbuf_set_thumb_description (GdkPixbuf   *thumbnail,
						        const gchar *description);
gint64		      egg_pixbuf_get_thumb_mtime (GdkPixbuf *thumbnail);
gboolean	      egg_pixbuf_set_thumb_mtime (GdkPixbuf *thumbnail,
						  gint64     mtime);
gint64		      egg_pixbuf_get_thumb_filesize (GdkPixbuf *thumbnail);
gboolean	      egg_pixbuf_set_thumb_filesize (GdkPixbuf *thumbnail,
						     gint64     filesize);
gint		      egg_pixbuf_get_thumb_image_width (GdkPixbuf *thumbnail);
gboolean	      egg_pixbuf_set_thumb_image_width (GdkPixbuf *thumbnail,
							gint       image_width);
gint		      egg_pixbuf_get_thumb_image_height (GdkPixbuf *thumbnail);
gboolean	      egg_pixbuf_set_thumb_image_height (GdkPixbuf *thumbnail,
							 gint       image_height);
gint		      egg_pixbuf_get_thumb_document_pages (GdkPixbuf *thumbnail);
gboolean	      egg_pixbuf_set_thumb_document_pages (GdkPixbuf
							   gint       document_pages);
gint64		      egg_pixbuf_get_thumb_movie_length (GdkPixbuf *thumbnail);
gboolean	      egg_pixbuf_set_thumb_movie_length (GdkPixbuf *thumbnail,
							 gint64     movie_length);

G_CONST_RETURN gchar *egg_pixbuf_get_thumb_software (GdkPixbuf

/* Gets the thumbnail filename for @uri at @size */
gchar                *egg_pixbuf_get_thumb_filename (const gchar
				                     EggPixbufThumbSize  size);

The only real addition to that thumbnailing API is "load_at_size" and
"get_for_file_at_size" to load a pixbuf at a pre-determined pixel size
(mainly to speed pixbuf loading when !128/!256-pixel sizes are desired).
Carlos Garnacho Parro (added to CC) had mentioned wanting to do a
GtkImagePreview widget which would be useful for things like the
wallpaper-properties capplet (and the chooser API described below) as
well as any other "pick an image from a file chooser" cases.


Finally, an EggIconChooser API to superceed GnomeIconSelection. I had
originally wanted to do a mixed icon/image chooser, but that proved to
be massive overkill, a horribly bad API, and a *lot* of wasted work, so
I'm returning to the basic IconChooser idea (which I managed to
accidentally delete in the meantime :-(). The UI will look something
like that described in [
id=128723]. I've got the EggIconChooserIface API back up and compiling
(but better):

gboolean       egg_icon_chooser_get_select_multiple  (EggIconChooser
void	       egg_icon_chooser_set_select_multiple  (EggIconChooser
						      gboolean        select_multiple);

void	       egg_icon_chooser_unselect_all         (EggIconChooser

/* Icon theme context, NULL for "All icons", "gtk-custom" to switch to
custom pane */
gchar         *egg_icon_chooser_get_context          (EggIconChooser
void           egg_icon_chooser_set_context          (EggIconChooser
						      const gchar    *context);

/* Useful for an icon theme editor, but should it be here? */
GtkIconTheme  *egg_icon_chooser_get_icon_theme       (EggIconChooser
void           egg_icon_chooser_set_icon_theme       (EggIconChooser
						      GtkIconTheme   *icon_theme);

/* The icon pane's selection */
GSList	      *egg_icon_chooser_get_icons            (EggIconChooser
gchar         *egg_icon_chooser_get_icon             (EggIconChooser
void           egg_icon_chooser_set_icon             (EggIconChooser
						      const gchar    *icon);
gboolean       egg_icon_chooser_select_icon          (EggIconChooser
						      const gchar    *icon_name);
void           egg_icon_chooser_unselect_icon        (EggIconChooser
						      const gchar    *icon_name);

/* Show the "custom" file-chooser pane */
gboolean       egg_icon_chooser_get_allow_custom     (EggIconChooser
void	       egg_icon_chooser_set_allow_custom     (EggIconChooser
						      gboolean        allow_custom);

/* The file-chooser pane */
GSList	      *egg_icon_chooser_get_uris             (EggIconChooser
gchar         *egg_icon_chooser_get_uri              (EggIconChooser
void           egg_icon_chooser_set_uri              (EggIconChooser
						      const gchar    *uri);
gboolean       egg_icon_chooser_select_uri           (EggIconChooser
						      const gchar    *uri);
void           egg_icon_chooser_unselect_uri         (EggIconChooser
						      const gchar    *uri);

GSList	      *egg_icon_chooser_get_filenames        (EggIconChooser
gchar         *egg_icon_chooser_get_filename         (EggIconChooser
void           egg_icon_chooser_set_filename         (EggIconChooser
						      const gchar    *filename);
gboolean       egg_icon_chooser_select_filename      (EggIconChooser
						      const gchar    *filename);
void           egg_icon_chooser_unselect_filename    (EggIconChooser
						      const gchar    *filename);

GSList	      *egg_icon_chooser_list_custom_filters  (EggIconChooser
void	       egg_icon_chooser_add_custom_filter    (EggIconChooser
						      GtkFileFilter  *filter);
void	       egg_icon_chooser_remove_custom_filter (EggIconChooser
						      GtkFileFilter  *filter);

GtkFileFilter *egg_icon_chooser_get_custom_filter    (EggIconChooser
void           egg_icon_chooser_set_custom_filter    (EggIconChooser
						      GtkFileFilter  *filter);

One possible addition I can see for this is controlling which icon-theme
contexts are visible from inside apps.

I still have to (somewhat) rewrite the code for this, but it's mostly
copy/paste/cleanup-alot from the EggImageChooser (the dead-end).

Anyhow, that's all of what I've been doing lately, I can put any/all of
these in libegg (or hack up some patches) if desired. :-)


    Jim Cape

    "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]