Control Bar

Control Bar — How to migrate Control Bars

Migrating Control Bars

ControlBar widgets are deprecated since Hildon 2.2 and a GtkScale should be used to accomplish the same functionality.

To make a GtkScale have the same functionality as a control bar you'll need to change some properties of the widget's Adjustment so it has a range equal to the control bar's as well as the step increment.

The following example shows a control bar with the range of 0 to 4.

Example 30. A Typical Control Bar


HildonControlbar *bar = HILDON_CONTROLBAR (hildon_controlbar_new ());
hildon_controlbar_set_range (bar, 1, 4);
hildon_controlbar_set_value (bar, 2);

        

To accomplish the same functionality as the previous control bar example, one could use something like in the following example.

Example 31. A Replacement for the Control Bar


GtkHScale *scale = GTK_HSCALE (hildon_gtk_hscale_new ());
GtkAdjustment *adjustment = GTK_ADJUSTMENT (
                        gtk_range_get_adjustment (GTK_RANGE (scale)));
g_object_set (adjustment, "step-increment", 1, "lower", 0, NULL);
g_object_set (adjustment, "upper", 4, NULL);
g_object_set (adjustment, "value", 2, NULL);