From 4af19c56cf90e31a0d800821e8daf7fb08108e94 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 26 Nov 2012 10:33:19 +0000 Subject: Drop support for GTK+ < 2.24 Fixed bugs: - https://launchpad.net/bugs/1069024 (bzr r11907) --- src/ui/widget/frame.cpp | 2 -- src/ui/widget/gimpspinscale.c | 10 ---------- src/ui/widget/preferences-widget.cpp | 13 ------------- src/ui/widget/unit-menu.cpp | 14 +------------- 4 files changed, 1 insertion(+), 38 deletions(-) (limited to 'src/ui/widget') diff --git a/src/ui/widget/frame.cpp b/src/ui/widget/frame.cpp index b2968f806..eaa4336bb 100644 --- a/src/ui/widget/frame.cpp +++ b/src/ui/widget/frame.cpp @@ -56,9 +56,7 @@ Frame::set_label(const Glib::ustring &label_text, gboolean label_bold /*= TRUE*/ void Frame::set_padding (guint padding_top, guint padding_bottom, guint padding_left, guint padding_right) { -#if WITH_GTKMM_2_24 _alignment.set_padding(padding_top, padding_bottom, padding_left, padding_right); -#endif } Gtk::Label const * diff --git a/src/ui/widget/gimpspinscale.c b/src/ui/widget/gimpspinscale.c index df39b9644..222a8aa1d 100644 --- a/src/ui/widget/gimpspinscale.c +++ b/src/ui/widget/gimpspinscale.c @@ -432,12 +432,7 @@ static gboolean gdk_cairo_region (cr, event->region); cairo_clip (cr); -#if GTK_CHECK_VERSION(2, 24,0) w = gdk_window_get_width (event->window); -#else - gdk_drawable_get_size (event->window, &w, NULL); -#endif - #endif cairo_set_line_width (cr, 1.0); @@ -687,12 +682,7 @@ gimp_spin_scale_change_value (GtkWidget *widget, gimp_spin_scale_get_limits (GIMP_SPIN_SCALE (widget), &lower, &upper); -#if GTK_CHECK_VERSION(2, 24,0) width = gdk_window_get_width (text_window); -#else - gdk_drawable_get_size (text_window, &width, NULL); -#endif - #endif diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index b793893c7..e7e317d11 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -378,12 +378,7 @@ ZoomCorrRuler::redraw() { Glib::RefPtr window = get_window(); Cairo::RefPtr cr = window->create_cairo_context(); -#if WITH_GTKMM_2_24 int w = window->get_width(); -#else - int w, h; - window->get_size(w, h); -#endif _drawing_width = w - _border * 2; cr->set_source_rgb(1.0, 1.0, 1.0); @@ -597,11 +592,7 @@ void PrefCombo::init(Glib::ustring const &prefs_path, for (int i = 0 ; i < num_items; ++i) { -#if WITH_GTKMM_2_24 this->append(labels[i]); -#else - this->append_text(labels[i]); -#endif _values.push_back(values[i]); if (value == values[i]) row = i; @@ -623,11 +614,7 @@ void PrefCombo::init(Glib::ustring const &prefs_path, for (int i = 0 ; i < num_items; ++i) { -#if WITH_GTKMM_2_24 this->append(labels[i]); -#else - this->append_text(labels[i]); -#endif _ustr_values.push_back(values[i]); if (value == values[i]) row = i; diff --git a/src/ui/widget/unit-menu.cpp b/src/ui/widget/unit-menu.cpp index 86e8c9e58..18b7bcab9 100644 --- a/src/ui/widget/unit-menu.cpp +++ b/src/ui/widget/unit-menu.cpp @@ -34,11 +34,7 @@ bool UnitMenu::setUnitType(UnitType unit_type) UnitTable::UnitMap::iterator iter = m.begin(); while(iter != m.end()) { Glib::ustring text = (*iter).first; -#if WITH_GTKMM_2_24 append(text); -#else - append_text(text); -#endif ++iter; } _type = unit_type; @@ -49,11 +45,7 @@ bool UnitMenu::setUnitType(UnitType unit_type) bool UnitMenu::resetUnitType(UnitType unit_type) { -#if WITH_GTKMM_2_24 - remove_all(); -#else - clear_items(); -#endif + remove_all(); return setUnitType(unit_type); } @@ -61,11 +53,7 @@ bool UnitMenu::resetUnitType(UnitType unit_type) void UnitMenu::addUnit(Unit const& u) { _unit_table.addUnit(u, false); -#if WITH_GTKMM_2_24 append(u.abbr); -#else - append_text(u.abbr); -#endif } Unit UnitMenu::getUnit() const -- cgit v1.2.3 From 083e48b0f1e09b0f9056c6cda5a6f344a457583b Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 27 Nov 2012 23:31:10 +0000 Subject: GTK+ 3: Migrate to GdkRGBA (bzr r11910) --- src/ui/widget/gimpspinscale.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/ui/widget') diff --git a/src/ui/widget/gimpspinscale.c b/src/ui/widget/gimpspinscale.c index 222a8aa1d..f9f9a3807 100644 --- a/src/ui/widget/gimpspinscale.c +++ b/src/ui/widget/gimpspinscale.c @@ -408,21 +408,20 @@ static gboolean gimp_spin_scale_expose (GtkWidget *widget, GdkEventExpose *event) #endif { - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - GtkStyle *style = gtk_widget_get_style (widget); - + GimpSpinScalePrivate *private = GET_PRIVATE (widget); #if WITH_GTKMM_3_0 + GtkStyleContext *style = gtk_widget_get_style_context(widget); GtkAllocation allocation; + GdkRGBA color; cairo_save (cr); GTK_WIDGET_CLASS (parent_class)->draw (widget, cr); cairo_restore (cr); gtk_widget_get_allocation (widget, &allocation); - - #else + GtkStyle *style = gtk_widget_get_style (widget); cairo_t *cr; gint w; @@ -499,12 +498,17 @@ static gboolean #if WITH_GTKMM_3_0 cairo_move_to (cr, layout_offset_x, text_area.y + layout_offset_y-3); + + gtk_style_context_get_color (style, gtk_widget_get_state_flags (widget), + &color); + + gdk_cairo_set_source_rgba (cr, &color); #else cairo_move_to (cr, layout_offset_x, layout_offset_y-3); -#endif - + gdk_cairo_set_source_color (cr, &style->text[gtk_widget_get_state (widget)]); +#endif pango_cairo_show_layout (cr, private->layout); } -- cgit v1.2.3