[gnote] Remove ImageMenuItem from toc
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Remove ImageMenuItem from toc
- Date: Sat, 22 May 2021 19:43:14 +0000 (UTC)
commit 6e8bfac4f9cdd70b6fe9a3d9e34e2f51b1f363b6
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sat May 22 22:39:54 2021 +0300
Remove ImageMenuItem from toc
src/plugins/tableofcontents/tableofcontentsmenuitem.cpp | 8 +-------
src/plugins/tableofcontents/tableofcontentsmenuitem.hpp | 11 ++++-------
.../tableofcontents/tableofcontentsnoteaddin.cpp | 17 ++++++-----------
3 files changed, 11 insertions(+), 25 deletions(-)
---
diff --git a/src/plugins/tableofcontents/tableofcontentsmenuitem.cpp
b/src/plugins/tableofcontents/tableofcontentsmenuitem.cpp
index 3bd07514..f77b558f 100644
--- a/src/plugins/tableofcontents/tableofcontentsmenuitem.cpp
+++ b/src/plugins/tableofcontents/tableofcontentsmenuitem.cpp
@@ -2,7 +2,7 @@
* "Table of Contents" is a Note add-in for Gnote.
* It lists note's table of contents in a menu.
*
- * Copyright (C) 2015,2017,2019 Aurimas Cernius <aurisc4 gmail com>
+ * Copyright (C) 2015,2017,2019,2021 Aurimas Cernius <aurisc4 gmail com>
* Copyright (C) 2013 Luc Pionchon <pionchon luc gmail com>
*
* This program is free software: you can redistribute it and/or modify
@@ -23,9 +23,6 @@
#include <glibmm/i18n.h>
-#include <gtkmm/stock.h>
-
-#include "iconmanager.hpp"
#include "notewindow.hpp"
#include "tableofcontentsmenuitem.hpp"
@@ -36,7 +33,6 @@ namespace tableofcontents {
TableofcontentsMenuItem::TableofcontentsMenuItem (
- gnote::IconManager & icon_manager,
const gnote::Note::Ptr & note,
const Glib::ustring & heading,
Heading::Type heading_level,
@@ -59,12 +55,10 @@ TableofcontentsMenuItem::TableofcontentsMenuItem (
set_use_underline (false); //we don't want potential '_' in the heading to be used as mnemonic
if (heading_level == Heading::Title) {
- set_image(*manage(new Gtk::Image(icon_manager.get_icon(gnote::IconManager::NOTE, 16))));
Gtk::Label *label = (Gtk::Label*)get_child();
label->set_markup("<b>" + heading + "</b>");
}
else if (heading_level == Heading::Level_1) {
- set_image(*manage(new Gtk::Image(Gtk::Stock::GO_FORWARD, Gtk::ICON_SIZE_MENU)));
set_label(heading);
}
else if (heading_level == Heading::Level_2) {
diff --git a/src/plugins/tableofcontents/tableofcontentsmenuitem.hpp
b/src/plugins/tableofcontents/tableofcontentsmenuitem.hpp
index 93918a52..691ca3cc 100644
--- a/src/plugins/tableofcontents/tableofcontentsmenuitem.hpp
+++ b/src/plugins/tableofcontents/tableofcontentsmenuitem.hpp
@@ -3,7 +3,7 @@
* It lists note's table of contents in a menu.
*
* Copyright (C) 2013 Luc Pionchon <pionchon luc gmail com>
- * Copyright (C) 2013,2017,2019 Aurimas Cernius
+ * Copyright (C) 2013,2017,2019,2021 Aurimas Cernius
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,12 +19,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* A subclass of ImageMenuItem to show a toc menu item */
-
#ifndef __TABLEOFCONTENT_MENU_ITEM_HPP_
#define __TABLEOFCONTENT_MENU_ITEM_HPP_
-#include <gtkmm/imagemenuitem.h>
+#include <gtkmm/menuitem.h>
#include "note.hpp"
#include "tableofcontents.hpp"
@@ -37,11 +35,10 @@ namespace gnote {
namespace tableofcontents {
-class TableofcontentsMenuItem : public Gtk::ImageMenuItem
+class TableofcontentsMenuItem : public Gtk::MenuItem
{
public:
- TableofcontentsMenuItem(gnote::IconManager & icon_manager, const gnote::Note::Ptr & note,
- const Glib::ustring & heading, Heading::Type heading_level, int heading_position);
+ TableofcontentsMenuItem(const gnote::Note::Ptr & note, const Glib::ustring & heading, Heading::Type
heading_level, int heading_position);
protected:
virtual void on_activate() override;
diff --git a/src/plugins/tableofcontents/tableofcontentsnoteaddin.cpp
b/src/plugins/tableofcontents/tableofcontentsnoteaddin.cpp
index 226dfa95..1022b8a8 100644
--- a/src/plugins/tableofcontents/tableofcontentsnoteaddin.cpp
+++ b/src/plugins/tableofcontents/tableofcontentsnoteaddin.cpp
@@ -3,7 +3,7 @@
* It lists note's table of contents in a menu.
*
* Copyright (C) 2013 Luc Pionchon <pionchon luc gmail com>
- * Copyright (C) 2013,2015-2017,2019-2020 Aurimas Cernius <aurisc4 gmail com>
+ * Copyright (C) 2013,2015-2017,2019-2021 Aurimas Cernius <aurisc4 gmail com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,7 +24,6 @@
#include <glibmm/i18n.h>
#include <gtkmm/modelbutton.h>
-#include <gtkmm/stock.h>
#include <gtkmm/separator.h>
#include <gtkmm/separatormenuitem.h>
@@ -60,11 +59,10 @@ void TableofcontentsNoteAddin::initialize () {}
void TableofcontentsNoteAddin::shutdown () {}
-Gtk::ImageMenuItem * new_toc_menu_item ()
+Gtk::MenuItem *new_toc_menu_item ()
//create a menu item like: "[]_Table_of_Contents______Ctrl-Alt-1__>"
{
- Gtk::ImageMenuItem * menu_item = manage(new Gtk::ImageMenuItem ());
- menu_item->set_image(*manage(new Gtk::Image(Gtk::Stock::JUMP_TO, Gtk::ICON_SIZE_MENU)));
+ Gtk::MenuItem * menu_item = manage(new Gtk::MenuItem);
Gtk::AccelLabel *acclabel = manage(new Gtk::AccelLabel(_("Table of Contents")));
acclabel->set_alignment (Gtk::ALIGN_START);
@@ -236,7 +234,7 @@ void TableofcontentsNoteAddin::on_populate_popup (Gtk::Menu* popup_menu)
separator->show ();
popup_menu->prepend (*separator);
- Gtk::ImageMenuItem *menu_item = new_toc_menu_item ();
+ Gtk::MenuItem *menu_item = new_toc_menu_item();
menu_item->set_submenu (*toc_menu);
menu_item->show ();
@@ -316,12 +314,12 @@ std::vector<TableofcontentsMenuItem*> TableofcontentsNoteAddin::get_tableofconte
if(toc_items.size()) {
//If we have at least one heading
//we also insert an entry linked to the Note's title:
- item = manage(new TableofcontentsMenuItem(ignote().icon_manager(), get_note(), get_note()->get_title(),
Heading::Title, 0));
+ item = manage(new TableofcontentsMenuItem(get_note(), get_note()->get_title(), Heading::Title, 0));
items.push_back(item);
}
for(auto & toc_item : toc_items) {
- item = manage(new TableofcontentsMenuItem(ignote().icon_manager(), get_note(), toc_item.heading,
toc_item.heading_level, toc_item.heading_position));
+ item = manage(new TableofcontentsMenuItem(get_note(), toc_item.heading, toc_item.heading_level,
toc_item.heading_position));
items.push_back(item);
}
@@ -350,9 +348,6 @@ void TableofcontentsNoteAddin::get_toc_popover_items(std::vector<Gtk::Widget*> &
toc_item.heading = "→ " + toc_item.heading;
}
auto item =
dynamic_cast<Gtk::ModelButton*>(gnote::utils::create_popover_button("win.tableofcontents-goto-heading",
toc_item.heading));
- if(toc_item.heading_level == Heading::Level_1) {
- item->set_image(*manage(new Gtk::Image(Gtk::Stock::GO_FORWARD, Gtk::ICON_SIZE_MENU)));
- }
gtk_actionable_set_action_target_value(GTK_ACTIONABLE(item->gobj()),
g_variant_new_int32(toc_item.heading_position));
item->property_role() = Gtk::BUTTON_ROLE_NORMAL;
item->property_inverted() = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]