mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Changes for sx plugin pages
This commit is contained in:
parent
161dad7a4c
commit
273b7439aa
@ -124,6 +124,7 @@ static void gnc_plugin_page_sx_list_cmd_new (GSimpleAction *simple, GVariant *pa
|
||||
static void gnc_plugin_page_sx_list_cmd_edit (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
|
||||
static void gnc_plugin_page_sx_list_cmd_delete (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
|
||||
static void gnc_plugin_page_sx_list_cmd_refresh (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
|
||||
static void gnc_plugin_page_sx_list_cmd_edit_tax_options (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
|
||||
|
||||
/* Command callbacks */
|
||||
static GActionEntry gnc_plugin_page_sx_list_actions [] =
|
||||
@ -133,6 +134,7 @@ static GActionEntry gnc_plugin_page_sx_list_actions [] =
|
||||
{ "SxListEditAction", gnc_plugin_page_sx_list_cmd_edit, NULL, NULL, NULL },
|
||||
{ "SxListDeleteAction", gnc_plugin_page_sx_list_cmd_delete, NULL, NULL, NULL },
|
||||
{ "ViewRefreshAction", gnc_plugin_page_sx_list_cmd_refresh, NULL, NULL, NULL },
|
||||
{ "EditTaxOptionsAction", gnc_plugin_page_sx_list_cmd_edit_tax_options, NULL, NULL, NULL },
|
||||
};
|
||||
/** The number of actions provided by this plugin. */
|
||||
static guint gnc_plugin_page_sx_list_n_actions = G_N_ELEMENTS(gnc_plugin_page_sx_list_actions);
|
||||
@ -161,6 +163,17 @@ static GncDisplayItem gnc_plugin_page_sx_list_display_items [] =
|
||||
/** The number of display items provided by this plugin. */
|
||||
static guint gnc_plugin_page_sx_list_n_display_items = G_N_ELEMENTS(gnc_plugin_page_sx_list_display_items);
|
||||
|
||||
/** The default menu items that need to be add to the menu */
|
||||
static const gchar *gnc_plugin_load_ui_items [] =
|
||||
{
|
||||
"EditPlaceholder3",
|
||||
"EditPlaceholder5",
|
||||
"ViewPlaceholder4",
|
||||
"SchedulePlaceholder0",
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
GncPluginPage *
|
||||
gnc_plugin_page_sx_list_new (void)
|
||||
{
|
||||
@ -188,6 +201,16 @@ gnc_plugin_page_sx_list_focus_widget (GncPluginPage *sx_plugin_page)
|
||||
GncPluginPageSxListPrivate *priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(sx_plugin_page);
|
||||
GtkTreeView *tree_view = priv->tree_view;
|
||||
|
||||
/* Disable the Transaction Menu */
|
||||
GAction *action = gnc_main_window_find_action (GNC_MAIN_WINDOW(sx_plugin_page->window), "TransactionAction");
|
||||
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE);
|
||||
/* Enable the Schedule Menu */
|
||||
action = gnc_main_window_find_action (GNC_MAIN_WINDOW(sx_plugin_page->window), "ScheduledAction");
|
||||
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), TRUE);
|
||||
|
||||
gnc_main_window_update_menu (GNC_MAIN_WINDOW(sx_plugin_page->window), sx_plugin_page,
|
||||
gnc_plugin_load_ui_items);
|
||||
|
||||
if (GTK_IS_TREE_VIEW(tree_view))
|
||||
{
|
||||
if (!gtk_widget_is_focus (GTK_WIDGET(tree_view)))
|
||||
@ -384,26 +407,6 @@ gppsl_model_populated_cb (GtkTreeModel *tree_model, GncPluginPageSxList *page)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gpps_new_cb (GtkMenuItem *menuitem, GncPluginPageSxList *page)
|
||||
{
|
||||
gnc_plugin_page_sx_list_cmd_new (NULL, NULL, page);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
gpps_edit_cb (GtkMenuItem *menuitem, GncPluginPageSxList *page)
|
||||
{
|
||||
gnc_plugin_page_sx_list_cmd_edit (NULL, NULL, page);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
gpps_delete_cb (GtkMenuItem *menuitem, GncPluginPageSxList *page)
|
||||
{
|
||||
gnc_plugin_page_sx_list_cmd_delete (NULL, NULL, page);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
treeview_popup (GtkTreeView *treeview, GdkEvent *event, GncPluginPageSxList *page)
|
||||
@ -413,21 +416,27 @@ treeview_popup (GtkTreeView *treeview, GdkEvent *event, GncPluginPageSxList *pag
|
||||
GtkTreeSelection *selection = gtk_tree_view_get_selection (tree_view);
|
||||
gint count_selection = gtk_tree_selection_count_selected_rows (selection);
|
||||
GtkWidget *menu, *menuitem;
|
||||
gchar *full_action_name;
|
||||
const gchar *group_name = gnc_plugin_page_get_simple_action_group_name (GNC_PLUGIN_PAGE(page));
|
||||
|
||||
menu = gtk_menu_new();
|
||||
|
||||
menuitem = gtk_menu_item_new_with_mnemonic (_("_New"));
|
||||
g_signal_connect (menuitem, "activate", G_CALLBACK(gpps_new_cb), page);
|
||||
full_action_name = g_strconcat (group_name, ".SxListNewAction", NULL);
|
||||
gtk_actionable_set_action_name (GTK_ACTIONABLE(menuitem), full_action_name);
|
||||
g_free (full_action_name);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL(menu), menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_mnemonic (_("_Edit"));
|
||||
g_signal_connect (menuitem, "activate", G_CALLBACK(gpps_edit_cb), page);
|
||||
gtk_widget_set_sensitive (menuitem, count_selection > 0);
|
||||
full_action_name = g_strconcat (group_name, ".SxListEditAction", NULL);
|
||||
gtk_actionable_set_action_name (GTK_ACTIONABLE(menuitem), full_action_name);
|
||||
g_free (full_action_name);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL(menu), menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_mnemonic (_("_Delete"));
|
||||
g_signal_connect (menuitem, "activate", G_CALLBACK(gpps_delete_cb), page);
|
||||
gtk_widget_set_sensitive (menuitem, count_selection > 0);
|
||||
full_action_name = g_strconcat (group_name, ".SxListDeleteAction", NULL);
|
||||
gtk_actionable_set_action_name (GTK_ACTIONABLE(menuitem), full_action_name);
|
||||
g_free (full_action_name);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL(menu), menuitem);
|
||||
|
||||
gtk_menu_attach_to_widget (GTK_MENU (menu), GTK_WIDGET (priv->tree_view), NULL);
|
||||
@ -542,15 +551,13 @@ gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page)
|
||||
|
||||
selection = gtk_tree_view_get_selection (priv->tree_view);
|
||||
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
|
||||
gtk_tree_selection_select_path (selection, path);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
g_signal_connect (G_OBJECT(selection), "changed", (GCallback)gppsl_selection_changed_cb, (gpointer)page);
|
||||
g_signal_connect (G_OBJECT(priv->tree_view), "row-activated", (GCallback)gppsl_row_activated_cb, (gpointer)page);
|
||||
g_signal_connect (G_OBJECT(gtk_tree_view_get_model (GTK_TREE_VIEW(priv->tree_view))),
|
||||
"model-populated", (GCallback)gppsl_model_populated_cb, (gpointer)page);
|
||||
|
||||
gppsl_selection_changed_cb (selection, page);
|
||||
gtk_tree_selection_select_path (selection, path);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
@ -810,6 +817,21 @@ gnc_plugin_page_sx_list_cmd_edit (GSimpleAction *simple,
|
||||
g_list_free (selected_paths);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gnc_plugin_page_sx_list_cmd_edit_tax_options (GSimpleAction *simple,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GncPluginPageSxList *plugin_page = user_data;
|
||||
GtkWidget *window = GTK_WIDGET(gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(plugin_page)));
|
||||
|
||||
ENTER ("(action %p, page %p)", simple, plugin_page);
|
||||
gnc_tax_info_dialog (window, NULL);
|
||||
LEAVE (" ");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gppsl_row_activated_cb (GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
|
@ -21,6 +21,7 @@
|
||||
<file>ui/gnc-plugin-page-account-tree.ui</file>
|
||||
<file>ui/gnc-plugin-page-budget.ui</file>
|
||||
<file>ui/gnc-plugin-page-register.ui</file>
|
||||
<file>ui/gnc-plugin-page-sx-list.ui</file>
|
||||
|
||||
<file>ui/gnc-plugin-ofx.ui</file>
|
||||
<file>ui/gnc-plugin-aqbanking.ui</file>
|
||||
|
190
gnucash/ui/gnc-plugin-page-sx-list.ui
Normal file
190
gnucash/ui/gnc-plugin-page-sx-list.ui
Normal file
@ -0,0 +1,190 @@
|
||||
<?xml version="1.0"?>
|
||||
<interface>
|
||||
|
||||
<menu id="EditPlaceholder3">
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Find...</attribute>
|
||||
<attribute name="action">gnc-plugin-basic-commands-actions.EditFindTransactionsAction</attribute>
|
||||
<attribute name="accel"><Primary>f</attribute>
|
||||
<attribute name="tooltip" translatable="yes">Find transactions with a search</attribute>
|
||||
<attribute name="temp" translatable="no">yes</attribute>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
<menu id="EditPlaceholder5">
|
||||
<item>
|
||||
<!-- Translators: remember to reuse this translation in dialog-account.glade -->
|
||||
<attribute name="label" translatable="yes">Ta_x Report Options</attribute>
|
||||
<attribute name="action">GncPluginPageSxListActions.EditTaxOptionsAction</attribute>
|
||||
<!-- Translators: currently implemented are, US: income tax and DE: VAT, So adjust this string -->
|
||||
<attribute name="tooltip" translatable="yes">Setup relevant accounts for tax reports, e.g. US income tax</attribute>
|
||||
<attribute name="temp" translatable="no">yes</attribute>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
<menu id="ViewPlaceholder4">
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Refresh</attribute>
|
||||
<attribute name="action">GncPluginPageSxListActions.ViewRefreshAction</attribute>
|
||||
<attribute name="accel"><Primary>r</attribute>
|
||||
<attribute name="tooltip" translatable="yes">Refresh this window</attribute>
|
||||
<attribute name="temp" translatable="no">yes</attribute>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
<menu id="SchedulePlaceholder0">
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_New</attribute>
|
||||
<attribute name="action">GncPluginPageSxListActions.SxListNewAction</attribute>
|
||||
<attribute name="tooltip" translatable="yes">Create a new scheduled transaction</attribute>
|
||||
<attribute name="temp" translatable="no">yes</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Edit</attribute>
|
||||
<attribute name="action">GncPluginPageSxListActions.SxListEditAction</attribute>
|
||||
<attribute name="tooltip" translatable="yes">Edit the selected scheduled transaction</attribute>
|
||||
<attribute name="temp" translatable="no">yes</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Delete</attribute>
|
||||
<attribute name="action">GncPluginPageSxListActions.SxListDeleteAction</attribute>
|
||||
<attribute name="tooltip" translatable="yes">Delete the selected scheduled transaction</attribute>
|
||||
<attribute name="temp" translatable="no">yes</attribute>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
|
||||
<menu id="mainwin-popup">
|
||||
<item>
|
||||
<attribute name="label" translatable="no">_Test</attribute>
|
||||
<attribute name="action">mainwin.TestAction</attribute>
|
||||
</item>
|
||||
</menu>
|
||||
|
||||
|
||||
<object class="GtkToolbar" id="mainwin-toolbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="but1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">_Save</property>
|
||||
<property name="action-name">gnc-plugin-basic-commands-actions.FileSaveAction</property>
|
||||
<property name="tooltip-text" translatable="yes">Save the current file</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="icon-name">document-save</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="but2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">_Close</property>
|
||||
<property name="action-name">mainwin.FileCloseAction</property>
|
||||
<property name="tooltip-text" translatable="yes">Close the currently active page</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="icon-name">window-close</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorToolItem">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="but2a">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">New _Invoice...</property>
|
||||
<property name="action-name">gnc-plugin-business-actions.ToolbarNewInvoiceAction</property>
|
||||
<property name="tooltip-text" translatable="yes">Open the New Invoice dialog</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="icon-name">gnc-invoice-new</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorToolItem" id="extra_separator">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="but3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">_New</property>
|
||||
<property name="action-name">GncPluginPageSxListActions.SxListNewAction</property>
|
||||
<property name="tooltip-text" translatable="yes">Create a new scheduled transaction</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="icon-name">gnc-account-open</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="but4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">_Edit</property>
|
||||
<property name="action-name">GncPluginPageSxListActions.SxListEditAction</property>
|
||||
<property name="tooltip-text" translatable="yes">Edit the selected scheduled transaction</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="icon-name">gnc-account-edit</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorToolItem">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="but5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">_Delete</property>
|
||||
<property name="action-name">GncPluginPageSxListActions.SxListDeleteAction</property>
|
||||
<property name="tooltip-text" translatable="yes">Delete the selected scheduled transaction</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="icon-name">gnc-account-delete</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
</interface>
|
Loading…
Reference in New Issue
Block a user