From 329341f89f78cd995e6266e97e19e76f08a419b2 Mon Sep 17 00:00:00 2001 From: Lawrence Lee <45837045+Lawrence37@users.noreply.github.com> Date: Sat, 5 Mar 2022 18:36:28 -0800 Subject: [PATCH] Replace Gtk::make_managed() with Gtk::manage() Maintain compatibility with gtkmm 3.16. --- rtgui/editorpanel.cc | 2 +- rtgui/externaleditorpreferences.cc | 22 +++++++++++----------- rtgui/popupcommon.cc | 12 ++++++------ rtgui/preferences.cc | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 987852891..a9797a216 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -671,7 +671,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) queueimg->set_tooltip_markup (M ("MAIN_BUTTON_PUTTOQUEUE_TOOLTIP")); setExpandAlignProperties (queueimg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); - send_to_external = Gtk::make_managed("", false); + send_to_external = Gtk::manage(new PopUpButton("", false)); send_to_external->set_tooltip_text(M("MAIN_BUTTON_SENDTOEDITOR_TOOLTIP")); setExpandAlignProperties(send_to_external->buttonGroup, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); send_to_external->addEntry("palette-brush.png", M("GENERAL_OTHER")); diff --git a/rtgui/externaleditorpreferences.cc b/rtgui/externaleditorpreferences.cc index c6ee9b93e..58a562725 100644 --- a/rtgui/externaleditorpreferences.cc +++ b/rtgui/externaleditorpreferences.cc @@ -34,7 +34,7 @@ ExternalEditorPreferences::ExternalEditorPreferences(): toolbar(Gtk::Orientation::ORIENTATION_HORIZONTAL) { // List view. - list_view = Gtk::make_managed(); + list_view = Gtk::manage(new Gtk::TreeView()); list_view->set_model(list_model); list_view->append_column(*Gtk::manage(makeAppColumn())); list_view->append_column(*Gtk::manage(makeCommandColumn())); @@ -52,13 +52,13 @@ ExternalEditorPreferences::ExternalEditorPreferences(): list_scroll_area.add(*list_view); // Toolbar buttons. - auto add_image = Gtk::make_managed("add-small.png"); - auto remove_image = Gtk::make_managed("remove-small.png"); - button_add = Gtk::make_managed(); - button_remove = Gtk::make_managed(); + auto add_image = Gtk::manage(new RTImage("add-small.png")); + auto remove_image = Gtk::manage(new RTImage("remove-small.png")); + button_add = Gtk::manage(new Gtk::Button()); + button_remove = Gtk::manage(new Gtk::Button()); button_add->set_image(*add_image); button_remove->set_image(*remove_image); - button_app_chooser = Gtk::make_managed(M("PREFERENCES_EXTERNALEDITOR_CHANGE")); + button_app_chooser = Gtk::manage(new Gtk::Button(M("PREFERENCES_EXTERNALEDITOR_CHANGE"))); button_file_chooser = Gtk::manage(new Gtk::Button(M("PREFERENCES_EXTERNALEDITOR_CHANGE_FILE"))); button_app_chooser->signal_pressed().connect(sigc::mem_fun( @@ -159,9 +159,9 @@ void ExternalEditorPreferences::addEditor() Gtk::TreeViewColumn *ExternalEditorPreferences::makeAppColumn() { - auto name_renderer = Gtk::make_managed(); - auto icon_renderer = Gtk::make_managed(); - auto col = Gtk::make_managed(); + auto name_renderer = Gtk::manage(new Gtk::CellRendererText()); + auto icon_renderer = Gtk::manage(new Gtk::CellRendererPixbuf()); + auto col = Gtk::manage(new Gtk::TreeViewColumn()); col->set_title(M("PREFERENCES_EXTERNALEDITOR_COLUMN_NAME")); col->set_resizable(); @@ -180,8 +180,8 @@ Gtk::TreeViewColumn *ExternalEditorPreferences::makeAppColumn() Gtk::TreeViewColumn *ExternalEditorPreferences::makeCommandColumn() { - auto command_renderer = Gtk::make_managed(); - auto col = Gtk::make_managed(); + auto command_renderer = Gtk::manage(new Gtk::CellRendererText()); + auto col = Gtk::manage(new Gtk::TreeViewColumn()); col->set_title(M("PREFERENCES_EXTERNALEDITOR_COLUMN_COMMAND")); col->pack_start(*command_renderer); diff --git a/rtgui/popupcommon.cc b/rtgui/popupcommon.cc index c33ac068e..1dbde833e 100644 --- a/rtgui/popupcommon.cc +++ b/rtgui/popupcommon.cc @@ -50,14 +50,14 @@ PopUpCommon::PopUpCommon (Gtk::Button* thisButton, const Glib::ustring& label) buttonGroup->get_style_context()->add_class("image-combo"); // Create the image for the button - buttonImage = Gtk::make_managed(); + buttonImage = Gtk::manage(new RTImage()); setExpandAlignProperties(buttonImage, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); imageContainer->attach_next_to(*buttonImage, Gtk::POS_RIGHT, 1, 1); buttonImage->set_no_show_all(); // Create the button for showing the pop-up. - arrowButton = Gtk::make_managed(); - Gtk::Image *arrowImage = Gtk::make_managed(); + arrowButton = Gtk::manage(new Gtk::Button()); + Gtk::Image *arrowImage = Gtk::manage(new Gtk::Image()); arrowImage->set_from_icon_name("pan-down-symbolic", Gtk::ICON_SIZE_BUTTON); setExpandAlignProperties(arrowButton, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); arrowButton->add(*arrowImage); //menuSymbol); @@ -82,7 +82,7 @@ bool PopUpCommon::insertEntry(int position, const Glib::ustring& fileName, const { RTImage* image = nullptr; if (!fileName.empty()) { - image = Gtk::make_managed(fileName); + image = Gtk::manage(new RTImage(fileName)); } bool success = insertEntryImpl(position, fileName, Glib::RefPtr(), image, label); if (!success && image) { @@ -93,7 +93,7 @@ bool PopUpCommon::insertEntry(int position, const Glib::ustring& fileName, const bool PopUpCommon::insertEntry(int position, const Glib::RefPtr& gIcon, const Glib::ustring& label) { - RTImage* image = Gtk::make_managed(gIcon, Gtk::ICON_SIZE_BUTTON); + RTImage* image = Gtk::manage(new RTImage(gIcon, Gtk::ICON_SIZE_BUTTON)); bool success = insertEntryImpl(position, "", gIcon, image, label); if (!success) { delete image; @@ -107,7 +107,7 @@ bool PopUpCommon::insertEntryImpl(int position, const Glib::ustring& fileName, c return false; // Create the menu item and image - MyImageMenuItem *newItem = Gtk::make_managed(label, image); + MyImageMenuItem *newItem = Gtk::manage(new MyImageMenuItem(label, image)); imageIcons.insert(imageIcons.begin() + position, gIcon); imageFilenames.insert(imageFilenames.begin() + position, fileName); images.insert(images.begin() + position, newItem->getImage()); diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index a8f5c64a3..734e74e91 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -1249,7 +1249,7 @@ Gtk::Widget* Preferences::getGeneralPanel() #endif #endif - externalEditors = Gtk::make_managed(); + externalEditors = Gtk::manage(new ExternalEditorPreferences()); externalEditors->set_size_request(-1, 200); #ifdef EXT_EDITORS_RADIOS externaleditorGrid->attach_next_to(*externalEditors, *edOther, Gtk::POS_BOTTOM, 2, 1);