[Gnucash-changes] r11926 - gnucash/trunk - Clarify what "short" labels are used for by adding comments and

David Hampton hampton at cvs.gnucash.org
Sun Nov 13 21:42:56 EST 2005


Author: hampton
Date: 2005-11-13 21:42:55 -0500 (Sun, 13 Nov 2005)
New Revision: 11926
Trac: http://svn.gnucash.org/trac/changeset/11926

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c
   gnucash/trunk/src/gnome-utils/gnc-plugin.c
   gnucash/trunk/src/gnome-utils/gnc-plugin.h
   gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
   gnucash/trunk/src/gnome/gnc-plugin-page-budget.c
   gnucash/trunk/src/gnome/gnc-plugin-page-register.c
   gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
Log:
Clarify what "short" labels are used for by adding comments and
changing array names.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2005-11-14 01:49:52 UTC (rev 11925)
+++ gnucash/trunk/ChangeLog	2005-11-14 02:42:55 UTC (rev 11926)
@@ -1,3 +1,14 @@
+2005-11-13  David Hampton  <hampton at 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 at ihtfp.com>
 
 	* src/core-utils/gnc-gkeyfile-utils.c: cast the

Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c	2005-11-14 01:49:52 UTC (rev 11925)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c	2005-11-14 02:42:55 UTC (rev 11926)
@@ -183,8 +183,8 @@
 	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 @@
 					    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

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c	2005-11-14 01:49:52 UTC (rev 11925)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c	2005-11-14 02:42:55 UTC (rev 11926)
@@ -214,8 +214,9 @@
 	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_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 */ 

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-budget.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-budget.c	2005-11-14 01:49:52 UTC (rev 11925)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-budget.c	2005-11-14 02:42:55 UTC (rev 11926)
@@ -130,19 +130,18 @@
     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") },
   //{ "EditBudgetOptionsAction",      N_("Options") },
@@ -150,7 +149,7 @@
   { "DeleteBudgetAction", 	    N_("Delete") },
   { NULL, NULL },
 };
-*/
+#endif
 
 typedef struct GncPluginPageBudgetPrivate
 {
@@ -272,7 +271,7 @@
                                   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) {

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2005-11-14 01:49:52 UTC (rev 11925)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2005-11-14 02:42:55 UTC (rev 11926)
@@ -277,8 +277,9 @@
 	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 @@
 					    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;

Modified: gnucash/trunk/src/gnome-utils/gnc-plugin.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-plugin.c	2005-11-14 01:49:52 UTC (rev 11925)
+++ gnucash/trunk/src/gnome-utils/gnc-plugin.c	2005-11-14 02:42:55 UTC (rev 11926)
@@ -281,10 +281,12 @@
 
 
 /** 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 @@
 
   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);
   }
 }

Modified: gnucash/trunk/src/gnome-utils/gnc-plugin.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-plugin.h	2005-11-14 01:49:52 UTC (rev 11925)
+++ gnucash/trunk/src/gnome-utils/gnc-plugin.h	2005-11-14 02:42:55 UTC (rev 11926)
@@ -164,23 +164,37 @@
 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

Modified: gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c	2005-11-14 01:49:52 UTC (rev 11925)
+++ gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c	2005-11-14 02:42:55 UTC (rev 11926)
@@ -837,7 +837,8 @@
 };
 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 @@
                                       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*



More information about the gnucash-changes mailing list