mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Commit r17686 "Bug 559783 - SQL-related menu entry only when
--enable-dbi is given" introduced a Gtk critical warning because an action was removed from the compilation, but still referenced from the ui xml file. This commit changes this so that the database connection action is still created, but the add_to_window() function is overriden to set that action insensitive if --enable-dbi is not given. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17759 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
5c25bb7557
commit
60afa42460
@ -65,6 +65,8 @@ static void gnc_plugin_basic_commands_class_init (GncPluginBasicCommandsClass *k
|
|||||||
static void gnc_plugin_basic_commands_init (GncPluginBasicCommands *plugin);
|
static void gnc_plugin_basic_commands_init (GncPluginBasicCommands *plugin);
|
||||||
static void gnc_plugin_basic_commands_finalize (GObject *object);
|
static void gnc_plugin_basic_commands_finalize (GObject *object);
|
||||||
|
|
||||||
|
static void gnc_plugin_basic_commands_add_to_window (GncPlugin *plugin, GncMainWindow *window, GQuark type);
|
||||||
|
|
||||||
/* Command callbacks */
|
/* Command callbacks */
|
||||||
static void gnc_main_window_cmd_file_new (GtkAction *action, GncMainWindowActionData *data);
|
static void gnc_main_window_cmd_file_new (GtkAction *action, GncMainWindowActionData *data);
|
||||||
static void gnc_main_window_cmd_file_open (GtkAction *action, GncMainWindowActionData *data);
|
static void gnc_main_window_cmd_file_open (GtkAction *action, GncMainWindowActionData *data);
|
||||||
@ -103,11 +105,9 @@ static GtkActionEntry gnc_plugin_actions [] = {
|
|||||||
{ "FileOpenAction", GTK_STOCK_OPEN, N_("_Open..."), NULL,
|
{ "FileOpenAction", GTK_STOCK_OPEN, N_("_Open..."), NULL,
|
||||||
N_("Open an existing GnuCash file"),
|
N_("Open an existing GnuCash file"),
|
||||||
G_CALLBACK (gnc_main_window_cmd_file_open) },
|
G_CALLBACK (gnc_main_window_cmd_file_open) },
|
||||||
#ifdef HAVE_DBI_DBI_H
|
|
||||||
{ "FileDatabaseConnectionAction", NULL, N_("_Database Connection"), NULL,
|
{ "FileDatabaseConnectionAction", NULL, N_("_Database Connection"), NULL,
|
||||||
N_("Connect to a database"),
|
N_("Connect to a database"),
|
||||||
G_CALLBACK (gnc_main_window_cmd_file_db_connection) },
|
G_CALLBACK (gnc_main_window_cmd_file_db_connection) },
|
||||||
#endif
|
|
||||||
{ "FileSaveAction", GTK_STOCK_SAVE, N_("_Save"), "<control>s",
|
{ "FileSaveAction", GTK_STOCK_SAVE, N_("_Save"), "<control>s",
|
||||||
N_("Save the current file"),
|
N_("Save the current file"),
|
||||||
G_CALLBACK (gnc_main_window_cmd_file_save) },
|
G_CALLBACK (gnc_main_window_cmd_file_save) },
|
||||||
@ -247,6 +247,29 @@ gnc_plugin_basic_commands_new (void)
|
|||||||
return GNC_PLUGIN (plugin);
|
return GNC_PLUGIN (plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Initialize the basic commands menu for a window. This function is
|
||||||
|
* called as part of the initialization of a window, after all the
|
||||||
|
* plugin menu items have been added to the menu structure. Its job
|
||||||
|
* is to correctly initialize the basic commands menu, It does this by
|
||||||
|
* hiding the Database Connection menu item if database support has not
|
||||||
|
* been included in the build.
|
||||||
|
*
|
||||||
|
* @param plugin A pointer to the gnc-plugin object responsible for
|
||||||
|
* adding/removing the basic commands menu.
|
||||||
|
*
|
||||||
|
* @param window A pointer the gnc-main-window that is being initialized.
|
||||||
|
*
|
||||||
|
* @param type Unused
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
gnc_plugin_basic_commands_add_to_window (GncPlugin *plugin,
|
||||||
|
GncMainWindow *window,
|
||||||
|
GQuark type)
|
||||||
|
{
|
||||||
|
#if !defined(HAVE_DBI_DBI_H)
|
||||||
|
gnc_main_window_all_action_set_sensitive("FileDatabaseConnectionAction", FALSE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/** Initialize the class for a new basic commands plugin. This will
|
/** Initialize the class for a new basic commands plugin. This will
|
||||||
* set up any function pointers that override functions in the parent
|
* set up any function pointers that override functions in the parent
|
||||||
@ -268,6 +291,9 @@ gnc_plugin_basic_commands_class_init (GncPluginBasicCommandsClass *klass)
|
|||||||
/* plugin info */
|
/* plugin info */
|
||||||
plugin_class->plugin_name = GNC_PLUGIN_BASIC_COMMANDS_NAME;
|
plugin_class->plugin_name = GNC_PLUGIN_BASIC_COMMANDS_NAME;
|
||||||
|
|
||||||
|
/* function overrides */
|
||||||
|
plugin_class->add_to_window = gnc_plugin_basic_commands_add_to_window;
|
||||||
|
|
||||||
/* widget addition/removal */
|
/* widget addition/removal */
|
||||||
plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
|
plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
|
||||||
plugin_class->actions = gnc_plugin_actions;
|
plugin_class->actions = gnc_plugin_actions;
|
||||||
|
Loading…
Reference in New Issue
Block a user