GtkOptionMenu needs replacing with GtkComboBox

Bug #903671 reported by Alex Valavanis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
John Smith

Bug Description

There are a few uses of the GtkOptionMenu API, which has been deprecated since gtk 2.4 and is removed in gtk3. This needs to be replaced by the GtkComboBox API.

There is some guidance available at http://developer.gnome.org/gtk/stable/gtk-migrating-GtkComboBox.html#migrating-GtkOptionMenu

Remaining source files that use GtkOptionMenu:
* widgets/gradient-vector.cpp

Tags: build
Changed in inkscape:
status: New → Triaged
Revision history for this message
Codain (codain) wrote :

Be carefull with the guidance: in the Gnome dev center they said that functions such as :

gtk_combo_box_new_text()
gtk_combo_box_append_text()
(and maybe others)

That are used in the guidance as a replacement of the old way are deprecated since GTK 2.24. We should use a dedicated class : GtkComboBoxText

See http://developer.gnome.org/gtk/stable/GtkComboBox.html#gtk-combo-box-new-text

It's crasy that the same website propose to replace deprecated functions by others deprecated functions!

I've looked at the source files, Inkscape uses mainly GtkOptionMenu (the old way) for combo box that show items with pictures (gradients or stops). So the GtkComboBoxText could be not usefull here.

John Smith (john-smithi)
Changed in inkscape:
assignee: nobody → John Smith (john-smithi)
Revision history for this message
John Smith (john-smithi) wrote :

r11072 : Fill and Stroke Dashes OptionMenu replaced with Gtk::Combobox. Dash preview simplified with Cairo rendering.

Kris (kris-degussem)
Changed in inkscape:
status: Triaged → Fix Committed
Revision history for this message
su_v (suv-lp) wrote :

> Triaged → Fix Committed

AFAICT there are others still in need to be replaced (e.g. markers, units selector in some places) - based e.g. on the 'ClearlooksTest' theme from <http://git.gnome.org/browse/gnome-themes/tree/gtk-themes/ClearlooksTest/gtkrc#n429> which highlights deprecated widgets.

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Yes, there are still quite a few places that need attention. See the buildlogs for bug #367607 and bug #943225 for details.

Changed in inkscape:
status: Fix Committed → In Progress
description: updated
Revision history for this message
John Smith (john-smithi) wrote :

r11077 : Gradient tool toolbar gradient selector gtk_option_menu replaced with gtk_combo_box.

Includes some small changes:
* Gradient Preview "icon" moved to the left of the label (seems more natural and similar to other combo_boxes such as Fill and Stroke Markers/Layers. Will change the Gradient Editor and Fill Stroke gradient (bug #722017) to match this as well .
* Text "No gradients in selection" replaced with "No gradient" in the list for objects with no gradient.
* Reduced height of the selected gradient preview icon by a few pixels.

Revision history for this message
su_v (suv-lp) wrote : Re: [Bug 903671] Re: GtkOptionMenu needs replacing with GtkComboBox

With regard to the gradient tool controls bar:
> Includes some small changes:
> (…)
> * Reduced height of the selected gradient preview icon by a few
> pixels.

- Previously, the height of the preview apparently scaled with the theme
settings (icons/toolbar size (?)), now it uses a fixed height (see
attached screenshot: with the new fixed height, it looks noticeably
smaller with 'Ambiance', but not necessarily with other themes). Any
chance that the new preview image can adjust to theme settings, e.g. by
referring to the toolbar icon size?

- The size of the popup list from the GtkComboBox is much larger with
regard to vertical spacing: is this due to the fixed size of the
gradient preview image? Could it be made a bit more compact
(vertically)? Or are there theme settings which would allow to adjust
the height for compact themes?

Revision history for this message
John Smith (john-smithi) wrote :

@suv, thanks for doing those comparisons - very useful.

Indeed the size of the gradient preview is fixed.
The new ComboBox only accepts a fixed size image (GtkCellRendererPixbuf)
The deprecated OptionMenu can take a variable sized GtkWidget, that scales with the menu/theme size.

I am looking for a way to determine the size of the various theme objects (row height etc) , and scale the Pixbuf if possible ...

Revision history for this message
John Smith (john-smithi) wrote :

r11082 : SPUnitSelector (used in Stroke Style width and Export) gtk_option_menu replaced with gtk_combo_box.

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Looks like there's just one more to go!
* widgets/gradient-vector.cpp

description: updated
Revision history for this message
John Smith (john-smithi) wrote :

r11089 : widgets/gradient-vector.cpp
Includes some small changes:
* Gradient preview moved to the left of the label in gradient comboboxes to match the gradient toolbar (64x18 px close to existing size)
* Gradient label consistent with the gradient toolbar (removed #linearGradient / #radialGradient)

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Awesome... looks like that's the end of it!

Changed in inkscape:
status: In Progress → Fix Committed
Revision history for this message
su_v (suv-lp) wrote :

@John - any chance you could take a look at bug #959223?
(AFAICT a recent regression introduced in r11082 which badly affects working with multiple stroked paths)

Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.