38 #include <glib/gi18n.h> 48 static QofLogModule log_module = GNC_MOD_GUI;
50 static void gnc_plugin_constructed (GObject *
object);
51 static void gnc_plugin_finalize (GObject *
object);
62 G_ADD_PRIVATE(GncPlugin))
64 #define GNC_PLUGIN_GET_PRIVATE(o) \ 65 ((GncPluginPrivate*)gnc_plugin_get_instance_private((GncPlugin*)o)) 75 gnc_plugin_class_init (GncPluginClass *klass)
77 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
79 gobject_class->constructed = gnc_plugin_constructed;
80 gobject_class->finalize = gnc_plugin_finalize;
91 gnc_plugin_init (GncPlugin *plugin)
102 gnc_plugin_constructed (GObject *obj)
106 G_OBJECT_CLASS (gnc_plugin_parent_class)->constructed (obj);
118 gnc_plugin_finalize (GObject *
object)
120 g_return_if_fail (GNC_IS_PLUGIN (
object));
123 G_OBJECT_CLASS (gnc_plugin_parent_class)->finalize (
object);
137 GncPluginClass *klass;
139 g_return_if_fail (GNC_IS_PLUGIN (plugin));
140 klass = GNC_PLUGIN_GET_CLASS (plugin);
147 if (klass->actions_name)
149 DEBUG (
"%s: %d actions to merge with gui from %s",
150 klass->actions_name, klass->n_actions, klass->ui_filename);
152 klass->actions, klass->n_actions,
154 klass->ui_filename, plugin);
160 if (GNC_PLUGIN_GET_CLASS (plugin)->add_to_window)
162 DEBUG (
"Calling child class function %p", GNC_PLUGIN_GET_CLASS (plugin)->add_to_window);
163 GNC_PLUGIN_GET_CLASS (plugin)->add_to_window (plugin, window, type);
179 GncPluginClass *klass;
181 g_return_if_fail (GNC_IS_PLUGIN (plugin));
182 klass = GNC_PLUGIN_GET_CLASS (plugin);
189 if (GNC_PLUGIN_GET_CLASS (plugin)->remove_from_window)
191 DEBUG (
"Calling child class function %p",
192 GNC_PLUGIN_GET_CLASS (plugin)->remove_from_window);
193 GNC_PLUGIN_GET_CLASS (plugin)->remove_from_window (plugin, window, type);
199 if (klass->actions_name && !window->just_plugin_prefs)
201 DEBUG (
"%s: %d actions to unmerge",
202 klass->actions_name, (klass->n_actions));
214 g_return_val_if_fail (GNC_IS_PLUGIN (plugin), NULL);
215 return (GNC_PLUGIN_GET_CLASS(plugin)->plugin_name);
232 g_return_if_fail (toolbar != NULL);
233 g_return_if_fail (toolbar_labels != NULL);
235 for (gint i = 0; (toolbar_labels[i].
action_name); i++)
242 gtk_tool_button_set_label (GTK_TOOL_BUTTON(tool_item), _(toolbar_labels[i].short_label));
243 gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON(tool_item), TRUE);
251 const gchar **action_names, gboolean enable)
253 g_return_if_fail (action_map != NULL);
255 for (gint i = 0; action_names[i]; i++)
257 GAction *action = g_action_map_lookup_action (G_ACTION_MAP(action_map),
260 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), enable);
262 PERR(
"No such action with name '%s' in action group %p)",
263 action_names[i], action_map);
269 GMenuModel *menubar_model,
270 GtkWidget *statusbar)
272 GList *menu_item_list;
274 g_return_if_fail (G_IS_MENU_MODEL(menubar_model));
275 g_return_if_fail (GTK_IS_STATUSBAR(statusbar));
279 for (GList *node = menu_item_list; node; node = node->next)
281 GtkWidget *menu_item = node->data;
285 g_object_set_data (G_OBJECT(statusbar),
"menu-model", menubar_model);
286 g_list_free (menu_item_list);
290 for_each_tool_action (GtkWidget *widget, gpointer user_data)
292 GtkWidget *statusbar = user_data;
294 if (GTK_IS_ACTIONABLE(widget))
301 g_return_if_fail (GTK_IS_TOOLBAR(toolbar));
302 g_return_if_fail (GTK_IS_STATUSBAR(statusbar));
304 gtk_container_foreach (GTK_CONTAINER(toolbar), for_each_tool_action, statusbar);
void gnc_tool_item_setup_tooltip_to_statusbar_callback(GtkWidget *tool_item, GtkWidget *statusbar)
Setup the callbacks for tool bar items so the tooltip can be displayed in the status bar...
void gnc_gobject_tracking_forget(GObject *object)
Tell gnucash to remember this object in the database.
#define DEBUG(format, args...)
Print a debugging message.
void gnc_main_window_merge_actions(GncMainWindow *window, const gchar *group_name, GActionEntry *actions, guint n_actions, const gchar **ui_updates, const gchar *ui_filename, gpointer user_data)
Add a set of actions to the specified window.
void gnc_main_window_unmerge_actions(GncMainWindow *window, const gchar *group_name)
Remove a set of actions from the specified window.
#define PERR(format, args...)
Log a serious error.
#define ENTER(format, args...)
Print a function entry debugging message.
void gnc_gobject_tracking_remember(GObject *object)
Tell gnucash to remember this object in the database.
GList * gnc_menu_get_items(GtkWidget *menu)
Return a list of GtkMenuItems.
Gnome specific utility functions.
GtkWidget * gnc_find_toolbar_item(GtkWidget *toolbar, const gchar *action_name)
Search the toolbar for the tool item based on the action name.
All type declarations for the whole Gnucash engine.
Functions for adding plugins to a GnuCash window.
#define LEAVE(format, args...)
Print a function exit debugging message.
The instance data structure for a main window object.
File path resolution utility functions.
void gnc_menu_item_setup_tooltip_to_statusbar_callback(GtkWidget *menu_item, GtkWidget *statusbar)
Setup the callbacks for menu bar items so the tooltip can be displayed in the status bar...
The instance private data for a menu-only plugin.