From da27cd196516ec88c10ed9c799bbb5dd38244f6c Mon Sep 17 00:00:00 2001 From: Karl Cheng Date: Wed, 8 May 2019 20:38:05 +1000 Subject: Remove leftover GTK/gtkmm >= 3.16 check This was mostly done in 630be82740, but it seems this file was missed. Refs: https://gitlab.com/inkscape/inkscape/commit/630be8274013c5eef5f19e19a14bc6d759aada5a --- src/extension/param/description.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 154c172df..60e2d02c8 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -108,11 +108,7 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node label->set_text(newtext); } label->set_line_wrap(); -#if (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION >= 16) label->set_xalign(0); -#else - label->set_alignment(Gtk::ALIGN_START); -#endif // TODO: Ugly "fix" for gtk3 width/height calculation of labels. // - If not applying any limits long labels will make the window grow horizontally until it uses up -- cgit v1.2.3 From 0d0545debc43c951942786c425eed9dad70a270e Mon Sep 17 00:00:00 2001 From: Karl Cheng Date: Wed, 8 May 2019 20:50:54 +1000 Subject: Replace deprecated Gtk::Misc functions --- src/extension/extension.cpp | 3 ++- src/ui/desktop/menubar.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index a373e5ec0..77a171487 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -796,7 +796,8 @@ Extension::get_help_widget() if (_help == nullptr) { Gtk::Label * content = Gtk::manage(new Gtk::Label(_("Currently there is no help available for this Extension. Please look on the Inkscape website or ask on the mailing lists if you have questions regarding this extension."))); - content->set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START); + content->set_xalign(0); + content->set_yalign(0); retval->pack_start(*content, true, true, 4); content->set_line_wrap(true); content->show(); diff --git a/src/ui/desktop/menubar.cpp b/src/ui/desktop/menubar.cpp index 7300e8c3b..04e97a933 100644 --- a/src/ui/desktop/menubar.cpp +++ b/src/ui/desktop/menubar.cpp @@ -124,7 +124,7 @@ build_menu_item_from_verb(SPAction* action, } Gtk::AccelLabel* label = Gtk::manage(new Gtk::AccelLabel(action->name, true)); - label->set_alignment(0.0, 0.5); + label->set_xalign(0.0); label->set_accel_widget(*menuitem); sp_shortcut_add_accelerator((GtkWidget*)menuitem->gobj(), sp_shortcut_get_primary(action->verb)); -- cgit v1.2.3 From 2f4ab1a9c35f85320413fbb03ed52c7c440852ea Mon Sep 17 00:00:00 2001 From: Karl Cheng Date: Sat, 11 May 2019 20:37:14 +1000 Subject: Replace deprecated Gtk::Label numeric align values --- src/ui/dialog/filter-effects-dialog.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 48398e716..4521cada7 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -983,8 +983,9 @@ private: Gtk::HBox *hb = Gtk::manage(new Gtk::HBox); hb->set_spacing(12); - if(label != "") { - Gtk::Label *lbl = Gtk::manage(new Gtk::Label(label, 0.0, 0.5)); + if (label != "") { + Gtk::Label *lbl = Gtk::manage(new Gtk::Label(label)); + lbl->set_xalign(0.0); hb->pack_start(*lbl, Gtk::PACK_SHRINK); _size_group->add_widget(*lbl); } @@ -1156,10 +1157,11 @@ public: : AttrWidget(SP_ATTR_INVALID), _dialog(d), _settings(d, _box, sigc::mem_fun(_dialog, &FilterEffectsDialog::set_child_attr_direct), LIGHT_ENDSOURCE), - _light_label(_("Light Source:"), 0.0, 0.5), + _light_label(_("Light Source:")), _light_source(LightSourceConverter), _locked(false) { + _light_label.set_xalign(0.0); _settings._size_group->add_widget(_light_label); _light_box.pack_start(_light_label, Gtk::PACK_SHRINK); _light_box.pack_start(_light_source, Gtk::PACK_EXPAND_WIDGET); -- cgit v1.2.3 From 4f745cb4474ad8ec8abc7d357bb08c42fdec4ddf Mon Sep 17 00:00:00 2001 From: Karl Cheng Date: Sat, 11 May 2019 20:45:22 +1000 Subject: Remove deprecated gtk_adjustment_changed() call As of GTK 3.18 this has been deprecated, it is no longer required. Also remove gtkmm equivalent Gtk::Adjustment::changed(). --- src/ui/toolbar/gradient-toolbar.cpp | 1 - src/widgets/gradient-vector.cpp | 2 -- 2 files changed, 3 deletions(-) (limited to 'src') diff --git a/src/ui/toolbar/gradient-toolbar.cpp b/src/ui/toolbar/gradient-toolbar.cpp index afd613c83..b38736cf7 100644 --- a/src/ui/toolbar/gradient-toolbar.cpp +++ b/src/ui/toolbar/gradient-toolbar.cpp @@ -749,7 +749,6 @@ GradientToolbar::stop_set_offset() _offset_adj->set_value(stop->offset); _offset_item->set_sensitive( !isEndStop ); - _offset_adj->changed(); } /** diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index 677936ba5..cc5fe0185 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -641,8 +641,6 @@ static void sp_grad_edit_combo_box_changed (GtkComboBox * /*widget*/, GtkWidget gtk_adjustment_set_value(adj, stop->offset); - gtk_adjustment_changed(adj); - blocked = FALSE; } -- cgit v1.2.3 From d1a0590532064daa20732a88360b722f251e8442 Mon Sep 17 00:00:00 2001 From: Karl Cheng Date: Sat, 11 May 2019 20:46:51 +1000 Subject: Replace deprecated Gtk::Menu::popup() -> popup_at_pointer() --- src/ui/widget/spin-button-tool-item.cpp | 17 ++++------------- src/ui/widget/spin-button-tool-item.h | 4 ++-- 2 files changed, 6 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/ui/widget/spin-button-tool-item.cpp b/src/ui/widget/spin-button-tool-item.cpp index c21989723..b283939e9 100644 --- a/src/ui/widget/spin-button-tool-item.cpp +++ b/src/ui/widget/spin-button-tool-item.cpp @@ -418,9 +418,9 @@ SpinButtonToolItem::set_icon(const Glib::ustring& icon_name) } bool -SpinButtonToolItem::on_btn_button_press_event(GdkEventButton *button_event) +SpinButtonToolItem::on_btn_button_press_event(const GdkEventButton *button_event) { - if (gdk_event_triggers_context_menu((GdkEvent *)button_event) && + if (gdk_event_triggers_context_menu(reinterpret_cast(button_event)) && button_event->type == GDK_BUTTON_PRESS) { do_popup_menu(button_event); return true; @@ -430,21 +430,12 @@ SpinButtonToolItem::on_btn_button_press_event(GdkEventButton *button_event) } void -SpinButtonToolItem::do_popup_menu(GdkEventButton *button_event) +SpinButtonToolItem::do_popup_menu(const GdkEventButton *button_event) { auto menu = create_numeric_menu(); menu->attach_to_widget(*_btn); menu->show_all(); - - int button = 0; - int time = gtk_get_current_event_time(); - - if (button_event) { - button = button_event->button; - time = button_event->time; - } - - menu->popup(button, time); + menu->popup_at_pointer(reinterpret_cast(button_event)); } /** diff --git a/src/ui/widget/spin-button-tool-item.h b/src/ui/widget/spin-button-tool-item.h index 4386d4799..c073f561c 100644 --- a/src/ui/widget/spin-button-tool-item.h +++ b/src/ui/widget/spin-button-tool-item.h @@ -44,9 +44,9 @@ private: bool on_btn_focus_in_event(GdkEventFocus *focus_event); bool on_btn_focus_out_event(GdkEventFocus *focus_event); bool on_btn_key_press_event(GdkEventKey *key_event); - bool on_btn_button_press_event(GdkEventButton *button_event); + bool on_btn_button_press_event(const GdkEventButton *button_event); bool on_popup_menu(); - void do_popup_menu(GdkEventButton *button_event); + void do_popup_menu(const GdkEventButton *button_event); void defocus(); bool process_tab(int direction); -- cgit v1.2.3 From eee1a8040505f84fad7b313a82082e85ea0a94c6 Mon Sep 17 00:00:00 2001 From: Karl Cheng Date: Wed, 22 May 2019 20:39:30 +1000 Subject: Replace deprecated Gtk::Main::quit() call As this should only be called in a console context, we can replace Gtk::Main::quit() with Gio::Application::quit(). --- src/file.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/file.cpp b/src/file.cpp index a0c53a6ee..6b8e52c45 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -148,12 +148,13 @@ SPDesktop* sp_file_new_default() /** * Perform document closures preceding an exit() */ -void -sp_file_exit() +void sp_file_exit() { if (SP_ACTIVE_DESKTOP == nullptr) { // We must be in console mode - Gtk::Main::quit(); + auto app = Gio::Application::get_default(); + g_assert(app); + app->quit(); } else { sp_ui_close_all(); // no need to call inkscape_exit here; last document being closed will take care of that @@ -161,7 +162,6 @@ sp_file_exit() } - /** * Handle prompting user for "do you want to revert"? Revert on "OK" */ -- cgit v1.2.3 From 89c1effb9a63177251f759bee7c2e76cec06c2cd Mon Sep 17 00:00:00 2001 From: Karl Cheng Date: Wed, 22 May 2019 21:31:09 +1000 Subject: Remove custom tab order in Document Properties The method for handling custom tab order in GTK (set_focus_chain) has been deprecated since GTK 3.24 with no direct replacement. I've decided to remove this code as the code did not seem to make any difference during testing: the tab order appeared to be the same. Regardless, 'Page -> Custom size' in Document Properties is the only place that it's used, so the impact should be fairly limited anyway. --- src/ui/widget/page-sizer.cpp | 7 ------- src/ui/widget/page-sizer.h | 1 - 2 files changed, 8 deletions(-) (limited to 'src') diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index a193f84da..bd7409a0c 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -191,13 +191,6 @@ PageSizer::PageSizer(Registry & _wr) _customDimTable.attach(_fitPageMarginExpander, 0, 1, 3, 1); - _dimTabOrderList.clear(); - _dimTabOrderList.push_back(&_dimensionWidth); - _dimTabOrderList.push_back(&_dimensionHeight); - _dimTabOrderList.push_back(&_dimensionUnits); - _dimTabOrderList.push_back(&_fitPageMarginExpander); - _customDimTable.set_focus_chain(_dimTabOrderList); - //## Set up fit page expander _fitPageMarginExpander.set_use_underline(); _fitPageMarginExpander.set_label(_("Resi_ze page to content...")); diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h index 54ffb9c73..b399835b7 100644 --- a/src/ui/widget/page-sizer.h +++ b/src/ui/widget/page-sizer.h @@ -224,7 +224,6 @@ protected: RegisteredUnitMenu _dimensionUnits; RegisteredScalarUnit _dimensionWidth; RegisteredScalarUnit _dimensionHeight; - std::vector _dimTabOrderList; //### Fit Page options Gtk::Expander _fitPageMarginExpander; -- cgit v1.2.3 From 0a4ab9a3f12609a955cd02ea4b22aa901fdd1eb1 Mon Sep 17 00:00:00 2001 From: Karl Cheng Date: Mon, 10 Jun 2019 18:24:48 +1000 Subject: Remove deprecated usage of custom Gtk::IconSize Custom Gtk::IconSize values have been deprecated since GTK 3.10. Also fix incorrect usage of pixel values to the Gtk::IconSize() constructor (introduced in de13793763), these are in fact meant to be enum values. Refs: https://gitlab.com/inkscape/inkscape/commit/de137937630524727b287fb2e03ec470554683a8 --- src/ui/dialog/livepatheffect-add.cpp | 15 ++++++++------- src/ui/dialog/symbols.cpp | 37 ++++++++++++++++++------------------ 2 files changed, 27 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index a31f71a8c..39b6f7d52 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -141,7 +141,7 @@ LivePathEffectAdd::LivePathEffectAdd() LPEExperimentalToggle->set_active(active); Gtk::Image *LPEIcon; builder_effect->get_widget("LPEIcon", LPEIcon); - LPEIcon->set_from_icon_name(converter.get_icon(data->id), Gtk::BuiltinIconSize(Gtk::ICON_SIZE_DIALOG)); + LPEIcon->set_from_icon_name(converter.get_icon(data->id), Gtk::IconSize(Gtk::ICON_SIZE_DIALOG)); Gtk::EventBox *LPESelectorEffectEventInfo; builder_effect->get_widget("LPESelectorEffectEventInfo", LPESelectorEffectEventInfo); LPESelectorEffectEventInfo->signal_enter_notify_event().connect(sigc::bind>( @@ -150,7 +150,7 @@ LivePathEffectAdd::LivePathEffectAdd() builder_effect->get_widget("LPESelectorEffectEventFav", LPESelectorEffectEventFav); if (sp_has_fav(LPEName->get_text())) { Gtk::Image *fav = dynamic_cast(LPESelectorEffectEventFav->get_child()); - fav->set_from_icon_name("draw-star", Gtk::IconSize(25)); + fav->set_from_icon_name("draw-star", Gtk::IconSize(Gtk::ICON_SIZE_SMALL_TOOLBAR)); } Gtk::EventBox *LPESelectorEffectEventFavTop; builder_effect->get_widget("LPESelectorEffectEventFavTop", LPESelectorEffectEventFavTop); @@ -271,7 +271,7 @@ bool LivePathEffectAdd::pop_description(GdkEventCrossing *evt, Glib::RefPtrget_widget("LPESelectorEffectInfoIcon", LPESelectorEffectInfoIcon); - LPESelectorEffectInfoIcon->set_from_icon_name(LPEIcon->get_icon_name(), Gtk::IconSize(60)); + LPESelectorEffectInfoIcon->set_from_icon_name(LPEIcon->get_icon_name(), Gtk::IconSize(Gtk::ICON_SIZE_DIALOG)); Gtk::Label *LPESelectorEffectInfoName; _builder->get_widget("LPESelectorEffectInfoName", LPESelectorEffectInfoName); @@ -306,7 +306,7 @@ bool LivePathEffectAdd::fav_toggler(GdkEventButton *evt, Glib::RefPtrget_text())) { LPESelectorEffectEventFavTop->set_visible(false); LPESelectorEffectEventFavTop->hide(); - LPESelectorEffectFav->set_from_icon_name("draw-star-outline", Gtk::IconSize(25)); + LPESelectorEffectFav->set_from_icon_name("draw-star-outline", Gtk::IconSize(Gtk::ICON_SIZE_SMALL_TOOLBAR)); sp_remove_fav(LPEName->get_text()); LPESelectorEffect->get_parent()->get_style_context()->remove_class("lpefav"); LPESelectorEffect->get_parent()->get_style_context()->add_class("lpenormal"); @@ -317,7 +317,7 @@ bool LivePathEffectAdd::fav_toggler(GdkEventButton *evt, Glib::RefPtrset_visible(true); LPESelectorEffectEventFavTop->show(); - LPESelectorEffectFav->set_from_icon_name("draw-star", Gtk::IconSize(25)); + LPESelectorEffectFav->set_from_icon_name("draw-star", Gtk::IconSize(Gtk::ICON_SIZE_SMALL_TOOLBAR)); sp_add_fav(LPEName->get_text()); LPESelectorEffect->get_parent()->get_style_context()->add_class("lpefav"); LPESelectorEffect->get_parent()->get_style_context()->remove_class("lpenormal"); @@ -333,14 +333,15 @@ bool LivePathEffectAdd::show_fav_toggler(GdkEventButton *evt) Gtk::Image *favimage = dynamic_cast(_LPESelectorEffectEventFavShow->get_child()); if (favimage) { if (_showfavs) { - favimage->set_from_icon_name("draw-star", Gtk::IconSize(favimage->get_pixel_size())); + favimage->set_from_icon_name("draw-star", Gtk::IconSize(Gtk::ICON_SIZE_SMALL_TOOLBAR)); } else { - favimage->set_from_icon_name("draw-star-outline", Gtk::IconSize(favimage->get_pixel_size())); + favimage->set_from_icon_name("draw-star-outline", Gtk::IconSize(Gtk::ICON_SIZE_SMALL_TOOLBAR)); } } reload_effect_list(); return true; } + bool LivePathEffectAdd::apply(GdkEventButton *evt, Glib::RefPtr builder_effect, const LivePathEffect::EnumEffectData *to_add) { diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index d4b48258d..ec190ef29 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -202,37 +202,38 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : overlay->get_style_context()->add_class("colorbright"); overlay->get_style_context()->add_class("backgroundbright"); scroller->set_size_request(100, 250); - table->attach(*Gtk::manage(overlay),0,row,2,1); + table->attach(*Gtk::manage(overlay), 0, row, 2, 1); /*************************Overlays******************************/ overlay_opacity = new Gtk::Image(); - overlay_opacity->set_halign(Gtk::ALIGN_START ); - overlay_opacity->set_valign(Gtk::ALIGN_START ); - //No results - iconsize = Gtk::IconSize().from_name(Glib::ustring("ICON_SIZE_DIALOG_EXTRA")); - if (!iconsize) { - iconsize = Gtk::IconSize().register_new(Glib::ustring("ICON_SIZE_DIALOG_EXTRA"), 110, 110); - } - overlay_icon = sp_get_icon_image("searching", iconsize); + overlay_opacity->set_halign(Gtk::ALIGN_START); + overlay_opacity->set_valign(Gtk::ALIGN_START); + + // No results + overlay_icon = sp_get_icon_image("searching", Gtk::ICON_SIZE_DIALOG); + overlay_icon->set_pixel_size(110); overlay_icon->get_style_context()->add_class("iconsymbolic"); - overlay_icon->set_halign(Gtk::ALIGN_CENTER ); - overlay_icon->set_valign(Gtk::ALIGN_START ); + overlay_icon->set_halign(Gtk::ALIGN_CENTER); + overlay_icon->set_valign(Gtk::ALIGN_START); overlay_icon->set_margin_top(45); + overlay_title = new Gtk::Label(); overlay_title->set_halign(Gtk::ALIGN_CENTER ); overlay_title->set_valign(Gtk::ALIGN_START ); overlay_title->set_justify(Gtk::JUSTIFY_CENTER); overlay_title->set_margin_top(155); + overlay_desc = new Gtk::Label(); - overlay_desc->set_halign(Gtk::ALIGN_CENTER ); - overlay_desc->set_valign(Gtk::ALIGN_START ); + overlay_desc->set_halign(Gtk::ALIGN_CENTER); + overlay_desc->set_valign(Gtk::ALIGN_START); overlay_desc->set_margin_top(180); overlay_desc->set_justify(Gtk::JUSTIFY_CENTER); - overlay->add_overlay(* overlay_opacity); - overlay->add_overlay(* overlay_icon); - overlay->add_overlay(* overlay_title); - overlay->add_overlay(* overlay_desc); - + + overlay->add_overlay(*overlay_opacity); + overlay->add_overlay(*overlay_icon); + overlay->add_overlay(*overlay_title); + overlay->add_overlay(*overlay_desc); + previous_height = 0; ++row; -- cgit v1.2.3