[Gnucash-changes] r13014 - gnucash/trunk - Remove gnc-split-reg "create" and "capabilities" flags and dead code.

Joshua Sled jsled at cvs.gnucash.org
Sat Jan 28 18:31:31 EST 2006


Author: jsled
Date: 2006-01-28 18:31:30 -0500 (Sat, 28 Jan 2006)
New Revision: 13014
Trac: http://svn.gnucash.org/trac/changeset/13014

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/gnome/dialog-scheduledxaction.c
   gnucash/trunk/src/gnome/dialog-sxsincelast.c
   gnucash/trunk/src/gnome/gnc-plugin-page-register.c
   gnucash/trunk/src/gnome/gnc-plugin-page-register.h
   gnucash/trunk/src/gnome/gnc-split-reg.c
   gnucash/trunk/src/gnome/gnc-split-reg.h
Log:
Remove gnc-split-reg "create" and "capabilities" flags and dead code.
2006-01-28  Joshua Sled  <jsled at asynchronous.org>

	* src/gnome/gnc-split-reg.c: Remove a lot of dead code.
	(gnc_split_reg_new): Remove create-flags and
	disallowed-cap[abilitie]s; add simple "read-only" flag.

	* src/gnome/gnc-plugin-page-register.c
	(gnc_plugin_page_register_actions): remove stock-missing icon for
	"edit exchange rate" action.
	(GncPluginPageRegisterPrivate, gnc_plugin_page_register_init) 
	(gnc_plugin_page_register_create_widget): Replace "disallow
	cap[abilitie]s" with specific read-only flag.

	* src/gnome/dialog-scheduledxaction.c (schedXact_editor_create_ledger): 
	* src/gnome/dialog-sxsincelast.c (create_to_create_ledger) 
	(create_autoCreate_ledger, create_created_ledger): Set read-only
	flag on register.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-01-28 23:22:28 UTC (rev 13013)
+++ gnucash/trunk/ChangeLog	2006-01-28 23:31:30 UTC (rev 13014)
@@ -1,3 +1,21 @@
+2006-01-28  Joshua Sled  <jsled at asynchronous.org>
+
+	* src/gnome/gnc-split-reg.c: Remove a lot of dead code.
+	(gnc_split_reg_new): Remove create-flags and
+	disallowed-cap[abilitie]s; add simple "read-only" flag.
+
+	* src/gnome/gnc-plugin-page-register.c
+	(gnc_plugin_page_register_actions): remove stock-missing icon for
+	"edit exchange rate" action.
+	(GncPluginPageRegisterPrivate, gnc_plugin_page_register_init) 
+	(gnc_plugin_page_register_create_widget): Replace "disallow
+	cap[abilitie]s" with specific read-only flag.
+
+	* src/gnome/dialog-scheduledxaction.c (schedXact_editor_create_ledger): 
+	* src/gnome/dialog-sxsincelast.c (create_to_create_ledger) 
+	(create_autoCreate_ledger, create_created_ledger): Set read-only
+	flag on register.
+
 2006-01-28  David Hampton  <hampton at employees.org>
 
 	* src/gnome-utils/print-session.h: Add an include so gnucash

Modified: gnucash/trunk/src/gnome/dialog-scheduledxaction.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-scheduledxaction.c	2006-01-28 23:22:28 UTC (rev 13013)
+++ gnucash/trunk/src/gnome/dialog-scheduledxaction.c	2006-01-28 23:31:30 UTC (rev 13014)
@@ -1576,8 +1576,7 @@
 					    "gnc-sxed-window-ui-full.xml");
 	gnc_plugin_page_register_set_options (sxed->plugin_page,
 					      NULL, NULL,
-					      NUM_LEDGER_LINES_DEFAULT,
-					      (CAP_JUMP | CAP_SCHEDULE) );
+					      NUM_LEDGER_LINES_DEFAULT, FALSE );
 	gnc_embedded_window_open_page (sxed->embed_window, sxed->plugin_page);
 
         /* configure... */

Modified: gnucash/trunk/src/gnome/dialog-sxsincelast.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-sxsincelast.c	2006-01-28 23:22:28 UTC (rev 13013)
+++ gnucash/trunk/src/gnome/dialog-sxsincelast.c	2006-01-28 23:31:30 UTC (rev 13014)
@@ -3570,8 +3570,7 @@
 	gnc_plugin_page_set_ui_description (sxsld->ac_register,
 					    "gnc-plugin-page-sxregister-ui.xml");
 	gnc_plugin_page_register_set_options (sxsld->ac_register,
-					      NULL, NULL, 4,
-					      CAP_SCHEDULE);
+					      NULL, NULL, 4, FALSE);
 	gnc_embedded_window_open_page (sxsld->ac_window, sxsld->ac_register);
 
 	/* Now configure the register */
@@ -3613,8 +3612,7 @@
 	gnc_plugin_page_set_ui_description (sxsld->created_register,
 					    "gnc-plugin-page-sxregister-ui.xml");
 	gnc_plugin_page_register_set_options (sxsld->created_register,
-					      NULL, NULL, 4,
-					      CAP_SCHEDULE);
+					      NULL, NULL, 4, FALSE);
 	gnc_embedded_window_open_page (sxsld->created_window, sxsld->created_register);
 
 	/* Now configure the register */
@@ -3722,9 +3720,8 @@
 	sxsld->to_create_register = gnc_plugin_page_register_new_ledger(sxsld->to_create_ledger);
 	gnc_plugin_page_set_ui_description (sxsld->to_create_register,
 					    "gnc-sxed-to-create-window-ui.xml");
-	gnc_plugin_page_register_set_options (sxsld->to_create_register,
-					      NULL, NULL, 4,
-					      CAP_READ_ONLY);
+	gnc_plugin_page_register_set_options(sxsld->to_create_register,
+                                             NULL, NULL, 4, TRUE);
 	gnc_embedded_window_open_page (sxsld->to_create_window, sxsld->to_create_register);
 
 	/* Now configure the register */

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2006-01-28 23:22:28 UTC (rev 13013)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2006-01-28 23:31:30 UTC (rev 13014)
@@ -229,7 +229,7 @@
 	{ "BlankTransactionAction", GTK_STOCK_GOTO_BOTTOM, N_("_Blank Transaction"), NULL,
 	  N_("Move to the blank transaction at the bottom of the register"),
 	  G_CALLBACK (gnc_plugin_page_register_cmd_blank_transaction) },
-	{ "EditExchangeRateAction", GTK_STOCK_MISSING_IMAGE, N_("Edit E_xchange Rate"), NULL,
+	{ "EditExchangeRateAction", NULL, N_("Edit E_xchange Rate"), NULL,
 	  N_("Exit the exchange rate for the current transaction"),
 	  G_CALLBACK (gnc_plugin_page_register_cmd_exchange_rate) },
 	{ "JumpTransactionAction", GTK_STOCK_JUMP_TO, N_("_Jump"), NULL,
@@ -347,7 +347,7 @@
 	const char *lines_opt_section;
 	const char *lines_opt_name;
 	gint lines_default;
-	gint disallowCaps;
+        gboolean read_only;
 
 	struct {
 	  GtkWidget *dialog;
@@ -539,7 +539,7 @@
 	priv->lines_opt_section = DEFAULT_LINES_OPTION_SECTION;
 	priv->lines_opt_name    = DEFAULT_LINES_OPTION_NAME;
 	priv->lines_default     = DEFAULT_LINES_AMOUNT;
-	priv->disallowCaps      = 0;
+        priv->read_only         = FALSE;
 	priv->fd.cleared_match  = CLEARED_ALL;
 }
 
@@ -653,7 +653,7 @@
 	gnc_window = GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window);
 	gsr = gnc_split_reg_new(priv->ledger,
 				gnc_window_get_gtk_window(gnc_window),
-				numRows, 0, priv->disallowCaps);
+				numRows, priv->read_only);
 	priv->gsr = (GNCSplitReg *)gsr;
 	gtk_widget_show (gsr);
 	gtk_box_pack_start (GTK_BOX (priv->widget), gsr, TRUE, TRUE, 0);
@@ -2570,7 +2570,7 @@
 				      const char *lines_opt_section,
 				      const char *lines_opt_name,
 				      gint lines_default,
-				      gint disallowCaps)
+                                      gboolean read_only)
 {
 	GncPluginPageRegister *page;
 	GncPluginPageRegisterPrivate *priv;
@@ -2582,7 +2582,7 @@
 	priv->lines_opt_section = lines_opt_section;
 	priv->lines_opt_name 	= lines_opt_name;
 	priv->lines_default  	= lines_default;
-	priv->disallowCaps   	= disallowCaps;
+        priv->read_only         = read_only;
 }
 
 GNCSplitReg *

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.h
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.h	2006-01-28 23:22:28 UTC (rev 13013)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.h	2006-01-28 23:31:30 UTC (rev 13014)
@@ -118,15 +118,14 @@
  *  @param lines_default The number of lines to use if the specified
  *  options cannot be found or has never been set.
  *
- *  @param disallowCaps Capabilities to disable on this register.
- *  These include "read only", "jump", "schedule", et. al.
+ *  @param read_only True if the register should be read-only.
  */
 void
 gnc_plugin_page_register_set_options (GncPluginPage *plugin_page,
 				      const char *lines_opt_page,
 				      const char *lines_opt_name,
 				      gint lines_default,
-				      gint disallowCaps);
+                                      gboolean read_only);
 
 
 /** Get the GNCSplitReg data structure associated with this register page.

Modified: gnucash/trunk/src/gnome/gnc-split-reg.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-split-reg.c	2006-01-28 23:22:28 UTC (rev 13013)
+++ gnucash/trunk/src/gnome/gnc-split-reg.c	2006-01-28 23:31:30 UTC (rev 13014)
@@ -58,29 +58,8 @@
 #include <libguile.h>
 #include "dialog-utils.h"
 
-static QofLogModule log_module = GNC_MOD_SX;
+// static QofLogModule log_module = GNC_MOD_SX;
 
-/**
- * TODO list:
- *
- * X alpha-necessary
- *   X fill out gnc-split-reg.h interface
- *   X calendar/date-picker
- * . beta-necessary
- *   X date-inclusion on jumping
- *   . pass in, use number-of-lines
- *   . title-renaming in read-only case.
- *   X size-allocation
- *   X default schedule/recur handling for from-SX items.
- *   X handle destruction/cleanup more cleanly
- *   X conditional creation
- *   X handle widget-visibility callbacks
- *   X fix regWindow{Simple,Ledger,Account}
- *   X fix jumping-to-split
- *   X fix window-raising
- **/
-
-
 /***** PROTOTYPES ***************************************************/
 void gnc_split_reg_raise( GNCSplitReg *gsr );
 
@@ -92,15 +71,10 @@
 static GNCPlaceholderType gnc_split_reg_get_placeholder( GNCSplitReg *gsr );
 static gncUIWidget gnc_split_reg_get_parent( GNCLedgerDisplay *ledger );
 
-static void gsr_create_menus( GNCSplitReg *gsr );
-static void gsr_setup_menu_widgets( GNCSplitReg *gsr, GladeXML *xml );
-static void gsr_create_toolbar( GNCSplitReg *gsr );
 static void gsr_create_table( GNCSplitReg *gsr );
 static void gsr_setup_table( GNCSplitReg *gsr );
 static void gsr_setup_status_widgets( GNCSplitReg *gsr );
-static GtkWidget* gsr_create_popup_menu( GNCSplitReg *gsr );
 
-
 static void gsr_update_summary_label( GtkWidget *label,
                                       xaccGetBalanceFn getter,
                                       Account *leader,
@@ -339,16 +313,14 @@
 gnc_split_reg_new( GNCLedgerDisplay *ld,
                    GtkWindow *parent,
                    gint numberOfLines,
-                   gint createFlags,
-                   gint disallowCaps )
+                   gboolean read_only )
 {
   GNCSplitReg *gsrToRet;
 
   gsrToRet = g_object_new( gnc_split_reg_get_type(), NULL );
 
-  gsrToRet->disallowedCaps = disallowCaps;
   gsrToRet->numRows        = numberOfLines;
-  gsrToRet->createFlags    = createFlags;
+  gsrToRet->read_only      = read_only;
 
   gsrToRet->ledger = ld;
   gsrToRet->window = GTK_WIDGET(parent);
@@ -364,24 +336,10 @@
   gsr->sort_type = BY_STANDARD;
   gsr->width = -1;
   gsr->height = -1;
-  gsr->disallowedCaps = 0;
   gsr->numRows = gnc_gconf_get_float(GCONF_GENERAL_REGISTER,
 				     KEY_NUMBER_OF_ROWS, NULL);
   gsr->read_only = FALSE;
 
-  /* IMPORTANT: If we set this to anything other than GTK_RESIZE_QUEUE, we
-   * enter into a very bad back-and-forth between the sheet and a containing
-   * GnomeDruid [in certain conditions and circumstances not detailed here],
-   * resulting in either a single iteration of the Druid resizing or infinite
-   * iterations of the Druid resizing without bound.  Contact
-   * jsled at asynchronous.org for details. -- 2002.04.15
-   */
-  /* This function call causes several problems in gnome2 port.  I do
-   * not see any problems with the code when it is removed.
-   * hampton at employees.org -- 2003-10-06
-   */
-  //gtk_container_set_resize_mode( GTK_CONTAINER(gsr), GTK_RESIZE_QUEUE );
-
   g_signal_connect( gsr, "destroy",
                     G_CALLBACK (gnc_split_reg_destroy_cb), gsr );
 }
@@ -393,23 +351,10 @@
 
   gnc_split_reg_determine_read_only( gsr );
 
-  if ( gsr->createFlags & CREATE_MENUS ) {
-    gsr_create_menus( gsr );
-  }
-
-  if ( gsr->createFlags & CREATE_TOOLBAR ) {
-    gsr_create_toolbar( gsr );
-  }
-
-  if ( gsr->createFlags & CREATE_SUMMARYBAR ) {
-    gsr_create_summary_bar( gsr );
-  }
-
   gsr_setup_status_widgets( gsr );
   /* ordering is important here... setup_status before create_table */
   gsr_create_table( gsr );
   gsr_setup_table( gsr );
-
 }
 
 static
@@ -418,13 +363,6 @@
 {
   SplitRegister *sr;
 
-  if ( gsr->createFlags & CREATE_POPUP ) {
-    if ( !gsr->popup_menu ) {
-      gsr->popup_menu = gsr_create_popup_menu (gsr);
-    }
-    gnucash_register_attach_popup( gsr->reg, gsr->popup_menu, gsr );
-  }
-
   sr = gnc_ledger_display_get_split_register( gsr->ledger );
   gnc_split_register_show_present_divider( sr, TRUE );
   /* events should be sufficient to redraw this */
@@ -432,93 +370,8 @@
   gnc_split_reg_refresh_toolbar( gsr );
 }
 
-
 static
 void
-gsr_create_menus( GNCSplitReg *gsr )
-{
-  GladeXML *xml;
-  GtkWidget *mbar, *mi;
-  xml = gnc_glade_xml_new( "register.glade", "register_menubar" );
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     gsr );
-
-  mbar = glade_xml_get_widget( xml, "register_menubar" );
-  gtk_widget_hide( mbar );
-
-  gsr->edit_menu = glade_xml_get_widget( xml, "menu_edit_menu" );
-  g_object_ref( gsr->edit_menu );
-  mi = glade_xml_get_widget( xml, "menu_edit" );
-  gtk_menu_item_remove_submenu( GTK_MENU_ITEM( mi ) );
-
-  gsr->view_menu = glade_xml_get_widget( xml, "menu_view_menu" );
-  g_object_ref( gsr->view_menu );
-  mi = glade_xml_get_widget( xml, "menu_view" );
-  gtk_menu_item_remove_submenu( GTK_MENU_ITEM(mi) );
-
-  gsr->style_submenu = glade_xml_get_widget( xml, "menu_style_menu" );
-  gsr->sort_submenu = glade_xml_get_widget( xml, "menu_sort_order_menu" );
-
-  gsr->action_menu = glade_xml_get_widget( xml, "menu_actions_menu" );
-  g_object_ref( gsr->action_menu );
-  mi = glade_xml_get_widget( xml, "menu_actions" );
-  gtk_menu_item_remove_submenu( GTK_MENU_ITEM(mi) );
-
-  gsr->double_line_check =
-    glade_xml_get_widget (xml, "menu_style_double_line");
-  gsr->split_menu_check =
-    glade_xml_get_widget (xml, "menu_splits");
-
-  gsr_setup_menu_widgets( gsr, xml );
-
-  /* we've ref'd the objects we need to. */
-  gtk_widget_destroy( mbar );
-}
-
-static
-void
-gsr_create_toolbar( GNCSplitReg *gsr )
-{
-#if 0
-  GladeXML *xml;
-  GtkWidget *widget;
-  SCM id;
-
-  xml = gnc_glade_xml_new( "register.glade", "toolbar" );
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     gsr );
-
-  gsr->toolbar = glade_xml_get_widget( xml, "toolbar" );
-  gsr->split_button = glade_xml_get_widget( xml, "toolbar_split" );
-
-  if ( gsr->disallowedCaps & CAP_DELETE ) {
-    widget = glade_xml_get_widget( xml, "toolbar_delete" );
-    gtk_widget_set_sensitive( widget, FALSE );
-  }
-
-  if ( gsr->disallowedCaps & CAP_JUMP ) {
-    widget = glade_xml_get_widget( xml, "toolbar_jump" );
-    gtk_widget_set_sensitive( widget, FALSE );
-  }
-
-  if ( gsr->disallowedCaps & CAP_SCHEDULE ) {
-    widget = glade_xml_get_widget( xml, "toolbar_schedule" );
-    gtk_widget_set_sensitive( widget, FALSE );
-  }
-
-  if (gsr->read_only) {
-    widget = glade_xml_get_widget (xml, "toolbar_delete");
-    gtk_widget_set_sensitive(widget, FALSE);
-    widget = glade_xml_get_widget (xml, "toolbar_duplicate");
-    gtk_widget_set_sensitive(widget, FALSE);
-  }
-#endif
-}
-
-static
-void
 gsr_create_table( GNCSplitReg *gsr )
 {
   GtkWidget *register_widget;
@@ -553,27 +406,12 @@
 {
   SplitRegister *sr;
   gboolean use_double_line;
-  GtkCheckMenuItem *check;
 
   sr = gnc_ledger_display_get_split_register( gsr->ledger );
   use_double_line = gnc_ledger_display_default_double_line( gsr->ledger );
 
   /* be sure to initialize the gui elements associated with the cursor */
   gnc_split_register_config( sr, sr->type, sr->style, use_double_line );
-
-  if ( ! (gsr->createFlags & CREATE_MENUS) ) {
-    return;
-  }
-
-  check = GTK_CHECK_MENU_ITEM( gsr->double_line_check );
-
-  g_signal_handlers_block_by_func( check,
-                                   gnc_split_reg_double_line_cb, gsr );
-
-  gtk_check_menu_item_set_active(check, use_double_line);
-
-  g_signal_handlers_unblock_by_func( check,
-                                     gnc_split_reg_double_line_cb, gsr );
 }
 
 void
@@ -1998,136 +1836,6 @@
   return gsr->summarybar;
 }
 
-static
-void
-gsr_setup_menu_widgets(GNCSplitReg *gsr, GladeXML *xml)
-{
-  /* Make sure the right style radio item is active */
-  SplitRegister *reg;
-  GtkWidget *widget;
-  char *widget_name;
-
-  if ( gsr->disallowedCaps & CAP_DELETE ) {
-    widget = glade_xml_get_widget( xml, "menu_delete" );
-    gtk_widget_set_sensitive( widget, FALSE );
-  }
-
-  if ( gsr->disallowedCaps & CAP_JUMP ) {
-    widget = glade_xml_get_widget( xml, "menu_jump" );
-    gtk_widget_set_sensitive( widget, FALSE );
-  }
-
-  if ( gsr->disallowedCaps & CAP_SCHEDULE ) {
-    widget = glade_xml_get_widget( xml, "menu_schedule" );
-    gtk_widget_set_sensitive( widget, FALSE );
-  }
-    
-
-  if (gsr->read_only) {
-    widget = glade_xml_get_widget (xml, "menu_paste");
-    gtk_widget_set_sensitive(widget, FALSE);
-    widget = glade_xml_get_widget (xml, "menu_cut_trans");
-    gtk_widget_set_sensitive(widget, FALSE);
-    widget = glade_xml_get_widget (xml, "menu_paste_trans");
-    gtk_widget_set_sensitive(widget, FALSE);
-    widget = glade_xml_get_widget (xml, "menu_delete");
-    gtk_widget_set_sensitive(widget, FALSE);
-    widget = glade_xml_get_widget (xml, "menu_duplicate");
-    gtk_widget_set_sensitive(widget, FALSE);
-    widget = glade_xml_get_widget (xml, "menu_reinitialize");
-    gtk_widget_set_sensitive(widget, FALSE);
-    widget = glade_xml_get_widget (xml, "menu_exchange");
-    gtk_widget_set_sensitive(widget, FALSE);
-  }
-
-  reg = gnc_ledger_display_get_split_register( gsr->ledger );
-
-  switch (reg->style)
-    {
-    default:
-    case REG_STYLE_LEDGER:
-      widget_name = "menu_style_basic_ledger";
-      break;
-    case REG_STYLE_AUTO_LEDGER:
-      widget_name = "menu_style_auto_split_ledger";
-      break;
-    case REG_STYLE_JOURNAL:
-      widget_name = "menu_style_transaction_journal";
-      break;
-    }
-
-  /* registers with more than one account can only use journal mode */
-  if (reg->type >= NUM_SINGLE_REGISTER_TYPES)
-    {
-      widget = glade_xml_get_widget(xml, "menu_style_basic_ledger");
-      gtk_widget_set_sensitive (widget, FALSE);
-
-      widget = glade_xml_get_widget(xml, "menu_style_auto_split_ledger");
-      gtk_widget_set_sensitive (widget, FALSE);
-    }
-
-  widget = glade_xml_get_widget(xml, widget_name);
-  g_signal_handlers_block_matched(widget, G_SIGNAL_MATCH_DATA,
-				  0, 0, NULL, NULL, gsr);
-  gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), TRUE);
-  g_signal_handlers_unblock_matched(widget, G_SIGNAL_MATCH_DATA,
-				    0, 0, NULL, NULL, gsr);
-}
-
-static
-GtkWidget *
-gsr_create_popup_menu( GNCSplitReg *gsr )
-{
-  GtkWidget *popup, *menuitem;
-  GladeXML *xml;
-
-  xml = gnc_glade_xml_new( "register.glade", "register_popup" );
-  popup = glade_xml_get_widget( xml, "register_popup" );
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     gsr );
-
-  /* Glade insists on making this a tearoff menu. */
-  if (gnc_gconf_menus_have_tearoff()) {
-    GtkMenuShell *ms = GTK_MENU_SHELL(popup);
-    GtkWidget *tearoff;
-
-    tearoff = g_list_nth_data(ms->children, 0);
-    ms->children = g_list_remove(ms->children, tearoff);
-    gtk_widget_destroy(tearoff);
-  }
-
-  gsr->split_popup_check = glade_xml_get_widget( xml, "popup_splits" );
-
-  if ( gsr->disallowedCaps & CAP_DELETE ) {
-    menuitem = glade_xml_get_widget( xml, "sr_popup_delete" );
-    gtk_widget_set_sensitive( menuitem, FALSE );
-  }
-
-  if ( gsr->disallowedCaps & CAP_JUMP ) {
-    menuitem = glade_xml_get_widget( xml, "sr_popup_jump" );
-    gtk_widget_set_sensitive( menuitem, FALSE );
-  }
-
-  if ( gsr->disallowedCaps & CAP_SCHEDULE ) {
-    menuitem = glade_xml_get_widget( xml, "sr_popup_schedule" );
-    gtk_widget_set_sensitive( menuitem, FALSE );
-  }
-
-  if (gsr->read_only) {
-    menuitem = glade_xml_get_widget( xml, "sr_popup_delete" );
-    gtk_widget_set_sensitive( menuitem, FALSE );
-    menuitem = glade_xml_get_widget( xml, "sr_popup_duplicate" );
-    gtk_widget_set_sensitive( menuitem, FALSE );
-    menuitem = glade_xml_get_widget( xml, "sr_popup_reinitialize" );
-    gtk_widget_set_sensitive( menuitem, FALSE );
-    menuitem = glade_xml_get_widget( xml, "sr_popup_exchange" );
-    gtk_widget_set_sensitive( menuitem, FALSE );
-  }
-
-  return popup;
-}
-
 /**
  * Opens up a register window for a group of Accounts.
  * @param gsr the register window instance
@@ -2216,16 +1924,8 @@
   dialog_args *args = g_malloc(sizeof(dialog_args));
   SplitRegister *reg;
 
-  gsr->read_only = FALSE;
+  if ( !gsr->read_only ) {
 
-  if ( gsr->disallowedCaps & CAP_READ_ONLY ) {
-
-    /* FIXME: this is not ideal, as whatever window-title solution we come up
-     * with should be used in this case as well. */
-    gsr->read_only = TRUE;
-
-  } else {
-
     switch (gnc_split_reg_get_placeholder(gsr)) {
     case PLACEHOLDER_NONE:
       /* stay as false. */
@@ -2316,101 +2016,12 @@
 }
 
 GtkWidget*
-gnc_split_reg_get_edit_menu( GNCSplitReg *gsr )
-{
-  if ( !gsr ) return NULL;
-  return gsr->edit_menu;
-}
-
-GtkWidget*
-gnc_split_reg_get_view_menu( GNCSplitReg *gsr )
-{
-  if ( !gsr ) return NULL;
-  return gsr->view_menu;
-}
-
-GtkWidget*
-gnc_split_reg_get_style_menu( GNCSplitReg *gsr )
-{
-  if ( !gsr ) return NULL;
-  return gsr->style_submenu;
-}
-
-GtkWidget*
-gnc_split_reg_get_sort_menu( GNCSplitReg *gsr )
-{
-  if ( !gsr ) return NULL;
-  return gsr->sort_submenu;
-}
-
-GtkWidget*
-gnc_split_reg_get_action_menu( GNCSplitReg *gsr )
-{
-  if ( !gsr ) return NULL;
-  return gsr->action_menu;
-}
-
-GtkWidget*
-gnc_split_reg_get_toolbar( GNCSplitReg *gsr )
-{
-  if ( !gsr ) return NULL;
-  return gsr->toolbar;
-}
-
-GtkWidget*
 gnc_split_reg_get_summarybar( GNCSplitReg *gsr )
 {
   if ( !gsr ) return NULL;
   return gsr->summarybar;
 }
 
-GtkWidget*
-gnc_split_reg_get_popup( GNCSplitReg *gsr )
-{
-  if ( !gsr ) return NULL;
-  return gsr->popup_menu;
-}
-
-void
-gnc_split_reg_set_split_state( GNCSplitReg *gsr, gboolean split )
-{
-  g_assert( gsr );
-  /* FIXME */
-  PERR( "Unimplemented" );
-}
-
-void
-gnc_split_reg_set_double_line( GNCSplitReg *gsr, gboolean doubleLine )
-{
-  g_assert( gsr );
-  /* FIXME */
-  PERR( "unimplemented" );
-}
-
-void
-gnc_split_reg_use_extended_popup( GNCSplitReg *gsr )
-{
-  GtkWidget *popup, *tmpMenu, *tmpMI;
-
-  g_assert( gsr );
-
-  popup = gsr->popup_menu;
-
-  gtk_menu_shell_append( GTK_MENU_SHELL(popup), gtk_menu_item_new() );
-
-  tmpMenu = gnc_split_reg_get_edit_menu( gsr );
-  tmpMI = gtk_menu_item_new_with_label( N_("Edit") );
-  gtk_menu_item_set_submenu( GTK_MENU_ITEM(tmpMI), tmpMenu );
-  gtk_menu_shell_append( GTK_MENU_SHELL(popup), tmpMI );
-
-  tmpMenu = gnc_split_reg_get_view_menu( gsr );
-  tmpMI = gtk_menu_item_new_with_label( N_("View") );
-  gtk_menu_item_set_submenu( GTK_MENU_ITEM(tmpMI), tmpMenu );
-  gtk_menu_shell_append( GTK_MENU_SHELL(popup), tmpMI );
-
-  gtk_widget_show_all( popup );
-}
-
 gboolean
 gnc_split_reg_get_read_only( GNCSplitReg *gsr )
 {

Modified: gnucash/trunk/src/gnome/gnc-split-reg.h
===================================================================
--- gnucash/trunk/src/gnome/gnc-split-reg.h	2006-01-28 23:22:28 UTC (rev 13013)
+++ gnucash/trunk/src/gnome/gnc-split-reg.h	2006-01-28 23:31:30 UTC (rev 13014)
@@ -5,7 +5,7 @@
  * Copyright (C) 1998 Rob Browning <rlb at cs.utexas.edu>              *
  * Copyright (C) 1999-2000 Dave Peticolas <dave at krondo.com>         *
  * Copyright (C) 2001 Gnumatic, Inc.                                *
- * Copyright (C) 2002 Joshua Sled <jsled at asynchronous.org>          *
+ * Copyright (C) 2002,2006 Joshua Sled <jsled at asynchronous.org>     *
  *                                                                  *
  * This program is free software; you can redistribute it and/or    *
  * modify it under the terms of the GNU General Public License as   *
@@ -26,44 +26,6 @@
 \********************************************************************/
 
 
-/**
- * Another take at the gnc-reg-widget.
- * 2002.10.27 -- jsled
- *
- * To be explained:
- * . inserting controls
- *   . menus, toolbar
- *     . gtk_{menu,toolbar}_{append,prepend,insert} is good; callers need to know indexes
- *       . gint gnc_reg_widget_get_toolbar_index( GNCRegWidget, GNC_REG_WIDGET_ITEM )
- *       . gint gnc_reg_widget_get_menu_index   ( GNCRegWidget, GNC_REG_WIDGET_ITEM )
- *       . gint gnc_reg_widget_get_popup_index  ( GNCRegWidget, GNC_REG_WIDGET_ITEM )
- *   
- * . created status-display widgets [checkboxes in menus, &c.]
- *   . i/f to changing?
- *     . gnc_reg_widget_set_split_state( GNCRegWidget, gboolean split )
- *     . gnc_reg_widget_set_double_line( GNCRegWidget, gboolean doubleLine )
- *
- * Questionable Features:
- * . File
- *   . new account
- *   . print
- *   . print check
- *   . save (as)...
- *   . close
- *   . exit
- * . view
- *   . date range
- * . edit
- *   . find
- * . actions
- *   . transfer
- *   . reconcile
- *   . stock split
- *   . check and repair
- * . reports
- * . tools
- **/
-
 #ifndef GNC_SPLIT_REG_H
 #define GNC_SPLIT_REG_H
 
@@ -120,8 +82,6 @@
   GnucashRegister *reg;
 
   gint numRows;
-  gint createFlags;
-  gint disallowedCaps;
 
   guint sort_type;
 
@@ -197,23 +157,6 @@
 FROM_STRING_DEC(SortType, ENUM_LIST_SORTTYPE)
 
 /**
- * Flags for creation-time selection of what subwidgets are to be created.
- **/
-#define CREATE_TOOLBAR    (1 << 0)
-#define CREATE_MENUS      (1 << 1)
-#define CREATE_POPUP      (1 << 2)
-#define CREATE_SUMMARYBAR (1 << 3)
-
-/**
- * Flags for various capabilities of the GNCSplitReg; these are used to
- * disable specific functionality.
- **/
-#define CAP_READ_ONLY (1 << 0)  /**< A read-only register. **/
-#define CAP_DELETE    (1 << 1)  /**< Deleting items. **/
-#define CAP_JUMP      (1 << 2)  /**< Jumping to the related transaction. **/
-#define CAP_SCHEDULE  (1 << 3)  /**< Scheduling transactions. **/
-
-/**
  * GTK-related; gets an identifier for the class of GNCSplitRegs.
  **/
 guint gnc_split_reg_get_type(void);
@@ -223,15 +166,12 @@
  * @param ld            The GNCLedgerDisplay to use for display.
  * @param parent        The containing window.
  * @param numberOfLines The initial number of lines for the register.
- * @param createFlags   A set of flags for the sub-widgets to create.
- * @param disallowCaps  A set of flags for capabilities which should be
- *                      disallowed.
+ * @param read_only      If the contained register should be setup read-only.
  **/
 GtkWidget* gnc_split_reg_new( GNCLedgerDisplay *ld,
                               GtkWindow *parent,
                               gint numberOfLines,
-                              gint createFlags,
-                              gint disallowCaps );
+                              gboolean read_only );
 
 /**
  * Returns the GnucashRegister in effect for this GNCSplitReg.
@@ -255,21 +195,9 @@
 void gnc_split_reg_change_style (GNCSplitReg *gsr, SplitRegisterStyle style);
 
 /**
- * Retreives the various menus created by the GNCSplitReg.  Callers may want
- * to put these in a more traditional menu bar, for instance.
- **/
-GtkWidget *gnc_split_reg_get_edit_menu       ( GNCSplitReg *gsr );
-GtkWidget *gnc_split_reg_get_view_menu       ( GNCSplitReg *gsr );
-GtkWidget *gnc_split_reg_get_style_menu      ( GNCSplitReg *gsr );
-GtkWidget *gnc_split_reg_get_sort_menu       ( GNCSplitReg *gsr );
-GtkWidget *gnc_split_reg_get_action_menu     ( GNCSplitReg *gsr );
-
-/**
  * Can return NULL if the indicated subwidget was not created.
  **/
-GtkWidget *gnc_split_reg_get_toolbar   ( GNCSplitReg *gsr );
 GtkWidget *gnc_split_reg_get_summarybar( GNCSplitReg *gsr );
-GtkWidget *gnc_split_reg_get_popup     ( GNCSplitReg *gsr );
 
 /**
  * These will manipulate the in-GNCSplitReg state-reflecting widgets as
@@ -279,17 +207,6 @@
 void gnc_split_reg_set_double_line( GNCSplitReg *gsr, gboolean doubleLine );
 
 /**
- * Convenience function for callers.  Sets up the popup menu to contain the
- * GNCSplitReg-provided menuswhat would normally be the menu-bar.  Callers
- * may not have a menu bar themselves, but wish to provide full
- * functionality via the popup menu.
- *
- * The menu-bar items will be at the bottom of the popup menu, seperated.
- * The menu-bar items will not be created if they were not originally created.
- **/
-void gnc_split_reg_use_extended_popup( GNCSplitReg *gsr );
-
-/**
  * Check if its OK to close this register window.  Gives the register
  * a chance to abort the close if there are roblems, e.g. an open
  * transaction.



More information about the gnucash-changes mailing list