Clarify what "short" labels are used for by adding comments and

changing array names.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@11926 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2005-11-14 02:42:55 +00:00
parent 04eb0593b5
commit f240baaee3
8 changed files with 57 additions and 28 deletions

View File

@ -1,3 +1,14 @@
2005-11-13 David Hampton <hampton@employees.org>
* src/report/report-gnome/gnc-plugin-page-report.c:
* src/business/business-gnome/gnc-plugin-page-invoice.c:
* src/gnome-utils/gnc-plugin.c:
* src/gnome-utils/gnc-plugin.h:
* src/gnome/gnc-plugin-page-register.c:
* src/gnome/gnc-plugin-page-account-tree.c:
* src/gnome/gnc-plugin-page-budget.c: Clarify what "short" labels
are used for by adding comments and changing array names.
2005-11-13 Derek Atkins <derek@ihtfp.com>
* src/core-utils/gnc-gkeyfile-utils.c: cast the

View File

@ -183,8 +183,8 @@ static const gchar *can_unpost_actions[] = {
NULL
};
/* Short labels: Used on toolbar buttons. */
static action_short_labels short_labels[] = {
/** Short labels for use on the toolbar buttons. */
static action_toolbar_labels toolbar_labels[] = {
{ "RecordEntryAction", N_("Enter") },
{ "CancelEntryAction", N_("Cancel") },
{ "DeleteEntryAction", N_("Delete") },
@ -327,7 +327,7 @@ gnc_plugin_page_invoice_init (GncPluginPageInvoice *plugin_page)
G_CALLBACK(gnc_plugin_page_invoice_cmd_sort_changed),
plugin_page);
gnc_plugin_init_short_names (action_group, short_labels);
gnc_plugin_init_short_names (action_group, toolbar_labels);
}
static void

View File

@ -281,10 +281,12 @@ gnc_plugin_get_name (GncPlugin *plugin)
/** Add "short" labels to existing actions. The "short" label is the
* string used on toolbar buttons when the action is visible.*/
* string used on toolbar buttons when the action is visible.
*
* See gnc-plugin.h for documentation on the function arguments. */
void
gnc_plugin_init_short_names (GtkActionGroup *action_group,
action_short_labels *short_labels)
action_toolbar_labels *toolbar_labels)
{
GtkAction *action;
GValue value = { 0, };
@ -292,11 +294,11 @@ gnc_plugin_init_short_names (GtkActionGroup *action_group,
g_value_init (&value, G_TYPE_STRING);
for (i = 0; short_labels[i].action_name; i++) {
for (i = 0; toolbar_labels[i].action_name; i++) {
/* Add a couple of short labels for the toolbar */
action = gtk_action_group_get_action (action_group,
short_labels[i].action_name);
g_value_set_static_string (&value, gettext(short_labels[i].label));
toolbar_labels[i].action_name);
g_value_set_static_string (&value, gettext(toolbar_labels[i].label));
g_object_set_property (G_OBJECT(action), "short_label", &value);
}
}

View File

@ -164,23 +164,37 @@ GncPluginPage *gnc_plugin_create_page (GncPlugin *plugin,
const gchar *gnc_plugin_get_name (GncPlugin *plugin);
/** A structure for defining alternate action names for use in the
* toolbar. All toolbar buttons are homogeneous in size and are sized
* to fit the longest label. Therefore, this structure should be
* used if an action name is more than one word. This way the menu
* can have the label "Whizzy Feature", while the toolbar button only
* has the label "Whizzy". */
typedef struct {
/** The name of the action. */
const char *action_name;
/** The alternate toolbar label to use */
const char *label;
} action_short_labels;
} action_toolbar_labels;
/** Add "short" labels to existing actions. The "short" label is the
* string used on toolbar buttons when the action is visible.
* string used on toolbar buttons when the action is visible. All
* toolbar buttons are homogeneous in size and are sized to fit the
* longest label. Therefore, this structure should be used if an
* action name is more than one word. This way the menu can have the
* label "Whizzy Feature", while the toolbar button only has the
* label "Whizzy".
*
* @param action_group The group of all actions associated with a
* plugin or plugin page. All actions to me modified must be in this
* group.
*
* @param short_labels A pointer to a data structure containing
* [action name, label string] string pairs.
* @param toolbar_labels A pointer to a NULL terminated array of data
* action_toolbar_labels items.
*/
void gnc_plugin_init_short_names (GtkActionGroup *action_group,
action_short_labels *short_labels);
action_toolbar_labels *toolbar_labels);
/** Mark certain actions as "important". This means that their labels

View File

@ -214,8 +214,9 @@ static const gchar *actions_requiring_account[] = {
NULL
};
/* DRH - Suggest short_labels be added to libegg */
static action_short_labels short_labels[] = {
/** Short labels for use on the toolbar buttons. */
static action_toolbar_labels toolbar_labels[] = {
{ "FileOpenAccountAction", N_("Open") },
{ "EditEditAccountAction", N_("Edit") },
{ "EditAccountViewOptionsAction", N_("Options") },
@ -328,7 +329,7 @@ gnc_plugin_page_account_tree_init (GncPluginPageAccountTree *plugin_page)
gnc_plugin_page_account_tree_actions,
gnc_plugin_page_account_tree_n_actions,
plugin_page);
gnc_plugin_init_short_names (action_group, short_labels);
gnc_plugin_init_short_names (action_group, toolbar_labels);
/* get the options and the window ID */

View File

@ -130,18 +130,17 @@ static guint gnc_plugin_page_budget_n_actions =
G_N_ELEMENTS (gnc_plugin_page_budget_actions);
// TODO: What's all this do?
/*
#if 0
static const gchar *actions_requiring_budget[] = {
"OpenBudgetAction",
"BudgetViewOptionsAction",
"DeleteBudgetAction",
NULL
};
*/
/* DRH - Suggest this be added to libegg */
/*
static action_short_labels short_labels[] = {
/** Short labels for use on the toolbar buttons. */
static action_toolbar_labels toolbar_labels[] = {
{ "OpenBudgetAction", N_("Open") },
//{ "EditBudgetAction", N_("Edit") },
@ -150,7 +149,7 @@ static action_short_labels short_labels[] = {
{ "DeleteBudgetAction", N_("Delete") },
{ NULL, NULL },
};
*/
#endif
typedef struct GncPluginPageBudgetPrivate
{
@ -272,7 +271,7 @@ gnc_plugin_page_budget_init (GncPluginPageBudget *plugin_page)
gnc_plugin_page_budget_n_actions,
plugin_page);
// FIXME? needed?
//gnc_gnome_utils_init_short_names (action_group, short_labels);
//gnc_gnome_utils_init_short_names (action_group, toolbar_labels);
// FIXME: need to test this url case
if(!url) {

View File

@ -277,8 +277,9 @@ static const gchar *actions_requiring_account[] = {
NULL
};
/* DRH - Suggest short_labels be added to libegg */
static action_short_labels short_labels[] = {
/** Short labels for use on the toolbar buttons. */
static action_toolbar_labels toolbar_labels[] = {
{ "ActionsTransferAction", N_("Transfer") },
{ "RecordTransactionAction", N_("Enter") },
{ "CancelTransactionAction", N_("Cancel") },
@ -502,7 +503,7 @@ gnc_plugin_page_register_init (GncPluginPageRegister *plugin_page)
G_CALLBACK(gnc_plugin_page_register_cmd_style_changed),
plugin_page);
gnc_plugin_init_short_names (action_group, short_labels);
gnc_plugin_init_short_names (action_group, toolbar_labels);
gnc_plugin_set_important_actions (action_group, important_actions);
priv->lines_opt_section = DEFAULT_LINES_OPTION_SECTION;

View File

@ -837,7 +837,8 @@ static GtkActionEntry report_actions[] =
};
static guint num_report_actions = G_N_ELEMENTS( report_actions );
static action_short_labels short_labels[] = {
/** Short labels for use on the toolbar buttons. */
static action_toolbar_labels toolbar_labels[] = {
{ "FilePrintAction", N_("Print") },
{ "ReportExportAction", N_("Export") },
{ "ReportOptionsAction", N_("Options") },
@ -916,7 +917,7 @@ gnc_plugin_page_report_constr_init(GncPluginPageReport *plugin_page, gint report
report_actions,
num_report_actions,
plugin_page );
gnc_plugin_init_short_names (action_group, short_labels);
gnc_plugin_init_short_names (action_group, toolbar_labels);
}
GncPluginPage*