summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2016-08-04 11:26:03 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2016-08-04 11:26:03 +0000
commit16fbf83a79ecd1882817598b74a14c07115a5a2c (patch)
tree9b33850b019c65f9780d9d7cc09df65b9ad6836b /src/widgets
parentFix Win32 build (diff)
parentruler: Backport upstream patches (diff)
downloadinkscape-16fbf83a79ecd1882817598b74a14c07115a5a2c.tar.gz
inkscape-16fbf83a79ecd1882817598b74a14c07115a5a2c.zip
End GTK+ 2 support and remove GDL fork
(bzr r15038)
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/CMakeLists.txt7
-rw-r--r--src/widgets/Makefile_insert8
-rw-r--r--src/widgets/button.cpp29
-rw-r--r--src/widgets/dash-selector.cpp14
-rw-r--r--src/widgets/dash-selector.h5
-rw-r--r--src/widgets/desktop-widget.cpp179
-rw-r--r--src/widgets/eek-preview.cpp148
-rw-r--r--src/widgets/ege-adjustment-action.cpp12
-rw-r--r--src/widgets/ege-output-action.cpp6
-rw-r--r--src/widgets/ege-select-one-action.cpp32
-rw-r--r--src/widgets/font-selector.cpp33
-rw-r--r--src/widgets/gradient-image.cpp45
-rw-r--r--src/widgets/gradient-selector.cpp13
-rw-r--r--src/widgets/gradient-selector.h8
-rw-r--r--src/widgets/gradient-vector.cpp65
-rw-r--r--src/widgets/gradient-vector.h8
-rw-r--r--src/widgets/icon.cpp51
-rw-r--r--src/widgets/ink-action.cpp42
-rw-r--r--src/widgets/ink-comboboxentry-action.cpp14
-rw-r--r--src/widgets/paint-selector.cpp54
-rw-r--r--src/widgets/paint-selector.h8
-rw-r--r--src/widgets/ruler.cpp187
-rw-r--r--src/widgets/select-toolbar.cpp6
-rw-r--r--src/widgets/sp-attribute-widget.cpp27
-rw-r--r--src/widgets/sp-attribute-widget.h9
-rw-r--r--src/widgets/sp-color-selector.cpp6
-rw-r--r--src/widgets/sp-color-selector.h9
-rw-r--r--src/widgets/sp-widget.cpp30
-rw-r--r--src/widgets/sp-xmlview-attr-list.cpp19
-rw-r--r--src/widgets/sp-xmlview-content.cpp19
-rw-r--r--src/widgets/sp-xmlview-tree.cpp20
-rw-r--r--src/widgets/spw-utilities.cpp69
-rw-r--r--src/widgets/spw-utilities.h12
-rw-r--r--src/widgets/stroke-style.cpp60
-rw-r--r--src/widgets/stroke-style.h11
-rw-r--r--src/widgets/text-toolbar.cpp19
-rw-r--r--src/widgets/toolbox.cpp55
37 files changed, 82 insertions, 1257 deletions
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
index 225afe317..ba71b39f4 100644
--- a/src/widgets/CMakeLists.txt
+++ b/src/widgets/CMakeLists.txt
@@ -33,6 +33,7 @@ set(widgets_SRC
gradient-toolbar.cpp
gradient-vector.cpp
icon.cpp
+ image-menu-item.c
ink-action.cpp
ink-comboboxentry-action.cpp
paint-selector.cpp
@@ -88,6 +89,7 @@ set(widgets_SRC
gradient-toolbar.h
gradient-vector.h
icon.h
+ image-menu-item.h
ink-action.h
ink-comboboxentry-action.h
paint-selector.h
@@ -108,11 +110,6 @@ set(widgets_SRC
widget-sizes.h
)
-if(${WITH_GTK3_EXPERIMENTAL})
- set(image_menu_item_SRC image-menu-item.h image-menu-item.c)
- add_inkscape_source("${image_menu_item_SRC}")
-endif()
-
# add_inkscape_lib(widgets_LIB "${widgets_SRC}")
add_inkscape_source("${widgets_SRC}")
diff --git a/src/widgets/Makefile_insert b/src/widgets/Makefile_insert
index c9f04de14..8f10e1d56 100644
--- a/src/widgets/Makefile_insert
+++ b/src/widgets/Makefile_insert
@@ -1,11 +1,5 @@
## Makefile.am fragment sourced by src/Makefile.am.
-if WITH_GTKMM_3_0
-ink_common_sources += \
- widgets/image-menu-item.c \
- widgets/image-menu-item.h
-endif
-
ink_common_sources += \
widgets/arc-toolbar.cpp \
widgets/arc-toolbar.h \
@@ -50,6 +44,8 @@ ink_common_sources += \
widgets/gradient-vector.h \
widgets/icon.cpp \
widgets/icon.h \
+ widgets/image-menu-item.c \
+ widgets/image-menu-item.h \
widgets/ink-action.cpp \
widgets/ink-action.h \
widgets/ink-comboboxentry-action.cpp \
diff --git a/src/widgets/button.cpp b/src/widgets/button.cpp
index bc59d1a39..3f4f1207a 100644
--- a/src/widgets/button.cpp
+++ b/src/widgets/button.cpp
@@ -21,15 +21,8 @@
#include "helper/action.h"
static void sp_button_dispose(GObject *object);
-
-#if GTK_CHECK_VERSION(3, 0, 0)
static void sp_button_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width);
-
static void sp_button_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height);
-#else
-static void sp_button_size_request(GtkWidget *widget, GtkRequisition *requisition);
-#endif
-
static void sp_button_clicked(GtkButton *button);
static void sp_button_perform_action(SPButton *button, gpointer data);
static gint sp_button_process_event(SPButton *button, GdkEvent *event);
@@ -48,12 +41,8 @@ static void sp_button_class_init(SPButtonClass *klass)
GtkButtonClass *button_class = GTK_BUTTON_CLASS(klass);
object_class->dispose = sp_button_dispose;
-#if GTK_CHECK_VERSION(3, 0, 0)
widget_class->get_preferred_width = sp_button_get_preferred_width;
widget_class->get_preferred_height = sp_button_get_preferred_height;
-#else
- widget_class->size_request = sp_button_size_request;
-#endif
button_class->clicked = sp_button_clicked;
}
@@ -90,7 +79,6 @@ static void sp_button_dispose(GObject *object)
(G_OBJECT_CLASS(sp_button_parent_class))->dispose(object);
}
-#if GTK_CHECK_VERSION(3, 0, 0)
static void sp_button_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width)
{
GtkWidget *child = gtk_bin_get_child(GTK_BIN(widget));
@@ -134,23 +122,6 @@ static void sp_button_get_preferred_height(GtkWidget *widget, gint *minimal_heig
*minimal_height += MAX(2, padding.top + padding.bottom + border.top + border.bottom);
*natural_height += MAX(2, padding.top + padding.bottom + border.top + border.bottom);
}
-#else
-static void sp_button_size_request(GtkWidget *widget, GtkRequisition *requisition)
-{
- GtkWidget *child = gtk_bin_get_child(GTK_BIN(widget));
- GtkStyle *style = gtk_widget_get_style(widget);
-
- if (child) {
- gtk_widget_size_request(GTK_WIDGET(child), requisition);
- } else {
- requisition->width = 0;
- requisition->height = 0;
- }
-
- requisition->width += 2 + 2 * MAX(2, style->xthickness);
- requisition->height += 2 + 2 * MAX(2, style->ythickness);
-}
-#endif
static void sp_button_clicked(GtkButton *button)
{
diff --git a/src/widgets/dash-selector.cpp b/src/widgets/dash-selector.cpp
index e1cb563a7..522705cec 100644
--- a/src/widgets/dash-selector.cpp
+++ b/src/widgets/dash-selector.cpp
@@ -59,18 +59,9 @@ SPDashSelector::SPDashSelector()
dash_combo.signal_changed().connect( sigc::mem_fun(*this, &SPDashSelector::on_selection) );
this->pack_start(dash_combo, false, false, 0);
-
-#if WITH_GTKMM_3_0
offset = Gtk::Adjustment::create(0.0, 0.0, 10.0, 0.1, 1.0, 0.0);
-#else
- offset = new Gtk::Adjustment(0.0, 0.0, 10.0, 0.1, 1.0, 0.0);
-#endif
offset->signal_value_changed().connect(sigc::mem_fun(*this, &SPDashSelector::offset_value_changed));
-#if WITH_GTKMM_3_0
- Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(offset, 0.1, 2);
-#else
- Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(*offset, 0.1, 2);
-#endif
+ auto sb = new Inkscape::UI::Widget::SpinButton(offset, 0.1, 2);
sb->set_tooltip_text(_("Pattern offset"));
sp_dialog_defocus_on_enter_cpp(sb);
sb->show();
@@ -97,9 +88,6 @@ SPDashSelector::SPDashSelector()
SPDashSelector::~SPDashSelector() {
// FIXME: for some reason this doesn't get called; does the call to manage() in
// sp_stroke_style_line_widget_new() not processed correctly?
-#if !WITH_GTKMM_3_0
- delete offset;
-#endif
}
void SPDashSelector::prepareImageRenderer( Gtk::TreeModel::const_iterator const &row ) {
diff --git a/src/widgets/dash-selector.h b/src/widgets/dash-selector.h
index ec5a1cbd5..f176acf04 100644
--- a/src/widgets/dash-selector.h
+++ b/src/widgets/dash-selector.h
@@ -85,12 +85,7 @@ private:
Glib::RefPtr<Gtk::ListStore> dash_store;
Gtk::ComboBox dash_combo;
Gtk::CellRendererPixbuf image_renderer;
-
-#if WITH_GTKMM_3_0
Glib::RefPtr<Gtk::Adjustment> offset;
-#else
- Gtk::Adjustment *offset;
-#endif
static gchar const *const _prefs_path;
int preview_width;
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index ec155ce4c..aa485498e 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -64,9 +64,7 @@
#include "widget-sizes.h"
#include "verbs.h"
-#if GTK_CHECK_VERSION(3,0,0)
-# include <gtkmm/cssprovider.h>
-#endif
+#include <gtkmm/cssprovider.h>
#include <gtkmm/paned.h>
#include <gtkmm/messagedialog.h>
@@ -248,16 +246,11 @@ Geom::Point
SPDesktopWidget::window_get_pointer()
{
gint x,y;
- GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(canvas));
-
-#if GTK_CHECK_VERSION(3,0,0)
- GdkDisplay *display = gdk_window_get_display(window);
- GdkDeviceManager *dm = gdk_display_get_device_manager(display);
- GdkDevice *device = gdk_device_manager_get_client_pointer(dm);
+ auto window = gtk_widget_get_window(GTK_WIDGET(canvas));
+ auto display = gdk_window_get_display(window);
+ auto dm = gdk_display_get_device_manager(display);
+ auto device = gdk_device_manager_get_client_pointer(dm);
gdk_window_get_device_position(window, device, &x, &y, NULL);
-#else
- gdk_window_get_pointer(window, &x, &y, NULL);
-#endif
return Geom::Point(x,y);
}
@@ -336,21 +329,11 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
dtw->_interaction_disabled_counter = 0;
/* Main table */
-#if GTK_CHECK_VERSION(3,0,0)
dtw->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_name(dtw->vbox, "DesktopMainTable");
-#else
- dtw->vbox = gtk_vbox_new (FALSE, 0);
-#endif
gtk_container_add( GTK_CONTAINER(dtw), GTK_WIDGET(dtw->vbox) );
-
-#if GTK_CHECK_VERSION(3,0,0)
dtw->statusbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_name(dtw->statusbar, "DesktopStatusBar");
-#else
- dtw->statusbar = gtk_hbox_new (FALSE, 0);
-#endif
- //gtk_widget_set_usize (dtw->statusbar, -1, BOTTOM_BAR_HEIGHT);
gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->statusbar, FALSE, TRUE, 0);
{
@@ -358,19 +341,12 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
dtw->panels = new SwatchesPanel("/embedded/swatches" /*false*/);
dtw->panels->setOrientation(SP_ANCHOR_SOUTH);
-#if GTK_CHECK_VERSION(3,0,0)
dtw->panels->set_vexpand(false);
-#endif
-
gtk_box_pack_end( GTK_BOX( dtw->vbox ), GTK_WIDGET(dtw->panels->gobj()), FALSE, TRUE, 0 );
}
-#if GTK_CHECK_VERSION(3,0,0)
dtw->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_name(dtw->hbox, "DesktopHbox");
-#else
- dtw->hbox = gtk_hbox_new(FALSE, 0);
-#endif
gtk_box_pack_end( GTK_BOX (dtw->vbox), dtw->hbox, TRUE, TRUE, 0 );
gtk_widget_show(dtw->hbox);
@@ -394,14 +370,12 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
NULL,
INKSCAPE_ICON("object-locked"),
_("Toggle lock of all guides in the document"));
-#if GTK_CHECK_VERSION(3,0,0)
- Glib::RefPtr<Gtk::CssProvider> guides_lock_style_provider = Gtk::CssProvider::create();
+ auto guides_lock_style_provider = Gtk::CssProvider::create();
guides_lock_style_provider->load_from_data("GtkWidget { padding-left: 0; padding-right: 0; padding-top: 0; padding-bottom: 0; }");
- Gtk::Widget * wnd = Glib::wrap(dtw->guides_lock);
+ auto wnd = Glib::wrap(dtw->guides_lock);
wnd->set_name("LockGuides");
- Glib::RefPtr<Gtk::StyleContext> context = wnd->get_style_context();
+ auto context = wnd->get_style_context();
context->add_provider(guides_lock_style_provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-#endif
/* Horizontal ruler */
GtkWidget *eventbox = gtk_event_box_new ();
@@ -416,29 +390,13 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
g_signal_connect (G_OBJECT (eventbox), "button_release_event", G_CALLBACK (sp_dt_hruler_event), dtw);
g_signal_connect (G_OBJECT (eventbox), "motion_notify_event", G_CALLBACK (sp_dt_hruler_event), dtw);
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *tbl_wrapper = gtk_grid_new(); // Is this widget really needed?
+ auto tbl_wrapper = gtk_grid_new(); // Is this widget really needed?
gtk_widget_set_name(tbl_wrapper, "CanvasTableWrapper");
dtw->canvas_tbl = gtk_grid_new();
gtk_widget_set_name(dtw->canvas_tbl, "CanvasTable");
gtk_grid_attach(GTK_GRID(dtw->canvas_tbl), dtw->guides_lock, 0, 0, 1, 1);
gtk_grid_attach(GTK_GRID(dtw->canvas_tbl), eventbox, 1, 0, 1, 1);
-#else
- GtkWidget *tbl_wrapper = gtk_table_new(2, 3, FALSE);
- dtw->canvas_tbl = gtk_table_new(3, 3, FALSE);
-
- gtk_table_attach(GTK_TABLE(dtw->canvas_tbl),
- dtw->guides_lock,
- 0, 1, 0, 1,
- GTK_FILL, GTK_FILL,
- 0, 0);
- gtk_table_attach(GTK_TABLE(dtw->canvas_tbl),
- eventbox,
- 1, 2, 0, 1,
- GTK_FILL, GTK_FILL,
- 0, 0);
-#endif
g_signal_connect (G_OBJECT (dtw->guides_lock), "toggled", G_CALLBACK (sp_update_guides_lock), dtw);
gtk_box_pack_start( GTK_BOX(dtw->hbox), tbl_wrapper, TRUE, TRUE, 1 );
@@ -452,16 +410,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
sp_ruler_set_unit (SP_RULER (dtw->vruler), pt);
gtk_widget_set_tooltip_text (dtw->vruler_box, gettext(pt->name_plural.c_str()));
gtk_container_add (GTK_CONTAINER (eventbox), GTK_WIDGET (dtw->vruler));
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(dtw->canvas_tbl), eventbox, 0, 1, 1, 1);
-#else
- gtk_table_attach(GTK_TABLE (dtw->canvas_tbl),
- eventbox,
- 0, 1, 1, 2,
- GTK_FILL, GTK_FILL,
- 0, 0);
-#endif
g_signal_connect (G_OBJECT (eventbox), "button_press_event", G_CALLBACK (sp_dt_vruler_event), dtw);
g_signal_connect (G_OBJECT (eventbox), "button_release_event", G_CALLBACK (sp_dt_vruler_event), dtw);
@@ -469,19 +418,10 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
// Horizontal scrollbar
dtw->hadj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0));
-
-#if GTK_CHECK_VERSION(3,0,0)
dtw->hscrollbar = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (dtw->hadj));
gtk_widget_set_name(dtw->hscrollbar, "HorizontalScrollbar");
gtk_grid_attach(GTK_GRID(dtw->canvas_tbl), dtw->hscrollbar, 1, 2, 1, 1);
dtw->vscrollbar_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
-#else
- dtw->hscrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (dtw->hadj));
- gtk_table_attach(GTK_TABLE (dtw->canvas_tbl), dtw->hscrollbar, 1, 2, 2, 3,
- GTK_FILL, GTK_SHRINK,
- 0, 0);
- dtw->vscrollbar_box = gtk_vbox_new (FALSE, 0);
-#endif
// Sticky zoom button
dtw->sticky_zoom = sp_button_new_from_data ( Inkscape::ICON_SIZE_DECORATION,
@@ -496,23 +436,10 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
// Vertical scrollbar
dtw->vadj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0));
-
-#if GTK_CHECK_VERSION(3,0,0)
dtw->vscrollbar = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT(dtw->vadj));
gtk_widget_set_name(dtw->vscrollbar, "VerticalScrollbar");
-#else
- dtw->vscrollbar = gtk_vscrollbar_new (GTK_ADJUSTMENT (dtw->vadj));
-#endif
-
gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->vscrollbar, TRUE, TRUE, 0);
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(dtw->canvas_tbl), dtw->vscrollbar_box, 2, 0, 1, 2);
-#else
- gtk_table_attach(GTK_TABLE(dtw->canvas_tbl), dtw->vscrollbar_box, 2, 3, 0, 2,
- GTK_SHRINK, GTK_FILL,
- 0, 0);
-#endif
gchar const* tip = "";
Inkscape::Verb* verb = Inkscape::Verb::get( SP_VERB_VIEW_CMS_TOGGLE );
@@ -546,15 +473,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
cms_adjust_set_sensitive(dtw, FALSE);
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
-#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach( GTK_GRID(dtw->canvas_tbl), dtw->cms_adjust, 2, 2, 1, 1);
-#else
- gtk_table_attach( GTK_TABLE(dtw->canvas_tbl), dtw->cms_adjust, 2, 3, 2, 3,
- (GtkAttachOptions)(GTK_SHRINK),
- (GtkAttachOptions)(GTK_SHRINK),
- 0, 0);
-#endif
-
{
if (!watcher) {
watcher = new CMSPrefWatcher();
@@ -571,10 +490,8 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
sp_ruler_add_track_widget (SP_RULER(dtw->hruler), GTK_WIDGET(dtw->canvas));
sp_ruler_add_track_widget (SP_RULER(dtw->vruler), GTK_WIDGET(dtw->canvas));
-
-#if GTK_CHECK_VERSION(3,0,0)
- GtkCssProvider *css_provider = gtk_css_provider_new();
- GtkStyleContext *style_context = gtk_widget_get_style_context(GTK_WIDGET(dtw->canvas));
+ auto css_provider = gtk_css_provider_new();
+ auto style_context = gtk_widget_get_style_context(GTK_WIDGET(dtw->canvas));
gtk_css_provider_load_from_data(css_provider,
"SPCanvas {\n"
@@ -585,21 +502,11 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
gtk_style_context_add_provider(style_context,
GTK_STYLE_PROVIDER(css_provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
-#else
- GtkStyle *style = gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(dtw->canvas)));
- style->bg[GTK_STATE_NORMAL] = style->white;
- gtk_widget_set_style (GTK_WIDGET (dtw->canvas), style);
-#endif
-
g_signal_connect (G_OBJECT (dtw->canvas), "event", G_CALLBACK (sp_desktop_widget_event), dtw);
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_hexpand(GTK_WIDGET(dtw->canvas), TRUE);
gtk_widget_set_vexpand(GTK_WIDGET(dtw->canvas), TRUE);
gtk_grid_attach(GTK_GRID(dtw->canvas_tbl), GTK_WIDGET(dtw->canvas), 1, 1, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (dtw->canvas_tbl), GTK_WIDGET(dtw->canvas), 1, 2, 1, 2, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), 0, 0);
-#endif
/* Dock */
bool create_dock =
@@ -608,12 +515,8 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
if (create_dock) {
dtw->dock = new Inkscape::UI::Widget::Dock();
-#if WITH_GTKMM_3_0
- Gtk::Paned *paned = new Gtk::Paned();
+ auto paned = new Gtk::Paned();
paned->set_name("Canvas_and_Dock");
-#else
- Gtk::HPaned *paned = new Gtk::HPaned();
-#endif
paned->pack1(*Glib::wrap(dtw->canvas_tbl));
paned->pack2(dtw->dock->getWidget(), Gtk::FILL);
@@ -624,24 +527,13 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
paned_class->cycle_handle_focus = NULL;
}
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_hexpand(GTK_WIDGET(paned->gobj()), TRUE);
gtk_widget_set_vexpand(GTK_WIDGET(paned->gobj()), TRUE);
gtk_grid_attach(GTK_GRID(tbl_wrapper), GTK_WIDGET (paned->gobj()), 1, 1, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (tbl_wrapper), GTK_WIDGET (paned->gobj()), 1, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
-#endif
-
} else {
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_hexpand(GTK_WIDGET(dtw->canvas_tbl), TRUE);
gtk_widget_set_vexpand(GTK_WIDGET(dtw->canvas_tbl), TRUE);
gtk_grid_attach(GTK_GRID(tbl_wrapper), GTK_WIDGET (dtw->canvas_tbl), 1, 1, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (tbl_wrapper), GTK_WIDGET (dtw->canvas_tbl), 1, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
-#endif
}
// connect scrollbar signals
@@ -658,11 +550,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
// Separator
gtk_box_pack_start(GTK_BOX(dtw->statusbar),
-#if GTK_CHECK_VERSION(3,0,0)
gtk_separator_new(GTK_ORIENTATION_VERTICAL),
-#else
- gtk_vseparator_new(),
-#endif
FALSE, FALSE, 0);
// Layer Selector
@@ -681,12 +569,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
gtk_label_set_lines (GTK_LABEL(dtw->select_status), 2);
#endif
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_halign(dtw->select_status, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (dtw->select_status), 0.0, 0.5);
-#endif
-
gtk_widget_set_size_request (dtw->select_status, 1, -1);
// Display the initial welcome message in the statusbar
@@ -712,65 +595,36 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
dtw->zoom_update = g_signal_connect (G_OBJECT (dtw->zoom_status), "populate_popup", G_CALLBACK (sp_dtw_zoom_populate_popup), dtw);
// Cursor coordinates
-#if GTK_CHECK_VERSION(3,0,0)
dtw->coord_status = gtk_grid_new();
gtk_widget_set_name(dtw->coord_status, "CoordinateAndZStatus");
gtk_grid_set_row_spacing(GTK_GRID(dtw->coord_status), 0);
gtk_grid_set_column_spacing(GTK_GRID(dtw->coord_status), 2);
- GtkWidget* sep = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
+ auto sep = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
gtk_widget_set_name(sep, "CoordinateSeparator");
gtk_grid_attach(GTK_GRID(dtw->coord_status),
GTK_WIDGET(sep),
0, 0, 1, 2);
-#else
- dtw->coord_status = gtk_table_new(5, 2, FALSE);
- gtk_table_set_row_spacings(GTK_TABLE(dtw->coord_status), 0);
- gtk_table_set_col_spacings(GTK_TABLE(dtw->coord_status), 2);
- gtk_table_attach(GTK_TABLE(dtw->coord_status),
- gtk_vseparator_new(),
- 0, 1, 0, 2,
- GTK_FILL, GTK_FILL, 0, 0);
-#endif
gtk_widget_set_tooltip_text (dtw->coord_status, _("Cursor coordinates"));
- GtkWidget *label_x = gtk_label_new(_("X:"));
- GtkWidget *label_y = gtk_label_new(_("Y:"));
-
-#if GTK_CHECK_VERSION(3,0,0)
+ auto label_x = gtk_label_new(_("X:"));
+ auto label_y = gtk_label_new(_("Y:"));
gtk_widget_set_halign(label_x, GTK_ALIGN_START);
gtk_widget_set_halign(label_y, GTK_ALIGN_START);
gtk_grid_attach(GTK_GRID(dtw->coord_status), label_x, 1, 0, 1, 1);
gtk_grid_attach(GTK_GRID(dtw->coord_status), label_y, 1, 1, 1, 1);
-#else
- gtk_misc_set_alignment (GTK_MISC(label_x), 0.0, 0.5);
- gtk_misc_set_alignment (GTK_MISC(label_y), 0.0, 0.5);
- gtk_table_attach(GTK_TABLE(dtw->coord_status), label_x, 1,2, 0,1, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(dtw->coord_status), label_y, 1,2, 1,2, GTK_FILL, GTK_FILL, 0, 0);
-#endif
-
dtw->coord_status_x = gtk_label_new(NULL);
dtw->coord_status_y = gtk_label_new(NULL);
gtk_label_set_markup( GTK_LABEL(dtw->coord_status_x), "<tt> 0.00 </tt>" );
gtk_label_set_markup( GTK_LABEL(dtw->coord_status_y), "<tt> 0.00 </tt>" );
- GtkWidget* label_z = gtk_label_new(_("Z:"));
+ auto label_z = gtk_label_new(_("Z:"));
gtk_widget_set_name(label_z, "ZLabel");
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_halign(dtw->coord_status_x, GTK_ALIGN_END);
gtk_widget_set_halign(dtw->coord_status_y, GTK_ALIGN_END);
gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->coord_status_x, 2, 0, 1, 1);
gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->coord_status_y, 2, 1, 1, 1);
gtk_grid_attach(GTK_GRID(dtw->coord_status), label_z, 3, 0, 1, 2);
gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->zoom_status, 4, 0, 1, 2);
-#else
- gtk_misc_set_alignment (GTK_MISC(dtw->coord_status_x), 1.0, 0.5);
- gtk_misc_set_alignment (GTK_MISC(dtw->coord_status_y), 1.0, 0.5);
- gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->coord_status_x, 2,3, 0,1, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->coord_status_y, 2,3, 1,2, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(dtw->coord_status), label_z, 3,4, 0,2, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->zoom_status, 4,5, 0,2, GTK_FILL, GTK_FILL, 0, 0);
-#endif
sp_set_font_size_smaller (dtw->coord_status);
@@ -2203,7 +2057,6 @@ set_adjustment (GtkAdjustment *adj, double l, double u, double ps, double si, do
gtk_adjustment_set_page_size(adj, ps);
gtk_adjustment_set_step_increment(adj, si);
gtk_adjustment_set_page_increment(adj, pi);
- gtk_adjustment_changed (adj);
}
}
diff --git a/src/widgets/eek-preview.cpp b/src/widgets/eek-preview.cpp
index 9951a8957..5f1997672 100644
--- a/src/widgets/eek-preview.cpp
+++ b/src/widgets/eek-preview.cpp
@@ -194,7 +194,6 @@ static void eek_preview_size_request( GtkWidget* widget, GtkRequisition* req )
req->height = height;
}
-#if GTK_CHECK_VERSION(3,0,0)
static void eek_preview_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width)
{
GtkRequisition requisition;
@@ -208,7 +207,6 @@ static void eek_preview_get_preferred_height(GtkWidget *widget, gint *minimal_he
eek_preview_size_request(widget, &requisition);
*minimal_height = *natural_height = requisition.height;
}
-#endif
enum {
CLICKED_SIGNAL,
@@ -219,22 +217,6 @@ enum {
static guint eek_preview_signals[LAST_SIGNAL] = { 0 };
-#if !GTK_CHECK_VERSION(3,0,0)
-static gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* /* event */ )
-{
- gboolean result = FALSE;
-
- if (gtk_widget_is_drawable(widget)) {
- GdkWindow* window = gtk_widget_get_window(widget);
- cairo_t* cr = gdk_cairo_create(window);
- result = eek_preview_draw(widget, cr);
- cairo_destroy(cr);
- }
-
- return result;
-}
-#endif
-
static
gboolean eek_preview_draw(GtkWidget *widget,
cairo_t *cr)
@@ -246,14 +228,6 @@ gboolean eek_preview_draw(GtkWidget *widget,
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
-#if !GTK_CHECK_VERSION(3,0,0)
- GdkColor fg = { 0,
- static_cast<guint16>(priv->r),
- static_cast<guint16>(priv->g),
- static_cast<guint16>(priv->b)
- };
-#endif
-
gint insetTop = 0, insetBottom = 0;
gint insetLeft = 0, insetRight = 0;
@@ -270,9 +244,7 @@ gboolean eek_preview_draw(GtkWidget *widget,
insetLeft = insetRight = 1;
}
-
-#if GTK_CHECK_VERSION(3,0,0)
- GtkStyleContext *context = gtk_widget_get_style_context(widget);
+ auto context = gtk_widget_get_style_context(widget);
gtk_render_frame(context,
cr,
@@ -283,22 +255,6 @@ gboolean eek_preview_draw(GtkWidget *widget,
cr,
0, 0,
allocation.width, allocation.height);
-#else
- GtkStyle *style = gtk_widget_get_style(widget);
- GdkWindow *window = gtk_widget_get_window(widget);
-
- gtk_paint_flat_box( style,
- window,
- (GtkStateType)gtk_widget_get_state(widget),
- GTK_SHADOW_NONE,
- NULL,
- widget,
- NULL,
- 0, 0,
- allocation.width, allocation.height);
-
- gdk_colormap_alloc_color( gdk_colormap_get_system(), &fg, FALSE, TRUE );
-#endif
// Border
if (priv->border != BORDER_NONE) {
@@ -377,27 +333,12 @@ gboolean eek_preview_draw(GtkWidget *widget,
if (priv->linked & PREVIEW_LINK_IN)
{
-#if GTK_CHECK_VERSION(3,0,0)
gtk_render_arrow(context,
cr,
G_PI, // Down-pointing arrow
area.x, area.y,
min(area.width, area.height)
);
-#else
- gtk_paint_arrow( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_IN,
- NULL, /* clip area. &area, */
- widget, /* may be NULL */
- NULL, /* detail */
- GTK_ARROW_DOWN,
- FALSE,
- area.x, area.y,
- area.width, area.height
- );
-#endif
}
if (priv->linked & PREVIEW_LINK_OUT)
@@ -407,27 +348,12 @@ gboolean eek_preview_draw(GtkWidget *widget,
otherArea.y = possible.y + (possible.height - otherArea.height);
}
-#if GTK_CHECK_VERSION(3,0,0)
gtk_render_arrow(context,
cr,
G_PI, // Down-pointing arrow
otherArea.x, otherArea.y,
min(otherArea.width, otherArea.height)
);
-#else
- gtk_paint_arrow( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- NULL, /* clip area. &area, */
- widget, /* may be NULL */
- NULL, /* detail */
- GTK_ARROW_DOWN,
- FALSE,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height
- );
-#endif
}
if (priv->linked & PREVIEW_LINK_OTHER)
@@ -437,27 +363,12 @@ gboolean eek_preview_draw(GtkWidget *widget,
otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
}
-#if GTK_CHECK_VERSION(3,0,0)
gtk_render_arrow(context,
cr,
1.5*G_PI, // Left-pointing arrow
otherArea.x, otherArea.y,
min(otherArea.width, otherArea.height)
);
-#else
- gtk_paint_arrow( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- NULL, /* clip area. &area, */
- widget, /* may be NULL */
- NULL, /* detail */
- GTK_ARROW_LEFT,
- FALSE,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height
- );
-#endif
}
@@ -469,22 +380,10 @@ gboolean eek_preview_draw(GtkWidget *widget,
if ( otherArea.height < possible.height ) {
otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
}
-#if GTK_CHECK_VERSION(3,0,0)
gtk_render_check(context,
cr,
otherArea.x, otherArea.y,
otherArea.width, otherArea.height );
-#else
- gtk_paint_check( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- NULL,
- widget,
- NULL,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height );
-#endif
}
if (priv->linked & PREVIEW_STROKE)
@@ -495,23 +394,11 @@ gboolean eek_preview_draw(GtkWidget *widget,
if ( otherArea.height < possible.height ) {
otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
}
-#if GTK_CHECK_VERSION(3,0,0)
// This should be a diamond too?
gtk_render_check(context,
cr,
otherArea.x, otherArea.y,
otherArea.width, otherArea.height );
-#else
- gtk_paint_diamond( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- NULL,
- widget,
- NULL,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height );
-#endif
}
}
@@ -519,21 +406,10 @@ gboolean eek_preview_draw(GtkWidget *widget,
if ( gtk_widget_has_focus(widget) ) {
gtk_widget_get_allocation (widget, &allocation);
-#if GTK_CHECK_VERSION(3,0,0)
gtk_render_focus(context,
cr,
0 + 1, 0 + 1,
allocation.width - 2, allocation.height - 2 );
-#else
- gtk_paint_focus( style,
- window,
- GTK_STATE_NORMAL,
- NULL, /* GdkRectangle *area, */
- widget,
- NULL,
- 0 + 1, 0 + 1,
- allocation.width - 2, allocation.height - 2 );
-#endif
}
return FALSE;
@@ -547,11 +423,7 @@ static gboolean eek_preview_enter_cb( GtkWidget* widget, GdkEventCrossing* event
EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
priv->within = TRUE;
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_state_flags( widget, priv->hot ? GTK_STATE_FLAG_ACTIVE : GTK_STATE_FLAG_PRELIGHT, false );
-#else
- gtk_widget_set_state( widget, priv->hot ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT );
-#endif
}
return FALSE;
@@ -564,11 +436,7 @@ static gboolean eek_preview_leave_cb( GtkWidget* widget, GdkEventCrossing* event
EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
priv->within = FALSE;
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_state_flags( widget, GTK_STATE_FLAG_NORMAL, false );
-#else
- gtk_widget_set_state( widget, GTK_STATE_NORMAL );
-#endif
}
return FALSE;
@@ -593,11 +461,7 @@ static gboolean eek_preview_button_press_cb( GtkWidget* widget, GdkEventButton*
if ( priv->within )
{
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_state_flags( widget, GTK_STATE_FLAG_ACTIVE, false );
-#else
- gtk_widget_set_state( widget, GTK_STATE_ACTIVE );
-#endif
}
}
}
@@ -612,11 +476,7 @@ static gboolean eek_preview_button_release_cb( GtkWidget* widget, GdkEventButton
EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
priv->hot = FALSE;
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_state_flags( widget, GTK_STATE_FLAG_NORMAL, false );
-#else
- gtk_widget_set_state( widget, GTK_STATE_NORMAL );
-#endif
if ( priv->within &&
(event->button == PRIME_BUTTON_MAGIC_NUMBER ||
@@ -697,15 +557,9 @@ static void eek_preview_class_init( EekPreviewClass *klass )
parent_class = (GtkWidgetClass*)g_type_class_peek_parent( klass );
-#if GTK_CHECK_VERSION(3,0,0)
widgetClass->get_preferred_width = eek_preview_get_preferred_width;
widgetClass->get_preferred_height = eek_preview_get_preferred_height;
widgetClass->draw = eek_preview_draw;
-#else
- widgetClass->size_request = eek_preview_size_request;
- widgetClass->expose_event = eek_preview_expose_event;
-#endif
-
widgetClass->button_press_event = eek_preview_button_press_cb;
widgetClass->button_release_event = eek_preview_button_release_cb;
widgetClass->enter_notify_event = eek_preview_enter_cb;
diff --git a/src/widgets/ege-adjustment-action.cpp b/src/widgets/ege-adjustment-action.cpp
index 272217aa4..8fef21741 100644
--- a/src/widgets/ege-adjustment-action.cpp
+++ b/src/widgets/ege-adjustment-action.cpp
@@ -813,12 +813,8 @@ static GtkWidget* create_tool_item( GtkAction* action )
if ( IS_EGE_ADJUSTMENT_ACTION(action) ) {
EgeAdjustmentAction* act = EGE_ADJUSTMENT_ACTION( action );
GtkWidget* spinbutton = 0;
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget* hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget* hb = gtk_hbox_new( FALSE, 5 );
-#endif
GValue value;
memset( &value, 0, sizeof(value) );
g_value_init( &value, G_TYPE_STRING );
@@ -865,13 +861,7 @@ static GtkWidget* create_tool_item( GtkAction* action )
gtk_box_pack_start( GTK_BOX(hb), icon, FALSE, FALSE, 0 );
} else {
GtkWidget* lbl = gtk_label_new( g_value_get_string( &value ) ? g_value_get_string( &value ) : "wwww" );
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_halign(lbl, GTK_ALIGN_END);
-#else
- gtk_misc_set_alignment( GTK_MISC(lbl), 1.0, 0.5 );
-#endif
-
gtk_box_pack_start( GTK_BOX(hb), lbl, FALSE, FALSE, 0 );
}
}
diff --git a/src/widgets/ege-output-action.cpp b/src/widgets/ege-output-action.cpp
index 5dece8e91..da29524a5 100644
--- a/src/widgets/ege-output-action.cpp
+++ b/src/widgets/ege-output-action.cpp
@@ -166,12 +166,8 @@ GtkWidget* create_tool_item( GtkAction* action )
if ( IS_EGE_OUTPUT_ACTION(action) )
{
GValue value;
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget* hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget* hb = gtk_hbox_new( FALSE, 5 );
-#endif
GtkWidget* lbl = 0;
memset( &value, 0, sizeof(value) );
diff --git a/src/widgets/ege-select-one-action.cpp b/src/widgets/ege-select-one-action.cpp
index 2e106154e..5555663e4 100644
--- a/src/widgets/ege-select-one-action.cpp
+++ b/src/widgets/ege-select-one-action.cpp
@@ -632,12 +632,8 @@ GtkWidget* create_tool_item( GtkAction* action )
item = GTK_WIDGET( gtk_tool_item_new() );
if ( act->private_data->appearanceMode == APPEARANCE_FULL ) {
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget* holder = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ auto holder = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous(GTK_BOX(holder), FALSE);
-#else
- GtkWidget* holder = gtk_hbox_new( FALSE, 0 );
-#endif
GtkRadioAction* ract = 0;
GSList* group = 0;
@@ -744,12 +740,8 @@ GtkWidget* create_tool_item( GtkAction* action )
gtk_container_add( GTK_CONTAINER(item), holder );
} else {
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget* holder = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
+ auto holder = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_set_homogeneous(GTK_BOX(holder), FALSE);
-#else
- GtkWidget *holder = gtk_hbox_new( FALSE, 4 );
-#endif
GtkEntry *entry = 0;
GtkWidget *normal;
@@ -818,14 +810,8 @@ GtkWidget* create_tool_item( GtkAction* action )
gtk_box_pack_start( GTK_BOX(holder), normal, FALSE, FALSE, 0 );
{
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_halign(holder, GTK_ALIGN_START);
gtk_container_add(GTK_CONTAINER(item), holder);
-#else
- GtkWidget *align = gtk_alignment_new(0, 0.5, 0, 0);
- gtk_container_add( GTK_CONTAINER(align), holder);
- gtk_container_add( GTK_CONTAINER(item), align );
-#endif
}
}
@@ -861,13 +847,6 @@ void resync_active( EgeSelectOneAction* act, gint active, gboolean override )
if ( children && children->data ) {
gpointer combodata = g_object_get_data( G_OBJECT(children->data), "ege-combo-box" );
-#if !GTK_CHECK_VERSION(3,0,0)
- if (!combodata && GTK_IS_ALIGNMENT(children->data)) {
- GList *other = gtk_container_get_children( GTK_CONTAINER(children->data) );
- combodata = g_object_get_data( G_OBJECT(other->data), "ege-combo-box" );
- }
-#endif
-
if ( GTK_IS_COMBO_BOX(combodata) ) {
GtkComboBox* combo = GTK_COMBO_BOX(combodata);
if ((active == -1) && (gtk_combo_box_get_has_entry(combo))) {
@@ -925,13 +904,6 @@ void resync_sensitive( EgeSelectOneAction* act )
if ( children && children->data ) {
gpointer combodata = g_object_get_data( G_OBJECT(children->data), "ege-combo-box" );
-#if !GTK_CHECK_VERSION(3,0,0)
- if (!combodata && GTK_IS_ALIGNMENT(children->data)) {
- GList *other = gtk_container_get_children( GTK_CONTAINER(children->data) );
- combodata = g_object_get_data( G_OBJECT(other->data), "ege-combo-box" );
- }
-#endif
-
if ( GTK_IS_COMBO_BOX(combodata) ) {
/* Not implemented */
} else if ( GTK_IS_BOX(children->data) ) {
diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp
index 2ed6705d7..4822020be 100644
--- a/src/widgets/font-selector.cpp
+++ b/src/widgets/font-selector.cpp
@@ -31,11 +31,7 @@
struct SPFontSelector
{
-#if GTK_CHECK_VERSION(3,0,0)
GtkBox hbox;
-#else
- GtkHBox hbox;
-#endif
unsigned int block_emit : 1;
@@ -56,11 +52,7 @@ struct SPFontSelector
struct SPFontSelectorClass
{
-#if GTK_CHECK_VERSION(3,0,0)
GtkBoxClass parent_class;
-#else
- GtkHBoxClass parent_class;
-#endif
void (* font_set) (SPFontSelector *fsel, gchar *fontspec);
};
@@ -86,11 +78,7 @@ static void sp_font_selector_set_sizes( SPFontSelector *fsel );
static guint fs_signals[LAST_SIGNAL] = { 0 };
-#if GTK_CHECK_VERSION(3,0,0)
G_DEFINE_TYPE(SPFontSelector, sp_font_selector, GTK_TYPE_BOX);
-#else
-G_DEFINE_TYPE(SPFontSelector, sp_font_selector, GTK_TYPE_HBOX);
-#endif
static void sp_font_selector_class_init(SPFontSelectorClass *c)
{
@@ -155,8 +143,7 @@ static void sp_font_selector_init(SPFontSelector *fsel)
/* Muck with style, see text-toolbar.cpp */
gtk_widget_set_name( GTK_WIDGET(fsel->family_treeview), "font_selector_family" );
-#if GTK_CHECK_VERSION(3,0,0)
- GtkCssProvider *css_provider = gtk_css_provider_new();
+ auto css_provider = gtk_css_provider_new();
gtk_css_provider_load_from_data(css_provider,
"#font_selector_family {\n"
" -GtkWidget-wide-separators: true;\n"
@@ -164,14 +151,10 @@ static void sp_font_selector_init(SPFontSelector *fsel)
"}\n",
-1, NULL);
- GdkScreen *screen = gdk_screen_get_default();
+ auto screen = gdk_screen_get_default();
gtk_style_context_add_provider_for_screen(screen,
GTK_STYLE_PROVIDER(css_provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
-#else
- gtk_rc_parse_string (
- "widget \"*font_selector_family\" style \"fontfamily-separator-style\"");
-#endif
Inkscape::FontLister* fontlister = Inkscape::FontLister::get_instance();
Glib::RefPtr<Gtk::ListStore> store = fontlister->get_font_list();
@@ -190,12 +173,8 @@ static void sp_font_selector_init(SPFontSelector *fsel)
gtk_widget_show(f);
gtk_box_pack_start(GTK_BOX (fsel), f, TRUE, TRUE, 0);
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
+ auto vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
gtk_box_set_homogeneous(GTK_BOX(vb), FALSE);
-#else
- GtkWidget *vb = gtk_vbox_new(FALSE, 4);
-#endif
gtk_widget_show(vb);
gtk_container_set_border_width(GTK_CONTAINER (vb), 4);
gtk_container_add(GTK_CONTAINER(f), vb);
@@ -230,12 +209,8 @@ static void sp_font_selector_init(SPFontSelector *fsel)
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(fsel->style_treeview));
g_signal_connect (G_OBJECT(selection), "changed", G_CALLBACK (sp_font_selector_style_select_row), fsel);
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, 4);
-#endif
gtk_widget_show(hb);
gtk_box_pack_start(GTK_BOX(vb), hb, FALSE, FALSE, 0);
diff --git a/src/widgets/gradient-image.cpp b/src/widgets/gradient-image.cpp
index 6901b8549..dff564feb 100644
--- a/src/widgets/gradient-image.cpp
+++ b/src/widgets/gradient-image.cpp
@@ -21,7 +21,6 @@
static void sp_gradient_image_size_request (GtkWidget *widget, GtkRequisition *requisition);
-#if GTK_CHECK_VERSION(3,0,0)
static void sp_gradient_image_destroy(GtkWidget *object);
static void sp_gradient_image_get_preferred_width(GtkWidget *widget,
gint *minimal_width,
@@ -30,11 +29,6 @@ static void sp_gradient_image_get_preferred_width(GtkWidget *widget,
static void sp_gradient_image_get_preferred_height(GtkWidget *widget,
gint *minimal_height,
gint *natural_height);
-#else
-static void sp_gradient_image_destroy(GtkObject *object);
-static gboolean sp_gradient_image_expose(GtkWidget *widget, GdkEventExpose *event);
-#endif
-
static gboolean sp_gradient_image_draw(GtkWidget *widget, cairo_t *cr);
static void sp_gradient_image_gradient_release (SPObject *, SPGradientImage *im);
static void sp_gradient_image_gradient_modified (SPObject *, guint flags, SPGradientImage *im);
@@ -46,18 +40,10 @@ static void sp_gradient_image_class_init(SPGradientImageClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
-#if GTK_CHECK_VERSION(3,0,0)
widget_class->get_preferred_width = sp_gradient_image_get_preferred_width;
widget_class->get_preferred_height = sp_gradient_image_get_preferred_height;
widget_class->draw = sp_gradient_image_draw;
widget_class->destroy = sp_gradient_image_destroy;
-#else
- GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass);
-
- object_class->destroy = sp_gradient_image_destroy;
- widget_class->size_request = sp_gradient_image_size_request;
- widget_class->expose_event = sp_gradient_image_expose;
-#endif
}
static void
@@ -71,11 +57,7 @@ sp_gradient_image_init (SPGradientImage *image)
new (&image->modified_connection) sigc::connection();
}
-#if GTK_CHECK_VERSION(3,0,0)
static void sp_gradient_image_destroy(GtkWidget *object)
-#else
-static void sp_gradient_image_destroy(GtkObject *object)
-#endif
{
SPGradientImage *image = SP_GRADIENT_IMAGE (object);
@@ -88,13 +70,8 @@ static void sp_gradient_image_destroy(GtkObject *object)
image->release_connection.~connection();
image->modified_connection.~connection();
-#if GTK_CHECK_VERSION(3,0,0)
if (GTK_WIDGET_CLASS(sp_gradient_image_parent_class)->destroy)
GTK_WIDGET_CLASS(sp_gradient_image_parent_class)->destroy(object);
-#else
- if (GTK_OBJECT_CLASS(sp_gradient_image_parent_class)->destroy)
- GTK_OBJECT_CLASS(sp_gradient_image_parent_class)->destroy(object);
-#endif
}
static void sp_gradient_image_size_request(GtkWidget * /*widget*/, GtkRequisition *requisition)
@@ -103,7 +80,6 @@ static void sp_gradient_image_size_request(GtkWidget * /*widget*/, GtkRequisitio
requisition->height = 12;
}
-#if GTK_CHECK_VERSION(3,0,0)
static void sp_gradient_image_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width)
{
GtkRequisition requisition;
@@ -117,27 +93,6 @@ static void sp_gradient_image_get_preferred_height(GtkWidget *widget, gint *mini
sp_gradient_image_size_request(widget, &requisition);
*minimal_height = *natural_height = requisition.height;
}
-#endif
-
-#if !GTK_CHECK_VERSION(3,0,0)
-static gboolean sp_gradient_image_expose(GtkWidget *widget, GdkEventExpose *event)
-{
- gboolean result = TRUE;
- if(gtk_widget_is_drawable(widget)) {
- cairo_t *ct = gdk_cairo_create(gtk_widget_get_window (widget));
- cairo_rectangle(ct, event->area.x, event->area.y,
- event->area.width, event->area.height);
- cairo_clip(ct);
- GtkAllocation allocation;
- gtk_widget_get_allocation(widget, &allocation);
- cairo_translate(ct, allocation.x, allocation.y);
- result = sp_gradient_image_draw(widget, ct);
- cairo_destroy(ct);
- }
-
- return result;
-}
-#endif
static gboolean sp_gradient_image_draw(GtkWidget *widget, cairo_t *ct)
{
diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp
index 425eb9cbc..569f66c2b 100644
--- a/src/widgets/gradient-selector.cpp
+++ b/src/widgets/gradient-selector.cpp
@@ -57,11 +57,7 @@ static void sp_gradient_selector_delete_vector_clicked (GtkWidget *w, SPGradient
static guint signals[LAST_SIGNAL] = {0};
-#if GTK_CHECK_VERSION(3,0,0)
G_DEFINE_TYPE(SPGradientSelector, sp_gradient_selector, GTK_TYPE_BOX);
-#else
-G_DEFINE_TYPE(SPGradientSelector, sp_gradient_selector, GTK_TYPE_VBOX);
-#endif
static void sp_gradient_selector_class_init(SPGradientSelectorClass *klass)
{
@@ -113,9 +109,7 @@ static void sp_gradient_selector_init(SPGradientSelector *sel)
sel->safelyInit = true;
sel->blocked = false;
-#if GTK_CHECK_VERSION(3,0,0)
gtk_orientable_set_orientation(GTK_ORIENTABLE(sel), GTK_ORIENTATION_VERTICAL);
-#endif
new (&sel->nonsolid) std::vector<GtkWidget*>();
new (&sel->swatch_widgets) std::vector<GtkWidget*>();
@@ -177,13 +171,8 @@ static void sp_gradient_selector_init(SPGradientSelector *sel)
/* Create box for buttons */
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new( FALSE, 2 );
-#endif
- //sel->nonsolid.push_back(hb);
gtk_box_pack_start( GTK_BOX(sel), hb, FALSE, FALSE, 0 );
sel->add = gtk_button_new();
diff --git a/src/widgets/gradient-selector.h b/src/widgets/gradient-selector.h
index e090d7cbd..6b5d4ca60 100644
--- a/src/widgets/gradient-selector.h
+++ b/src/widgets/gradient-selector.h
@@ -45,11 +45,7 @@ class TreeView;
struct SPGradientSelector {
-#if GTK_CHECK_VERSION(3,0,0)
GtkBox vbox;
-#else
- GtkVBox vbox;
-#endif
enum SelectorMode {
MODE_LINEAR,
@@ -131,11 +127,7 @@ struct SPGradientSelector {
};
struct SPGradientSelectorClass {
-#if GTK_CHECK_VERSION(3,0,0)
GtkBoxClass parent_class;
-#else
- GtkVBoxClass parent_class;
-#endif
void (* grabbed) (SPGradientSelector *sel);
void (* dragged) (SPGradientSelector *sel);
diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp
index 6e7c8cdf8..ed88432f1 100644
--- a/src/widgets/gradient-vector.cpp
+++ b/src/widgets/gradient-vector.cpp
@@ -63,11 +63,7 @@ enum {
LAST_SIGNAL
};
-#if GTK_CHECK_VERSION(3,0,0)
static void sp_gradient_vector_selector_destroy(GtkWidget *object);
-#else
-static void sp_gradient_vector_selector_destroy(GtkObject *object);
-#endif
static void sp_gvs_gradient_release(SPObject *obj, SPGradientVectorSelector *gvs);
static void sp_gvs_defs_release(SPObject *defs, SPGradientVectorSelector *gvs);
@@ -86,11 +82,7 @@ static win_data wd;
static gint x = -1000, y = -1000, w = 0, h = 0; // impossible original values to make sure they are read from prefs
static Glib::ustring const prefs_path = "/dialogs/gradienteditor/";
-#if GTK_CHECK_VERSION(3,0,0)
G_DEFINE_TYPE(SPGradientVectorSelector, sp_gradient_vector_selector, GTK_TYPE_BOX);
-#else
-G_DEFINE_TYPE(SPGradientVectorSelector, sp_gradient_vector_selector, GTK_TYPE_VBOX);
-#endif
static void sp_gradient_vector_selector_class_init(SPGradientVectorSelectorClass *klass)
{
@@ -105,20 +97,13 @@ static void sp_gradient_vector_selector_class_init(SPGradientVectorSelectorClass
G_TYPE_NONE, 1,
G_TYPE_POINTER);
-#if GTK_CHECK_VERSION(3,0,0)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
widget_class->destroy = sp_gradient_vector_selector_destroy;
-#else
- GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass);
- object_class->destroy = sp_gradient_vector_selector_destroy;
-#endif
}
static void sp_gradient_vector_selector_init(SPGradientVectorSelector *gvs)
{
-#if GTK_CHECK_VERSION(3,0,0)
gtk_orientable_set_orientation(GTK_ORIENTABLE(gvs), GTK_ORIENTATION_VERTICAL);
-#endif
gvs->idlabel = TRUE;
@@ -137,11 +122,7 @@ static void sp_gradient_vector_selector_init(SPGradientVectorSelector *gvs)
}
-#if GTK_CHECK_VERSION(3,0,0)
static void sp_gradient_vector_selector_destroy(GtkWidget *object)
-#else
-static void sp_gradient_vector_selector_destroy(GtkObject *object)
-#endif
{
SPGradientVectorSelector *gvs = SP_GRADIENT_VECTOR_SELECTOR(object);
@@ -162,15 +143,9 @@ static void sp_gradient_vector_selector_destroy(GtkObject *object)
gvs->defs_modified_connection.~connection();
gvs->tree_select_connection.~connection();
-#if GTK_CHECK_VERSION(3,0,0)
if ((GTK_WIDGET_CLASS(sp_gradient_vector_selector_parent_class))->destroy) {
(GTK_WIDGET_CLASS(sp_gradient_vector_selector_parent_class))->destroy(object);
}
-#else
- if ((GTK_OBJECT_CLASS(sp_gradient_vector_selector_parent_class))->destroy) {
- (GTK_OBJECT_CLASS(sp_gradient_vector_selector_parent_class))->destroy(object);
- }
-#endif
}
GtkWidget *sp_gradient_vector_selector_new(SPDocument *doc, SPGradient *gr)
@@ -480,15 +455,8 @@ static GtkWidget *sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *st
static void sp_gradient_vector_widget_load_gradient(GtkWidget *widget, SPGradient *gradient);
static gint sp_gradient_vector_dialog_delete(GtkWidget *widget, GdkEvent *event, GtkWidget *dialog);
-
-#if GTK_CHECK_VERSION(3,0,0)
static void sp_gradient_vector_dialog_destroy(GtkWidget *object, gpointer data);
static void sp_gradient_vector_widget_destroy(GtkWidget *object, gpointer data);
-#else
-static void sp_gradient_vector_dialog_destroy(GtkObject *object, gpointer data);
-static void sp_gradient_vector_widget_destroy(GtkObject *object, gpointer data);
-#endif
-
static void sp_gradient_vector_gradient_release(SPObject *obj, GtkWidget *widget);
static void sp_gradient_vector_gradient_modified(SPObject *obj, guint flags, GtkWidget *widget);
static void sp_gradient_vector_color_dragged(Inkscape::UI::SelectedColor *selected_color, GObject *object);
@@ -841,12 +809,8 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s
g_return_val_if_fail(gradient != NULL, NULL);
g_return_val_if_fail(SP_IS_GRADIENT(gradient), NULL);
-#if GTK_CHECK_VERSION(3,0,0)
vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, PAD);
gtk_box_set_homogeneous(GTK_BOX(vb), FALSE);
-#else
- vb = gtk_vbox_new(FALSE, PAD);
-#endif
g_signal_connect(G_OBJECT(vb), "destroy", G_CALLBACK(sp_gradient_vector_widget_destroy), NULL);
w = sp_gradient_image_new(gradient);
@@ -879,12 +843,8 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s
g_signal_connect(G_OBJECT(combo_box), "changed", G_CALLBACK(sp_grad_edit_combo_box_changed), vb);
/* Add and Remove buttons */
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, 1);
-#endif
// TRANSLATORS: "Stop" means: a "phase" of a gradient
GtkWidget *b = gtk_button_new_with_label(_("Add stop"));
gtk_widget_show(b);
@@ -901,21 +861,12 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s
gtk_box_pack_start(GTK_BOX(vb),hb, FALSE, FALSE, AUX_BETWEEN_BUTTON_GROUPS);
/* Offset Slider and stuff */
-#if GTK_CHECK_VERSION(3,0,0)
hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- hb = gtk_hbox_new(FALSE, 0);
-#endif
/* Label */
GtkWidget *l = gtk_label_new(C_("Gradient","Offset:"));
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_halign(l, GTK_ALIGN_END);
-#else
- gtk_misc_set_alignment(GTK_MISC(l), 1.0, 0.5);
-#endif
gtk_box_pack_start(GTK_BOX(hb),l, FALSE, FALSE, AUX_BETWEEN_BUTTON_GROUPS);
gtk_widget_show(l);
@@ -933,11 +884,7 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s
gtk_adjustment_set_value(Offset_adj, stop->offset);
/* Slider */
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *slider = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, Offset_adj);
-#else
- GtkWidget *slider = gtk_hscale_new(Offset_adj);
-#endif
+ auto slider = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, Offset_adj);
gtk_scale_set_draw_value( GTK_SCALE(slider), FALSE );
gtk_widget_show(slider);
gtk_box_pack_start(GTK_BOX(hb),slider, TRUE, TRUE, AUX_BETWEEN_BUTTON_GROUPS);
@@ -1175,11 +1122,7 @@ static void sp_gradient_vector_widget_load_gradient(GtkWidget *widget, SPGradien
blocked = FALSE;
}
-#if GTK_CHECK_VERSION(3,0,0)
static void sp_gradient_vector_dialog_destroy(GtkWidget * /*object*/, gpointer /*data*/)
-#else
-static void sp_gradient_vector_dialog_destroy(GtkObject * /*object*/, gpointer /*data*/)
-#endif
{
GObject *obj = G_OBJECT(dlg);
assert(obj != NULL);
@@ -1230,11 +1173,7 @@ static gboolean sp_gradient_vector_dialog_delete(GtkWidget */*widget*/, GdkEvent
}
/* Widget destroy handler */
-#if GTK_CHECK_VERSION(3,0,0)
static void sp_gradient_vector_widget_destroy(GtkWidget *object, gpointer /*data*/)
-#else
-static void sp_gradient_vector_widget_destroy(GtkObject *object, gpointer /*data*/)
-#endif
{
SPObject *gradient = SP_OBJECT(g_object_get_data(G_OBJECT(object), "gradient"));
diff --git a/src/widgets/gradient-vector.h b/src/widgets/gradient-vector.h
index 5ae90b28f..b51b276b9 100644
--- a/src/widgets/gradient-vector.h
+++ b/src/widgets/gradient-vector.h
@@ -35,11 +35,7 @@ class SPGradient;
class SPStop;
struct SPGradientVectorSelector {
-#if GTK_CHECK_VERSION(3,0,0)
GtkBox vbox;
-#else
- GtkVBox vbox;
-#endif
guint idlabel : 1;
@@ -61,11 +57,7 @@ struct SPGradientVectorSelector {
};
struct SPGradientVectorSelectorClass {
-#if GTK_CHECK_VERSION(3,0,0)
GtkBoxClass parent_class;
-#else
- GtkVBoxClass parent_class;
-#endif
void (* vector_set) (SPGradientVectorSelector *gvs, SPGradient *gr);
};
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index 515deb565..1efa8f06b 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -61,10 +61,6 @@ struct IconImpl {
static void sizeAllocate(GtkWidget *widget, GtkAllocation *allocation);
static gboolean draw(GtkWidget *widget, cairo_t *cr);
-#if !GTK_CHECK_VERSION(3,0,0)
- static gboolean expose(GtkWidget *widget, GdkEventExpose *event);
-#endif
-
static void screenChanged( GtkWidget *widget, GdkScreen *previous_screen );
static void styleSet( GtkWidget *widget, GtkStyle *previous_style );
static void themeChanged( SPIcon *icon );
@@ -146,14 +142,9 @@ sp_icon_class_init(SPIconClass *klass)
object_class->dispose = IconImpl::dispose;
-#if GTK_CHECK_VERSION(3,0,0)
widget_class->get_preferred_width = IconImpl::getPreferredWidth;
widget_class->get_preferred_height = IconImpl::getPreferredHeight;
widget_class->draw = IconImpl::draw;
-#else
- widget_class->size_request = IconImpl::sizeRequest;
- widget_class->expose_event = IconImpl::expose;
-#endif
widget_class->size_allocate = IconImpl::sizeAllocate;
widget_class->screen_changed = IconImpl::screenChanged;
widget_class->style_set = IconImpl::styleSet;
@@ -241,37 +232,15 @@ gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr)
bool unref_image = false;
/* copied from the expose function of GtkImage */
-#if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_state_flags (GTK_WIDGET(icon)) != GTK_STATE_FLAG_NORMAL && image) {
-#else
- if (gtk_widget_get_state (GTK_WIDGET(icon)) != GTK_STATE_NORMAL && image) {
- std::cerr << "IconImpl::draw: Ooops! It is called in GTK2" << std::endl;
-#endif
std::cerr << "IconImpl::draw: No image, creating fallback" << std::endl;
-#if GTK_CHECK_VERSION(3,0,0)
- // image = gtk_render_icon_pixbuf(gtk_widget_get_style_context(widget),
- // source,
- // (GtkIconSize)-1);
-
- // gtk_render_icon_pixbuf deprecated, replaced by:
GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
image = gtk_icon_theme_load_icon (icon_theme,
"gtk-image",
32,
(GtkIconLookupFlags)0,
NULL);
-#else
- GtkIconSource *source = gtk_icon_source_new();
- gtk_icon_source_set_pixbuf(source, icon->pb);
- gtk_icon_source_set_size(source, GTK_ICON_SIZE_SMALL_TOOLBAR); // note: this is boilerplate and not used
- gtk_icon_source_set_size_wildcarded(source, FALSE);
- image = gtk_style_render_icon(gtk_widget_get_style(widget), source,
- gtk_widget_get_direction(widget),
- (GtkStateType) gtk_widget_get_state(widget),
- (GtkIconSize)-1, widget, "gtk-image");
- gtk_icon_source_free(source);
-#endif
unref_image = true;
}
@@ -280,12 +249,7 @@ gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr)
GtkAllocation allocation;
GtkRequisition requisition;
gtk_widget_get_allocation(widget, &allocation);
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_preferred_size(widget, &requisition, NULL);
-#else
- gtk_widget_get_requisition(widget, &requisition);
-#endif
int x = floor(allocation.x + ((allocation.width - requisition.width) * 0.5));
int y = floor(allocation.y + ((allocation.height - requisition.height) * 0.5));
@@ -305,21 +269,6 @@ gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr)
return TRUE;
}
-#if !GTK_CHECK_VERSION(3,0,0)
-gboolean IconImpl::expose(GtkWidget *widget, GdkEventExpose * /*event*/)
-{
- gboolean result = TRUE;
-
- if (gtk_widget_is_drawable(widget)) {
- cairo_t * cr = gdk_cairo_create(gtk_widget_get_window(widget));
- result = draw(widget, cr);
- cairo_destroy(cr);
- }
-
- return result;
-}
-#endif
-
// PUBLIC CALL:
void sp_icon_fetch_pixbuf( SPIcon *icon )
{
diff --git a/src/widgets/ink-action.cpp b/src/widgets/ink-action.cpp
index c0797b236..501aeaa74 100644
--- a/src/widgets/ink-action.cpp
+++ b/src/widgets/ink-action.cpp
@@ -1,14 +1,9 @@
+#include "ink-action.h"
#include "widgets/icon.h"
-#include "widgets/ink-action.h"
+#include "widgets/image-menu-item.h"
-#include "widgets/button.h"
-
-#if GTK_CHECK_VERSION(3,0,0)
- // Fork of gtk-imagemenuitem to continue support
- #include "widgets/image-menu-item.h"
-
-#endif
+#include <gtk/gtk.h>
static void ink_action_finalize( GObject* obj );
static void ink_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec );
@@ -160,12 +155,7 @@ static GtkWidget* ink_action_create_menu_item( GtkAction* action )
if ( act->private_data->iconId ) {
gchar* label = 0;
g_object_get( G_OBJECT(act), "label", &label, NULL );
-
-#if GTK_CHECK_VERSION(3,0,0)
item = image_menu_item_new_with_mnemonic( label );
-#else
- item = gtk_image_menu_item_new_with_mnemonic( label );
-#endif
GtkWidget* child = sp_icon_new( Inkscape::ICON_SIZE_MENU, act->private_data->iconId );
// TODO this work-around is until SPIcon will live properly inside of a popup menu
@@ -180,12 +170,7 @@ static GtkWidget* ink_action_create_menu_item( GtkAction* action )
}
}
gtk_widget_show_all( child );
-
-#if GTK_CHECK_VERSION(3,0,0)
image_menu_item_set_image( IMAGE_MENU_ITEM(item), child );
-#else
- gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(item), child );
-#endif
g_free( label );
label = 0;
@@ -388,15 +373,9 @@ static GtkWidget* ink_toggle_action_create_tool_item( GtkAction* action )
if ( act->private_data->iconId ) {
GtkWidget* child = sp_icon_new( act->private_data->iconSize, act->private_data->iconId );
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_hexpand(child, FALSE);
gtk_widget_set_vexpand(child, FALSE);
gtk_tool_button_set_icon_widget(button, child);
-#else
- GtkWidget* align = gtk_alignment_new( 0.5, 0.5, 0.0, 0.0 );
- gtk_container_add( GTK_CONTAINER(align), child );
- gtk_tool_button_set_icon_widget( button, align );
-#endif
} else {
gchar *label = 0;
g_object_get( G_OBJECT(action), "short_label", &label, NULL );
@@ -425,18 +404,10 @@ static void ink_toggle_action_update_icon( InkToggleAction* action )
GtkToolButton* button = GTK_TOOL_BUTTON(proxies->data);
GtkWidget* child = sp_icon_new( action->private_data->iconSize, action->private_data->iconId );
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_hexpand(child, FALSE);
gtk_widget_set_vexpand(child, FALSE);
gtk_widget_show_all(child);
gtk_tool_button_set_icon_widget(button, child);
-#else
- GtkWidget* align = gtk_alignment_new( 0.5, 0.5, 0.0, 0.0 );
- gtk_container_add( GTK_CONTAINER(align), child );
- gtk_widget_show_all( align );
- gtk_tool_button_set_icon_widget( button, align );
-#endif
}
}
@@ -605,16 +576,9 @@ static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action )
GtkToolButton* button = GTK_TOOL_BUTTON(item);
GtkWidget* child = sp_icon_new( act->private_data->iconSize, act->private_data->iconId );
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_hexpand(child, FALSE);
gtk_widget_set_vexpand(child, FALSE);
gtk_tool_button_set_icon_widget(button, child);
-#else
- GtkWidget* align = gtk_alignment_new( 0.5, 0.5, 0.0, 0.0 );
- gtk_container_add( GTK_CONTAINER(align), child );
- gtk_tool_button_set_icon_widget( button, align );
-#endif
} else {
// For now trigger a warning but don't do anything else
GtkToolButton* button = GTK_TOOL_BUTTON(item);
diff --git a/src/widgets/ink-comboboxentry-action.cpp b/src/widgets/ink-comboboxentry-action.cpp
index ec5e26cf5..2fecb06a4 100644
--- a/src/widgets/ink-comboboxentry-action.cpp
+++ b/src/widgets/ink-comboboxentry-action.cpp
@@ -371,16 +371,10 @@ GtkWidget* create_tool_item( GtkAction* action )
g_free( combobox_name );
{
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_halign(comboBoxEntry, GTK_ALIGN_START);
gtk_widget_set_hexpand(comboBoxEntry, FALSE);
gtk_widget_set_vexpand(comboBoxEntry, FALSE);
gtk_container_add(GTK_CONTAINER(item), comboBoxEntry);
-#else
- GtkWidget *align = gtk_alignment_new(0, 0.5, 0, 0);
- gtk_container_add( GTK_CONTAINER(align), comboBoxEntry );
- gtk_container_add( GTK_CONTAINER(item), align );
-#endif
}
ink_comboboxentry_action->combobox = GTK_COMBO_BOX (comboBoxEntry);
@@ -414,11 +408,7 @@ GtkWidget* create_tool_item( GtkAction* action )
// Optionally widen the combobox width... which widens the drop-down list in list mode.
if( ink_comboboxentry_action->extra_width > 0 ) {
GtkRequisition req;
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_preferred_size(GTK_WIDGET(ink_comboboxentry_action->combobox), &req, NULL);
-#else
- gtk_widget_size_request( GTK_WIDGET( ink_comboboxentry_action->combobox ), &req );
-#endif
gtk_widget_set_size_request( GTK_WIDGET( ink_comboboxentry_action->combobox ),
req.width + ink_comboboxentry_action->extra_width, -1 );
}
@@ -635,11 +625,7 @@ void ink_comboboxentry_action_set_extra_width( Ink_ComboBoxEntry_Action* action,
// Widget may not have been created....
if( action->combobox ) {
GtkRequisition req;
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_preferred_size(GTK_WIDGET(action->combobox), &req, NULL);
-#else
- gtk_widget_size_request( GTK_WIDGET( action->combobox ), &req );
-#endif
gtk_widget_set_size_request( GTK_WIDGET( action->combobox ), req.width + action->extra_width, -1 );
}
}
diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp
index a421ea7d3..01118f337 100644
--- a/src/widgets/paint-selector.cpp
+++ b/src/widgets/paint-selector.cpp
@@ -131,11 +131,7 @@ static SPGradientSelector *getGradientFromData(SPPaintSelector const *psel)
return grad;
}
-#if GTK_CHECK_VERSION(3,0,0)
G_DEFINE_TYPE(SPPaintSelector, sp_paint_selector, GTK_TYPE_BOX);
-#else
-G_DEFINE_TYPE(SPPaintSelector, sp_paint_selector, GTK_TYPE_VBOX);
-#endif
static void
sp_paint_selector_class_init(SPPaintSelectorClass *klass)
@@ -194,19 +190,13 @@ sp_paint_selector_class_init(SPPaintSelectorClass *klass)
static void
sp_paint_selector_init(SPPaintSelector *psel)
{
-#if GTK_CHECK_VERSION(3,0,0)
gtk_orientable_set_orientation(GTK_ORIENTABLE(psel), GTK_ORIENTATION_VERTICAL);
-#endif
psel->mode = static_cast<SPPaintSelector::Mode>(-1); // huh? do you mean 0xff? -- I think this means "not in the enum"
/* Paint style button box */
-#if GTK_CHECK_VERSION(3,0,0)
psel->style = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous(GTK_BOX(psel->style), FALSE);
-#else
- psel->style = gtk_hbox_new(FALSE, 0);
-#endif
gtk_widget_show(psel->style);
gtk_container_set_border_width(GTK_CONTAINER(psel->style), 4);
gtk_box_pack_start(GTK_BOX(psel), psel->style, FALSE, FALSE, 0);
@@ -233,12 +223,8 @@ sp_paint_selector_init(SPPaintSelector *psel)
/* Fillrule */
{
-#if GTK_CHECK_VERSION(3,0,0)
- psel->fillrulebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(psel->fillrulebox), FALSE);
-#else
- psel->fillrulebox = gtk_hbox_new(FALSE, 0);
-#endif
+ psel->fillrulebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_box_set_homogeneous(GTK_BOX(psel->fillrulebox), FALSE);
gtk_box_pack_end(GTK_BOX(psel->style), psel->fillrulebox, FALSE, FALSE, 0);
GtkWidget *w;
@@ -267,22 +253,14 @@ sp_paint_selector_init(SPPaintSelector *psel)
/* Frame */
psel->label = gtk_label_new("");
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *lbbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
+ auto lbbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_set_homogeneous(GTK_BOX(lbbox), FALSE);
-#else
- GtkWidget *lbbox = gtk_hbox_new(FALSE, 4);
-#endif
gtk_widget_show(psel->label);
gtk_box_pack_start(GTK_BOX(lbbox), psel->label, false, false, 4);
gtk_box_pack_start(GTK_BOX(psel), lbbox, false, false, 4);
-#if GTK_CHECK_VERSION(3,0,0)
psel->frame = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
gtk_box_set_homogeneous(GTK_BOX(psel->frame), FALSE);
-#else
- psel->frame = gtk_vbox_new(FALSE, 4);
-#endif
gtk_widget_show(psel->frame);
//gtk_container_set_border_width(GTK_CONTAINER(psel->frame), 0);
gtk_box_pack_start(GTK_BOX(psel), psel->frame, TRUE, TRUE, 0);
@@ -697,12 +675,8 @@ static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelec
sp_paint_selector_clear_frame(psel);
/* Create new color selector */
/* Create vbox */
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
- gtk_box_set_homogeneous(GTK_BOX(vb), FALSE);
-#else
- GtkWidget *vb = gtk_vbox_new(FALSE, 4);
-#endif
+ auto vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
+ gtk_box_set_homogeneous(GTK_BOX(vb), FALSE);
gtk_widget_show(vb);
/* Color selector */
@@ -1043,21 +1017,13 @@ static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSel
sp_paint_selector_clear_frame(psel);
/* Create vbox */
-#if GTK_CHECK_VERSION(3,0,0)
tbl = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
gtk_box_set_homogeneous(GTK_BOX(tbl), FALSE);
-#else
- tbl = gtk_vbox_new(FALSE, 4);
-#endif
gtk_widget_show(tbl);
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, 1);
-#endif
/**
* Create a combo_box and store with 4 columns,
@@ -1085,13 +1051,9 @@ static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSel
}
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, 0);
-#endif
- GtkWidget *l = gtk_label_new(NULL);
+ auto l = gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(l), _("Use the <b>Node tool</b> to adjust position, scale, and rotation of the pattern on canvas. Use <b>Object &gt; Pattern &gt; Objects to Pattern</b> to create a new pattern from selection."));
gtk_label_set_line_wrap(GTK_LABEL(l), true);
gtk_widget_set_size_request(l, 180, -1);
diff --git a/src/widgets/paint-selector.h b/src/widgets/paint-selector.h
index 23c2dd456..dde14b6a6 100644
--- a/src/widgets/paint-selector.h
+++ b/src/widgets/paint-selector.h
@@ -40,11 +40,7 @@ class SPStyle;
* Generic paint selector widget.
*/
struct SPPaintSelector {
-#if GTK_CHECK_VERSION(3,0,0)
GtkBox vbox;
-#else
- GtkVBox vbox;
-#endif
enum Mode {
MODE_EMPTY,
@@ -130,11 +126,7 @@ enum {COMBO_COL_LABEL=0, COMBO_COL_STOCK=1, COMBO_COL_PATTERN=2, COMBO_COL_SEP=3
/// The SPPaintSelector vtable
struct SPPaintSelectorClass {
-#if GTK_CHECK_VERSION(3,0,0)
GtkBoxClass parent_class;
-#else
- GtkVBoxClass parent_class;
-#endif
void (* mode_changed) (SPPaintSelector *psel, SPPaintSelector::Mode mode);
diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp
index 1f6e4396c..bfb9c9071 100644
--- a/src/widgets/ruler.cpp
+++ b/src/widgets/ruler.cpp
@@ -119,7 +119,6 @@ static void sp_ruler_unmap (GtkWidget *widget);
static void sp_ruler_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-#if GTK_CHECK_VERSION(3,0,0)
static void sp_ruler_get_preferred_width (GtkWidget *widget,
gint *minimum_width,
gint *natural_width);
@@ -128,21 +127,11 @@ static void sp_ruler_get_preferred_height (GtkWidget *widget,
gint *minimum_height,
gint *natural_height);
static void sp_ruler_style_updated (GtkWidget *widget);
-#else
-static void sp_ruler_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void sp_ruler_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
-#endif
static gboolean sp_ruler_motion_notify (GtkWidget *widget,
GdkEventMotion *event);
static gboolean sp_ruler_draw (GtkWidget *widget,
cairo_t *cr);
-#if !GTK_CHECK_VERSION(3,0,0)
-static gboolean sp_ruler_expose (GtkWidget *widget,
- GdkEventExpose *event);
-#endif
static void sp_ruler_draw_ticks (SPRuler *ruler);
static GdkRectangle sp_ruler_get_pos_rect (SPRuler *ruler,
gdouble position);
@@ -180,16 +169,10 @@ sp_ruler_class_init (SPRulerClass *klass)
widget_class->map = sp_ruler_map;
widget_class->unmap = sp_ruler_unmap;
widget_class->size_allocate = sp_ruler_size_allocate;
-#if GTK_CHECK_VERSION(3,0,0)
widget_class->get_preferred_width = sp_ruler_get_preferred_width;
widget_class->get_preferred_height = sp_ruler_get_preferred_height;
widget_class->style_updated = sp_ruler_style_updated;
widget_class->draw = sp_ruler_draw;
-#else
- widget_class->size_request = sp_ruler_size_request;
- widget_class->style_set = sp_ruler_style_set;
- widget_class->expose_event = sp_ruler_expose;
-#endif
widget_class->motion_notify_event = sp_ruler_motion_notify;
g_type_class_add_private (object_class, sizeof (SPRulerPrivate));
@@ -486,16 +469,10 @@ sp_ruler_realize (GtkWidget *widget)
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_ONLY;
-#if GTK_CHECK_VERSION(3,0,0)
attributes.event_mask = (gtk_widget_get_events (widget) |
GDK_EXPOSURE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK);
-#else
- attributes.event_mask = (gtk_widget_get_events (widget) |
- GDK_EXPOSURE_MASK |
- GDK_POINTER_MOTION_MASK);
-#endif
attributes_mask = GDK_WA_X | GDK_WA_Y;
@@ -598,7 +575,6 @@ sp_ruler_size_request (GtkWidget *widget,
size = 2 + ink_rect.height * 1.7;
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *context = gtk_widget_get_style_context (widget);
GtkBorder border;
@@ -606,47 +582,25 @@ sp_ruler_size_request (GtkWidget *widget,
requisition->width = border.left + border.right;
requisition->height = border.top + border.bottom;
-#else
- GtkStyle *style = gtk_widget_get_style(widget);
-#endif
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
-#if GTK_CHECK_VERSION(3,0,0)
requisition->width += 1;
requisition->height += size;
-#else
- requisition->width = style->xthickness * 2 + 1;
- requisition->height = style->ythickness * 2 + size;
-#endif
}
else
{
-#if GTK_CHECK_VERSION(3,0,0)
requisition->width += size;
requisition->height += 1;
-#else
- requisition->width = style->xthickness * 2 + size;
- requisition->height = style->ythickness * 2 + 1;
-#endif
}
}
static void
-#if GTK_CHECK_VERSION(3,0,0)
sp_ruler_style_updated (GtkWidget *widget)
-#else
-sp_ruler_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
-#endif
{
SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (widget);
-#if GTK_CHECK_VERSION(3,0,0)
GTK_WIDGET_CLASS (sp_ruler_parent_class)->style_updated (widget);
-#else
- GTK_WIDGET_CLASS (sp_ruler_parent_class)->style_set (widget, prev_style);
-#endif
gtk_widget_style_get (widget,
"font-scale", &priv->font_scale,
@@ -659,7 +613,6 @@ sp_ruler_style_set (GtkWidget *widget,
}
}
-#if GTK_CHECK_VERSION(3,0,0)
static void
sp_ruler_get_preferred_width (GtkWidget *widget,
gint *minimum_width,
@@ -683,33 +636,19 @@ sp_ruler_get_preferred_height (GtkWidget *widget,
*minimum_height = *natural_height = requisition.height;
}
-#else
-static gboolean
-sp_ruler_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(widget));
- GtkAllocation allocation;
-
- gdk_cairo_region (cr, event->region);
- cairo_clip (cr);
-
- gtk_widget_get_allocation (widget, &allocation);
-
- gboolean result = sp_ruler_draw (widget, cr);
-
- cairo_destroy (cr);
-
- return result;
-}
-#endif
static gboolean
sp_ruler_draw (GtkWidget *widget,
cairo_t *cr)
{
- SPRuler *ruler = SP_RULER (widget);
- SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
+ SPRuler *ruler = SP_RULER (widget);
+ SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
+ GtkStyleContext *context = gtk_widget_get_style_context (widget);
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ gtk_render_background (context, cr, 0, 0, allocation.width, allocation.height);
+ gtk_render_frame (context, cr, 0, 0, allocation.width, allocation.height);
sp_ruler_draw_ticks (ruler);
@@ -735,7 +674,7 @@ sp_ruler_make_pixmap (SPRuler *ruler)
priv->backing_store =
gdk_window_create_similar_surface (gtk_widget_get_window (widget),
- CAIRO_CONTENT_COLOR,
+ CAIRO_CONTENT_COLOR_ALPHA,
allocation.width,
allocation.height);
@@ -748,13 +687,8 @@ sp_ruler_draw_pos (SPRuler *ruler,
{
GtkWidget *widget = GTK_WIDGET (ruler);
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *context = gtk_widget_get_style_context (widget);
GdkRGBA color;
-#else
- GtkStyle *style = gtk_widget_get_style (widget);
- GtkStateType state = gtk_widget_get_state (widget);
-#endif
SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
GdkRectangle pos_rect;
@@ -766,13 +700,9 @@ sp_ruler_draw_pos (SPRuler *ruler,
if ((pos_rect.width > 0) && (pos_rect.height > 0))
{
-#if GTK_CHECK_VERSION(3,0,0)
gtk_style_context_get_color (context, gtk_widget_get_state_flags (widget),
&color);
gdk_cairo_set_source_rgba (cr, &color);
-#else
- gdk_cairo_set_source_color (cr, &style->fg[state]);
-#endif
cairo_move_to (cr, pos_rect.x, pos_rect.y);
@@ -1111,16 +1041,9 @@ sp_ruler_draw_ticks (SPRuler *ruler)
{
GtkWidget *widget = GTK_WIDGET (ruler);
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *context = gtk_widget_get_style_context (widget);
GtkBorder border;
GdkRGBA color;
-#else
- GtkStyle *style = gtk_widget_get_style (widget);
- GtkStateType state = gtk_widget_get_state (widget);
- gint xthickness;
- gint ythickness;
-#endif
SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
GtkAllocation allocation;
@@ -1149,12 +1072,7 @@ sp_ruler_draw_ticks (SPRuler *ruler)
gtk_widget_get_allocation (widget, &allocation);
-#if GTK_CHECK_VERSION(3,0,0)
gtk_style_context_get_border (context, static_cast<GtkStateFlags>(0), &border);
-#else
- xthickness = style->xthickness;
- ythickness = style->ythickness;
-#endif
layout = sp_ruler_get_layout (widget, "0123456789");
pango_layout_get_extents (layout, &ink_rect, &logical_rect);
@@ -1165,28 +1083,20 @@ sp_ruler_draw_ticks (SPRuler *ruler)
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
width = allocation.width;
-#if GTK_CHECK_VERSION(3,0,0)
height = allocation.height - (border.top + border.bottom);
-#else
- height = allocation.height - ythickness * 2;
-#endif
}
else
{
width = allocation.height;
-#if GTK_CHECK_VERSION(3,0,0)
height = allocation.width - (border.top + border.bottom);
-#else
- height = allocation.width - ythickness * 2;
-#endif
}
cr = cairo_create (priv->backing_store);
-#if GTK_CHECK_VERSION(3,0,0)
- gtk_render_background (context, cr, 0, 0, allocation.width, allocation.height);
- gtk_render_frame (context, cr, 0, 0, allocation.width, allocation.height);
-
+ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+ cairo_paint (cr);
+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+
gtk_style_context_get_color (context, gtk_widget_get_state_flags (widget),
&color);
gdk_cairo_set_source_rgba (cr, &color);
@@ -1207,30 +1117,6 @@ sp_ruler_draw_ticks (SPRuler *ruler)
1,
allocation.height - (border.top + border.bottom));
}
-#else
- gdk_cairo_set_source_color (cr, &style->bg[state]);
-
- cairo_paint (cr);
-
- gdk_cairo_set_source_color(cr, &style->fg[state]);
-
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- cairo_rectangle (cr,
- xthickness,
- height + ythickness,
- allocation.width - 2 * xthickness,
- 1);
- }
- else
- {
- cairo_rectangle (cr,
- height + xthickness,
- ythickness,
- 1,
- allocation.height - 2 * ythickness);
- }
-#endif
sp_ruler_get_range (ruler, &lower, &upper, &max_size);
@@ -1311,7 +1197,6 @@ sp_ruler_draw_ticks (SPRuler *ruler)
// by a pixel, and jump back on the next redraw). This is suppressed by adding 1e-9 (that's only one nanopixel ;-))
pos = gint(Inkscape::round((cur - lower) * increment + 1e-12));
-#if GTK_CHECK_VERSION(3,0,0)
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
cairo_rectangle (cr,
@@ -1324,20 +1209,6 @@ sp_ruler_draw_ticks (SPRuler *ruler)
height + border.left - length, pos,
length, 1);
}
-#else
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- cairo_rectangle (cr,
- pos, height + ythickness - length,
- 1, length);
- }
- else
- {
- cairo_rectangle (cr,
- height + xthickness - length, pos,
- length, 1);
- }
-#endif
/* draw label */
double label_spacing_px = fabs(increment*(double)ruler_metric.ruler_scale[scale]/ruler_metric.subdivide[i]);
@@ -1355,15 +1226,9 @@ sp_ruler_draw_ticks (SPRuler *ruler)
pango_layout_set_text (layout, unit_str, -1);
pango_layout_get_extents (layout, &logical_rect, NULL);
-#if GTK_CHECK_VERSION(3,0,0)
cairo_move_to (cr,
pos + 2,
border.top + PANGO_PIXELS (logical_rect.y - digit_offset));
-#else
- cairo_move_to (cr,
- pos + 2,
- ythickness + PANGO_PIXELS (logical_rect.y - digit_offset));
-#endif
pango_cairo_show_layout(cr, layout);
}
@@ -1377,15 +1242,9 @@ sp_ruler_draw_ticks (SPRuler *ruler)
pango_layout_set_text (layout, digit_str, 1);
pango_layout_get_extents (layout, NULL, &logical_rect);
-#if GTK_CHECK_VERSION(3,0,0)
cairo_move_to (cr,
border.left + 1,
pos + digit_height * j + 2 + PANGO_PIXELS (logical_rect.y - digit_offset));
-#else
- cairo_move_to (cr,
- xthickness + 1,
- pos + digit_height * j + 2 + PANGO_PIXELS (logical_rect.y - digit_offset));
-#endif
pango_cairo_show_layout (cr, layout);
}
}
@@ -1422,7 +1281,6 @@ sp_ruler_get_pos_rect (SPRuler *ruler,
gtk_widget_get_allocation (widget, &allocation);
-#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *context = gtk_widget_get_style_context (widget);
GtkBorder padding;
@@ -1430,11 +1288,6 @@ sp_ruler_get_pos_rect (SPRuler *ruler,
xthickness = padding.left + padding.right;
ythickness = padding.top + padding.bottom;
-#else
- GtkStyle *style = gtk_widget_get_style (widget);
- xthickness = style->xthickness;
- ythickness = style->ythickness;
-#endif
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
@@ -1472,9 +1325,6 @@ sp_ruler_get_pos_rect (SPRuler *ruler,
rect.y = ROUND ((position - lower) * increment) + (ythickness - rect.height) / 2 - 1;
}
- rect.x += allocation.x;
- rect.y += allocation.y;
-
return rect;
}
@@ -1497,18 +1347,21 @@ sp_ruler_queue_pos_redraw (SPRuler *ruler)
{
SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
const GdkRectangle rect = sp_ruler_get_pos_rect (ruler, priv->position);
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (GTK_WIDGET(ruler), &allocation);
gtk_widget_queue_draw_area (GTK_WIDGET(ruler),
- rect.x,
- rect.y,
+ rect.x + allocation.x,
+ rect.y + allocation.y,
rect.width,
rect.height);
if (priv->last_pos_rect.width != 0 || priv->last_pos_rect.height != 0)
{
gtk_widget_queue_draw_area (GTK_WIDGET(ruler),
- priv->last_pos_rect.x,
- priv->last_pos_rect.y,
+ priv->last_pos_rect.x + allocation.x,
+ priv->last_pos_rect.y + allocation.y,
priv->last_pos_rect.width,
priv->last_pos_rect.height);
diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp
index 9a48b9a07..fde5a95cd 100644
--- a/src/widgets/select-toolbar.cpp
+++ b/src/widgets/select-toolbar.cpp
@@ -411,12 +411,8 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb
g_object_set_data(G_OBJECT(spw), "dtw", desktop->getCanvas());
// The vb frame holds all other widgets and is used to set sensitivity depending on selection state.
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ auto vb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous(GTK_BOX(vb), FALSE);
-#else
- GtkWidget *vb = gtk_hbox_new(FALSE, 0);
-#endif
gtk_widget_show(vb);
gtk_container_add(GTK_CONTAINER(spw), vb);
diff --git a/src/widgets/sp-attribute-widget.cpp b/src/widgets/sp-attribute-widget.cpp
index de44cdbb4..cbff62b23 100644
--- a/src/widgets/sp-attribute-widget.cpp
+++ b/src/widgets/sp-attribute-widget.cpp
@@ -16,12 +16,7 @@
#include <glibmm/i18n.h>
#include <gtkmm/entry.h>
-
-#if WITH_GTKMM_3_0
-# include <gtkmm/grid.h>
-#else
-# include <gtkmm/table.h>
-#endif
+#include <gtkmm/grid.h>
#include "sp-object.h"
#include "xml/repr.h"
@@ -152,11 +147,7 @@ void SPAttributeTable::set_object(SPObject *object,
release_connection = object->connectRelease (sigc::bind<1>(sigc::ptr_fun(&sp_attribute_table_object_release), this));
// Create table
-#if WITH_GTKMM_3_0
table = new Gtk::Grid();
-#else
- table = new Gtk::Table(attributes.size(), 2, false);
-#endif
if (!(parent == NULL))
gtk_container_add(GTK_CONTAINER(parent), (GtkWidget*)table->gobj());
@@ -167,27 +158,17 @@ void SPAttributeTable::set_object(SPObject *object,
Gtk::Label *ll = new Gtk::Label (_(labels[i].c_str()));
ll->show();
ll->set_alignment (1.0, 0.5);
-
-#if WITH_GTKMM_3_0
ll->set_vexpand();
ll->set_margin_left(XPAD);
ll->set_margin_right(XPAD);
ll->set_margin_top(XPAD);
ll->set_margin_bottom(XPAD);
table->attach(*ll, 0, i, 1, 1);
-#else
- table->attach (*ll, 0, 1, i, i + 1,
- Gtk::FILL,
- (Gtk::EXPAND | Gtk::FILL),
- XPAD, YPAD );
-#endif
Gtk::Entry *ee = new Gtk::Entry();
ee->show();
const gchar *val = object->getRepr()->attribute(attributes[i].c_str());
ee->set_text (val ? val : (const gchar *) "");
-
-#if WITH_GTKMM_3_0
ee->set_hexpand();
ee->set_vexpand();
ee->set_margin_left(XPAD);
@@ -195,12 +176,6 @@ void SPAttributeTable::set_object(SPObject *object,
ee->set_margin_top(XPAD);
ee->set_margin_bottom(XPAD);
table->attach(*ee, 1, i, 1, 1);
-#else
- table->attach (*ee, 1, 2, i, i + 1,
- (Gtk::EXPAND | Gtk::FILL),
- (Gtk::EXPAND | Gtk::FILL),
- XPAD, YPAD );
-#endif
_entries.push_back(ee);
g_signal_connect ( ee->gobj(), "changed",
diff --git a/src/widgets/sp-attribute-widget.h b/src/widgets/sp-attribute-widget.h
index d9b972201..161bb706a 100644
--- a/src/widgets/sp-attribute-widget.h
+++ b/src/widgets/sp-attribute-widget.h
@@ -25,12 +25,7 @@
namespace Gtk {
class Entry;
-
-#if WITH_GTKMM_3_0
class Grid;
-#else
-class Table;
-#endif
}
namespace Inkscape {
@@ -138,11 +133,7 @@ private:
/**
* Container widget for the dynamically created child widgets (labels and entry boxes).
*/
-#if WITH_GTKMM_3_0
Gtk::Grid *table;
-#else
- Gtk::Table *table;
-#endif
/**
* List of attributes.
diff --git a/src/widgets/sp-color-selector.cpp b/src/widgets/sp-color-selector.cpp
index 932f074d2..159350012 100644
--- a/src/widgets/sp-color-selector.cpp
+++ b/src/widgets/sp-color-selector.cpp
@@ -32,11 +32,7 @@ static guint csel_signals[LAST_SIGNAL] = {0};
double ColorSelector::_epsilon = 1e-4;
-#if GTK_CHECK_VERSION(3,0,0)
G_DEFINE_TYPE(SPColorSelector, sp_color_selector, GTK_TYPE_BOX);
-#else
-G_DEFINE_TYPE(SPColorSelector, sp_color_selector, GTK_TYPE_VBOX);
-#endif
void sp_color_selector_class_init( SPColorSelectorClass *klass )
{
@@ -86,9 +82,7 @@ void sp_color_selector_class_init( SPColorSelectorClass *klass )
void sp_color_selector_init( SPColorSelector *csel )
{
-#if GTK_CHECK_VERSION(3,0,0)
gtk_orientable_set_orientation(GTK_ORIENTABLE(csel), GTK_ORIENTATION_VERTICAL);
-#endif
if ( csel->base )
{
diff --git a/src/widgets/sp-color-selector.h b/src/widgets/sp-color-selector.h
index 75cb79b00..14a9fccdf 100644
--- a/src/widgets/sp-color-selector.h
+++ b/src/widgets/sp-color-selector.h
@@ -64,21 +64,12 @@ private:
#define SP_COLOR_SELECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SP_TYPE_COLOR_SELECTOR, SPColorSelectorClass))
struct SPColorSelector {
-#if GTK_CHECK_VERSION(3,0,0)
GtkBox vbox;
-#else
- GtkVBox vbox;
-#endif
-
ColorSelector* base;
};
struct SPColorSelectorClass {
-#if GTK_CHECK_VERSION(3,0,0)
GtkBoxClass parent_class;
-#else
- GtkVBoxClass parent_class;
-#endif
const gchar **name;
guint submode_count;
diff --git a/src/widgets/sp-widget.cpp b/src/widgets/sp-widget.cpp
index 180704f59..707e62c12 100644
--- a/src/widgets/sp-widget.cpp
+++ b/src/widgets/sp-widget.cpp
@@ -40,7 +40,6 @@ public:
static void show(GtkWidget *widget);
static void hide(GtkWidget *widget);
-#if GTK_CHECK_VERSION(3,0,0)
static void getPreferredWidth(GtkWidget *widget,
gint *minimal_width,
gint *natural_width);
@@ -49,10 +48,6 @@ public:
gint *minimal_height,
gint *natural_height);
static gboolean draw(GtkWidget *widget, cairo_t *cr);
-#else
- static void sizeRequest(GtkWidget *widget, GtkRequisition *requisition);
- static gboolean expose(GtkWidget *widget, GdkEventExpose *event);
-#endif
static void sizeAllocate(GtkWidget *widget, GtkAllocation *allocation);
static void modifySelectionCB(Selection *selection, guint flags, SPWidget *spw);
@@ -119,14 +114,9 @@ sp_widget_class_init(SPWidgetClass *klass)
widget_class->show = SPWidgetImpl::show;
widget_class->hide = SPWidgetImpl::hide;
-#if GTK_CHECK_VERSION(3,0,0)
widget_class->get_preferred_width = SPWidgetImpl::getPreferredWidth;
widget_class->get_preferred_height = SPWidgetImpl::getPreferredHeight;
widget_class->draw = SPWidgetImpl::draw;
-#else
- widget_class->size_request = SPWidgetImpl::sizeRequest;
- widget_class->expose_event = SPWidgetImpl::expose;
-#endif
widget_class->size_allocate = SPWidgetImpl::sizeAllocate;
}
@@ -206,27 +196,18 @@ void SPWidgetImpl::hide(GtkWidget *widget)
}
}
-#if GTK_CHECK_VERSION(3,0,0)
gboolean SPWidgetImpl::draw(GtkWidget *widget, cairo_t *cr)
-#else
-gboolean SPWidgetImpl::expose(GtkWidget *widget, GdkEventExpose *event)
-#endif
{
GtkBin *bin = GTK_BIN(widget);
GtkWidget *child = gtk_bin_get_child(bin);
if (child) {
-#if GTK_CHECK_VERSION(3,0,0)
gtk_container_propagate_draw(GTK_CONTAINER(widget), child, cr);
-#else
- gtk_container_propagate_expose(GTK_CONTAINER(widget), child, event);
-#endif
}
return FALSE;
}
-#if GTK_CHECK_VERSION(3,0,0)
void SPWidgetImpl::getPreferredWidth(GtkWidget *widget, gint *minimal_width, gint *natural_width)
{
GtkBin *bin = GTK_BIN(widget);
@@ -246,17 +227,6 @@ void SPWidgetImpl::getPreferredHeight(GtkWidget *widget, gint *minimal_height, g
gtk_widget_get_preferred_height(child, minimal_height, natural_height);
}
}
-#else
-void SPWidgetImpl::sizeRequest(GtkWidget *widget, GtkRequisition *requisition)
-{
- GtkBin *bin = GTK_BIN(widget);
- GtkWidget *child = gtk_bin_get_child(bin);
-
- if (child) {
- gtk_widget_size_request(child, requisition);
- }
-}
-#endif
void SPWidgetImpl::sizeAllocate(GtkWidget *widget, GtkAllocation *allocation)
{
diff --git a/src/widgets/sp-xmlview-attr-list.cpp b/src/widgets/sp-xmlview-attr-list.cpp
index 45dbae52a..e99605b97 100644
--- a/src/widgets/sp-xmlview-attr-list.cpp
+++ b/src/widgets/sp-xmlview-attr-list.cpp
@@ -20,11 +20,7 @@
#include "../xml/node-event-vector.h"
#include "sp-xmlview-attr-list.h"
-#if GTK_CHECK_VERSION(3,0,0)
static void sp_xmlview_attr_list_destroy(GtkWidget * object);
-#else
-static void sp_xmlview_attr_list_destroy(GtkObject * object);
-#endif
static void event_attr_changed (Inkscape::XML::Node * repr, const gchar * name, const gchar * old_value, const gchar * new_value, bool is_interactive, gpointer data);
@@ -87,13 +83,8 @@ G_DEFINE_TYPE(SPXMLViewAttrList, sp_xmlview_attr_list, GTK_TYPE_TREE_VIEW);
void sp_xmlview_attr_list_class_init (SPXMLViewAttrListClass * klass)
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidgetClass * widget_class = GTK_WIDGET_CLASS(klass);
+ auto widget_class = GTK_WIDGET_CLASS(klass);
widget_class->destroy = sp_xmlview_attr_list_destroy;
-#else
- GtkObjectClass * object_class = GTK_OBJECT_CLASS(klass);
- object_class->destroy = sp_xmlview_attr_list_destroy;
-#endif
g_signal_new("row-value-changed",
G_TYPE_FROM_CLASS(klass),
@@ -112,11 +103,7 @@ sp_xmlview_attr_list_init (SPXMLViewAttrList * list)
list->repr = NULL;
}
-#if GTK_CHECK_VERSION(3,0,0)
void sp_xmlview_attr_list_destroy(GtkWidget * object)
-#else
-void sp_xmlview_attr_list_destroy(GtkObject * object)
-#endif
{
SPXMLViewAttrList * list;
@@ -125,11 +112,7 @@ void sp_xmlview_attr_list_destroy(GtkObject * object)
g_object_unref(list->store);
sp_xmlview_attr_list_set_repr (list, NULL);
-#if GTK_CHECK_VERSION(3,0,0)
GTK_WIDGET_CLASS(sp_xmlview_attr_list_parent_class)->destroy (object);
-#else
- GTK_OBJECT_CLASS(sp_xmlview_attr_list_parent_class)->destroy (object);
-#endif
}
void sp_xmlview_attr_list_select_row_by_key(SPXMLViewAttrList * list, const gchar *name)
diff --git a/src/widgets/sp-xmlview-content.cpp b/src/widgets/sp-xmlview-content.cpp
index a1d8475ba..6e59ba3cd 100644
--- a/src/widgets/sp-xmlview-content.cpp
+++ b/src/widgets/sp-xmlview-content.cpp
@@ -23,11 +23,7 @@
using Inkscape::DocumentUndo;
-#if GTK_CHECK_VERSION(3,0,0)
static void sp_xmlview_content_destroy(GtkWidget * object);
-#else
-static void sp_xmlview_content_destroy(GtkObject * object);
-#endif
void sp_xmlview_content_changed (GtkTextBuffer *tb, SPXMLViewContent *text);
@@ -80,13 +76,8 @@ G_DEFINE_TYPE(SPXMLViewContent, sp_xmlview_content, GTK_TYPE_TEXT_VIEW);
void sp_xmlview_content_class_init(SPXMLViewContentClass * klass)
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidgetClass * widget_class = GTK_WIDGET_CLASS(klass);
+ auto widget_class = GTK_WIDGET_CLASS(klass);
widget_class->destroy = sp_xmlview_content_destroy;
-#else
- GtkObjectClass * object_class = GTK_OBJECT_CLASS(klass);
- object_class->destroy = sp_xmlview_content_destroy;
-#endif
}
void
@@ -96,21 +87,13 @@ sp_xmlview_content_init (SPXMLViewContent *text)
text->blocked = FALSE;
}
-#if GTK_CHECK_VERSION(3,0,0)
void sp_xmlview_content_destroy(GtkWidget * object)
-#else
-void sp_xmlview_content_destroy(GtkObject * object)
-#endif
{
SPXMLViewContent * text = SP_XMLVIEW_CONTENT (object);
sp_xmlview_content_set_repr (text, NULL);
-#if GTK_CHECK_VERSION(3,0,0)
GTK_WIDGET_CLASS (sp_xmlview_content_parent_class)->destroy (object);
-#else
- GTK_OBJECT_CLASS (sp_xmlview_content_parent_class)->destroy (object);
-#endif
}
void
diff --git a/src/widgets/sp-xmlview-tree.cpp b/src/widgets/sp-xmlview-tree.cpp
index 5af7c243d..3f8cc6063 100644
--- a/src/widgets/sp-xmlview-tree.cpp
+++ b/src/widgets/sp-xmlview-tree.cpp
@@ -22,11 +22,7 @@ struct NodeData {
enum { STORE_TEXT_COL = 0, STORE_DATA_COL, STORE_REPR_COL, STORE_N_COLS };
-#if GTK_CHECK_VERSION(3,0,0)
static void sp_xmlview_tree_destroy(GtkWidget * object);
-#else
-static void sp_xmlview_tree_destroy(GtkObject * object);
-#endif
static NodeData * node_data_new (SPXMLViewTree * tree, GtkTreeIter * node, GtkTreeRowReference *rowref, Inkscape::XML::Node * repr);
@@ -120,13 +116,8 @@ G_DEFINE_TYPE(SPXMLViewTree, sp_xmlview_tree, GTK_TYPE_TREE_VIEW);
void sp_xmlview_tree_class_init(SPXMLViewTreeClass * klass)
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidgetClass * widget_class = GTK_WIDGET_CLASS(klass);
+ auto widget_class = GTK_WIDGET_CLASS(klass);
widget_class->destroy = sp_xmlview_tree_destroy;
-#else
- GtkObjectClass * object_class = GTK_OBJECT_CLASS(klass);
- object_class->destroy = sp_xmlview_tree_destroy;
-#endif
// Signal for when a tree drag and drop has completed
g_signal_new ( "tree_move",
@@ -147,22 +138,13 @@ sp_xmlview_tree_init (SPXMLViewTree * tree)
tree->dndactive = FALSE;
}
-
-#if GTK_CHECK_VERSION(3,0,0)
void sp_xmlview_tree_destroy(GtkWidget * object)
-#else
-void sp_xmlview_tree_destroy(GtkObject * object)
-#endif
{
SPXMLViewTree * tree = SP_XMLVIEW_TREE (object);
sp_xmlview_tree_set_repr (tree, NULL);
-#if GTK_CHECK_VERSION(3,0,0)
GTK_WIDGET_CLASS(sp_xmlview_tree_parent_class)->destroy (object);
-#else
- GTK_OBJECT_CLASS(sp_xmlview_tree_parent_class)->destroy (object);
-#endif
}
/*
diff --git a/src/widgets/spw-utilities.cpp b/src/widgets/spw-utilities.cpp
index 8bc472601..88a76b1ed 100644
--- a/src/widgets/spw-utilities.cpp
+++ b/src/widgets/spw-utilities.cpp
@@ -19,12 +19,7 @@
#include <gtkmm/box.h>
#include <gtkmm/label.h>
-
-#if GTK_CHECK_VERSION(3,0,0)
#include <gtkmm/grid.h>
-#else
-#include <gtkmm/table.h>
-#endif
#include "selection.h"
@@ -34,11 +29,7 @@
* Creates a label widget with the given text, at the given col, row
* position in the table.
*/
-#if GTK_CHECK_VERSION(3,0,0)
Gtk::Label * spw_label(Gtk::Grid *table, const gchar *label_text, int col, int row, Gtk::Widget* target)
-#else
-Gtk::Label * spw_label(Gtk::Table *table, const gchar *label_text, int col, int row, Gtk::Widget* target)
-#endif
{
Gtk::Label *label_widget = new Gtk::Label();
g_assert(label_widget != NULL);
@@ -54,7 +45,6 @@ Gtk::Label * spw_label(Gtk::Table *table, const gchar *label_text, int col, int
label_widget->set_alignment(1.0, 0.5);
label_widget->show();
-#if GTK_CHECK_VERSION(3,0,0)
label_widget->set_hexpand();
label_widget->set_halign(Gtk::ALIGN_FILL);
label_widget->set_valign(Gtk::ALIGN_CENTER);
@@ -68,9 +58,6 @@ Gtk::Label * spw_label(Gtk::Table *table, const gchar *label_text, int col, int
#endif
table->attach(*label_widget, col, row, 1, 1);
-#else
- table->attach(*label_widget, col, col+1, row, row+1, (Gtk::EXPAND | Gtk::FILL), static_cast<Gtk::AttachOptions>(0), 4, 0);
-#endif
return label_widget;
}
@@ -82,16 +69,9 @@ spw_label_old(GtkWidget *table, const gchar *label_text, int col, int row)
label_widget = gtk_label_new (label_text);
g_assert(label_widget != NULL);
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_halign(label_widget, GTK_ALIGN_END);
-#else
- gtk_misc_set_alignment (GTK_MISC (label_widget), 1.0, 0.5);
-#endif
-
gtk_widget_show (label_widget);
-#if GTK_CHECK_VERSION(3,0,0)
#if GTK_CHECK_VERSION(3,12,0)
gtk_widget_set_margin_start(label_widget, 4);
gtk_widget_set_margin_end(label_widget, 4);
@@ -103,10 +83,6 @@ spw_label_old(GtkWidget *table, const gchar *label_text, int col, int row)
gtk_widget_set_halign(label_widget, GTK_ALIGN_FILL);
gtk_widget_set_valign(label_widget, GTK_ALIGN_CENTER);
gtk_grid_attach(GTK_GRID(table), label_widget, col, row, 1, 1);
-#else
- gtk_table_attach(GTK_TABLE (table), label_widget, col, col+1, row, row+1,
- (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 0);
-#endif
return label_widget;
}
@@ -115,25 +91,16 @@ spw_label_old(GtkWidget *table, const gchar *label_text, int col, int row)
* Creates a horizontal layout manager with 4-pixel spacing between children
* and space for 'width' columns.
*/
-#if GTK_CHECK_VERSION(3,0,0)
Gtk::HBox * spw_hbox(Gtk::Grid * table, int width, int col, int row)
-#else
-Gtk::HBox * spw_hbox(Gtk::Table * table, int width, int col, int row)
-#endif
{
/* Create a new hbox with a 4-pixel spacing between children */
Gtk::HBox *hb = new Gtk::HBox(false, 4);
g_assert(hb != NULL);
hb->show();
-
-#if GTK_CHECK_VERSION(3,0,0)
hb->set_hexpand();
hb->set_halign(Gtk::ALIGN_FILL);
hb->set_valign(Gtk::ALIGN_CENTER);
table->attach(*hb, col, row, width, 1);
-#else
- table->attach(*hb, col, col+width, row, row+1, (Gtk::EXPAND | Gtk::FILL), static_cast<Gtk::AttachOptions>(0), 0, 0);
-#endif
return hb;
}
@@ -175,37 +142,21 @@ spw_checkbutton(GtkWidget * dialog, GtkWidget * table,
g_assert(table != NULL);
GtkWidget *l = gtk_label_new (label);
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_halign(l, GTK_ALIGN_END);
-#else
- gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5);
-#endif
-
gtk_widget_show (l);
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_halign(l, GTK_ALIGN_FILL);
gtk_widget_set_hexpand(l, TRUE);
gtk_widget_set_valign(l, GTK_ALIGN_CENTER);
gtk_grid_attach(GTK_GRID(table), l, 0, row, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), l, 0, 1, row, row+1,
- (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 0, 0);
-#endif
b = gtk_check_button_new ();
gtk_widget_show (b);
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_halign(b, GTK_ALIGN_FILL);
gtk_widget_set_hexpand(b, TRUE);
gtk_widget_set_valign(b, GTK_ALIGN_CENTER);
gtk_grid_attach(GTK_GRID(table), b, 1, row, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), b, 1, 2, row, row+1,
- (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 0, 0);
-#endif
g_object_set_data (G_OBJECT (b), "key", key);
g_object_set_data (G_OBJECT (dialog), key, b);
@@ -233,16 +184,10 @@ spw_dropdown(GtkWidget * dialog, GtkWidget * table,
spw_label_old(table, label_text, 0, row);
gtk_widget_show (selector);
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_halign(selector, GTK_ALIGN_FILL);
gtk_widget_set_hexpand(selector, TRUE);
gtk_widget_set_valign(selector, GTK_ALIGN_CENTER);
gtk_grid_attach(GTK_GRID(table), selector, 1, row, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table), selector, 1, 2, row, row+1,
- (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 0, 0);
-#endif
g_object_set_data (G_OBJECT (dialog), key, selector);
return selector;
@@ -253,8 +198,7 @@ sp_set_font_size_recursive (GtkWidget *w, gpointer font)
{
guint size = GPOINTER_TO_UINT (font);
-#if GTK_CHECK_VERSION(3,0,0)
- GtkCssProvider *css_provider = gtk_css_provider_new();
+ auto css_provider = gtk_css_provider_new();
const double pt_size = size / static_cast<double>(PANGO_SCALE);
std::ostringstream css_data;
@@ -266,25 +210,16 @@ sp_set_font_size_recursive (GtkWidget *w, gpointer font)
css_data.str().c_str(),
-1, NULL);
- GtkStyleContext *style_context = gtk_widget_get_style_context(w);
+ auto style_context = gtk_widget_get_style_context(w);
gtk_style_context_add_provider(style_context,
GTK_STYLE_PROVIDER(css_provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
-#else
- PangoFontDescription* pan = pango_font_description_new ();
- pango_font_description_set_size (pan, size);
- gtk_widget_modify_font (w, pan);
-#endif
if (GTK_IS_CONTAINER(w)) {
gtk_container_foreach (GTK_CONTAINER(w), (GtkCallback) sp_set_font_size_recursive, font);
}
-#if GTK_CHECK_VERSION(3,0,0)
g_object_unref(css_provider);
-#else
- pango_font_description_free (pan);
-#endif
}
void
diff --git a/src/widgets/spw-utilities.h b/src/widgets/spw-utilities.h
index 31f29e026..71b451631 100644
--- a/src/widgets/spw-utilities.h
+++ b/src/widgets/spw-utilities.h
@@ -20,25 +20,13 @@
namespace Gtk {
class Label;
-
-#if GTK_CHECK_VERSION(3,0,0)
class Grid;
-#else
- class Table;
-#endif
-
class HBox;
class Widget;
}
-#if GTK_CHECK_VERSION(3,0,0)
Gtk::Label * spw_label(Gtk::Grid *table, gchar const *label_text, int col, int row, Gtk::Widget *target);
Gtk::HBox * spw_hbox(Gtk::Grid *table, int width, int col, int row);
-#else
-Gtk::Label * spw_label(Gtk::Table *table, gchar const *label_text, int col, int row, Gtk::Widget *target);
-Gtk::HBox * spw_hbox(Gtk::Table *table, int width, int col, int row);
-#endif
-
GtkWidget * spw_label_old(GtkWidget *table, gchar const *label_text, int col, int row);
GtkWidget *
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index b66d97c1d..e6e1a49c9 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -152,17 +152,9 @@ StrokeStyle::StrokeStyle() :
Gtk::HBox *f = new Gtk::HBox(false, 0);
f->show();
add(*f);
-
-#if WITH_GTKMM_3_0
table = new Gtk::Grid();
table->set_border_width(4);
table->set_row_spacing(4);
-#else
- table = new Gtk::Table(3, 6, false);
- table->set_border_width(4);
- table->set_row_spacings(4);
-#endif
-
table->show();
f->add(*table);
@@ -178,13 +170,7 @@ StrokeStyle::StrokeStyle() :
// stroke_width_set_unit will be removed (because ScalarUnit takes care of conversions itself), and
// with it, the two remaining calls of stroke_average_width, allowing us to get rid of that
// function in desktop-style.
-
-#if WITH_GTKMM_3_0
widthAdj = new Glib::RefPtr<Gtk::Adjustment>(Gtk::Adjustment::create(1.0, 0.0, 1000.0, 0.1, 10.0, 0.0));
-#else
- widthAdj = new Gtk::Adjustment(1.0, 0.0, 1000.0, 0.1, 10.0, 0.0);
-#endif
-
widthSpin = new Inkscape::UI::Widget::SpinButton(*widthAdj, 0.1, 3);
widthSpin->set_tooltip_text(_("Stroke width"));
widthSpin->show();
@@ -210,12 +196,7 @@ StrokeStyle::StrokeStyle() :
us->show();
hb->pack_start(*us, FALSE, FALSE, 0);
-
-#if WITH_GTKMM_3_0
(*widthAdj)->signal_value_changed().connect(sigc::mem_fun(*this, &StrokeStyle::widthChangedCB));
-#else
- widthAdj->signal_value_changed().connect(sigc::mem_fun(*this, &StrokeStyle::widthChangedCB));
-#endif
i++;
/* Dash */
@@ -227,16 +208,10 @@ StrokeStyle::StrokeStyle() :
dashSelector = Gtk::manage(new SPDashSelector);
dashSelector->show();
-
-#if WITH_GTKMM_3_0
dashSelector->set_hexpand();
dashSelector->set_halign(Gtk::ALIGN_FILL);
dashSelector->set_valign(Gtk::ALIGN_CENTER);
table->attach(*dashSelector, 1, i, 3, 1);
-#else
- table->attach(*dashSelector, 1, 4, i, i+1, (Gtk::EXPAND | Gtk::FILL), static_cast<Gtk::AttachOptions>(0), 0, 0);
-#endif
-
dashSelector->changed_signal.connect(sigc::mem_fun(*this, &StrokeStyle::lineDashChangedCB));
i++;
@@ -320,28 +295,14 @@ StrokeStyle::StrokeStyle() :
// miter limit is to cut off such spikes (i.e. convert them into bevels)
// when they become too long.
//spw_label(t, _("Miter _limit:"), 0, i);
-
-#if WITH_GTKMM_3_0
miterLimitAdj = new Glib::RefPtr<Gtk::Adjustment>(Gtk::Adjustment::create(4.0, 0.0, 100.0, 0.1, 10.0, 0.0));
miterLimitSpin = new Inkscape::UI::Widget::SpinButton(*miterLimitAdj, 0.1, 2);
-#else
- miterLimitAdj = new Gtk::Adjustment(4.0, 0.0, 100.0, 0.1, 10.0, 0.0);
- miterLimitSpin = new Inkscape::UI::Widget::SpinButton(*miterLimitAdj, 0.1, 2);
-#endif
-
miterLimitSpin->set_tooltip_text(_("Maximum length of the miter (in units of stroke width)"));
miterLimitSpin->show();
sp_dialog_defocus_on_enter_cpp(miterLimitSpin);
hb->pack_start(*miterLimitSpin, false, false, 0);
-
-#if WITH_GTKMM_3_0
(*miterLimitAdj)->signal_value_changed().connect(sigc::mem_fun(*this, &StrokeStyle::miterLimitChangedCB));
-
-#else
- miterLimitAdj->signal_value_changed().connect(sigc::mem_fun(*this, &StrokeStyle::miterLimitChangedCB));
-#endif
-
i++;
/* Cap type */
@@ -924,17 +885,9 @@ StrokeStyle::updateLine()
if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) {
double avgwidth = Inkscape::Util::Quantity::convert(query.stroke_width.computed, "px", unit);
-#if WITH_GTKMM_3_0
(*widthAdj)->set_value(avgwidth);
-#else
- widthAdj->set_value(avgwidth);
-#endif
} else {
-#if WITH_GTKMM_3_0
(*widthAdj)->set_value(100);
-#else
- widthAdj->set_value(100);
-#endif
}
// if none of the selected objects has a stroke, than quite some controls should be disabled
@@ -955,11 +908,7 @@ StrokeStyle::updateLine()
}
if (result_ml != QUERY_STYLE_NOTHING)
-#if WITH_GTKMM_3_0
(*miterLimitAdj)->set_value(query.stroke_miterlimit.value); // TODO: reflect averagedness?
-#else
- miterLimitAdj->set_value(query.stroke_miterlimit.value); // TODO: reflect averagedness?
-#endif
if (result_join != QUERY_STYLE_MULTIPLE_DIFFERENT &&
result_join != QUERY_STYLE_NOTHING ) {
@@ -1047,13 +996,8 @@ StrokeStyle::scaleLine()
SPCSSAttr *css = sp_repr_css_attr_new();
if (!items.empty()) {
-#if WITH_GTKMM_3_0
double width_typed = (*widthAdj)->get_value();
double const miterlimit = (*miterLimitAdj)->get_value();
-#else
- double width_typed = widthAdj->get_value();
- double const miterlimit = miterLimitAdj->get_value();
-#endif
Inkscape::Util::Unit const *const unit = unitSelector->getUnit();
@@ -1093,11 +1037,7 @@ StrokeStyle::scaleLine()
if (unit->type != Inkscape::Util::UNIT_TYPE_LINEAR) {
// reset to 100 percent
-#if WITH_GTKMM_3_0
(*widthAdj)->set_value(100.0);
-#else
- widthAdj->set_value(100.0);
-#endif
}
}
diff --git a/src/widgets/stroke-style.h b/src/widgets/stroke-style.h
index d83067a4a..76582602d 100644
--- a/src/widgets/stroke-style.h
+++ b/src/widgets/stroke-style.h
@@ -23,12 +23,7 @@
#include "widgets/dash-selector.h"
#include <gtkmm/radiobutton.h>
-
-#if WITH_GTKMM_3_0
#include <gtkmm/grid.h>
-#else
-#include <gtkmm/table.h>
-#endif
#include <glibmm/i18n.h>
@@ -189,15 +184,9 @@ private:
MarkerComboBox *startMarkerCombo;
MarkerComboBox *midMarkerCombo;
MarkerComboBox *endMarkerCombo;
-#if WITH_GTKMM_3_0
Gtk::Grid *table;
Glib::RefPtr<Gtk::Adjustment> *widthAdj;
Glib::RefPtr<Gtk::Adjustment> *miterLimitAdj;
-#else
- Gtk::Table *table;
- Gtk::Adjustment *widthAdj;
- Gtk::Adjustment *miterLimitAdj;
-#endif
Inkscape::UI::Widget::SpinButton *miterLimitSpin;
Inkscape::UI::Widget::SpinButton *widthSpin;
Inkscape::UI::Widget::UnitMenu *unitSelector;
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp
index 3fa240a05..41199ecfe 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -1557,8 +1557,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
g_object_set_data( holder, "TextFontFamilyAction", act );
// Change style of drop-down from menu to list
-#if GTK_CHECK_VERSION(3,0,0)
- GtkCssProvider *css_provider = gtk_css_provider_new();
+ auto css_provider = gtk_css_provider_new();
gtk_css_provider_load_from_data(css_provider,
"#TextFontFamilyAction_combobox {\n"
" -GtkComboBox-appears-as-list: true;\n"
@@ -1569,24 +1568,10 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
"}\n",
-1, NULL);
- GdkScreen *screen = gdk_screen_get_default();
+ auto screen = gdk_screen_get_default();
gtk_style_context_add_provider_for_screen(screen,
GTK_STYLE_PROVIDER(css_provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
-#else
- gtk_rc_parse_string (
- "style \"dropdown-as-list-style\"\n"
- "{\n"
- " GtkComboBox::appears-as-list = 1\n"
- "}\n"
- "widget \"*.TextFontFamilyAction_combobox\" style \"dropdown-as-list-style\""
- "style \"fontfamily-separator-style\"\n"
- "{\n"
- " GtkWidget::wide-separators = 1\n"
- " GtkWidget::separator-height = 6\n"
- "}\n"
- "widget \"*gtk-combobox-popup-window.GtkScrolledWindow.GtkTreeView\" style \"fontfamily-separator-style\"");
-#endif
}
/* Font size */
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 1e67cca8f..20c3936a3 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -1009,26 +1009,18 @@ static GtkWidget* toolboxNewCommon( GtkWidget* tb, BarId id, GtkPositionType /*h
GtkWidget *ToolboxFactory::createToolToolbox()
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *tb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ auto tb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_name(tb, "ToolToolbox");
gtk_box_set_homogeneous(GTK_BOX(tb), FALSE);
-#else
- GtkWidget *tb = gtk_vbox_new(FALSE, 0);
-#endif
return toolboxNewCommon( tb, BAR_TOOL, GTK_POS_TOP );
}
GtkWidget *ToolboxFactory::createAuxToolbox()
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *tb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ auto tb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_name(tb, "AuxToolbox");
gtk_box_set_homogeneous(GTK_BOX(tb), FALSE);
-#else
- GtkWidget *tb = gtk_vbox_new(FALSE, 0);
-#endif
return toolboxNewCommon( tb, BAR_AUX, GTK_POS_LEFT );
}
@@ -1039,38 +1031,26 @@ GtkWidget *ToolboxFactory::createAuxToolbox()
GtkWidget *ToolboxFactory::createCommandsToolbox()
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *tb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ auto tb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_name(tb, "CommandsToolbox");
gtk_box_set_homogeneous(GTK_BOX(tb), FALSE);
-#else
- GtkWidget *tb = gtk_vbox_new(FALSE, 0);
-#endif
return toolboxNewCommon( tb, BAR_COMMANDS, GTK_POS_LEFT );
}
GtkWidget *ToolboxFactory::createSnapToolbox()
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *tb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ auto tb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_name(tb, "SnapToolbox");
gtk_box_set_homogeneous(GTK_BOX(tb), FALSE);
-#else
- GtkWidget *tb = gtk_vbox_new(FALSE, 0);
-#endif
return toolboxNewCommon( tb, BAR_SNAP, GTK_POS_LEFT );
}
static GtkWidget* createCustomSlider( GtkAdjustment *adjustment, gdouble climbRate, guint digits, Inkscape::UI::Widget::UnitTracker *unit_tracker)
{
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::Adjustment> adj = Glib::wrap(adjustment, true);
- Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(adj, climbRate, digits);
-#else
- Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(adjustment, true), climbRate, digits);
-#endif
+ auto adj = Glib::wrap(adjustment, true);
+ auto inkSpinner = new Inkscape::UI::Widget::SpinButton(adj, climbRate, digits);
inkSpinner->addUnitTracker(unit_tracker);
inkSpinner = Gtk::manage( inkSpinner );
GtkWidget *widget = GTK_WIDGET( inkSpinner->gobj() );
@@ -1432,17 +1412,10 @@ void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
if ( aux_toolboxes[i].prep_func ) {
// converted to GtkActions and UIManager
- GtkWidget* kludge = dataHolders[aux_toolboxes[i].type_name];
-
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget* holder = gtk_grid_new();
+ auto kludge = dataHolders[aux_toolboxes[i].type_name];
+ auto holder = gtk_grid_new();
gtk_widget_set_name( holder, "ToolbarHolder" );
gtk_grid_attach( GTK_GRID(holder), kludge, 2, 0, 1, 1);
-#else
- GtkWidget* holder = gtk_table_new( 1, 3, FALSE );
- gtk_table_attach( GTK_TABLE(holder), kludge, 2, 3, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0 );
-#endif
-
gchar* tmp = g_strdup_printf( "/ui/%s", aux_toolboxes[i].ui_name );
GtkWidget* toolBar = gtk_ui_manager_get_widget( mgr, tmp );
g_free( tmp );
@@ -1454,30 +1427,20 @@ void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
Inkscape::IconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/small");
gtk_toolbar_set_icon_size( GTK_TOOLBAR(toolBar), static_cast<GtkIconSize>(toolboxSize) );
-
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_hexpand(toolBar, TRUE);
gtk_grid_attach( GTK_GRID(holder), toolBar, 0, 0, 1, 1);
-#else
- gtk_table_attach( GTK_TABLE(holder), toolBar, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0 );
-#endif
if ( aux_toolboxes[i].swatch_verb_id != SP_VERB_INVALID ) {
Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch( NULL, _(aux_toolboxes[i].swatch_tip) );
swatch->setDesktop( desktop );
swatch->setClickVerb( aux_toolboxes[i].swatch_verb_id );
swatch->setWatchedTool( aux_toolboxes[i].swatch_tool, true );
- GtkWidget *swatch_ = GTK_WIDGET( swatch->gobj() );
-
-#if GTK_CHECK_VERSION(3,0,0)
+ auto swatch_ = GTK_WIDGET( swatch->gobj() );
gtk_widget_set_margin_left(swatch_, AUX_BETWEEN_BUTTON_GROUPS);
gtk_widget_set_margin_right(swatch_, AUX_BETWEEN_BUTTON_GROUPS);
gtk_widget_set_margin_top(swatch_, AUX_SPACING);
gtk_widget_set_margin_bottom(swatch_, AUX_SPACING);
gtk_grid_attach( GTK_GRID(holder), swatch_, 1, 0, 1, 1);
-#else
- gtk_table_attach( GTK_TABLE(holder), swatch_, 1, 2, 0, 1, (GtkAttachOptions)(GTK_SHRINK | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), AUX_BETWEEN_BUTTON_GROUPS, AUX_SPACING );
-#endif
}
if(i==0){
gtk_widget_show_all( holder );