mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Menu changes for cut/copy and paste
This commit is contained in:
parent
dcde7952ba
commit
fb5acb2673
@ -173,6 +173,7 @@ static void gnc_main_window_plugin_removed (GncPlugin *manager, GncPlugin *plugi
|
|||||||
static void gnc_main_window_engine_commit_error_callback( gpointer data, QofBackendError errcode );
|
static void gnc_main_window_engine_commit_error_callback( gpointer data, QofBackendError errcode );
|
||||||
|
|
||||||
/* Command callbacks */
|
/* Command callbacks */
|
||||||
|
static void gnc_main_window_cmd_redirect (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
|
||||||
static void gnc_main_window_cmd_page_setup (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
|
static void gnc_main_window_cmd_page_setup (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
|
||||||
static void gnc_main_window_cmd_file_properties (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
|
static void gnc_main_window_cmd_file_properties (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
|
||||||
static void gnc_main_window_cmd_file_close (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
|
static void gnc_main_window_cmd_file_close (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
|
||||||
@ -210,6 +211,8 @@ static void gnc_quartz_shutdown (GtkosxApplication *theApp, gpointer data);
|
|||||||
static gboolean gnc_quartz_should_quit (GtkosxApplication *theApp, GncMainWindow *window);
|
static gboolean gnc_quartz_should_quit (GtkosxApplication *theApp, GncMainWindow *window);
|
||||||
static void gnc_quartz_set_menu (GncMainWindow* window);
|
static void gnc_quartz_set_menu (GncMainWindow* window);
|
||||||
#endif
|
#endif
|
||||||
|
static void gnc_main_window_init_menu_updaters (GncMainWindow *window);
|
||||||
|
|
||||||
|
|
||||||
/** The instance private data structure for an embedded window
|
/** The instance private data structure for an embedded window
|
||||||
* object. */
|
* object. */
|
||||||
@ -315,26 +318,32 @@ static GActionEntry gnc_menu_actions [] =
|
|||||||
{ "FilePageSetupAction", gnc_main_window_cmd_page_setup, nullptr, nullptr, nullptr },
|
{ "FilePageSetupAction", gnc_main_window_cmd_page_setup, nullptr, nullptr, nullptr },
|
||||||
{ "FilePropertiesAction", gnc_main_window_cmd_file_properties, nullptr, nullptr, nullptr },
|
{ "FilePropertiesAction", gnc_main_window_cmd_file_properties, nullptr, nullptr, nullptr },
|
||||||
{ "FileCloseAction", gnc_main_window_cmd_file_close, nullptr, nullptr, nullptr },
|
{ "FileCloseAction", gnc_main_window_cmd_file_close, nullptr, nullptr, nullptr },
|
||||||
|
{ "FilePrintAction", gnc_main_window_cmd_redirect, nullptr, nullptr, nullptr },
|
||||||
{ "FileQuitAction", gnc_main_window_cmd_file_quit, nullptr, nullptr, nullptr },
|
{ "FileQuitAction", gnc_main_window_cmd_file_quit, nullptr, nullptr, nullptr },
|
||||||
|
|
||||||
{ "EditCutAction", gnc_main_window_cmd_edit_cut, nullptr, nullptr, nullptr },
|
{ "EditCutAction", gnc_main_window_cmd_edit_cut, nullptr, nullptr, nullptr },
|
||||||
{ "EditCopyAction", gnc_main_window_cmd_edit_copy, nullptr, nullptr, nullptr },
|
{ "EditCopyAction", gnc_main_window_cmd_edit_copy, nullptr, nullptr, nullptr },
|
||||||
{ "EditPasteAction", gnc_main_window_cmd_edit_paste, nullptr, nullptr, nullptr },
|
{ "EditPasteAction", gnc_main_window_cmd_edit_paste, nullptr, nullptr, nullptr },
|
||||||
{ "EditPreferencesAction", gnc_main_window_cmd_edit_preferences, nullptr, nullptr, nullptr },
|
{ "EditPreferencesAction", gnc_main_window_cmd_edit_preferences, nullptr, nullptr, nullptr },
|
||||||
{ "ViewRefreshAction", gnc_main_window_cmd_view_refresh, nullptr, nullptr, nullptr },
|
|
||||||
{ "ActionsForgetWarningsAction", gnc_main_window_cmd_actions_reset_warnings, nullptr, nullptr, nullptr },
|
{ "ActionsForgetWarningsAction", gnc_main_window_cmd_actions_reset_warnings, nullptr, nullptr, nullptr },
|
||||||
{ "ActionsRenamePageAction", gnc_main_window_cmd_actions_rename_page, nullptr, nullptr, nullptr },
|
{ "ActionsRenamePageAction", gnc_main_window_cmd_actions_rename_page, nullptr, nullptr, nullptr },
|
||||||
{ "WindowNewAction", gnc_main_window_cmd_window_new, nullptr, nullptr, nullptr },
|
|
||||||
{ "WindowMovePageAction", gnc_main_window_cmd_window_move_page, nullptr, nullptr, nullptr },
|
|
||||||
{ "HelpTutorialAction", gnc_main_window_cmd_help_tutorial, nullptr, nullptr, nullptr },
|
|
||||||
{ "HelpContentsAction", gnc_main_window_cmd_help_contents, nullptr, nullptr, nullptr },
|
|
||||||
{ "HelpAboutAction", gnc_main_window_cmd_help_about, nullptr, nullptr, nullptr },
|
|
||||||
|
|
||||||
|
{ "ViewSortByAction", nullptr, nullptr, nullptr, nullptr },
|
||||||
|
{ "ViewFilterByAction", nullptr, nullptr, nullptr, nullptr },
|
||||||
|
{ "ViewRefreshAction", gnc_main_window_cmd_view_refresh, nullptr, nullptr, nullptr },
|
||||||
{ "ViewToolbarAction", gnc_main_window_cmd_view_toolbar, nullptr, "true", toggle_change_state },
|
{ "ViewToolbarAction", gnc_main_window_cmd_view_toolbar, nullptr, "true", toggle_change_state },
|
||||||
{ "ViewSummaryAction", gnc_main_window_cmd_view_summary, nullptr, "true", toggle_change_state },
|
{ "ViewSummaryAction", gnc_main_window_cmd_view_summary, nullptr, "true", toggle_change_state },
|
||||||
{ "ViewStatusbarAction", gnc_main_window_cmd_view_statusbar, nullptr, "true", toggle_change_state },
|
{ "ViewStatusbarAction", gnc_main_window_cmd_view_statusbar, nullptr, "true", toggle_change_state },
|
||||||
|
|
||||||
{ "ViewTabPositionAction", gnc_main_window_cmd_view_tab_position, "i", "@i 0", radio_change_state },
|
{ "ViewTabPositionAction", gnc_main_window_cmd_view_tab_position, "i", "@i 0", radio_change_state },
|
||||||
|
|
||||||
|
{ "WindowNewAction", gnc_main_window_cmd_window_new, nullptr, nullptr, nullptr },
|
||||||
|
{ "WindowMovePageAction", gnc_main_window_cmd_window_move_page, nullptr, nullptr, nullptr },
|
||||||
{ "Window0Action", gnc_main_window_cmd_window_raise, "i", "@i 0", radio_change_state },
|
{ "Window0Action", gnc_main_window_cmd_window_raise, "i", "@i 0", radio_change_state },
|
||||||
|
|
||||||
|
{ "HelpTutorialAction", gnc_main_window_cmd_help_tutorial, nullptr, nullptr, nullptr },
|
||||||
|
{ "HelpContentsAction", gnc_main_window_cmd_help_contents, nullptr, nullptr, nullptr },
|
||||||
|
{ "HelpAboutAction", gnc_main_window_cmd_help_about, nullptr, nullptr, nullptr },
|
||||||
};
|
};
|
||||||
/** The number of actions provided by the main window. */
|
/** The number of actions provided by the main window. */
|
||||||
static guint gnc_menu_n_actions = G_N_ELEMENTS(gnc_menu_actions);
|
static guint gnc_menu_n_actions = G_N_ELEMENTS(gnc_menu_actions);
|
||||||
@ -1002,7 +1011,7 @@ gnc_main_window_restore_all_windows(const GKeyFile *keyfile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_main_window_restore_default_state(GncMainWindow *window)
|
gnc_main_window_restore_default_state (GncMainWindow *window)
|
||||||
{
|
{
|
||||||
GAction *action;
|
GAction *action;
|
||||||
|
|
||||||
@ -3694,7 +3703,8 @@ gnc_main_window_actions_updated (GncMainWindow *window)
|
|||||||
struct group_iterate
|
struct group_iterate
|
||||||
{
|
{
|
||||||
GAction *action;
|
GAction *action;
|
||||||
const gchar *name;
|
const gchar *group_name;
|
||||||
|
const gchar *action_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3706,10 +3716,16 @@ group_foreach_cb (gpointer key, gpointer item, gpointer arg)
|
|||||||
if (iter->action)
|
if (iter->action)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (iter->group_name != nullptr)
|
||||||
|
{
|
||||||
|
if (g_strcmp0 (iter->group_name, (gchar*)key) != 0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto entry{static_cast<MergedActionEntry *>(item)};
|
auto entry{static_cast<MergedActionEntry *>(item)};
|
||||||
|
|
||||||
action = g_action_map_lookup_action (G_ACTION_MAP(entry->simple_action_group),
|
action = g_action_map_lookup_action (G_ACTION_MAP(entry->simple_action_group),
|
||||||
iter->name);
|
iter->action_name);
|
||||||
|
|
||||||
if (action)
|
if (action)
|
||||||
iter->action = action;
|
iter->action = action;
|
||||||
@ -3717,6 +3733,22 @@ group_foreach_cb (gpointer key, gpointer item, gpointer arg)
|
|||||||
|
|
||||||
GAction *
|
GAction *
|
||||||
gnc_main_window_find_action (GncMainWindow *window, const gchar *name)
|
gnc_main_window_find_action (GncMainWindow *window, const gchar *name)
|
||||||
|
{
|
||||||
|
GncMainWindowPrivate *priv;
|
||||||
|
GAction *action = nullptr;
|
||||||
|
|
||||||
|
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
|
||||||
|
|
||||||
|
action = g_action_map_lookup_action (G_ACTION_MAP(priv->simple_action_group),
|
||||||
|
name);
|
||||||
|
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
GAction *
|
||||||
|
gnc_main_window_find_action_in_group (GncMainWindow *window,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *name)
|
||||||
{
|
{
|
||||||
GncMainWindowPrivate *priv;
|
GncMainWindowPrivate *priv;
|
||||||
GAction *action = nullptr;
|
GAction *action = nullptr;
|
||||||
@ -3728,7 +3760,8 @@ gnc_main_window_find_action (GncMainWindow *window, const gchar *name)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
iter.action = nullptr;
|
iter.action = nullptr;
|
||||||
iter.name = name;
|
iter.action_name = name;
|
||||||
|
iter.group_name = group_name;
|
||||||
|
|
||||||
g_hash_table_foreach (priv->merged_actions_table, group_foreach_cb, &iter);
|
g_hash_table_foreach (priv->merged_actions_table, group_foreach_cb, &iter);
|
||||||
|
|
||||||
@ -3827,10 +3860,11 @@ gnc_main_window_update_edit_actions_sensitivity (GncMainWindow *window, gboolean
|
|||||||
GncPluginPage *page;
|
GncPluginPage *page;
|
||||||
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
|
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
|
||||||
GAction *action;
|
GAction *action;
|
||||||
gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE;
|
gboolean can_copy = false, can_cut = false, can_paste = false;
|
||||||
|
|
||||||
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
|
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
|
||||||
page = priv->current_page;
|
page = priv->current_page;
|
||||||
|
|
||||||
if (page && GNC_PLUGIN_PAGE_GET_CLASS(page)->update_edit_menu_actions)
|
if (page && GNC_PLUGIN_PAGE_GET_CLASS(page)->update_edit_menu_actions)
|
||||||
{
|
{
|
||||||
(GNC_PLUGIN_PAGE_GET_CLASS(page)->update_edit_menu_actions)(page, hide);
|
(GNC_PLUGIN_PAGE_GET_CLASS(page)->update_edit_menu_actions)(page, hide);
|
||||||
@ -3865,23 +3899,21 @@ gnc_main_window_update_edit_actions_sensitivity (GncMainWindow *window, gboolean
|
|||||||
{
|
{
|
||||||
#ifdef ORIGINAL_EPIPHANY_CODE
|
#ifdef ORIGINAL_EPIPHANY_CODE
|
||||||
/* For now we assume all actions are possible */
|
/* For now we assume all actions are possible */
|
||||||
can_copy = can_cut = can_paste = TRUE;
|
can_copy = can_cut = can_paste = true;
|
||||||
#else
|
#else
|
||||||
/* If its not a GtkEditable, we don't know what to do
|
/* If its not a GtkEditable, we don't know what to do
|
||||||
* with it. */
|
* with it. */
|
||||||
can_copy = can_cut = can_paste = FALSE;
|
can_copy = can_cut = can_paste = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
action = gnc_main_window_find_action (window, "EditCopyAction");
|
action = gnc_main_window_find_action (window, "EditCopyAction");
|
||||||
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), can_copy);
|
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), can_copy);
|
||||||
//FIXMEb gtk_action_set_visible (action, !hide || can_copy);
|
|
||||||
action = gnc_main_window_find_action (window, "EditCutAction");
|
action = gnc_main_window_find_action (window, "EditCutAction");
|
||||||
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), can_cut);
|
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), can_cut);
|
||||||
//FIXMEb gtk_action_set_visible (action, !hide || can_cut);
|
|
||||||
action = gnc_main_window_find_action (window, "EditPasteAction");
|
action = gnc_main_window_find_action (window, "EditPasteAction");
|
||||||
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), can_paste);
|
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), can_paste);
|
||||||
//FIXMEb gtk_action_set_visible (action, !hide || can_paste);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3890,14 +3922,14 @@ gnc_main_window_enable_edit_actions_sensitivity (GncMainWindow *window)
|
|||||||
GAction *action;
|
GAction *action;
|
||||||
|
|
||||||
action = gnc_main_window_find_action (window, "EditCopyAction");
|
action = gnc_main_window_find_action (window, "EditCopyAction");
|
||||||
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), TRUE);
|
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), true);
|
||||||
//FIXMEb gtk_action_set_visible (action, TRUE);
|
|
||||||
action = gnc_main_window_find_action (window, "EditCutAction");
|
action = gnc_main_window_find_action (window, "EditCutAction");
|
||||||
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), TRUE);
|
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), true);
|
||||||
//FIXMEb gtk_action_set_visible (action, TRUE);
|
|
||||||
action = gnc_main_window_find_action (window, "EditPasteAction");
|
action = gnc_main_window_find_action (window, "EditPasteAction");
|
||||||
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), TRUE);
|
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), true);
|
||||||
//FIXMEb gtk_action_set_visible (action, TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3917,17 +3949,26 @@ gnc_main_window_edit_menu_hide_cb (GtkWidget *menu,
|
|||||||
static void
|
static void
|
||||||
gnc_main_window_init_menu_updaters (GncMainWindow *window)
|
gnc_main_window_init_menu_updaters (GncMainWindow *window)
|
||||||
{
|
{
|
||||||
|
GncMainWindowPrivate *priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
|
||||||
|
GncMenuModelSearch *gsm = g_new0 (GncMenuModelSearch, 1);
|
||||||
GtkWidget *edit_menu_item, *edit_menu;
|
GtkWidget *edit_menu_item, *edit_menu;
|
||||||
//FIXMEb
|
|
||||||
|
|
||||||
// edit_menu_item = gtk_ui_manager_get_widget
|
gsm->search_action_label = nullptr;
|
||||||
// (window->ui_merge, "/menubar/Edit");
|
gsm->search_action_name = "EditAction";
|
||||||
// edit_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (edit_menu_item));
|
|
||||||
|
|
||||||
// g_signal_connect (edit_menu, "show",
|
if (!gnc_menubar_model_find_item (priv->menubar_model, gsm))
|
||||||
// G_CALLBACK (gnc_main_window_edit_menu_show_cb), window);
|
return;
|
||||||
// g_signal_connect (edit_menu, "hide",
|
|
||||||
// G_CALLBACK (gnc_main_window_edit_menu_hide_cb), window);
|
edit_menu_item = gnc_find_menu_item_by_action_label (priv->menubar,
|
||||||
|
gsm->search_action_label);
|
||||||
|
|
||||||
|
edit_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM(edit_menu_item));
|
||||||
|
|
||||||
|
g_signal_connect (edit_menu, "show",
|
||||||
|
G_CALLBACK(gnc_main_window_edit_menu_show_cb), window);
|
||||||
|
g_signal_connect (edit_menu, "hide",
|
||||||
|
G_CALLBACK(gnc_main_window_edit_menu_hide_cb), window);
|
||||||
|
g_free (gsm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3971,6 +4012,36 @@ gnc_main_window_page_focus_in (GtkWidget *widget, GdkEvent *event,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GAction *
|
||||||
|
gnc_main_window_get_redirect (GncMainWindow *window, const gchar *action_name)
|
||||||
|
{
|
||||||
|
GncMainWindowPrivate *priv;
|
||||||
|
GAction *action = nullptr;
|
||||||
|
const gchar *group_name;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GNC_IS_MAIN_WINDOW (window), nullptr);
|
||||||
|
g_return_val_if_fail (action_name != nullptr, nullptr);
|
||||||
|
|
||||||
|
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
|
||||||
|
|
||||||
|
group_name = gnc_plugin_page_get_simple_action_group_name (priv->current_page);
|
||||||
|
|
||||||
|
PINFO("action anme is '%s', group_name is '%s'", action_name, group_name);
|
||||||
|
|
||||||
|
if (group_name)
|
||||||
|
{
|
||||||
|
action = gnc_main_window_find_action_in_group (window, group_name, action_name);
|
||||||
|
|
||||||
|
if (!action)
|
||||||
|
action = gnc_plugin_page_get_action (priv->current_page, action_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
PINFO("Redirect action is %p for action anme '%s' and group_name '%s'",
|
||||||
|
action, action_name, group_name);
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_main_window_setup_window (GncMainWindow *window)
|
gnc_main_window_setup_window (GncMainWindow *window)
|
||||||
{
|
{
|
||||||
@ -3979,6 +4050,8 @@ gnc_main_window_setup_window (GncMainWindow *window)
|
|||||||
// guint merge_id;
|
// guint merge_id;
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GncPluginManager *manager;
|
GncPluginManager *manager;
|
||||||
|
GtkAccelGroup *accel_group = gtk_accel_group_new ();
|
||||||
|
GtkWidget *extra_item;
|
||||||
GList *plugins;
|
GList *plugins;
|
||||||
GError *error = nullptr;
|
GError *error = nullptr;
|
||||||
gchar *filename;
|
gchar *filename;
|
||||||
@ -4032,7 +4105,7 @@ gnc_main_window_setup_window (GncMainWindow *window)
|
|||||||
0.01);
|
0.01);
|
||||||
|
|
||||||
builder = gtk_builder_new ();
|
builder = gtk_builder_new ();
|
||||||
|
gtk_builder_set_translation_domain (builder, PROJECT_NAME);
|
||||||
gtk_builder_add_from_resource (builder, "/org/gnucash/ui/gnc-main-window.ui", &error);
|
gtk_builder_add_from_resource (builder, "/org/gnucash/ui/gnc-main-window.ui", &error);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
@ -4047,6 +4120,10 @@ gnc_main_window_setup_window (GncMainWindow *window)
|
|||||||
gtk_container_add (GTK_CONTAINER(priv->menu_dock), priv->menubar); //FIXMEb this may need changing
|
gtk_container_add (GTK_CONTAINER(priv->menu_dock), priv->menubar); //FIXMEb this may need changing
|
||||||
gtk_widget_show (GTK_WIDGET(priv->menubar));
|
gtk_widget_show (GTK_WIDGET(priv->menubar));
|
||||||
|
|
||||||
|
// need to add the accelerator keys
|
||||||
|
gtk_window_add_accel_group (GTK_WINDOW(window), accel_group);
|
||||||
|
gnc_add_accelerator_keys_for_menu (GTK_WIDGET(priv->menubar), accel_group);
|
||||||
|
|
||||||
priv->toolbar = (GtkWidget *)gtk_builder_get_object (builder, "mainwin-toolbar");
|
priv->toolbar = (GtkWidget *)gtk_builder_get_object (builder, "mainwin-toolbar");
|
||||||
g_object_set (priv->toolbar, "toolbar-style", GTK_TOOLBAR_BOTH, NULL);
|
g_object_set (priv->toolbar, "toolbar-style", GTK_TOOLBAR_BOTH, NULL);
|
||||||
gtk_container_add (GTK_CONTAINER(priv->menu_dock), GTK_WIDGET(priv->toolbar)); //FIXMEb this may need changing
|
gtk_container_add (GTK_CONTAINER(priv->menu_dock), GTK_WIDGET(priv->toolbar)); //FIXMEb this may need changing
|
||||||
@ -4056,6 +4133,7 @@ gnc_main_window_setup_window (GncMainWindow *window)
|
|||||||
|
|
||||||
/* Create menu and toolbar information */
|
/* Create menu and toolbar information */
|
||||||
// priv->action_group = gtk_action_group_new ("MainWindowActions");
|
// priv->action_group = gtk_action_group_new ("MainWindowActions");
|
||||||
|
|
||||||
priv->simple_action_group = g_simple_action_group_new ();
|
priv->simple_action_group = g_simple_action_group_new ();
|
||||||
|
|
||||||
//FIXMEb gtk_action_group_set_translation_domain (priv->action_group, PROJECT_NAME);
|
//FIXMEb gtk_action_group_set_translation_domain (priv->action_group, PROJECT_NAME);
|
||||||
@ -4090,13 +4168,8 @@ gnc_main_window_setup_window (GncMainWindow *window)
|
|||||||
//FIXMEb g_signal_connect (G_OBJECT (window->ui_merge), "connect-proxy",
|
//FIXMEb g_signal_connect (G_OBJECT (window->ui_merge), "connect-proxy",
|
||||||
// G_CALLBACK (gnc_window_connect_proxy), priv->statusbar);
|
// G_CALLBACK (gnc_window_connect_proxy), priv->statusbar);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// filename = gnc_filepath_locate_ui_file("gnc-main-window.ui");
|
// filename = gnc_filepath_locate_ui_file("gnc-main-window.ui");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// merge_id = gtk_ui_manager_add_ui_from_file (window->ui_merge,
|
// merge_id = gtk_ui_manager_add_ui_from_file (window->ui_merge,
|
||||||
// filename, &error);
|
// filename, &error);
|
||||||
// g_assert(merge_id || error);
|
// g_assert(merge_id || error);
|
||||||
@ -4136,11 +4209,10 @@ gnc_main_window_setup_window (GncMainWindow *window)
|
|||||||
GNC_PREF_TAB_POSITION_RIGHT,
|
GNC_PREF_TAB_POSITION_RIGHT,
|
||||||
(gpointer)gnc_main_window_update_tab_position,
|
(gpointer)gnc_main_window_update_tab_position,
|
||||||
window);
|
window);
|
||||||
gnc_main_window_update_tab_position(nullptr, nullptr, window);
|
gnc_main_window_update_tab_position (nullptr, nullptr, window);
|
||||||
|
|
||||||
gnc_main_window_init_menu_updaters(window);
|
gnc_main_window_init_menu_updaters (window);
|
||||||
|
|
||||||
/* Testing */
|
|
||||||
/* Now update the "eXtensions" menu */
|
/* Now update the "eXtensions" menu */
|
||||||
if (!gnc_prefs_is_extra_enabled())
|
if (!gnc_prefs_is_extra_enabled())
|
||||||
{
|
{
|
||||||
@ -4432,6 +4504,26 @@ gnc_main_window_plugin_removed (GncPlugin *manager,
|
|||||||
|
|
||||||
|
|
||||||
/* Command callbacks */
|
/* Command callbacks */
|
||||||
|
static void
|
||||||
|
gnc_main_window_cmd_redirect (GSimpleAction *simple,
|
||||||
|
GVariant *parameter,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GncMainWindow *window = (GncMainWindow*)user_data;
|
||||||
|
GAction *redirect_action;
|
||||||
|
|
||||||
|
PINFO("Redirect action_is %p, name is '%s'", simple, g_action_get_name (G_ACTION(simple)));
|
||||||
|
|
||||||
|
redirect_action = gnc_main_window_get_redirect (window, g_action_get_name (G_ACTION(simple)));
|
||||||
|
|
||||||
|
if (redirect_action)
|
||||||
|
{
|
||||||
|
PINFO("Found action %p", redirect_action);
|
||||||
|
g_action_activate (redirect_action, nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_main_window_cmd_page_setup (GSimpleAction *simple,
|
gnc_main_window_cmd_page_setup (GSimpleAction *simple,
|
||||||
GVariant *parameter,
|
GVariant *parameter,
|
||||||
@ -4627,6 +4719,18 @@ gnc_main_window_cmd_edit_cut (GSimpleAction *simple,
|
|||||||
{
|
{
|
||||||
GncMainWindow *window = (GncMainWindow*)user_data;
|
GncMainWindow *window = (GncMainWindow*)user_data;
|
||||||
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW(window));
|
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW(window));
|
||||||
|
GAction *redirect_action;
|
||||||
|
|
||||||
|
PINFO("Copy action_is %p, name is '%s'", simple, g_action_get_name (G_ACTION(simple)));
|
||||||
|
|
||||||
|
redirect_action = gnc_main_window_get_redirect (window, g_action_get_name (G_ACTION(simple)));
|
||||||
|
|
||||||
|
if (redirect_action)
|
||||||
|
{
|
||||||
|
PINFO("Found action %p", redirect_action);
|
||||||
|
g_action_activate (redirect_action, nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (GTK_IS_EDITABLE(widget))
|
if (GTK_IS_EDITABLE(widget))
|
||||||
{
|
{
|
||||||
@ -4651,6 +4755,18 @@ gnc_main_window_cmd_edit_copy (GSimpleAction *simple,
|
|||||||
{
|
{
|
||||||
GncMainWindow *window = (GncMainWindow*)user_data;
|
GncMainWindow *window = (GncMainWindow*)user_data;
|
||||||
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW(window));
|
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW(window));
|
||||||
|
GAction *redirect_action;
|
||||||
|
|
||||||
|
PINFO("Copy action_is %p, name is '%s'", simple, g_action_get_name (G_ACTION(simple)));
|
||||||
|
|
||||||
|
redirect_action = gnc_main_window_get_redirect (window, g_action_get_name (G_ACTION(simple)));
|
||||||
|
|
||||||
|
if (redirect_action)
|
||||||
|
{
|
||||||
|
PINFO("Found action %p", redirect_action);
|
||||||
|
g_action_activate (redirect_action, nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (GTK_IS_EDITABLE(widget))
|
if (GTK_IS_EDITABLE(widget))
|
||||||
{
|
{
|
||||||
@ -4673,6 +4789,18 @@ gnc_main_window_cmd_edit_paste (GSimpleAction *simple,
|
|||||||
{
|
{
|
||||||
GncMainWindow *window = (GncMainWindow*)user_data;
|
GncMainWindow *window = (GncMainWindow*)user_data;
|
||||||
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW(window));
|
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW(window));
|
||||||
|
GAction *redirect_action;
|
||||||
|
|
||||||
|
PINFO("Paste action_is %p, name is '%s'", simple, g_action_get_name (G_ACTION(simple)));
|
||||||
|
|
||||||
|
redirect_action = gnc_main_window_get_redirect (window, g_action_get_name (G_ACTION(simple)));
|
||||||
|
|
||||||
|
if (redirect_action)
|
||||||
|
{
|
||||||
|
PINFO("Found action %p", redirect_action);
|
||||||
|
g_action_activate (redirect_action, nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (GTK_IS_EDITABLE(widget))
|
if (GTK_IS_EDITABLE(widget))
|
||||||
{
|
{
|
||||||
|
@ -434,6 +434,10 @@ void gnc_main_window_all_action_set_sensitive (const gchar *action_name, gboolea
|
|||||||
*/
|
*/
|
||||||
GAction *gnc_main_window_find_action (GncMainWindow *window, const gchar *name);
|
GAction *gnc_main_window_find_action (GncMainWindow *window, const gchar *name);
|
||||||
|
|
||||||
|
GAction *gnc_main_window_find_action_in_group (GncMainWindow *window,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *name); //FIXMEb added
|
||||||
|
|
||||||
GtkWidget *gnc_main_window_get_menu (GncMainWindow *window); //FIXMEb added
|
GtkWidget *gnc_main_window_get_menu (GncMainWindow *window); //FIXMEb added
|
||||||
|
|
||||||
GMenuModel *gnc_main_window_get_menu_model (GncMainWindow *window); //FIXMEb added
|
GMenuModel *gnc_main_window_get_menu_model (GncMainWindow *window); //FIXMEb added
|
||||||
|
Loading…
Reference in New Issue
Block a user