[gnote/tabbed: 6/19] Remove back button and always show new note button




commit 0ef8439ee53c55f0988fad19524b4c113e5ba4ed
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Oct 17 21:54:45 2021 +0300

    Remove back button and always show new note button

 src/recentchanges.cpp | 47 ++++++++++-------------------------------------
 src/recentchanges.hpp |  3 ---
 2 files changed, 10 insertions(+), 40 deletions(-)
---
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index 07d8e9e8..f3f9aa9d 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -206,27 +206,14 @@ namespace gnote {
     left_box->get_style_context()->add_class(GTK_STYLE_CLASS_RAISED);
     left_box->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
     left_box->set_valign(Gtk::ALIGN_CENTER);
-    m_all_notes_button = manage(new Gtk::Button);
-    Gtk::Image *image = manage(new Gtk::Image);
-    image->property_icon_name() = "go-previous-symbolic";
-    image->property_icon_size() = GTK_ICON_SIZE_MENU;
-    m_all_notes_button->set_image(*image);
-    m_all_notes_button->set_tooltip_text(_("All Notes"));
-    m_all_notes_button->signal_clicked().connect(sigc::mem_fun(*this, 
&NoteRecentChanges::on_all_notes_button_clicked));
-    m_all_notes_button->add_accelerator("activate", m_accel_group, GDK_KEY_comma, Gdk::CONTROL_MASK, 
(Gtk::AccelFlags) 0);
-    m_all_notes_button->show_all();
-    left_box->attach(*m_all_notes_button, 0, 0, 1, 1);
-
-    m_new_note_button = manage(new Gtk::Button);
-    image = manage(new Gtk::Image);
-    image->property_icon_name() = "list-add-symbolic";
-    image->property_icon_size() = GTK_ICON_SIZE_MENU;
-    m_new_note_button->set_image(*image);
-    m_new_note_button->set_tooltip_text(_("Create New Note"));
-    m_new_note_button->add_accelerator("activate", m_accel_group, GDK_KEY_N, Gdk::CONTROL_MASK, 
(Gtk::AccelFlags) 0);
-    m_new_note_button->signal_clicked().connect(sigc::mem_fun(*m_search_notes_widget, 
&SearchNotesWidget::new_note));
-    m_new_note_button->show_all();
-    left_box->attach(*m_new_note_button, 1, 0, 1, 1);
+
+    auto new_note_button = manage(new Gtk::Button);
+    new_note_button->set_image_from_icon_name("list-add-symbolic");
+    new_note_button->set_tooltip_text(_("Create New Note"));
+    new_note_button->add_accelerator("activate", m_accel_group, GDK_KEY_N, Gdk::CONTROL_MASK, 
(Gtk::AccelFlags) 0);
+    new_note_button->signal_clicked().connect(sigc::mem_fun(*m_search_notes_widget, 
&SearchNotesWidget::new_note));
+    new_note_button->show_all();
+    left_box->attach(*new_note_button, 0, 0, 1, 1);
     left_box->show();
 
     m_embedded_toolbar.set_margin_start(6);
@@ -238,10 +225,7 @@ namespace gnote {
     right_box->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
     right_box->set_column_spacing(5);
     right_box->set_valign(Gtk::ALIGN_CENTER);
-    image = manage(new Gtk::Image);
-    image->property_icon_name() = "edit-find-symbolic";
-    image->property_icon_size() = GTK_ICON_SIZE_MENU;
-    m_search_button.set_image(*image);
+    m_search_button.set_image_from_icon_name("edit-find-symbolic");
     m_search_button.signal_toggled().connect(sigc::mem_fun(*this, 
&NoteRecentChanges::on_search_button_toggled));
     m_search_button.add_accelerator("activate", m_accel_group, GDK_KEY_F, Gdk::CONTROL_MASK, 
(Gtk::AccelFlags) 0);
     m_search_button.set_tooltip_text(_("Search"));
@@ -249,10 +233,7 @@ namespace gnote {
     right_box->attach(m_search_button, 0, 0, 1, 1);
 
     m_window_actions_button = manage(new Gtk::Button);
-    image = manage(new Gtk::Image);
-    image->property_icon_name() = MAIN_MENU_PRIMARY_ICON;
-    image->property_icon_size() = GTK_ICON_SIZE_MENU;
-    m_window_actions_button->set_image(*image);
+    m_window_actions_button->set_image_from_icon_name(MAIN_MENU_PRIMARY_ICON);
     m_window_actions_button->signal_clicked().connect(
       sigc::mem_fun(*this, &NoteRecentChanges::on_show_window_menu));
     m_window_actions_button->add_accelerator(
@@ -878,8 +859,6 @@ namespace gnote {
   void NoteRecentChanges::update_toolbar(EmbeddableWidget & widget)
   {
     bool search = dynamic_cast<SearchNotesWidget*>(&widget) == m_search_notes_widget;
-    m_all_notes_button->set_visible(!search);
-    m_new_note_button->set_visible(search);
     dynamic_cast<Gtk::Image*>(m_window_actions_button->get_image())->property_icon_name() = search ? 
MAIN_MENU_PRIMARY_ICON : MAIN_MENU_SECONDARY_ICON;
     update_search_bar(widget, true);
 
@@ -894,12 +873,6 @@ namespace gnote {
     }
   }
 
-  void NoteRecentChanges::on_all_notes_button_clicked()
-  {
-    close_on_escape(false);  // intentional switch to search, user probably want to work more with this 
window
-    present_search();
-  }
-
   void NoteRecentChanges::on_show_window_menu()
   {
     HasActions *embed_with_actions = dynamic_cast<HasActions*>(currently_foreground());
diff --git a/src/recentchanges.hpp b/src/recentchanges.hpp
index 8d56062d..76390f89 100644
--- a/src/recentchanges.hpp
+++ b/src/recentchanges.hpp
@@ -90,7 +90,6 @@ private:
   Glib::ustring get_search_text();
   void update_toolbar(EmbeddableWidget & widget);
   void update_search_bar(EmbeddableWidget & widget, bool perform_search);
-  void on_all_notes_button_clicked();
   void on_show_window_menu();
   void on_search_button_toggled();
   void on_find_next_button_clicked();
@@ -117,8 +116,6 @@ private:
   Gtk::ToggleButton   m_search_button;
   Gtk::Grid           m_embedded_toolbar;
   Gtk::Notebook       m_embed_book;
-  Gtk::Button        *m_all_notes_button;
-  Gtk::Button        *m_new_note_button;
   Gtk::Button        *m_window_actions_button;
   bool                m_mapped;
   sigc::connection    m_signal_popover_widgets_changed_cid;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]