[Gnucash-changes] 2004-05-15 Joshua Sled <jsled@asynchronous.org> *

Joshua Sled jsled at cvs.gnucash.org
Sat May 15 18:24:36 EDT 2004


Log Message:
-----------
2004-05-15  Joshua Sled  <jsled at asynchronous.org>

	* src/report/report-gnome/gnc-plugin-page-report.c
	(gnc_plugin_page_report_class_init): Add 'report_id'
	object-property for page-c'tor.
	(gnc_plugin_page_report_setup): Setup the page's report at creation time so
	we can get the correct tab labels.

	* src/gnome-utils/gnc-mdi-utils.c (gnc_mdi_show_progress): Weaken
	assertion while code isn't fully changed over, yet.
	(gnc_ui_get_toplevel): Comment out b0rken MDI-related code.

Tags:
----
gnucash-gnome2-dev

Modified Files:
--------------
    gnucash:
        ChangeLog
        GNOME2_STATUS
    gnucash/src/gnome-utils:
        gnc-mdi-utils.c
    gnucash/src/report/report-gnome:
        gnc-plugin-page-report.c
    gnucash/src/report/report-system:
        gnc-report.c
        gnc-report.h
        report.scm

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1487.2.125
retrieving revision 1.1487.2.126
diff -LChangeLog -LChangeLog -u -r1.1487.2.125 -r1.1487.2.126
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,25 @@
+2004-05-15  Joshua Sled  <jsled at asynchronous.org>
+
+	* src/report/report-gnome/gnc-plugin-page-report.c
+	(gnc_plugin_page_report_class_init): Add 'report_id'
+	object-property for page-c'tor.
+	(gnc_plugin_page_report_setup): Setup the page's report at creation time so
+	we can get the correct tab labels.
+
+	* src/gnome-utils/gnc-mdi-utils.c (gnc_mdi_show_progress): Weaken
+	assertion while code isn't fully changed over, yet.
+	(gnc_ui_get_toplevel): Comment out b0rken MDI-related code.
+
+2004-05-05  Joshua Sled  <jsled at asynchronous.org>
+
+	* src/report/report-gnome/window-report.h: Comment interface with
+	recon about usage in the source tree.
+
+	* src/report/report-gnome/gnc-plugin-page-report.c: Copy
+	window-report.c implementation over to here, rename, and get
+	somewhat working again. At this point, report-menu invocations
+	result in a tab being created, and displaying the error message.
+
 2004-05-05  David Hampton  <hampton at employees.org>
 
 	Fixes from Christian Neumair <chris at gnome-de.org>.
Index: GNOME2_STATUS
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/Attic/GNOME2_STATUS,v
retrieving revision 1.1.2.19
retrieving revision 1.1.2.20
diff -LGNOME2_STATUS -LGNOME2_STATUS -u -r1.1.2.19 -r1.1.2.20
--- GNOME2_STATUS
+++ GNOME2_STATUS
@@ -35,6 +35,11 @@
 Export Accounts
 Stock Split Dialog
 
+        +-----
+        | Can someone who comes across this note and wants to help please go
+        | through 1.8.9 and create a list of stuff missing from 2.0?
+        +------------
+
 ========================================
           MISSING MENU ITEMS
 ========================================
@@ -42,7 +47,8 @@
 Main Window
   File
     Print <- remove ?
-  Reports (all)
+  Reports
+    Business reports
 
 Register Window
   Edit
@@ -55,7 +61,8 @@
     Reverse Transaction
   Actions
     Check and Repair (all)
-  Reports (all)
+  Reports
+    Business
   Business <- remove ?
 
 Register Toolbar
@@ -67,6 +74,10 @@
             General Notes
 ========================================
 
+Main Window
+        - New registers should open in new top-level windows.
+
+
 Register Core - MINIMALLY FUNCTIONAL
 
 	- Can navigate, enter transactions, etc.
@@ -92,9 +103,26 @@
           menu-merging so that it can call
           gnc_extensions_menu_setup( GtkWindow, char*, EggMenuMerge )
 
+Reporting - Somewhat functional
+
+        - Graphing still unsupported; [jsled] in periodic contact with Jody
+          Goldberg of Gnumeric regarding Gnome Office Graphing [GOG] to be
+          factored out of gnumeric into libgoffice.
+
+        - Menu / toolbar merging needs to be added; see
+          src/report/report-gnome/gnc-plugin-page-report.c:gnc_plugin_page_report_{,un}merge_actions(...)
+
+        - Business reports menu
+          a/ one-level deeper than it should be
+          b/ empty
+          - Probably both are simply changing the paths in
+            src/business/.../bus-reports.scm [whatever].
+
+        - Save/restore in unknown state; believed to crash on re-start.
+
 IMPORTING
 
-  HBCI - Needs new http support.
+  HBCI - Needs new http support. [gnet]
 
 ========================================
               ENHANCEMENTS
@@ -105,9 +133,14 @@
 	a) Add account
 	b) Register
 	c) Report
+           * Report options, especially.
 
 2)	Support a preference on whether new plugin pages appear in the
 	same or a new window.
+        * We definitely want register windows to appear in new top-levels.
+        * Reporting windows should probably appear in the top-level they were
+          created from.
+
 
 3)      Provide in-place editing where feasable.  E.G. Editing the
 	account code or the account name, but not being able to
Index: gnc-mdi-utils.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gnc-mdi-utils.c,v
retrieving revision 1.18.4.9
retrieving revision 1.18.4.10
diff -Lsrc/gnome-utils/gnc-mdi-utils.c -Lsrc/gnome-utils/gnc-mdi-utils.c -u -r1.18.4.9 -r1.18.4.10
--- src/gnome-utils/gnc-mdi-utils.c
+++ src/gnome-utils/gnc-mdi-utils.c
@@ -65,6 +65,7 @@
 gncUIWidget
 gnc_ui_get_toplevel (void)
 {
+#if 0
   GList *containers = gtk_window_list_toplevels ();
   GList *containerstop = containers;
 
@@ -93,6 +94,8 @@
   if (app)
     return GTK_WIDGET (app);
 
+#endif // 0
+
   return NULL;
 }
 
@@ -135,7 +138,7 @@
 void
 gnc_mdi_show_progress (const char *message, double percentage)
 {
-  g_assert_not_reached();
+  PERR( "FIXME: show progress." );
 }
 
 typedef struct {
Index: gnc-plugin-page-report.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/report-gnome/Attic/gnc-plugin-page-report.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -Lsrc/report/report-gnome/gnc-plugin-page-report.c -Lsrc/report/report-gnome/gnc-plugin-page-report.c -u -r1.1.2.2 -r1.1.2.3
--- src/report/report-gnome/gnc-plugin-page-report.c
+++ src/report/report-gnome/gnc-plugin-page-report.c
@@ -1,5 +1,4 @@
 /* gnc-plugin-page-report.c
- *
  * Copyright (C) 2004 Joshua Sled <jsled at asynchronous.org>
  *
  * Originally from window-report.c:
@@ -39,6 +38,7 @@
 #include "messages.h"
 #include "gnc-html.h"
 #include "gnc-html-history.h"
+#include "gnc-report.h"
 #include "gnc-ui.h"
 #include "gnc-ui-util.h"
 #include "gnc-engine-util.h"
@@ -51,11 +51,18 @@
 static GObjectClass *parent_class = NULL;
 static GList *active_pages = NULL;
 
+// Property-id values.
+enum {
+    PROP_0,
+    PROP_REPORT_ID,
+  };
+
 static void gnc_plugin_page_report_class_init( GncPluginPageReportClass *klass );
 static void gnc_plugin_page_report_init( GncPluginPageReport *plugin_page );
 static void gnc_plugin_page_report_finalize (GObject *object);
+static void gnc_plugin_page_report_setup( GncPluginPage *ppage );
 
-static void gnc_plugin_page_report_set_report_id( GncPluginPageReport *page, int reportId );
+//static void gnc_plugin_page_report_set_report_id( GncPluginPageReport *page, int reportId );
 
 static GtkWidget* gnc_plugin_page_report_create_widget( GncPluginPage *plugin_page );
 static void gnc_plugin_page_report_destroy_widget( GncPluginPage *plugin_page );
@@ -137,6 +144,56 @@
 }
 
 static void
+gnc_plugin_page_report_get_property( GObject *obj,
+                                     guint prop_id,
+                                     GValue *value,
+                                     GParamSpec *pspec )
+{
+        GncPluginPageReport *rep;
+        GncPluginPageReportPrivate * priv;
+
+        rep = GNC_PLUGIN_PAGE_REPORT( obj );
+        priv = (GncPluginPageReportPrivate*)rep->priv;
+        
+        switch ( prop_id )
+        {
+        case PROP_REPORT_ID:
+                g_value_set_int( value, priv->reportId );
+                break;
+        default:
+                PERR( "Unknown property id %d", prop_id );
+                break;
+        }
+}
+
+static void
+gnc_plugin_page_report_set_property( GObject *obj,
+                                     guint prop_id,
+                                     const GValue *value,
+                                     GParamSpec *pspec )
+{
+        GncPluginPageReport *rep;
+        GncPluginPageReportPrivate *priv;
+
+        rep = GNC_PLUGIN_PAGE_REPORT( obj );
+        priv = (GncPluginPageReportPrivate*)rep->priv;
+
+        DEBUG( "setting property with id %d / %p to value %d",
+               prop_id, rep->priv, g_value_get_int( value ) );
+
+        switch ( prop_id )
+        {
+        case PROP_REPORT_ID:
+                priv->reportId = g_value_get_int( value );
+                break;
+        default:
+                PERR( "unknown property id %d", prop_id );
+                break;
+        }
+               
+}
+
+static void
 gnc_plugin_page_report_class_init (GncPluginPageReportClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -146,6 +203,9 @@
 
 	object_class->finalize = gnc_plugin_page_report_finalize;
 
+        object_class->set_property = gnc_plugin_page_report_set_property;
+        object_class->get_property = gnc_plugin_page_report_get_property;
+
         // FIXME: stock reporting icon?
 	//gnc_plugin_page_class->tab_icon        = GNC_STOCK_ACCOUNT;
 	gnc_plugin_page_class->plugin_name     = GNC_PLUGIN_PAGE_REPORT_NAME;
@@ -155,6 +215,14 @@
 	gnc_plugin_page_class->merge_actions   = gnc_plugin_page_report_merge_actions;
 	gnc_plugin_page_class->unmerge_actions = gnc_plugin_page_report_unmerge_actions;
 
+        // create the "reportId" property
+        g_object_class_install_property( object_class,
+                                         PROP_REPORT_ID,
+                                         g_param_spec_int( "report_id",
+                                                           _("The numeric ID of the report."),
+                                                           _("The numeric ID of the report."),
+                                                           -1, G_MAXINT, -1, G_PARAM_READWRITE ) );
+
 /* JSLED: report-selected?
 	plugin_page_signals[ACCOUNT_SELECTED] =
 	  g_signal_new ("account_selected",
@@ -190,29 +258,20 @@
 GtkWidget*
 gnc_plugin_page_report_create_widget( GncPluginPage *page )
 {
+        GncPluginPageReport *gppReport;
         GncPluginPageReportPrivate *report;
-        URLType            type;
+        GtkWindow *topLvl;
+        URLType type;
         char * id_name;
         char * child_name;
-        char               * url_location = NULL;
-        char               * url_label = NULL;
-
-        g_assert( GNC_PLUGIN_PAGE_REPORT( page ) );
-        g_assert( page->priv != NULL );
-
-        report = (GncPluginPageReportPrivate*)page->priv;
+        char * url_location = NULL;
+        char * url_label = NULL;
 
-        DEBUG( "creating widget for %p / %d", page, report->reportId  );
-        
-        report->html              = gnc_html_new( GTK_WINDOW(gnc_ui_get_toplevel()) );
-        report->cur_report        = SCM_BOOL_F;
-        report->initial_report    = SCM_BOOL_F;
-        report->edited_reports    = SCM_EOL;
-        report->name_change_cb_id = SCM_BOOL_F;
+        gppReport = GNC_PLUGIN_PAGE_REPORT(page);
 
-        scm_protect_object(report->cur_report);
-        scm_protect_object(report->initial_report);
-        scm_protect_object(report->edited_reports);
+        report = (GncPluginPageReportPrivate*)gppReport->priv;
+        topLvl = GTK_WINDOW(gnc_ui_get_toplevel());
+        report->html              = gnc_html_new( topLvl );
 
         gnc_html_history_set_node_destroy_cb(gnc_html_get_history(report->html),
                                              gnc_plugin_page_report_history_destroy_cb,
@@ -261,6 +320,43 @@
   }
 }
 
+/**
+ * Simply get the initial report given the id, so we can do initialization
+ * things like setup the tab name based on the report's name.
+ **/
+static void
+gnc_plugin_page_report_setup( GncPluginPage *ppage )
+{
+        GncPluginPageReport *page = GNC_PLUGIN_PAGE_REPORT(ppage);
+        GncPluginPageReportPrivate *report = (GncPluginPageReportPrivate*)page->priv;
+        SCM  find_report = scm_c_eval_string("gnc:find-report");
+        SCM  inst_report;
+        int  report_id;
+
+        report->cur_report        = SCM_BOOL_F;
+        report->initial_report    = SCM_BOOL_F;
+        report->edited_reports    = SCM_EOL;
+        report->name_change_cb_id = SCM_BOOL_F;
+
+        scm_protect_object(report->cur_report);
+        scm_protect_object(report->initial_report);
+        scm_protect_object(report->edited_reports);
+
+        g_object_get( ppage, "report_id", &report_id, NULL );
+        
+        /* get the inst-report from the Scheme-side hash, and get its
+         * options and editor thunk */
+        if ((inst_report = scm_call_1(find_report, scm_int2num(report_id)))
+            == SCM_BOOL_F) {
+                return;
+        }
+        
+        if (report->initial_report == SCM_BOOL_F) {
+                scm_unprotect_object(report->initial_report);
+                report->initial_report = inst_report;
+                scm_protect_object(report->initial_report);
+        }
+}
 
 /********************************************************************
  * gnc_plugin_page_report_load_cb
@@ -271,7 +367,8 @@
                                const gchar * location, const gchar * label, 
                                gpointer data)
 {
-        GncPluginPageReportPrivate *win = data;
+        //GncPluginPageReport *report = GNC_PLUGIN_PAGE_REPORT();
+        GncPluginPageReportPrivate *win = (GncPluginPageReportPrivate*)data;
         int  report_id;
         SCM  find_report    = scm_c_eval_string("gnc:find-report");
         SCM  get_options    = scm_c_eval_string("gnc:report-options");
@@ -280,7 +377,7 @@
 
         ENTER( "load_cb: type=[%s], location=[%s], label=[%s]",
                type, location, label );
-        
+
         /* we get this callback if a new report is requested to be loaded OR
          * if any URL is clicked.  If an options URL is clicked, we want to
          * know about it */
@@ -300,7 +397,6 @@
                 if (inst_report != SCM_BOOL_F) {
                         gnc_plugin_page_report_add_edited_report(win, inst_report);
                 }
-                LEAVE( "a" );
                 return;
         } else {
                 LEAVE( " unknown URL type [%s] location [%s]", type, location );
@@ -326,7 +422,6 @@
                 win->name_change_cb_id = 
                         gnc_option_db_register_change_callback(win->initial_odb,
                                                                gnc_plugin_page_report_refresh,
-                                                               //win->mc,
                                                                win,
                                                                "General", "Report name");
         }
@@ -531,6 +626,7 @@
         // FIXME: ui-unmerge
 }
 
+#if 0
 static void
 gnc_plugin_page_report_set_report_id( GncPluginPageReport *page, int reportId )
 {
@@ -540,6 +636,7 @@
         DEBUG( "setting reportid = %d / %d",
                reportId, priv->reportId );
 }
+#endif /* 0 */
 
 static void
 gnc_plugin_page_report_init ( GncPluginPageReport *plugin_page )
@@ -548,15 +645,27 @@
 	//EggActionGroup *action_group;
 	GncPluginPageReportPrivate *priv;
 	GncPluginPage *parent;
+        GString *tmpStr;
+        gint reportId;
 
-	priv = plugin_page->priv = g_new0 (GncPluginPageReportPrivate, 1);
+	priv = plugin_page->priv = g_new0( GncPluginPageReportPrivate, 1 );
+
+        reportId = -42;
+        g_object_get( plugin_page, "report_id", &reportId, NULL );
+        DEBUG( "property reportId=%d", reportId );
+
+        gnc_plugin_page_report_setup( GNC_PLUGIN_PAGE(plugin_page) );
 
 	/* Init parent declared variables */
 	parent = GNC_PLUGIN_PAGE(plugin_page);
+        // FIXME: + _(Report:) + priv->ext->name;
+        tmpStr = g_string_sized_new( 32 );
+        g_string_sprintf( tmpStr, "%s: %s", _("Report"),
+                          gnc_report_name( priv->initial_report ) );
+	parent->title       = g_strdup(tmpStr->str);
         // FIXME: + _(Report:) + priv->ext->name; 
-	parent->title       = g_strdup(_("Report"));
-        // FIXME: + _(Report:) + priv->ext->name; 
-	parent->tab_name    = g_strdup(_("Report"));
+	//parent->tab_name    = g_strdup(_("Report"));
+        parent->tab_name = g_strdup( tmpStr->str );
         // FIXME: URI? gnc_report://classs/type ?
 	parent->uri         = g_strdup("default:");
 
@@ -585,8 +694,11 @@
 {
 	GncPluginPageReport *plugin_page;
 
-	plugin_page = g_object_new( GNC_TYPE_PLUGIN_PAGE_REPORT, NULL );
-        gnc_plugin_page_report_set_report_id( plugin_page, reportId );
+	plugin_page = g_object_new( GNC_TYPE_PLUGIN_PAGE_REPORT,
+                                    "report_id", reportId, NULL );
+        DEBUG( "plugin_page: %p", plugin_page );
+        //gnc_plugin_page_report_set_report_id( plugin_page, reportId );
+        //gnc_plugin_page_report_setup( plugin_page );
         DEBUG( "set %d on page %p", reportId, plugin_page );
 	return GNC_PLUGIN_PAGE( plugin_page );
 }
Index: gnc-report.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/report-system/gnc-report.c,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -Lsrc/report/report-system/gnc-report.c -Lsrc/report/report-system/gnc-report.c -u -r1.2.4.1 -r1.2.4.2
--- src/report/report-system/gnc-report.c
+++ src/report/report-system/gnc-report.c
@@ -71,3 +71,19 @@
 
   return gnc_run_report (report_id, data);
 }
+
+gchar*
+gnc_report_name( SCM report )
+{
+  SCM    get_name = scm_c_eval_string("gnc:report-name");
+  char   * name = NULL; 
+  
+  if (report != SCM_BOOL_F)
+  {
+    name = gh_scm2newstr(scm_call_1(get_name, report),
+                         NULL);
+  }
+
+  return name;
+}
+
Index: gnc-report.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/report-system/gnc-report.h,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -Lsrc/report/report-system/gnc-report.h -Lsrc/report/report-system/gnc-report.h -u -r1.1 -r1.1.6.1
--- src/report/report-system/gnc-report.h
+++ src/report/report-system/gnc-report.h
@@ -27,4 +27,11 @@
 gboolean gnc_run_report (int report_id, char ** data);
 gboolean gnc_run_report_id_string (const char * id_string, char **data);
 
+/**
+ * @param report The SCM version of the report.
+ * @return a caller-owned copy of the name of the report, or NULL if report
+ * is invalid.
+ **/
+gchar* gnc_report_name( SCM report );
+
 #endif
Index: report.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/report-system/report.scm,v
retrieving revision 1.12
retrieving revision 1.12.4.1
diff -Lsrc/report/report-system/report.scm -Lsrc/report/report-system/report.scm -u -r1.12 -r1.12.4.1
--- src/report/report-system/report.scm
+++ src/report/report-system/report.scm
@@ -325,7 +325,7 @@
      (gnc:report-children r))
     (hash-remove! *gnc:_reports_* id)))
 
-(define (gnc:find-report id) 
+(define (gnc:find-report id)
   (hash-ref *gnc:_reports_* id))
 
 (define (gnc:find-report-template report-type) 


More information about the gnucash-changes mailing list