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.

[snip]

>  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.

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

Look:
    - 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
OPEN/SELECT.
	    [ thefile.txt       | o ]
	+ _GtkFileChooserEntry w/ the "open" icon togglebutton for SAVE/CREATE.
	    [_thefile.txt______][ o ]

Behavior:
    - Autocomplete using _GtkFileChooserEntry.
    - clicking togglebutton/"active" property opens
GtkFileChooserDialog.
    - proper signal filtering (update-preview always, others on
Ok/Cancel)

Possible:
    - Use of a custom-GtkComboBox (with _GtkFileChooserEntry) instead of
entry/button to display a history (and rename to GtkFileChooserCombo
[Box])?

Currently the sources for this are in

http://esco.mine.nu/downloads/user-selector-applet-0.0.7.tar.gz

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
http://esco.mine.nu/downloads/eggpixbufthumbnail.tar.bz2

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> */
{
  EGG_PIXBUF_THUMB_UNKNOWN = -1,
  EGG_PIXBUF_THUMB_NORMAL  = 128,
  EGG_PIXBUF_THUMB_LARGE   = 256
}
EggPixbufThumbSize;


/* Convenience API, handles loading/creation/auto-failure-saving */
GdkPixbuf *egg_pixbuf_get_thumbnail_for_file (const gchar
*filename,
					      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
*thumbnail);
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
*thumbnail);
gboolean	      egg_pixbuf_set_thumb_mime_type (GdkPixbuf   *thumbnail,
						      const gchar *mime_type);
G_CONST_RETURN gchar *egg_pixbuf_get_thumb_description (GdkPixbuf
*thumbnail);
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
*thumbnail,
							   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
*thumbnail);

/* Gets the thumbnail filename for @uri at @size */
gchar                *egg_pixbuf_get_thumb_filename (const gchar
*uri,
				                     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 [http://bugzilla.gnome.org/show_bug.cgi?
id=128723]. I've got the EggIconChooserIface API back up and compiling
(but better):

gboolean       egg_icon_chooser_get_select_multiple  (EggIconChooser
*chooser);
void	       egg_icon_chooser_set_select_multiple  (EggIconChooser
*chooser,
						      gboolean        select_multiple);

void	       egg_icon_chooser_unselect_all         (EggIconChooser
*chooser);

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

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

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

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

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

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

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

GtkFileFilter *egg_icon_chooser_get_custom_filter    (EggIconChooser
*chooser);
void           egg_icon_chooser_set_custom_filter    (EggIconChooser
*chooser,
						      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. :-)

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