Commit da1a9592 authored by Murray Cumming's avatar Murray Cumming
Browse files

More use of GMenu with GtkBuilder

gmenu: Adapt to improved Gio::Action API.
parent 95c89668
......@@ -30,7 +30,6 @@
#include <gtkmm/window.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
#include <gtkmm/uimanager.h>
#include <glom/utility_widgets/gimpruler/gimpruler.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/spinbutton.h>
......@@ -79,8 +78,7 @@ private:
void on_menu_view_show_grid();
void on_menu_view_show_rules();
void on_menu_view_show_outlines();
void on_menu_view_zoom(guint percent);
void on_menu_view_fitpagewidth();
void on_menu_view_zoom(int parameter);
void on_menu_edit_cut();
void on_menu_edit_copy();
......@@ -123,6 +121,10 @@ private:
//override:
virtual bool on_configure_event(GdkEventConfigure* event);
void do_menu_view_show_grid(bool active);
void do_menu_view_show_rules(bool active);
void do_menu_view_show_outlines(bool active);
void update_table_title();
void setup_context_menu();
void set_ruler_sizes();
......@@ -185,17 +187,15 @@ private:
GimpRuler* m_hruler;
//Main menu:
Glib::RefPtr<Gtk::ActionGroup> m_action_group;
Glib::RefPtr<Gtk::UIManager> m_uimanager;
Glib::RefPtr<Gtk::ToggleAction> m_action_showgrid, m_action_showrules, m_action_showoutlines;
Glib::RefPtr<Gtk::ToggleAction> m_action_zoom_fit_page_width;
Glib::RefPtr<Gio::SimpleAction> m_action_showgrid, m_action_showrules, m_action_showoutlines;
Glib::RefPtr<Gio::SimpleAction> m_action_zoom;
//Edit menu:
Glib::RefPtr<Gtk::Action> m_action_edit_cut, m_action_edit_copy,
Glib::RefPtr<Gio::SimpleAction> m_action_edit_cut, m_action_edit_copy,
m_action_edit_paste, m_action_edit_delete;
//Align menu:
Glib::RefPtr<Gtk::Action> m_action_align_top, m_action_align_bottom,
Glib::RefPtr<Gio::SimpleAction> m_action_align_top, m_action_align_bottom,
m_action_align_left, m_action_align_right;
//Toolbar:
......@@ -205,9 +205,6 @@ private:
//Context menu for clicking on empty space on the canvas:
Gtk::Menu* m_context_menu;
Glib::RefPtr<Gtk::ActionGroup> m_context_menu_action_group;
Glib::RefPtr<Gtk::UIManager> m_context_menu_uimanager;
};
} //namespace Glom
......
......@@ -368,12 +368,12 @@ void Dialog_RelationshipsOverview::on_response(int /* id */)
hide();
}
void Dialog_RelationshipsOverview::on_menu_file_print(const Glib::VariantBase& /* parameter */)
void Dialog_RelationshipsOverview::on_menu_file_print()
{
print_or_preview(Gtk::PRINT_OPERATION_ACTION_PRINT_DIALOG);
}
void Dialog_RelationshipsOverview::on_menu_file_page_setup(const Glib::VariantBase& /* parameter */)
void Dialog_RelationshipsOverview::on_menu_file_page_setup()
{
//Show the page setup dialog, asking it to start with the existing settings:
Glib::RefPtr<Gtk::PageSetup> new_page_setup =
......@@ -386,7 +386,9 @@ void Dialog_RelationshipsOverview::on_menu_file_page_setup(const Glib::VariantBa
void Dialog_RelationshipsOverview::on_menu_view_showgrid(const Glib::VariantBase& /* parameter */)
{
if(m_action_showgrid->get_state_bool())
bool showgrid = false;
m_action_showgrid->get_state(showgrid);
if(showgrid)
{
m_canvas.set_grid_gap(40);
}
......@@ -397,7 +399,7 @@ void Dialog_RelationshipsOverview::on_menu_view_showgrid(const Glib::VariantBase
}
//TODO: Is this used?
void Dialog_RelationshipsOverview::on_menu_file_save(const Glib::VariantBase& parameter)
void Dialog_RelationshipsOverview::on_menu_file_save()
{
}
......
......@@ -63,10 +63,10 @@ private:
void print_or_preview(Gtk::PrintOperationAction print_action);
void on_response(int id);
void on_menu_file_print(const Glib::VariantBase& parameter);
void on_menu_file_page_setup(const Glib::VariantBase& parameter);
void on_menu_file_save(const Glib::VariantBase& parameter);
void on_menu_view_showgrid(const Glib::VariantBase& parameter);
void on_menu_file_print();
void on_menu_file_page_setup();
void on_menu_file_save();
void on_menu_view_showgrid(const Glib::VariantBase& /* parameter */);
void on_table_moved(const Glib::RefPtr<CanvasItemMovable>& item, double x_offset, double y_offset);
void on_table_show_context(guint button, guint32 activate_time, Glib::RefPtr<CanvasGroupDbTable> table);
......
......@@ -155,8 +155,7 @@ bool ImageGlom::on_button_press_event(GdkEventButton *event)
//Single-click to select file:
if(mods & GDK_BUTTON1_MASK)
{
Glib::VariantBase parameter;
on_menupopup_activate_select_file(parameter);
on_menupopup_activate_select_file();
return true; //We handled this event.
}
......@@ -499,12 +498,12 @@ Glib::RefPtr<Gdk::Pixbuf> ImageGlom::get_scaled_image()
return pixbuf;
}
void ImageGlom::on_menupopup_activate_open_file(const Glib::VariantBase& /* parameter */)
void ImageGlom::on_menupopup_activate_open_file()
{
open_with();
}
void ImageGlom::on_menupopup_activate_open_file_with(const Glib::VariantBase& /* parameter */)
void ImageGlom::on_menupopup_activate_open_file_with()
{
AppWindow* pApp = get_appwindow();
......@@ -675,7 +674,7 @@ static void set_file_filter_images(Gtk::FileChooser& file_chooser)
*/
}
void ImageGlom::on_menupopup_activate_save_file(const Glib::VariantBase& /* parameter */)
void ImageGlom::on_menupopup_activate_save_file()
{
AppWindow* pApp = get_appwindow();
......@@ -759,7 +758,7 @@ bool ImageGlom::save_file(const Glib::ustring& uri)
return true;
}
void ImageGlom::on_menupopup_activate_select_file(const Glib::VariantBase& /* parameter */)
void ImageGlom::on_menupopup_activate_select_file()
{
if(m_read_only)
return;
......@@ -856,7 +855,7 @@ void ImageGlom::on_clipboard_clear()
m_pixbuf_clipboard.reset();
}
void ImageGlom::on_menupopup_activate_copy(const Glib::VariantBase& /* parameter */)
void ImageGlom::on_menupopup_activate_copy()
{
if(m_pixbuf_original)
{
......@@ -899,7 +898,7 @@ void ImageGlom::on_clipboard_received_image(const Glib::RefPtr<Gdk::Pixbuf>& pix
}
void ImageGlom::on_menupopup_activate_paste(const Glib::VariantBase& /* parameter */)
void ImageGlom::on_menupopup_activate_paste()
{
if(m_read_only)
return;
......@@ -911,7 +910,7 @@ void ImageGlom::on_menupopup_activate_paste(const Glib::VariantBase& /* paramete
refClipboard->request_image( sigc::mem_fun(*this, &ImageGlom::on_clipboard_received_image) );
}
void ImageGlom::on_menupopup_activate_clear(const Glib::VariantBase& /* parameter */)
void ImageGlom::on_menupopup_activate_clear()
{
if(m_read_only)
return;
......@@ -1008,8 +1007,7 @@ void ImageGlom::setup_menu_usermode()
void ImageGlom::do_choose_image()
{
Glib::VariantBase parameter;
on_menupopup_activate_select_file(parameter);
on_menupopup_activate_select_file();
}
void ImageGlom::set_read_only(bool read_only)
......
......@@ -70,13 +70,13 @@ private:
virtual bool on_button_press_event(GdkEventButton *event);
void on_menupopup_activate_open_file(const Glib::VariantBase& parameter);
void on_menupopup_activate_open_file_with(const Glib::VariantBase& parameter);
void on_menupopup_activate_save_file(const Glib::VariantBase& parameter);
void on_menupopup_activate_select_file(const Glib::VariantBase& parameter);
void on_menupopup_activate_copy(const Glib::VariantBase& parameter);
void on_menupopup_activate_paste(const Glib::VariantBase& parameter);
void on_menupopup_activate_clear(const Glib::VariantBase& parameter);
void on_menupopup_activate_open_file();
void on_menupopup_activate_open_file_with();
void on_menupopup_activate_save_file();
void on_menupopup_activate_select_file();
void on_menupopup_activate_copy();
void on_menupopup_activate_paste();
void on_menupopup_activate_clear();
void on_clipboard_get(Gtk::SelectionData& selection_data, guint /* info */);
void on_clipboard_clear();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment