mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add ability to main window to specify a popup window qualifier
This will allow different popup context window menus for a plugin page to be popped when required.
This commit is contained in:
parent
0110442c28
commit
b30fb2d34a
@ -5510,7 +5510,10 @@ do_popup_menu (GncPluginPage *page, GdkEventButton *event)
|
|||||||
|
|
||||||
builder = gnc_plugin_page_get_builder (page);
|
builder = gnc_plugin_page_get_builder (page);
|
||||||
|
|
||||||
menu_qualifier = gnc_plugin_page_get_menu_qualifier (page);
|
menu_qualifier = gnc_plugin_page_get_menu_popup_qualifier (page);
|
||||||
|
|
||||||
|
if (!menu_qualifier)
|
||||||
|
menu_qualifier = gnc_plugin_page_get_menu_qualifier (page);
|
||||||
|
|
||||||
if (builder == nullptr)
|
if (builder == nullptr)
|
||||||
{
|
{
|
||||||
@ -5519,7 +5522,7 @@ do_popup_menu (GncPluginPage *page, GdkEventButton *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (menu_qualifier)
|
if (menu_qualifier)
|
||||||
popup_menu_name = g_strconcat ("mainwin-popup-", menu_qualifier, NULL);
|
popup_menu_name = g_strconcat ("mainwin-popup-", menu_qualifier, nullptr);
|
||||||
else
|
else
|
||||||
popup_menu_name = g_strdup ("mainwin-popup");
|
popup_menu_name = g_strdup ("mainwin-popup");
|
||||||
|
|
||||||
|
@ -94,6 +94,7 @@ typedef struct _GncPluginPagePrivate
|
|||||||
GSimpleActionGroup *simple_action_group;
|
GSimpleActionGroup *simple_action_group;
|
||||||
const gchar *simple_action_group_name;
|
const gchar *simple_action_group_name;
|
||||||
const gchar *menu_qualifier;
|
const gchar *menu_qualifier;
|
||||||
|
const gchar *menu_popup_qualifier;
|
||||||
|
|
||||||
GList *books;
|
GList *books;
|
||||||
|
|
||||||
@ -1024,7 +1025,6 @@ gnc_plugin_page_get_menu_qualifier (GncPluginPage *page)
|
|||||||
return priv->menu_qualifier;
|
return priv->menu_qualifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_plugin_page_set_menu_qualifier (GncPluginPage *page,
|
gnc_plugin_page_set_menu_qualifier (GncPluginPage *page,
|
||||||
const char *menu_qualifier)
|
const char *menu_qualifier)
|
||||||
@ -1038,6 +1038,31 @@ gnc_plugin_page_set_menu_qualifier (GncPluginPage *page,
|
|||||||
priv->menu_qualifier = menu_qualifier;
|
priv->menu_qualifier = menu_qualifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
gnc_plugin_page_get_menu_popup_qualifier (GncPluginPage *page)
|
||||||
|
{
|
||||||
|
GncPluginPagePrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
|
||||||
|
|
||||||
|
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
|
||||||
|
return priv->menu_popup_qualifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gnc_plugin_page_set_menu_popup_qualifier (GncPluginPage *page,
|
||||||
|
const char *menu_qualifier)
|
||||||
|
{
|
||||||
|
GncPluginPagePrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
|
||||||
|
|
||||||
|
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
|
||||||
|
|
||||||
|
priv->menu_popup_qualifier = menu_qualifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GSimpleActionGroup *
|
GSimpleActionGroup *
|
||||||
gnc_plugin_page_get_action_group (GncPluginPage *page)
|
gnc_plugin_page_get_action_group (GncPluginPage *page)
|
||||||
{
|
{
|
||||||
|
@ -516,6 +516,24 @@ const gchar * gnc_plugin_page_get_menu_qualifier (GncPluginPage *page);
|
|||||||
void gnc_plugin_page_set_menu_qualifier (GncPluginPage *page,
|
void gnc_plugin_page_set_menu_qualifier (GncPluginPage *page,
|
||||||
const char *menu_qualifier);
|
const char *menu_qualifier);
|
||||||
|
|
||||||
|
/** Retrieve the menu popup qualifier for this page.
|
||||||
|
*
|
||||||
|
* @param page The page whose quailifier string should be retrieved.
|
||||||
|
*
|
||||||
|
* @return A qualifier string for this page.
|
||||||
|
*/
|
||||||
|
const gchar * gnc_plugin_page_get_menu_popup_qualifier (GncPluginPage *page);
|
||||||
|
|
||||||
|
/** Set a qualifier string for this page. This string is used when there
|
||||||
|
* is more than one popup menu associated with the page.
|
||||||
|
*
|
||||||
|
* @param page The page whose qualifier string should be updated.
|
||||||
|
*
|
||||||
|
* @param menu_qualifier A string to be used as for the qualifier.
|
||||||
|
*/
|
||||||
|
void gnc_plugin_page_set_menu_popup_qualifier (GncPluginPage *page,
|
||||||
|
const char *menu_qualifier);
|
||||||
|
|
||||||
/** Retrieve the GSimpleActionGroup object associated with this page.
|
/** Retrieve the GSimpleActionGroup object associated with this page.
|
||||||
*
|
*
|
||||||
* @param page The page whose menu/toolbar action group should be
|
* @param page The page whose menu/toolbar action group should be
|
||||||
|
Loading…
Reference in New Issue
Block a user