Reformat source files gnc-plugin-page.*

Change tabs for spaces and change some space positioning.
This commit is contained in:
Robert Fewell 2020-02-16 14:39:37 +00:00
parent ba1af5504d
commit 832ad7e85e
2 changed files with 154 additions and 134 deletions

View File

@ -47,16 +47,16 @@ static gpointer parent_class = NULL;
static void gnc_plugin_page_class_init (GncPluginPageClass *klass); static void gnc_plugin_page_class_init (GncPluginPageClass *klass);
static void gnc_plugin_page_init (GncPluginPage *plugin_page, static void gnc_plugin_page_init (GncPluginPage *plugin_page,
void *data); void *data);
static void gnc_plugin_page_finalize (GObject *object); static void gnc_plugin_page_finalize (GObject *object);
static void gnc_plugin_page_set_property (GObject *object, static void gnc_plugin_page_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gnc_plugin_page_get_property (GObject *object, static void gnc_plugin_page_get_property (GObject *object,
guint prop_id, guint prop_id,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gnc_plugin_page_default_focus (GncPluginPage *plugin_page, static void gnc_plugin_page_default_focus (GncPluginPage *plugin_page,
gboolean on_current_page); gboolean on_current_page);
@ -112,10 +112,10 @@ typedef struct _GncPluginPagePrivate
} GncPluginPagePrivate; } GncPluginPagePrivate;
GNC_DEFINE_TYPE_WITH_CODE(GncPluginPage, gnc_plugin_page, G_TYPE_OBJECT, GNC_DEFINE_TYPE_WITH_CODE(GncPluginPage, gnc_plugin_page, G_TYPE_OBJECT,
G_ADD_PRIVATE(GncPluginPage)) G_ADD_PRIVATE(GncPluginPage))
#define GNC_PLUGIN_PAGE_GET_PRIVATE(o) \ #define GNC_PLUGIN_PAGE_GET_PRIVATE(o) \
((GncPluginPagePrivate*)g_type_instance_get_private((GTypeInstance*)o, GNC_TYPE_PLUGIN_PAGE)) ((GncPluginPagePrivate*)g_type_instance_get_private ((GTypeInstance*)o, GNC_TYPE_PLUGIN_PAGE))
/* Create the display widget that corresponds to this plugin. This /* Create the display widget that corresponds to this plugin. This
* function will be called by the main/embedded window manipulation * function will be called by the main/embedded window manipulation
@ -128,9 +128,9 @@ gnc_plugin_page_create_widget (GncPluginPage *plugin_page)
GncPluginPageClass *klass; GncPluginPageClass *klass;
GtkWidget *widget; GtkWidget *widget;
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (plugin_page), NULL); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page), NULL);
klass = GNC_PLUGIN_PAGE_GET_CLASS (plugin_page); klass = GNC_PLUGIN_PAGE_GET_CLASS(plugin_page);
g_return_val_if_fail (klass != NULL, NULL); g_return_val_if_fail (klass != NULL, NULL);
g_return_val_if_fail (klass->create_widget != NULL, NULL); g_return_val_if_fail (klass->create_widget != NULL, NULL);
@ -143,7 +143,7 @@ gnc_plugin_page_create_widget (GncPluginPage *plugin_page)
* main notebook for the window. * main notebook for the window.
*/ */
if (klass->destroy_widget) if (klass->destroy_widget)
g_object_ref(widget); g_object_ref (widget);
return widget; return widget;
} }
@ -157,9 +157,9 @@ gnc_plugin_page_destroy_widget (GncPluginPage *plugin_page)
{ {
GncPluginPageClass *klass; GncPluginPageClass *klass;
g_return_if_fail (GNC_IS_PLUGIN_PAGE (plugin_page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page));
klass = GNC_PLUGIN_PAGE_GET_CLASS (plugin_page); klass = GNC_PLUGIN_PAGE_GET_CLASS(plugin_page);
g_return_if_fail (klass != NULL); g_return_if_fail (klass != NULL);
g_return_if_fail (klass->destroy_widget != NULL); g_return_if_fail (klass->destroy_widget != NULL);
@ -172,19 +172,15 @@ void
gnc_plugin_page_show_summarybar (GncPluginPage *page, gnc_plugin_page_show_summarybar (GncPluginPage *page,
gboolean visible) gboolean visible)
{ {
g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
if (!page->summarybar) if (!page->summarybar)
return; return;
if (visible) if (visible)
{ gtk_widget_show (page->summarybar);
gtk_widget_show(page->summarybar);
}
else else
{ gtk_widget_hide (page->summarybar);
gtk_widget_hide(page->summarybar);
}
} }
@ -199,16 +195,16 @@ gnc_plugin_page_save_page (GncPluginPage *page,
{ {
GncPluginPageClass *klass; GncPluginPageClass *klass;
g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
g_return_if_fail (key_file != NULL); g_return_if_fail (key_file != NULL);
g_return_if_fail (group_name != NULL); g_return_if_fail (group_name != NULL);
ENTER(" "); ENTER(" ");
klass = GNC_PLUGIN_PAGE_GET_CLASS (page); klass = GNC_PLUGIN_PAGE_GET_CLASS(page);
g_return_if_fail (klass != NULL); g_return_if_fail (klass != NULL);
g_return_if_fail (klass->save_page != NULL); g_return_if_fail (klass->save_page != NULL);
klass->save_page(page, key_file, group_name); klass->save_page (page, key_file, group_name);
LEAVE(" "); LEAVE(" ");
} }
@ -227,17 +223,17 @@ gnc_plugin_page_recreate_page(GtkWidget *window,
GType type; GType type;
ENTER("type %s, keyfile %p, group %s", page_type, key_file, page_group); ENTER("type %s, keyfile %p, group %s", page_type, key_file, page_group);
type = g_type_from_name(page_type); type = g_type_from_name (page_type);
if (type == 0) if (type == 0)
{ {
LEAVE("Cannot find type named %s", page_type); LEAVE("Cannot find type named %s", page_type);
return NULL; return NULL;
} }
klass = g_type_class_ref(type); klass = g_type_class_ref (type);
if (klass == NULL) if (klass == NULL)
{ {
const gchar *type_name = g_type_name(type); const gchar *type_name = g_type_name (type);
LEAVE("Cannot create class %s(%s)", page_type, type_name ? type_name : "invalid type"); LEAVE("Cannot create class %s(%s)", page_type, type_name ? type_name : "invalid type");
return NULL; return NULL;
} }
@ -245,12 +241,12 @@ gnc_plugin_page_recreate_page(GtkWidget *window,
if (!klass->recreate_page) if (!klass->recreate_page)
{ {
LEAVE("Class %shas no recreate function.", page_type); LEAVE("Class %shas no recreate function.", page_type);
g_type_class_unref(klass); g_type_class_unref (klass);
return NULL; return NULL;
} }
page = (klass->recreate_page)(window, key_file, page_group); page = (klass->recreate_page)(window, key_file, page_group);
g_type_class_unref(klass); g_type_class_unref (klass);
LEAVE(" "); LEAVE(" ");
return page; return page;
} }
@ -268,9 +264,9 @@ gnc_plugin_page_merge_actions (GncPluginPage *page,
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
priv->ui_merge = ui_merge; priv->ui_merge = ui_merge;
gtk_action_group_set_sensitive (priv->action_group, TRUE); gtk_action_group_set_sensitive (priv->action_group, TRUE);
priv->merge_id = gnc_plugin_add_actions(priv->ui_merge, priv->merge_id = gnc_plugin_add_actions (priv->ui_merge,
priv->action_group, priv->action_group,
priv->ui_description); priv->ui_description);
} }
@ -283,13 +279,13 @@ gnc_plugin_page_unmerge_actions (GncPluginPage *page,
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
g_return_if_fail (priv->merge_id != 0); g_return_if_fail (priv->merge_id != 0);
g_return_if_fail (priv->action_group != NULL); g_return_if_fail (priv->action_group != NULL);
gtk_ui_manager_remove_ui(ui_merge, priv->merge_id); gtk_ui_manager_remove_ui (ui_merge, priv->merge_id);
gtk_action_group_set_sensitive (priv->action_group, FALSE); gtk_action_group_set_sensitive (priv->action_group, FALSE);
gtk_ui_manager_remove_action_group(ui_merge, priv->action_group); gtk_ui_manager_remove_action_group (ui_merge, priv->action_group);
priv->ui_merge = NULL; priv->ui_merge = NULL;
priv->merge_id = 0; priv->merge_id = 0;
@ -301,8 +297,8 @@ gnc_plugin_page_get_action (GncPluginPage *page, const gchar *name)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), NULL); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
g_return_val_if_fail(name != NULL, NULL); g_return_val_if_fail (name != NULL, NULL);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
if (!priv->action_group) if (!priv->action_group)
@ -317,9 +313,9 @@ gnc_plugin_page_get_plugin_name (GncPluginPage *plugin_page)
{ {
GncPluginPageClass *klass; GncPluginPageClass *klass;
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (plugin_page), NULL); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page), NULL);
klass = GNC_PLUGIN_PAGE_GET_CLASS (plugin_page); klass = GNC_PLUGIN_PAGE_GET_CLASS(plugin_page);
g_return_val_if_fail (klass != NULL, NULL); g_return_val_if_fail (klass != NULL, NULL);
return (klass->plugin_name); return (klass->plugin_name);
@ -330,33 +326,33 @@ gnc_plugin_page_get_plugin_name (GncPluginPage *plugin_page)
void void
gnc_plugin_page_inserted (GncPluginPage *plugin_page) gnc_plugin_page_inserted (GncPluginPage *plugin_page)
{ {
g_return_if_fail (GNC_IS_PLUGIN_PAGE (plugin_page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page));
g_signal_emit (G_OBJECT (plugin_page), signals[INSERTED], 0); g_signal_emit (G_OBJECT(plugin_page), signals[INSERTED], 0);
} }
void void
gnc_plugin_page_removed (GncPluginPage *plugin_page) gnc_plugin_page_removed (GncPluginPage *plugin_page)
{ {
g_return_if_fail (GNC_IS_PLUGIN_PAGE (plugin_page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page));
g_signal_emit (G_OBJECT (plugin_page), signals[REMOVED], 0); g_signal_emit (G_OBJECT(plugin_page), signals[REMOVED], 0);
} }
void void
gnc_plugin_page_selected (GncPluginPage *plugin_page) gnc_plugin_page_selected (GncPluginPage *plugin_page)
{ {
g_return_if_fail (GNC_IS_PLUGIN_PAGE (plugin_page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page));
g_signal_emit (G_OBJECT (plugin_page), signals[SELECTED], 0); g_signal_emit (G_OBJECT(plugin_page), signals[SELECTED], 0);
} }
void void
gnc_plugin_page_unselected (GncPluginPage *plugin_page) gnc_plugin_page_unselected (GncPluginPage *plugin_page)
{ {
g_return_if_fail (GNC_IS_PLUGIN_PAGE (plugin_page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(plugin_page));
g_signal_emit (G_OBJECT (plugin_page), signals[UNSELECTED], 0); g_signal_emit (G_OBJECT(plugin_page), signals[UNSELECTED], 0);
} }
/** Initialize the class for a new generic plugin page. This will set /** Initialize the class for a new generic plugin page. This will set
@ -369,7 +365,7 @@ gnc_plugin_page_unselected (GncPluginPage *plugin_page)
static void static void
gnc_plugin_page_class_init (GncPluginPageClass *klass) gnc_plugin_page_class_init (GncPluginPageClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = gnc_plugin_page_finalize; gobject_class->finalize = gnc_plugin_page_finalize;
@ -527,8 +523,8 @@ gnc_plugin_page_init (GncPluginPage *page, void *data)
page->window = NULL; page->window = NULL;
page->summarybar = NULL; page->summarybar = NULL;
gnc_gobject_tracking_remember(G_OBJECT(page), gnc_gobject_tracking_remember (G_OBJECT(page),
G_OBJECT_CLASS(klass)); G_OBJECT_CLASS(klass));
} }
@ -545,28 +541,31 @@ gnc_plugin_page_finalize (GObject *object)
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
GncPluginPage *page; GncPluginPage *page;
page = GNC_PLUGIN_PAGE (object); page = GNC_PLUGIN_PAGE(object);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
if (priv->page_name) if (priv->page_name)
g_free(priv->page_name); g_free (priv->page_name);
if (priv->page_color) if (priv->page_color)
g_free(priv->page_color); g_free (priv->page_color);
if (priv->uri) if (priv->uri)
g_free(priv->uri); g_free (priv->uri);
if (priv->statusbar_text) if (priv->statusbar_text)
g_free(priv->statusbar_text); g_free (priv->statusbar_text);
if (priv->books) if (priv->books)
{ {
g_list_free(priv->books); g_list_free (priv->books);
priv->books = NULL; priv->books = NULL;
} }
page->window = NULL; // Don't need to free it. page->window = NULL; // Don't need to free it.
gnc_gobject_tracking_forget(object); gnc_gobject_tracking_forget (object);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS(parent_class)->finalize (object);
} }
/************************************************************/ /************************************************************/
@ -673,22 +672,22 @@ gnc_plugin_page_set_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_PAGE_NAME: case PROP_PAGE_NAME:
gnc_plugin_page_set_page_name(page, g_value_get_string(value)); gnc_plugin_page_set_page_name (page, g_value_get_string (value));
break; break;
case PROP_PAGE_COLOR: case PROP_PAGE_COLOR:
gnc_plugin_page_set_page_color(page, g_value_get_string(value)); gnc_plugin_page_set_page_color (page, g_value_get_string (value));
break; break;
case PROP_PAGE_URI: case PROP_PAGE_URI:
gnc_plugin_page_set_uri(page, g_value_get_string(value)); gnc_plugin_page_set_uri (page, g_value_get_string (value));
break; break;
case PROP_STATUSBAR_TEXT: case PROP_STATUSBAR_TEXT:
gnc_plugin_page_set_statusbar_text(page, g_value_get_string(value)); gnc_plugin_page_set_statusbar_text (page, g_value_get_string (value));
break; break;
case PROP_USE_NEW_WINDOW: case PROP_USE_NEW_WINDOW:
gnc_plugin_page_set_use_new_window(page, g_value_get_boolean(value)); gnc_plugin_page_set_use_new_window (page, g_value_get_boolean (value));
break; break;
case PROP_UI_DESCRIPTION: case PROP_UI_DESCRIPTION:
gnc_plugin_page_set_ui_description(page, g_value_get_string(value)); gnc_plugin_page_set_ui_description (page, g_value_get_string (value));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -706,11 +705,11 @@ gnc_plugin_page_add_book (GncPluginPage *page, QofBook *book)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
g_return_if_fail (book != NULL); g_return_if_fail (book != NULL);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
priv->books = g_list_append(priv->books, book); priv->books = g_list_append (priv->books, book);
} }
@ -721,11 +720,11 @@ gnc_plugin_page_has_book (GncPluginPage *page, QofBook *book)
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
GList *item; GList *item;
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), FALSE); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
g_return_val_if_fail (book != NULL, FALSE); g_return_val_if_fail (book != NULL, FALSE);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
for (item = priv->books; item; item = g_list_next(item)) for (item = priv->books; item; item = g_list_next (item))
{ {
if (item->data == book) if (item->data == book)
{ {
@ -742,7 +741,7 @@ gnc_plugin_page_has_books (GncPluginPage *page)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), FALSE); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
return (priv->books != NULL); return (priv->books != NULL);
@ -754,7 +753,7 @@ gnc_plugin_page_has_books (GncPluginPage *page)
GtkWidget * GtkWidget *
gnc_plugin_page_get_window (GncPluginPage *page) gnc_plugin_page_get_window (GncPluginPage *page)
{ {
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
return page->window; return page->window;
} }
@ -767,7 +766,7 @@ gnc_plugin_page_get_page_name (GncPluginPage *page)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
return priv->page_name; return priv->page_name;
@ -782,12 +781,13 @@ gnc_plugin_page_set_page_name (GncPluginPage *page, const gchar *name)
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
GncPluginPageClass *klass; GncPluginPageClass *klass;
g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
if (priv->page_name) if (priv->page_name)
g_free(priv->page_name); g_free (priv->page_name);
priv->page_name = g_strdup(name);
priv->page_name = g_strdup (name);
/* Perform page specific actions */ /* Perform page specific actions */
klass = GNC_PLUGIN_PAGE_GET_CLASS (page); klass = GNC_PLUGIN_PAGE_GET_CLASS (page);
@ -806,7 +806,7 @@ gnc_plugin_page_get_page_long_name (GncPluginPage *page)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
return priv->page_long_name; return priv->page_long_name;
@ -820,12 +820,13 @@ gnc_plugin_page_set_page_long_name (GncPluginPage *page, const gchar *name)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
if (priv->page_long_name) if (priv->page_long_name)
g_free(priv->page_long_name); g_free (priv->page_long_name);
priv->page_long_name = g_strdup(name);
priv->page_long_name = g_strdup (name);
} }
@ -835,7 +836,7 @@ gnc_plugin_page_get_page_color (GncPluginPage *page)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
return priv->page_color; return priv->page_color;
@ -848,13 +849,14 @@ gnc_plugin_page_set_page_color (GncPluginPage *page, const gchar *color)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
if (priv->page_color) if (priv->page_color)
g_free(priv->page_color); g_free (priv->page_color);
if (color) if (color)
priv->page_color = g_strdup(color); priv->page_color = g_strdup (color);
} }
@ -968,7 +970,7 @@ gnc_plugin_page_get_uri (GncPluginPage *page)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
return priv->uri; return priv->uri;
@ -981,12 +983,13 @@ gnc_plugin_page_set_uri (GncPluginPage *page, const gchar *name)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
if (priv->uri) if (priv->uri)
g_free(priv->uri); g_free (priv->uri);
priv->uri = g_strdup(name);
priv->uri = g_strdup (name);
} }
@ -996,7 +999,7 @@ gnc_plugin_page_get_statusbar_text (GncPluginPage *page)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
return priv->statusbar_text; return priv->statusbar_text;
@ -1009,12 +1012,13 @@ gnc_plugin_page_set_statusbar_text (GncPluginPage *page, const gchar *message)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
if (priv->statusbar_text) if (priv->statusbar_text)
g_free(priv->statusbar_text); g_free (priv->statusbar_text);
priv->statusbar_text = g_strdup(message);
priv->statusbar_text = g_strdup (message);
} }
@ -1024,7 +1028,7 @@ gnc_plugin_page_get_use_new_window (GncPluginPage *page)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), FALSE); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
return priv->use_new_window; return priv->use_new_window;
@ -1040,7 +1044,7 @@ gnc_plugin_page_set_use_new_window (GncPluginPage *page, gboolean use_new)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_if_fail (GNC_IS_PLUGIN_PAGE (page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
priv->use_new_window = use_new; priv->use_new_window = use_new;
@ -1053,7 +1057,7 @@ gnc_plugin_page_get_ui_description (GncPluginPage *page)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), FALSE); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), FALSE);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
return priv->ui_description; return priv->ui_description;
@ -1068,12 +1072,13 @@ gnc_plugin_page_set_ui_description (GncPluginPage *page,
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_if_fail(GNC_IS_PLUGIN_PAGE(page)); g_return_if_fail (GNC_IS_PLUGIN_PAGE(page));
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
if (priv->ui_description) if (priv->ui_description)
g_free(priv->ui_description); g_free (priv->ui_description);
priv->ui_description = g_strdup(ui_filename);
priv->ui_description = g_strdup (ui_filename);
} }
@ -1083,7 +1088,7 @@ gnc_plugin_page_get_ui_merge (GncPluginPage *page)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), NULL); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
return priv->ui_merge; return priv->ui_merge;
@ -1096,7 +1101,8 @@ gnc_plugin_page_get_action_group(GncPluginPage *page)
{ {
GncPluginPagePrivate *priv; GncPluginPagePrivate *priv;
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), NULL); g_return_val_if_fail (GNC_IS_PLUGIN_PAGE(page), NULL);
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
return priv->action_group; return priv->action_group;
} }
@ -1110,8 +1116,8 @@ gnc_plugin_page_create_action_group (GncPluginPage *page, const gchar *group_nam
GtkActionGroup *group; GtkActionGroup *group;
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
group = gtk_action_group_new(group_name); group = gtk_action_group_new (group_name);
gtk_action_group_set_translation_domain(group, PROJECT_NAME); gtk_action_group_set_translation_domain (group, PROJECT_NAME);
priv->action_group = group; priv->action_group = group;
return group; return group;
} }
@ -1121,11 +1127,13 @@ gnc_plugin_page_finish_pending (GncPluginPage *page)
{ {
if (!page) if (!page)
return TRUE; return TRUE;
if (!GNC_IS_PLUGIN_PAGE(page)) if (!GNC_IS_PLUGIN_PAGE(page))
return TRUE; return TRUE;
if (!GNC_PLUGIN_PAGE_GET_CLASS(page)->finish_pending) if (!GNC_PLUGIN_PAGE_GET_CLASS(page)->finish_pending)
return TRUE; return TRUE;
return (GNC_PLUGIN_PAGE_GET_CLASS(page)->finish_pending)(page); return (GNC_PLUGIN_PAGE_GET_CLASS(page)->finish_pending)(page);
} }

View File

@ -1,6 +1,6 @@
/* /*
* gnc-plugin-page.h -- A page, which can be added to the * gnc-plugin-page.h -- A page, which can be added to the
* GnuCash main window. * GnuCash main window.
* *
* Copyright (C) 2003 Jan Arne Petersen <jpetersen@uni-bonn.de> * Copyright (C) 2003 Jan Arne Petersen <jpetersen@uni-bonn.de>
* Copyright (C) 2003,2005 David Hampton <hampton@employees.org> * Copyright (C) 2003,2005 David Hampton <hampton@employees.org>
@ -57,22 +57,22 @@ G_BEGIN_DECLS
/** The instance data structure for a content plugin. */ /** The instance data structure for a content plugin. */
typedef struct GncPluginPage typedef struct GncPluginPage
{ {
GObject gobject; /**< The parent object data. */ GObject gobject; /**< The parent object data. */
GtkWidget *window; /**< The window that contains the GtkWidget *window; /**< The window that contains the
* display widget for this plugin. * display widget for this plugin.
* This field is private to the * This field is private to the
* gnucash window management * gnucash window management
* code. */ * code. */
GtkWidget *notebook_page; /**< The display widget for this GtkWidget *notebook_page; /**< The display widget for this
* plugin. This field is private to * plugin. This field is private to
* the gnucash window management * the gnucash window management
* code. */ * code. */
GtkWidget *summarybar; /**< The summary bar widget (if any) GtkWidget *summarybar; /**< The summary bar widget (if any)
* that is associated with this * that is associated with this
* plugin. This field is private to * plugin. This field is private to
* the gnucash window management * the gnucash window management
* code. */ * code. */
} GncPluginPage; } GncPluginPage;
@ -105,6 +105,7 @@ typedef struct
* *
* @return A displayable gtk widget. */ * @return A displayable gtk widget. */
GtkWidget *(* create_widget) (GncPluginPage *plugin_page); GtkWidget *(* create_widget) (GncPluginPage *plugin_page);
/** Function called to destroy the display widget for a /** Function called to destroy the display widget for a
* particular type of plugin. * particular type of plugin.
* *
@ -167,7 +168,7 @@ typedef struct
* widget. * widget.
* *
* @param page The page that was added to a window. * @param page The page that was added to a window.
* *
* @return FALSE to remove idle */ * @return FALSE to remove idle */
gboolean (* focus_page_function) (GncPluginPage *plugin_page); gboolean (* focus_page_function) (GncPluginPage *plugin_page);
@ -219,7 +220,8 @@ GType gnc_plugin_page_get_type (void);
* @param plugin_page A pointer to the plugin for which a display * @param plugin_page A pointer to the plugin for which a display
* widget should be created. * widget should be created.
* *
* @return A displayable gtk widget. */ * @return A displayable gtk widget.
*/
GtkWidget *gnc_plugin_page_create_widget (GncPluginPage *plugin_page); GtkWidget *gnc_plugin_page_create_widget (GncPluginPage *plugin_page);
@ -228,7 +230,8 @@ GtkWidget *gnc_plugin_page_create_widget (GncPluginPage *plugin_page);
* code when a page is closed. * code when a page is closed.
* *
* @param plugin_page A pointer to the plugin whose display widget * @param plugin_page A pointer to the plugin whose display widget
* should be destroyed. */ * should be destroyed.
*/
void gnc_plugin_page_destroy_widget (GncPluginPage *plugin_page); void gnc_plugin_page_destroy_widget (GncPluginPage *plugin_page);
@ -251,7 +254,8 @@ void gnc_plugin_page_show_summarybar (GncPluginPage *page, gboolean visible);
* @param key_file A pointer to the GKeyFile data structure where the * @param key_file A pointer to the GKeyFile data structure where the
* page information should be written. * page information should be written.
* *
* @param group_name The group name to use when saving data. */ * @param group_name The group name to use when saving data.
*/
void gnc_plugin_page_save_page (GncPluginPage *page, void gnc_plugin_page_save_page (GncPluginPage *page,
GKeyFile *key_file, GKeyFile *key_file,
const gchar *group_name); const gchar *group_name);
@ -268,11 +272,12 @@ void gnc_plugin_page_save_page (GncPluginPage *page,
* @param key_file A pointer to the GKeyFile data structure where the * @param key_file A pointer to the GKeyFile data structure where the
* page information should be read. * page information should be read.
* *
* @param group_name The group name to use when restoring data. */ * @param group_name The group name to use when restoring data.
*/
GncPluginPage *gnc_plugin_page_recreate_page (GtkWidget *window, GncPluginPage *gnc_plugin_page_recreate_page (GtkWidget *window,
const gchar *page_type, const gchar *page_type,
GKeyFile *key_file, GKeyFile *key_file,
const gchar *group_name); const gchar *group_name);
/** Add the actions for a content page to the specified window. /** Add the actions for a content page to the specified window.
@ -281,7 +286,8 @@ GncPluginPage *gnc_plugin_page_recreate_page (GtkWidget *window,
* added to the user interface. * added to the user interface.
* *
* @param merge A pointer to the UI manager data structure for a * @param merge A pointer to the UI manager data structure for a
* window. */ * window.
*/
void gnc_plugin_page_merge_actions (GncPluginPage *plugin_page, void gnc_plugin_page_merge_actions (GncPluginPage *plugin_page,
GtkUIManager *merge); GtkUIManager *merge);
@ -292,7 +298,8 @@ void gnc_plugin_page_merge_actions (GncPluginPage *plugin_page,
* removed from the user interface. * removed from the user interface.
* *
* @param merge A pointer to the UI manager data structure for a * @param merge A pointer to the UI manager data structure for a
* window. */ * window.
*/
void gnc_plugin_page_unmerge_actions (GncPluginPage *plugin_page, void gnc_plugin_page_unmerge_actions (GncPluginPage *plugin_page,
GtkUIManager *merge); GtkUIManager *merge);
@ -303,7 +310,8 @@ void gnc_plugin_page_unmerge_actions (GncPluginPage *plugin_page,
* should be retrieved. * should be retrieved.
* *
* @return The name of this plugin. This string is owned by the * @return The name of this plugin. This string is owned by the
* plugin. */ * plugin.
*/
const gchar *gnc_plugin_page_get_plugin_name (GncPluginPage *plugin_page); const gchar *gnc_plugin_page_get_plugin_name (GncPluginPage *plugin_page);
@ -530,7 +538,8 @@ GtkUIManager *gnc_plugin_page_get_ui_merge (GncPluginPage *page);
* @param page The page whose menu/toolbar action group should be * @param page The page whose menu/toolbar action group should be
* retrieved. * retrieved.
* *
* @return A pointer to the GtkActionGroup object for this page. */ * @return A pointer to the GtkActionGroup object for this page.
*/
GtkActionGroup *gnc_plugin_page_get_action_group (GncPluginPage *page); GtkActionGroup *gnc_plugin_page_get_action_group (GncPluginPage *page);
@ -544,9 +553,10 @@ GtkActionGroup *gnc_plugin_page_get_action_group (GncPluginPage *page);
* be consistent across all pages of the same type. * be consistent across all pages of the same type.
* *
* @return A pointer to the newly created GtkActionGroup object for * @return A pointer to the newly created GtkActionGroup object for
* this page. */ * this page.
*/
GtkActionGroup * gnc_plugin_page_create_action_group (GncPluginPage *page, GtkActionGroup * gnc_plugin_page_create_action_group (GncPluginPage *page,
const gchar *group_name); const gchar *group_name);
/** Retrieve a GtkAction object associated with this page. /** Retrieve a GtkAction object associated with this page.
* *
@ -555,7 +565,8 @@ GtkActionGroup * gnc_plugin_page_create_action_group (GncPluginPage *page,
* *
* @param name The name of the GtkAction to find. * @param name The name of the GtkAction to find.
* *
* @return A pointer to the retuested GtkAction object or NULL. */ * @return A pointer to the retuested GtkAction object or NULL.
*/
GtkAction *gnc_plugin_page_get_action (GncPluginPage *page, const gchar *name); GtkAction *gnc_plugin_page_get_action (GncPluginPage *page, const gchar *name);
/* Signals */ /* Signals */
@ -569,7 +580,8 @@ void gnc_plugin_page_unselected (GncPluginPage *plugin_page);
* @param plugin_page A page. * @param plugin_page A page.
* *
* @return FALSE if the page could not or would not comply, which * @return FALSE if the page could not or would not comply, which
* should cancel the pending operation. TRUE otherwise */ * should cancel the pending operation. TRUE otherwise
*/
gboolean gnc_plugin_page_finish_pending (GncPluginPage *plugin_page); gboolean gnc_plugin_page_finish_pending (GncPluginPage *plugin_page);
G_END_DECLS G_END_DECLS