A New File Selector for GTK+ Owen Taylor Red Hat, Inc - - PowerPoint PPT Presentation

a new file selector for gtk
SMART_READER_LITE
LIVE PREVIEW

A New File Selector for GTK+ Owen Taylor Red Hat, Inc - - PowerPoint PPT Presentation

A New File Selector for GTK+ Owen Taylor Red Hat, Inc otaylor@redhat.com FOSDEM, 9 February 2003 Outline GTK+-2.4 overview The old file selector Other file selectors Fitting into the environment API considerations Conclusions API


slide-1
SLIDE 1

A New File Selector for GTK+

Owen Taylor Red Hat, Inc

  • taylor@redhat.com

FOSDEM, 9 February 2003

slide-2
SLIDE 2

Outline

GTK+-2.4 overview The old file selector Other file selectors Fitting into the environment API considerations Conclusions API sketch Other 2.4 features

slide-3
SLIDE 3

GTK+ History

Development begins - Mid 1996 1.0 - April 1998 1.2 - February 1999

DND, Themes, GtkCTree, separate GLib

2.0 - March 2002

GtkTextView, GtkTreeView, Win32 port, GObject, Pango, ATK

2.2 - December 2002

Multihead, Xft2

slide-4
SLIDE 4

GTK+ 2.4

Schedule

1 January - Start of development 1 July - Feature freeze 1 August - API/ABI freeze 1 September - Release

Possible features

New file selector New Menu API Enhanced toolbar Replacement for GtkCombo and GtkOptionMenu Height-for-width geometry management Disclosure triangle widget

http://gtk.org/plan/2.4

slide-5
SLIDE 5

GtkFileSel

Features

Dropdown for parent directories Directory list File list File name entry

slide-6
SLIDE 6

GtkFileSel

Features

Dropdown for parent directories Directory list File list

slide-7
SLIDE 7

GtkFileSel

Bad

No way to get to frequent used locations No obvious filtering features No extra details about files

slide-8
SLIDE 8

GtkFileSel

Good

Simple Powerful tab completion

slide-9
SLIDE 9

Qt File Selector

slide-10
SLIDE 10

Mozilla File Selector

slide-11
SLIDE 11

Java File Selector

slide-12
SLIDE 12

Windows XP File Selector

slide-13
SLIDE 13

KDE File Selector

slide-14
SLIDE 14

OS X file selector

slide-15
SLIDE 15

OS X file selector

slide-16
SLIDE 16

OS X file selector

slide-17
SLIDE 17

Loading versus Saving

Loading

Previews

Saving

Create new folders Type in new file name Often don’t need to navigate filesystem

slide-18
SLIDE 18

Allow using platform native widgets?

Disadvantages

Are frequently modal only Won’t derive from GtkDialog Don’t allow customization with embedded GTK+ widgets Will cause inconsistency between when we can use them and when we can’t

No platform widgets Allow platform customized file selectors

Use a similar layout to native selector Pick up native icons, thumbnails, filetypes

slide-19
SLIDE 19

API Issue - Virtual filesystems

Virtual file system

ftp:, http:

Lack of standardization of URI schemes a problem

KDE - fish: GNOME - ssh:

Can implement gnome-vfs support as a plugin But plain GTK+ apps won’t under gnome-vfs URIs Need:

gtk_file_chooser_set_understands_uris()

slide-20
SLIDE 20

API Issue - Desktop integration

Do we want to allow replacement of the GUI

Implement filesel in Nautilus process? Filesel customized to look like Win32, OS X

Do we need integration?

File selector is modal File manager allows full set of operations

Need to get:

Favorite / recent locations Icons Mime types VFS integration

slide-21
SLIDE 21

API Issue - Application customization

Custom preview widget Custom thumbnails File type selection for saving Random controls

Open-readonly

Things that reduce customizability

Allowing total desktop integration Using native file selector (completely)

slide-22
SLIDE 22

API Issue - static methods?

response = gtk_file_chooser_open_file ("Title"); vs: GtkWidget *chooser = gtk_file_chooser_dialog_new (GTK_FILE_CHOOSER_OPEN); if (gtk_dialog_run (GTK_DIALOG (chooser) == GTK_RESPONSE_OK)) { name = gtk_file_chooser_dialog_get_name (GTK_FILE_CHOOSER (chooser)); } gtk_widget_destroy (chooser);

Shorter, but API more complex

slide-23
SLIDE 23

Conclusions

No native dialogs Allow plugin file systems Think about replacement widgets for future No static methods Application customization

Custom preview widget Pack extra widgets

slide-24
SLIDE 24

GtkFileChooser

GtkFileChooserROX GtkFileChooserWin32 CtkFilterChooserDefault GtkFileChooserDialog GtkFileChooserWidget

slide-25
SLIDE 25

GtkFileChooser

Same set of methods for

Dialog Embeddable widget Replacement widgets "Lasagna API"

Use an interface - GtkFileChooser Methods:

select_uri deselect_uri add_filter remove_filter add_accessory_widget ...

slide-26
SLIDE 26

Filter objects

Standard types:

Filename Mime type Callback

Associated human readable name

GtkFileFilter *filter = gtk_file_filter_new (); gtk_file_filter_add_mimetype (filter, "image/jpeg"); gtk_file_filter_add_mimetype (filter, "image/png"); gtk_file_filter_add_mimetype (filter, "image/x-xcf"); gtk_file_filter_set_label (filter, "Images (JPEG,PNG,XCF)"); gtk_file_chooser_add_filter (chooser, filter);

slide-27
SLIDE 27

File system object

Loaded from dynamic module Works entirely in terms of URIs Operations

List roots Iterator for walking heirarchy Create folder Get details (mime type, file size, modification date) Get icon

slide-28
SLIDE 28

Preview API

To set custom preview widget:

gtk_file_chooser_set_preview_widget()

When get ::update-preview signal, either:

Have preview for file

gtk_file_chooser_set_has_preview (chooser, TRUE); [ Update chooser]

No preview for file

gtk_file_chooser_set_has_preview (chooser, FALSE);

slide-29
SLIDE 29

Where from here

Convert API sketch into header files Get first implementation into GTK+

? Reuse of code from EggFileSelector (Bastien Nocera) ?

Get UI design (GNOME UI team) Implement UI design Iterate until everybody is minimally unhappy Release

slide-30
SLIDE 30

New ComboBox - Kristian Rietveld

Get rid of the GtkList usage

(GtkList => GtkCList => GtkTreeView)

Unify GtkCombo, GtkOptionMenu

Appearance should be theme issue

Handle things like color, fill style combos Grids of choices

(Involves adding grid menus)

Completion

slide-31
SLIDE 31

New menu/toolbar API (jhmenu) - James Henstridge

Action based ("Print", "Save") Organization independent from action definition

Allows rearrangement

Do merging

Merge entry entries into main menu Inter-process merging

slide-32
SLIDE 32

Improved toolbar (EggToolbar) - Anders Carlsson

Clean up GtkToolbar API Handle overflows Miscellaneous improvements

Non-homogeneous buttons Priority text?

slide-33
SLIDE 33

Object private data

Public structures Private structures GObjectPrivate GtkWidgetPrivate GtkEntryPrivate GObject GtkWidget GtkEntry