What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6...
Transcript of What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6...
![Page 1: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/1.jpg)
What's new in GTK+ 2.6
Matthias [email protected]
GUADEC 2005Stuttgart, Germany
May 29 – May 1, 2005
![Page 2: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/2.jpg)
What's new in GTK+ 2.6
● New or improved widgets● New cell renderers● Clipboard improvements● Ellipsization and rotated text● Named icons● Better desktop integration
![Page 3: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/3.jpg)
GtkIconView
● intended to replace GnomeIconList● model-view, uses tree models● currently no editing, no DND support
![Page 4: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/4.jpg)
GtkIconView
Setting up the model:model = gtk_list_store_new (2, G_TYPE_STRING, GDK_TYPE_PIXBUF);gtk_icon_view_set_model (view, model); gtk_icon_view_set_text_column (view, 0);gtk_icon_view_set_pixbuf_column (view, 1);
Appending an item:pixbuf = gdk_pixbuf_new_from_file ("file.png");gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, 0, pixbuf, 1, "text", -1);
GnomeIconList:gnome_icon_list_append (list, "file.png", "text");
![Page 5: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/5.jpg)
GtkAboutDialog
● replaces GnomeAbout● supports hyperlinks, clickable email addresses● very easy to use, 1-function setup
![Page 6: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/6.jpg)
Showing an about dialog:gtk_show_about_dialog (GTK_WINDOW (window), “ name", "GTK+ Code Demos", “ version", "2.6.3", "copyright", "(C) 1997-2004 The GTK+ Team", "license", license, "website", "http://www.gtk.org", "comments", "Program to demonstrate GTK+ functions.", "authors", authors, "documenters", documentors, "logo", pixbuf, NULL);
Making links clickable:gtk_about_dialog_set_email_hook (open_link, NULL, NULL);gtk_about_dialog_set_url_hook (open_link, NULL, NULL);
![Page 7: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/7.jpg)
GtkFileChooserButton
● replaces GnomeFileEntry● implements GtkFileChooser API● only open and select-folder modes
![Page 8: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/8.jpg)
GtkMenuToolButton
● provides dropdown menus for toolbar buttons● derived from similar widgets in Epiphany, Galeon
and Gedit
![Page 9: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/9.jpg)
GtkComboBox
● supports trees● separators● insensitive items● list mode improvements: selection follows mouse,
expand/collapse on hover
![Page 10: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/10.jpg)
GtkComboBox
Rendering separators:gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo), is_separator, NULL, NULL);
gboolean is_separator (GtkTreeModel *model, GtkTreeIter *iter, gpointer data){ gboolean result;
gtk_tree_model_get (model, iter, SEPARATOR_COLUMN, &result, -1);
return result; }
![Page 11: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/11.jpg)
GtkComboBox
Making rows insensitive (a row is insensitive if all visible rows are insensitive):
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), pixbuf_renderer,
"pixbuf", PIXBUF_COLUMN, "sensitive", SENSITIVE_COLUMN,
NULL);
![Page 12: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/12.jpg)
GtkCellRendererProgress
● displays a numeric value as a progress bar
![Page 13: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/13.jpg)
GtkCellRendererCombo
● derived from GtkCellRendererText● uses a GtkComboBox to edit● uses a separate tree model for allowed values
![Page 14: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/14.jpg)
GtkCellRendererCombo
renderer = gtk_cell_renderer_combo_new ();g_object_set (renderer, "editable", TRUE, “ has-entry”, FALSE, "model", numbers_model, "text-column", COLUMN_NUMBER_TEXT, NULL);
gtk_tree_view_insert_column_with_attributes (treeview, -1, "Number", renderer, "text", TEXT_COLUMN, NULL);
g_signal_connect (renderer, "edited", G_CALLBACK (cell_edited), model);
![Page 15: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/15.jpg)
Clipboard improvements● can store clipboard data at exit (requires a
clipboard manager)● API for handling URIs● API for handling images:
gtk_clipboard_set_image()gtk_clipboard_request_image()
gtk_selection_data_set_pixbuf()gtk_selection_data_get_pixbuf()
gtk_drag_source_add_image_targets()gtk_drag_dest_add_image_targets()
![Page 16: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/16.jpg)
Text display● Text can be ellipsized if it does not fit● Text can be rendered at an angle● But not both at the same time...
gtk_label_set_max_width_chars()gtk_file_chooser_button_width_chars()
● Useful functions:
![Page 17: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/17.jpg)
Named icons● follow the icon theme● can be used for window icons● can be used in GtkImage
![Page 18: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/18.jpg)
Desktop integration
● display of icons in buttons● display of icons in menus● button order in dialogs
GTK+ 2.6 has settings to control
The Windows port includes the Wimp theme engine and the IME input method
![Page 19: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/19.jpg)
What will be new in GTK+ 2.8● Cairo rendering● Visuals with an alpha channel● Iconview improvements
![Page 20: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/20.jpg)
Cairo rendering, RGBA visuals● Owen talked about these
![Page 21: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/21.jpg)
Iconview improvements● Use cell renderers● Support DND
![Page 22: What's new in GTK+ 2people.redhat.com/mclasen/GUADEC05/slides.pdf · What's new in GTK+ 2.6 Matthias Clasen mclasen@redhat.com GUADEC 2005 Stuttgart, Germany May 29 – May 1, 2005](https://reader036.fdocuments.net/reader036/viewer/2022070923/5fbb08fb6d983e59307e59ac/html5/thumbnails/22.jpg)
References● GTK+ migration checklist● Detailed migration guides for GnomeIconList,
GnomeAbout, GnomeColorPicker● Lists of new symbols in GTK+ 2.2, 2.4 and 2.6
(all of these in the GTK+ API documentation: http://www.gtk.org/api )
● Code examples in gtk-demo