[Gnucash-changes] 2004-05-02 Joshua Sled <jsled@asynchronous.org> *
Joshua Sled
jsled at cvs.gnucash.org
Sun May 2 17:52:50 EDT 2004
Log Message:
-----------
2004-05-02 Joshua Sled <jsled at asynchronous.org>
* src/report/report-gnome/gnc-plugin-page-report.[ch]: Plugin-Page
for a report instance; yet to be finished.
* src/report/report-gnome/report-gnome.scm
(gnc:add-report-template-menu-items): Update menu path
constructors to have the correct gnome2-ui-merging menu path
value.
* src/gnome-utils/gnc-menu-extensions.[ch]: Partially-completed
changes for using the menu/UI merging code for setting up
extensions menu.
* src/gnome-utils/gnc-html.[ch]: Revert gtkhtml2 changes; restoring
gtkhtml1 version of the gnc-html.c code allows compatability
with gtkhtml3.
* src/gnome/ui/gnc-main-window-ui.xml: Add testing MiscAction,
MiscTestAction.
* src/gnome/gnc-main-window.c (gnc_main_window_cmd_test): Add test
menu item for GtkHtml3-window display.
* src/gnome/gnc-main-window.c (gnc_main_window_setup_window): Add
testing code to merge/display menu item, call the
extensions_menu setup routine.
* configure.in (DB_LIBS): move from gtkhtml2 to gtkhtml3.
* lib/egg/egg-menu-merge.c (egg_menu_merge_add_ui):
Merge egg_menu_merge_add_ui from gtk-2.4.0 GtkUIManager.
Tags:
----
gnucash-gnome2-dev
Modified Files:
--------------
gnucash:
ChangeLog
GNOME2_STATUS
configure.in
gnucash/src/business/business-gnome:
dialog-invoice.c
gnucash/src/gnome:
gnc-main-window.c
window-register.c
gnucash/src/gnome/ui:
gnc-main-window-ui.xml
gnucash/src/gnome-utils:
gnc-html.c
gnc-html.h
gnc-menu-extensions.c
gnc-menu-extensions.h
gw-gnome-utils-spec.scm
gnucash/src/report/report-gnome:
Makefile.am
report-gnome.scm
window-report.c
Added Files:
-----------
gnucash/src/report/report-gnome:
gnc-plugin-page-report.c
gnc-plugin-page-report.h
Revision Data
-------------
Index: configure.in
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/configure.in,v
retrieving revision 1.359.2.29
retrieving revision 1.359.2.30
diff -Lconfigure.in -Lconfigure.in -u -r1.359.2.29 -r1.359.2.30
--- configure.in
+++ configure.in
@@ -867,7 +867,7 @@
AC_SUBST(GLADE_CFLAGS)
AC_SUBST(GLADE_LIBS)
- PKG_CHECK_MODULES(GTKHTML, libgtkhtml-2.0)
+ PKG_CHECK_MODULES(GTKHTML, libgtkhtml-3.0)
AS_SCRUB_INCLUDE(GTKHTML_CFLAGS)
AC_SUBST(GTKHTML_CFLAGS)
AC_SUBST(GTKHTML_LIBS)
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1487.2.120
retrieving revision 1.1487.2.121
diff -LChangeLog -LChangeLog -u -r1.1487.2.120 -r1.1487.2.121
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,35 @@
+2004-05-02 Joshua Sled <jsled at asynchronous.org>
+
+ * src/report/report-gnome/gnc-plugin-page-report.[ch]: Plugin-Page
+ for a report instance; yet to be finished.
+
+ * src/report/report-gnome/report-gnome.scm
+ (gnc:add-report-template-menu-items): Update menu path
+ constructors to have the correct gnome2-ui-merging menu path
+ value.
+
+ * src/gnome-utils/gnc-menu-extensions.[ch]: Partially-completed
+ changes for using the menu/UI merging code for setting up
+ extensions menu.
+
+ * src/gnome-utils/gnc-html.[ch]: Revert gtkhtml2 changes; restoring
+ gtkhtml1 version of the gnc-html.c code allows compatability
+ with gtkhtml3.
+
+ * src/gnome/ui/gnc-main-window-ui.xml: Add testing MiscAction,
+ MiscTestAction.
+
+ * src/gnome/gnc-main-window.c (gnc_main_window_cmd_test): Add test
+ menu item for GtkHtml3-window display.
+ * src/gnome/gnc-main-window.c (gnc_main_window_setup_window): Add
+ testing code to merge/display menu item, call the
+ extensions_menu setup routine.
+
+ * configure.in (DB_LIBS): move from gtkhtml2 to gtkhtml3.
+
+ * lib/egg/egg-menu-merge.c (egg_menu_merge_add_ui):
+ Merge egg_menu_merge_add_ui from gtk-2.4.0 GtkUIManager.
+
2004-04-10 Derek Atkins <derek at ihtfp.com>
* src/app-utils/gnc-druid-provider-desc.h: add a comment about
Index: GNOME2_STATUS
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/Attic/GNOME2_STATUS,v
retrieving revision 1.1.2.16
retrieving revision 1.1.2.17
diff -LGNOME2_STATUS -LGNOME2_STATUS -u -r1.1.2.16 -r1.1.2.17
--- GNOME2_STATUS
+++ GNOME2_STATUS
@@ -90,8 +90,11 @@
Business functions - Somewhat Functional
- Everything works but the New Invoice/Bill code. The dialog
- seems to function properly but then gnucash crashes when the
- dialog is closed.
+ seems to function properly but then gnucash crashes when the
+ dialog is closed.
+ - The dialog-invoice.c needs to switch over to using GtkActions /
+ menu-merging so that it can call
+ gnc_extensions_menu_setup( GtkWindow, char*, EggMenuMerge )
IMPORTING
Index: dialog-invoice.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/business/business-gnome/dialog-invoice.c,v
retrieving revision 1.81.4.9
retrieving revision 1.81.4.10
diff -Lsrc/business/business-gnome/dialog-invoice.c -Lsrc/business/business-gnome/dialog-invoice.c -u -r1.81.4.9 -r1.81.4.10
--- src/business/business-gnome/dialog-invoice.c
+++ src/business/business-gnome/dialog-invoice.c
@@ -1913,8 +1913,10 @@
/* libglade should do this next line */
GNOME_APP(iw->dialog)->menubar = glade_xml_get_widget (xml, "menubar1");
- gnc_extensions_menu_setup(GNOME_APP(iw->dialog), WINDOW_NAME_INVOICE);
+ // FIXME:GNOME2 -- going to have to move this dialog over to using the
+ // GtkActions.
+ //gnc_extensions_menu_setup(GNOME_APP(iw->dialog), WINDOW_NAME_INVOICE);
/* Grab the widgets */
iw->id_entry = glade_xml_get_widget (xml, "id_entry");
Index: window-register.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/window-register.c,v
retrieving revision 1.198.4.14
retrieving revision 1.198.4.15
diff -Lsrc/gnome/window-register.c -Lsrc/gnome/window-register.c -u -r1.198.4.14 -r1.198.4.15
--- src/gnome/window-register.c
+++ src/gnome/window-register.c
@@ -939,8 +939,10 @@
/* The menu bar. Menu extension setup needs to come *after* that. */
gnc_register_setup_menu_widgets( regData, xml );
+ /* -JSLED: this file is dead; avoid making calls to dead methods.
gnc_extensions_menu_setup_with_data( GNOME_APP(register_window),
WINDOW_NAME_REGISTER, regData );
+ */
/* The tool bar */
{
Index: gnc-main-window.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/Attic/gnc-main-window.c,v
retrieving revision 1.1.2.30
retrieving revision 1.1.2.31
diff -Lsrc/gnome/gnc-main-window.c -Lsrc/gnome/gnc-main-window.c -u -r1.1.2.30 -r1.1.2.31
--- src/gnome/gnc-main-window.c
+++ src/gnome/gnc-main-window.c
@@ -35,6 +35,8 @@
#include "gnc-main-window.h"
+#include "gnc-menu-extensions.h"
+
#include "dialog-fincalc.h"
#include "dialog-find-transactions.h"
#include "dialog-options.h"
@@ -58,6 +60,8 @@
#include "window-main.h"
#include "messages.h"
+// +JSLED
+#include "gnc-html.h"
enum {
PAGE_ADDED,
@@ -119,6 +123,8 @@
static void gnc_main_window_cmd_help_contents (EggAction *action, GncMainWindow *window);
static void gnc_main_window_cmd_help_about (EggAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_test( EggAction *action, GncMainWindow *window );
+
struct GncMainWindowPrivate
{
GtkWidget *menu_dock;
@@ -152,6 +158,7 @@
{ "ActionsAction", N_("_Actions"), NULL, NULL, NULL, NULL },
{ "ToolsAction", N_("_Tools"), NULL, NULL, NULL, NULL },
{ "HelpAction", N_("_Help"), NULL, NULL, NULL, NULL },
+ { "MiscAction", N_("_Misc"), NULL, NULL, NULL, NULL },
/* File menu */
{ "FileNewAction", N_("_New File"), GTK_STOCK_NEW, "<control>n",
@@ -223,7 +230,7 @@
{ "ActionsCloseBooksAction", N_("Close Books"), NULL, "NULL",
N_("Archive old data using accounting periods"),
G_CALLBACK (gnc_main_window_cmd_actions_close_books) },
-
+
/* Tools menu */
{ "ToolsPriceEditorAction", N_("_Price Editor"), NULL, NULL,
N_("View and edit the prices for stocks and mutual funds"),
@@ -251,6 +258,11 @@
{ "HelpAboutAction", N_("_About"), GNOME_STOCK_ABOUT, NULL,
NULL,
G_CALLBACK (gnc_main_window_cmd_help_about) },
+
+ /* Misc menu */
+ { "MiscTestAction", N_("TEST"), NULL, "NULL",
+ N_("Testing stuff"), G_CALLBACK (gnc_main_window_cmd_test) },
+
};
static guint gnc_menu_n_entries = G_N_ELEMENTS (gnc_menu_entries);
@@ -788,6 +800,36 @@
g_assert(merge_id != 0);
}
+ /* Testing */
+ {
+ guint new_merge_id;
+ EggActionGroup *eag;
+ EggActionEntry newEntry[] =
+ {
+ { "BarAction", N_("_GtkHtml3 test"), NULL, "<control>3", NULL, G_CALLBACK (gnc_main_window_cmd_test) }
+ };
+
+ eag = egg_action_group_new ("MainWindowActions2");
+
+ egg_action_group_add_actions (eag, newEntry,
+ G_N_ELEMENTS (newEntry), window);
+ egg_menu_merge_insert_action_group( window->ui_merge, eag, 0 );
+
+ new_merge_id = egg_menu_merge_new_merge_id( window->ui_merge );
+
+ egg_menu_merge_add_ui( window->ui_merge, new_merge_id,
+ //"/menubar/Actions",
+ //"/menubar/Actions/ActionsPlaceholder",
+ // "/menubar/AdditionalMenusPlaceholder/AReportAction",
+ "/menubar/AdditionalMenusPlaceholder",
+ "BarAction",
+ "BarAction", EGG_MENU_MERGE_MENUITEM, FALSE );
+ egg_menu_merge_ensure_update( window->ui_merge );
+ }
+
+ /* Now update the extension-menus */
+ gnc_extensions_menu_setup( GTK_WINDOW(window), WINDOW_NAME_MAIN, window->ui_merge );
+
/* GncPluginManager stuff */
manager = gnc_plugin_manager_get ();
plugins = gnc_plugin_manager_get_plugins (manager);
@@ -797,6 +839,7 @@
G_CALLBACK (gnc_main_window_plugin_removed), window);
g_list_foreach (plugins, gnc_main_window_add_plugin, window);
g_list_free (plugins);
+
}
static void
@@ -1149,6 +1192,19 @@
gnc_main_window_cmd_help_contents (EggAction *action, GncMainWindow *window)
{
gnc_gnome_help (HF_HELP, NULL);
+}
+
+static void
+gnc_main_window_cmd_test( EggAction *action, GncMainWindow *window )
+{
+ GtkWindow *w = GTK_WINDOW(gtk_window_new( GTK_WINDOW_TOPLEVEL ));
+ gnc_html *gnchtml = gnc_html_new( w );
+ gtk_container_add( GTK_CONTAINER(w), GTK_WIDGET(gnc_html_get_widget(gnchtml)) );
+
+ gchar *html = "<html><head><title>testing</title></head><body><h1>testing</h1><h2>testing 2</h2> <p>Testing</p></body></html>";
+ gnc_html_show_data( gnchtml, html, strlen( html ) );
+
+ gtk_widget_show_all( GTK_WIDGET(w) );
}
static void
Index: gnc-main-window-ui.xml
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/ui/Attic/gnc-main-window-ui.xml,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -Lsrc/gnome/ui/gnc-main-window-ui.xml -Lsrc/gnome/ui/gnc-main-window-ui.xml -u -r1.1.2.7 -r1.1.2.8
--- src/gnome/ui/gnc-main-window-ui.xml
+++ src/gnome/ui/gnc-main-window-ui.xml
@@ -63,7 +63,7 @@
</menu>
<placeholder name="AdditionalMenusPlaceholder"/>
-
+
<menu name="Tools" action="ToolsAction">
<placeholder name="ToolsPlaceholder"/>
<menuitem name="ToolsPriceEditor" action="ToolsPriceEditorAction"/>
@@ -71,13 +71,18 @@
<menuitem name="ToolsFinancialCalculator" action="ToolsFinancialCalculatorAction"/>
<menuitem name="ToolsFindTransactions" action="ToolsFindTransactionsAction"/>
</menu>
-
+
<menu name="Help" action="HelpAction">
<menuitem name="HelpTutorial" action="HelpTutorialAction"/>
<menuitem name="HelpTipsOfTheDay" action="HelpTipsOfTheDayAction"/>
<menuitem name="HelpContents" action="HelpContentsAction"/>
<menuitem name="HelpAbout" action="HelpAboutAction"/>
</menu>
+
+ <menu name="Misc" action="MiscAction">
+ <menuitem name="MiscTest" action="MiscTestAction"/>
+ </menu>
+
</menubar>
<toolbar name="DefaultToolbar">
Index: gnc-html.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gnc-html.h,v
retrieving revision 1.7.4.3
retrieving revision 1.7.4.4
diff -Lsrc/gnome-utils/gnc-html.h -Lsrc/gnome-utils/gnc-html.h -u -r1.7.4.3 -r1.7.4.4
--- src/gnome-utils/gnc-html.h
+++ src/gnome-utils/gnc-html.h
@@ -24,11 +24,10 @@
#define GNC_HTML_H
#include <glib.h>
+#include <gtkhtml/gtkhtml.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
-#include <libgtkhtml/gtkhtml.h>
-
typedef char * URLType;
#define URL_TYPE_FILE "file"
@@ -82,15 +81,17 @@
gpointer data);
typedef int (* GncHTMLButtonCB)(gnc_html * html, GdkEventButton * event,
gpointer data);
-typedef int (* GncHTMLObjectCB)(gnc_html * html, HtmlEmbedded * widget,
+//#if 0
+typedef int (* GncHTMLObjectCB)(gnc_html * html, GtkHTMLEmbedded * eb,
gpointer data);
+//#endif
typedef int (* GncHTMLActionCB)(gnc_html * html, const char * method,
const char * action, GHashTable * form_data);
typedef gboolean (* GncHTMLStreamCB)(const char *location, char **data, int *datalen);
typedef gboolean (* GncHTMLUrlCB)(const char *location, const char *label,
gboolean new_window, GNCURLResult * result);
-gnc_html * gnc_html_new(GtkWidget *window);
+gnc_html * gnc_html_new(GtkWindow *parent);
void gnc_html_destroy(gnc_html * html);
void gnc_html_show_url(gnc_html * html,
URLType type,
@@ -117,9 +118,10 @@
/* object handlers deal with <object classid="foo"> objects in HTML.
* the handlers are looked up at object load time. */
-
+//#if 0
void gnc_html_register_object_handler(const char * classid,
GncHTMLObjectCB hand);
+//#endif
void gnc_html_unregister_object_handler(const char * classid);
/* action handlers deal with submitting forms of the type
Index: gw-gnome-utils-spec.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gw-gnome-utils-spec.scm,v
retrieving revision 1.19.4.4
retrieving revision 1.19.4.5
diff -Lsrc/gnome-utils/gw-gnome-utils-spec.scm -Lsrc/gnome-utils/gw-gnome-utils-spec.scm -u -r1.19.4.4 -r1.19.4.5
--- src/gnome-utils/gw-gnome-utils-spec.scm
+++ src/gnome-utils/gw-gnome-utils-spec.scm
@@ -28,6 +28,8 @@
(gw:wrap-value ws 'gnc:window-name-invoice '(<gw:mchars> callee-owned const) "WINDOW_NAME_INVOICE")
(gw:wrap-value ws 'gnc:window-name-all '(<gw:mchars> callee-owned const) "WINDOW_NAME_ALL")
+ (gw:wrap-value ws 'gnc:additional-menus-placeholder '(<gw:mchars> callee-owned const) "ADDITIONAL_MENUS_PLACEHOLDER")
+
(gw:wrapset-add-cs-declarations!
ws
(lambda (wrapset client-wrapset)
Index: gnc-menu-extensions.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gnc-menu-extensions.h,v
retrieving revision 1.5.4.1
retrieving revision 1.5.4.2
diff -Lsrc/gnome-utils/gnc-menu-extensions.h -Lsrc/gnome-utils/gnc-menu-extensions.h -u -r1.5.4.1 -r1.5.4.2
--- src/gnome-utils/gnc-menu-extensions.h
+++ src/gnome-utils/gnc-menu-extensions.h
@@ -26,13 +26,18 @@
#include <gnome.h>
#include <libguile.h>
#include "guile-mappings.h"
+#include "egg-menu-merge.h"
#define WINDOW_NAME_MAIN "Main"
#define WINDOW_NAME_REGISTER "Register"
#define WINDOW_NAME_INVOICE "Invoice"
#define WINDOW_NAME_ALL "All"
-void gnc_add_c_extension(GnomeUIInfo *info, gchar *path);
+#define ADDITIONAL_MENUS_PLACEHOLDER "AdditionalMenusPlaceholder"
+
+// unused --
+//void gnc_add_c_extension(GnomeUIInfo *info, gchar *path);
+
void gnc_add_scm_extension(SCM extension);
/* Replacement for gnome_app_insert_menus, since the original one will
@@ -54,10 +59,12 @@
* menu items stored by the above functions should now be inserted in
* the menu of the GnomeApp app.
*
- * app - The GnomeApp to add the stored menu items
- * prefix - The prefix of the window that is currently being set up.
+ * @param app The GnomeApp to add the stored menu items
+ * @param prefix The prefix of the window that is currently being set up.
+ * @param uiMerge The EggMenuMerge [GtkUIManager] object to use for merging.
*/
-void gnc_extensions_menu_setup(GnomeApp * app, gchar *prefix);
+void gnc_extensions_menu_setup( GtkWindow *app, gchar *prefix, EggMenuMerge *uiMerge );
+
/* This is called from the window initializing code, when the actual
* menu items stored by the above functions should now be inserted in
* the menu of the GnomeApp app.
@@ -69,9 +76,11 @@
* prefix - The prefix of the window that is currently being set up.
* user_data - The user data to be passed on to menu item's callback functions.
*/
+#if 0 /* re-add */
void gnc_extensions_menu_setup_with_data(GnomeApp * app,
gchar *prefix,
gpointer user_data);
+#endif /* 0; re-add */
void gnc_extensions_shutdown(void);
#endif
Index: gnc-html.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gnc-html.c,v
retrieving revision 1.23.4.8
retrieving revision 1.23.4.9
diff -Lsrc/gnome-utils/gnc-html.c -Lsrc/gnome-utils/gnc-html.c -u -r1.23.4.8 -r1.23.4.9
--- src/gnome-utils/gnc-html.c
+++ src/gnome-utils/gnc-html.c
@@ -32,8 +32,8 @@
#include <fcntl.h>
#include <unistd.h>
-#include <libgtkhtml/gtkhtml.h>
-#include <libgtkhtml/dom/core/dom-attr.h>
+#include <gtkhtml/gtkhtml.h>
+#include <gtkhtml/gtkhtml-embedded.h>
#ifdef USE_GUPPI
#include <libguppitank/guppi-tank.h>
#endif
@@ -61,14 +61,14 @@
struct gnc_html_struct {
GtkWidget * window; /* window this html goes into */
GtkWidget * container; /* parent of the gtkhtml widget */
- HtmlView * view;
+ GtkWidget * html; /* gtkhtml widget itself */
gchar * current_link; /* link under mouse pointer */
URLType base_type; /* base of URL (path - filename) */
gchar * base_location;
- gnc_http * http; /* documents HTTP requests */
- GHashTable * request_info; /* hash uri to GList of HtmlDocument * */
+ gnc_http * http; /* handles HTTP requests */
+ GHashTable * request_info; /* hash uri to GList of GtkHTMLStream * */
/* callbacks */
GncHTMLUrltypeCB urltype_cb; /* is this type OK for this instance? */
@@ -216,7 +216,7 @@
if(found_protocol) {
retval = g_hash_table_lookup (gnc_html_proto_to_type_hash, protocol);
if (!retval) {
- PWARN("undocumentd URL type for '%s'", url ? url : "(null)");
+ PWARN("unhandled URL type for '%s'", url ? url : "(null)");
retval = URL_TYPE_OTHER;
}
}
@@ -434,7 +434,7 @@
/************************************************************
* gnc_html_http_request_cb: fires when an HTTP request is completed.
- * this is when it's time to load the data into the HtmlView widget.
+ * this is when it's time to load the data into the GtkHTML widget.
************************************************************/
static void
@@ -446,56 +446,56 @@
URLType type;
char * location = NULL;
char * label = NULL;
- GList * documents = NULL;
+ GList * handles = NULL;
GList * current;
- gpointer loc_tmp, doc_tmp;
+ gpointer loc_tmp, handles_tmp;
DEBUG("uri %s, ok %d, body %10.10s, body len %d", uri, completed_ok, body, body_len);
- g_hash_table_lookup_extended(html->request_info, uri,
- &loc_tmp, &doc_tmp);
- location = (char *)loc_tmp;
- documents = (GList *)doc_tmp;
+ g_hash_table_lookup_extended(html->request_info, uri,
+ &loc_tmp, &handles_tmp );
+
+ location = loc_tmp;
+ handles = handles_tmp;
- /* documents will be NULL for an HTTP POST transaction, where we are
+ /* handles will be NULL for an HTTP POST transaction, where we are
* displaying the reply data. */
- if (documents == NULL) {
- HtmlDocument *document = html->view->document;
-
- html_document_open_stream (document, "text/html");
+ if(!handles) {
+ GtkHTMLStream * handle = gtk_html_begin(GTK_HTML(html->html));
if(completed_ok) {
- html_document_write_stream (document, body, body_len);
+ gtk_html_write(GTK_HTML(html->html), handle, body, body_len);
}
else {
char *data;
data = g_strdup_printf(error_format,
_(error_title), _(error_body1), _(error_body2));
- html_document_write_stream (document, data, strlen (data));
+ gtk_html_write(GTK_HTML(html->html), handle, data, strlen (data));
g_free (data);
- html_document_write_stream (document, body, body_len);
- html_document_write_stream (document,
- error_end, strlen(error_end));
- html_document_close_stream (document);
+ gtk_html_write(GTK_HTML(html->html), handle, body, body_len);
+ gtk_html_write(GTK_HTML(html->html), handle,
+ error_end, strlen(error_end));
+ gtk_html_end(GTK_HTML(html->html), handle, GTK_HTML_STREAM_OK);
}
}
/* otherwise, it's a normal SUBMIT transaction */
else {
- /* before writing to the documents, make sure any new traffic won't
+ /* before writing to the handles, make sure any new traffic won't
* see them while we're working */
g_hash_table_remove(html->request_info, uri);
g_free(location);
location = NULL;
- for(current = documents; current; current = current->next) {
- /* request completed OK... write the HTML to the documents that
+ for(current = handles; current; current = current->next) {
+ /* request completed OK... write the HTML to the handles that
* asked for that URI. */
if(completed_ok) {
- html_document_write_stream (HTML_DOCUMENT (current->data),
- body, body_len);
- html_document_close_stream (HTML_DOCUMENT (current->data));
- type = gnc_html_parse_url(html, uri, &location, &label);
+ gtk_html_write(GTK_HTML(html->html), (GtkHTMLStream *)(current->data),
+ body, body_len);
+ gtk_html_end(GTK_HTML(html->html), (GtkHTMLStream *)(current->data),
+ GTK_HTML_STREAM_OK);
+ type = gnc_html_parse_url(html, uri, &location, &label);
if(label) {
- html_view_jump_to_anchor(html->view, label);
+ gtk_html_jump_to_anchor(GTK_HTML(html->html), label);
}
g_free(location);
g_free(label);
@@ -507,20 +507,21 @@
data = g_strdup_printf(error_format,
_(error_title), _(error_body1), _(error_body2));
- html_document_write_stream (HTML_DOCUMENT (current->data),
- data, strlen(data));
+ gtk_html_write(GTK_HTML(html->html), (GtkHTMLStream *)(current->data),
+ data, strlen(data));
g_free (data);
- html_document_write_stream (HTML_DOCUMENT (current->data),
- body, body_len);
- html_document_write_stream (HTML_DOCUMENT (current->data),
- error_end, strlen(error_end));
- html_document_close_stream (HTML_DOCUMENT (current->data));
+ gtk_html_write(GTK_HTML(html->html), (GtkHTMLStream *)(current->data),
+ body, body_len);
+ gtk_html_write(GTK_HTML(html->html), (GtkHTMLStream *)(current->data),
+ error_end, strlen(error_end));
+ gtk_html_end(GTK_HTML(html->html), (GtkHTMLStream *)(current->data),
+ GTK_HTML_STREAM_ERROR);
}
}
- g_list_free(documents);
+ g_list_free(handles);
}
- gnc_unset_busy_cursor (GTK_WIDGET (html->view));
+ gnc_unset_busy_cursor (html->html);
}
@@ -530,40 +531,39 @@
************************************************************/
static void
-gnc_html_start_request(gnc_html *html, gchar *uri, HtmlDocument *document)
+gnc_html_start_request(gnc_html * html, gchar * uri, GtkHTMLStream * handle)
{
- GList *documents = NULL;
+ GList * handles = NULL;
gint need_request = FALSE;
- /* we want to make a list of documents to fill with this URI.
- * multiple documents with the same URI will all get filled when the
+ /* we want to make a list of handles to fill with this URI.
+ * multiple handles with the same URI will all get filled when the
* request comes in. */
DEBUG("requesting %s", uri);
-
- documents = g_hash_table_lookup (html->request_info, uri);
- if (documents == NULL) {
+ handles = g_hash_table_lookup(html->request_info, uri);
+ if(!handles) {
need_request = TRUE;
}
- documents = g_list_append (documents, document);
- g_hash_table_insert (html->request_info, uri, documents);
+ handles = g_list_append(handles, handle);
+ g_hash_table_insert(html->request_info, uri, handles);
if(need_request) {
- gnc_set_busy_cursor (GTK_WIDGET (html->view), FALSE);
- gnc_http_start_request (html->http, uri, gnc_html_http_request_cb,
- (gpointer)html);
+ gnc_set_busy_cursor (html->html, FALSE);
+ gnc_http_start_request(html->http, uri, gnc_html_http_request_cb,
+ (gpointer)html);
}
}
/********************************************************************
* gnc_html_load_to_stream : actually do the work of loading the HTML
- * or binary data referenced by a URL and feeding it into the HtmlView
+ * or binary data referenced by a URL and feeding it into the GtkHTML
* widget.
********************************************************************/
static void
-gnc_html_load_to_stream(gnc_html *html, HtmlDocument *document,
+gnc_html_load_to_stream(gnc_html * html, GtkHTMLStream * handle,
URLType type, const gchar * location,
const gchar * label)
{
@@ -571,8 +571,7 @@
int fdata_len = 0;
DEBUG("type %s, location %s, label %s", type, location, label);
-
- if (html == NULL) {
+ if(!html) {
return;
}
@@ -585,15 +584,15 @@
if(ok) {
fdata = fdata ? fdata : g_strdup ("");
- html_document_write_stream (document, fdata, fdata_len);
- html_document_close_stream (document);
+ gtk_html_write(GTK_HTML(html->html), handle, fdata, fdata_len);
+ gtk_html_end(GTK_HTML(html->html), handle, GTK_HTML_STREAM_OK);
}
else {
fdata = fdata ? fdata :
g_strdup_printf (error_404_format,
_(error_404_title), _(error_404_body));
- html_document_write_stream (document, fdata, fdata_len);
- html_document_close_stream (document);
+ gtk_html_write(GTK_HTML(html->html), handle, fdata, strlen (fdata));
+ gtk_html_end(GTK_HTML(html->html), handle, GTK_HTML_STREAM_ERROR);
}
g_free(fdata);
@@ -601,7 +600,7 @@
if(label) {
while (gtk_events_pending ())
gtk_main_iteration ();
- html_view_jump_to_anchor(html->view, label);
+ gtk_html_jump_to_anchor(GTK_HTML(html->html), label);
}
return;
@@ -611,37 +610,38 @@
do {
if (!safe_strcmp (type, URL_TYPE_SECURE) ||
!safe_strcmp (type, URL_TYPE_HTTP)) {
+
if (!safe_strcmp (type, URL_TYPE_SECURE)) {
if(!https_allowed()) {
- gnc_error_dialog(html->window,
- _("Secure HTTP access is disabled.\n"
- "You can enable it in the Network section of\n"
- "the Preferences dialog."));
+ gnc_error_dialog( html->window,
+ _("Secure HTTP access is disabled.\n"
+ "You can enable it in the Network section of\n"
+ "the Preferences dialog."));
break;
}
}
if(!http_allowed()) {
- gnc_error_dialog(html->window,
- _("Network HTTP access is disabled.\n"
- "You can enable it in the Network section of\n"
- "the Preferences dialog."));
+ gnc_error_dialog( html->window,
+ _("Network HTTP access is disabled.\n"
+ "You can enable it in the Network section of\n"
+ "the Preferences dialog."));
} else {
char *fullurl;
fullurl = gnc_build_url(type, location, label);
- gnc_html_start_request(html, fullurl, document);
+ gnc_html_start_request(html, fullurl, handle);
}
+
} else {
PWARN("load_to_stream for inappropriate type\n"
"\turl = '%s#%s'\n",
location ? location : "(null)",
label ? label : "(null)");
-
fdata = g_strdup_printf (error_404_format,
_(error_404_title), _(error_404_body));
- html_document_write_stream (document, fdata, fdata_len);
- html_document_close_stream (document);
+ gtk_html_write(GTK_HTML(html->html), handle, fdata, strlen (fdata));
+ gtk_html_end(GTK_HTML(html->html), handle, GTK_HTML_STREAM_ERROR);
g_free (fdata);
}
@@ -656,7 +656,7 @@
********************************************************************/
static void
-gnc_html_link_clicked_cb (HtmlDocument *document, const gchar *url, gpointer data)
+gnc_html_link_clicked_cb(GtkHTML * html, const gchar * url, gpointer data)
{
URLType type;
char * location = NULL;
@@ -664,23 +664,21 @@
gnc_html * gnchtml = (gnc_html *)data;
DEBUG("Clicked %s", url);
-
type = gnc_html_parse_url(gnchtml, url, &location, &label);
gnc_html_show_url(gnchtml, type, location, label, 0);
-
g_free(location);
g_free(label);
}
/********************************************************************
- * gnc_html_request_url_cb - called when a URL needs to be
+ * gnc_html_url_requested_cb - called when a URL needs to be
* loaded within the loading of a page (embedded image).
********************************************************************/
static void
-gnc_html_request_url_cb (HtmlDocument *document, const gchar *url,
- HtmlStream *stream, gpointer data)
+gnc_html_url_requested_cb(GtkHTML * html, char * url,
+ GtkHTMLStream * handle, gpointer data)
{
URLType type;
char * location=NULL;
@@ -688,10 +686,8 @@
gnc_html * gnchtml = (gnc_html *)data;
DEBUG("requesting %s", url);
-
type = gnc_html_parse_url(gnchtml, url, &location, &label);
- gnc_html_load_to_stream(gnchtml, document, type, location, label);
-
+ gnc_html_load_to_stream(gnchtml, handle, type, location, label);
g_free(location);
g_free(label);
}
@@ -703,27 +699,18 @@
********************************************************************/
static int
-gnc_html_object_requested_cb (HtmlView *view, HtmlEmbedded *widget,
+gnc_html_object_requested_cb(GtkHTML * html, GtkHTMLEmbedded * eb,
gpointer data)
{
- gnc_html * gnchtml = data;
- DomNamedNodeMap *attributes;
- DomAttr *classid;
+ gnc_html * gnchtml = data;
GncHTMLObjectCB h;
DEBUG(" ");
-
- g_return_val_if_fail (widget != NULL && widget->node != NULL, FALSE);
- g_return_val_if_fail (gnc_html_object_handlers != NULL, FALSE);
-
- attributes = dom_Node__get_attributes (widget->node);
- classid = DOM_ATTR (dom_NamedNodeMap_getNamedItem (attributes, "classid"));
-
- g_return_val_if_fail (classid != NULL, FALSE);
-
- h = g_hash_table_lookup(gnc_html_object_handlers, dom_Attr__get_value (classid));
- if (h != NULL) {
- return h (gnchtml, widget, data);
+ if(!eb || !(eb->classid) || !gnc_html_object_handlers) return FALSE;
+
+ h = g_hash_table_lookup(gnc_html_object_handlers, eb->classid);
+ if(h) {
+ return h(gnchtml, eb, data);
}
else {
return FALSE;
@@ -736,12 +723,11 @@
********************************************************************/
static void
-gnc_html_on_url_cb (HtmlView *html_view, const gchar *url, gpointer data)
+gnc_html_on_url_cb(GtkHTML * html, const gchar * url, gpointer data)
{
gnc_html * gnchtml = (gnc_html *) data;
DEBUG("Rollover %s", url);
-
g_free(gnchtml->current_link);
gnchtml->current_link = g_strdup(url);
if(gnchtml->flyover_cb) {
@@ -755,7 +741,7 @@
********************************************************************/
static void
-gnc_html_set_base_cb (HtmlDocument *document, const gchar *url,
+gnc_html_set_base_cb(GtkHTML * gtkhtml, const gchar * base,
gpointer data)
{
gnc_html * html = (gnc_html *)data;
@@ -763,9 +749,8 @@
char * location = NULL;
char * label = NULL;
- DEBUG("Setting base location to %s", url);
-
- type = gnc_html_parse_url(html, url, &location, &label);
+ DEBUG("Setting base location to %s", base);
+ type = gnc_html_parse_url(html, base, &location, &label);
g_free(html->base_location);
g_free(label);
@@ -906,7 +891,7 @@
********************************************************************/
static int
-gnc_html_submit_cb(HtmlDocument *document, const gchar *method,
+gnc_html_submit_cb(GtkHTML * html, const gchar * method,
const gchar * action, const gchar * encoded_form_data,
gpointer user_data)
{
@@ -944,11 +929,11 @@
}
}
else {
- gnc_error_dialog(gnchtml->window,
- _("GnuCash Network is disabled and the link "
- "you have clicked requires it.\n"
- "You can enable it in the Network section\n"
- "of the Preferences dialog."));
+ gnc_error_dialog( gnchtml->window,
+ _("GnuCash Network is disabled and the link "
+ "you have clicked requires it.\n"
+ "You can enable it in the Network section\n"
+ "of the Preferences dialog."));
}
}
else {
@@ -991,14 +976,12 @@
gnc_html_show_data(gnc_html * html, const char * data,
int datalen)
{
- HtmlDocument *document;
+ GtkHTMLStream * handle;
DEBUG("datalen %d, data %20.20s", datalen, data);
-
- document = html->view->document;
-
- html_document_write_stream (document, data, datalen);
- html_document_close_stream (document);
+ handle = gtk_html_begin(GTK_HTML(html->html));
+ gtk_html_write(GTK_HTML(html->html), handle, data, datalen);
+ gtk_html_end(GTK_HTML(html->html), handle, GTK_HTML_STREAM_OK);
}
@@ -1016,34 +999,32 @@
gboolean new_window_hint)
{
GncHTMLUrlCB url_handler;
- HtmlDocument *document;
+ GtkHTMLStream * handle;
gboolean new_window;
DEBUG(" ");
-
- g_return_if_fail (html != NULL);
- g_return_if_fail (location != NULL);
+ if (!html) return;
+ if (!location) return;
/* make sure it's OK to show this URL type in this window */
- if (new_window_hint == 0) {
- if (html->urltype_cb) {
+ if(new_window_hint == 0) {
+ if (html->urltype_cb)
new_window = !((html->urltype_cb)(type));
- } else {
+ else
new_window = FALSE;
- }
- } else {
+ }
+ else {
new_window = TRUE;
}
- if (!new_window) {
+ if(!new_window) {
gnc_html_cancel(html);
}
- if (gnc_html_url_handlers) {
+ if (gnc_html_url_handlers)
url_handler = g_hash_table_lookup (gnc_html_url_handlers, type);
- } else {
+ else
url_handler = NULL;
- }
if (url_handler)
{
@@ -1061,23 +1042,23 @@
ok = url_handler (location, label, new_window, &result);
if (!ok)
{
- if (result.error_message) {
- gnc_error_dialog(html->window, result.error_message);
- } else {
+ if (result.error_message)
+ gnc_error_dialog( html->window, result.error_message);
+ else
/* %s is a URL (some location somewhere). */
- gnc_error_dialog(html->window, _("There was an error accessing %s."), location);
- }
+ gnc_error_dialog( html->window, _("There was an error accessing %s."), location);
- if (html->load_cb) {
+ if (html->load_cb)
html->load_cb (html, result.url_type,
location, label,
html->load_cb_data);
- }
- } else if (result.load_to_stream) {
+ }
+ else if (result.load_to_stream)
+ {
gnc_html_history_node *hnode;
const char *new_location;
const char *new_label;
- HtmlDocument *document;
+ GtkHTMLStream * stream;
new_location = result.location ? result.location : location;
new_label = result.label ? result.label : label;
@@ -1092,8 +1073,8 @@
g_strdup (extract_base_name(result.base_type, new_location));
DEBUG("resetting base location to %s", html->base_location);
- document = html->view->document;
- gnc_html_load_to_stream (html, document, result.url_type,
+ stream = gtk_html_begin (GTK_HTML(html->html));
+ gnc_html_load_to_stream (html, stream, result.url_type,
new_location, new_label);
if (html->load_cb)
@@ -1114,7 +1095,7 @@
gnc_html_open_scm(html, location, label, new_window);
} else if (!safe_strcmp (type, URL_TYPE_JUMP)) {
- html_view_jump_to_anchor(html->view, label);
+ gtk_html_jump_to_anchor(GTK_HTML(html->html), label);
} else if (!safe_strcmp (type, URL_TYPE_SECURE) ||
!safe_strcmp (type, URL_TYPE_HTTP) ||
@@ -1123,20 +1104,20 @@
do {
if (!safe_strcmp (type, URL_TYPE_SECURE)) {
if(!https_allowed()) {
- gnc_error_dialog(html->window,
- _("Secure HTTP access is disabled.\n"
- "You can enable it in the Network section of\n"
- "the Preferences dialog."));
+ gnc_error_dialog( html->window,
+ _("Secure HTTP access is disabled.\n"
+ "You can enable it in the Network section of\n"
+ "the Preferences dialog."));
break;
}
}
if (safe_strcmp (type, URL_TYPE_FILE)) {
if(!http_allowed()) {
- gnc_error_dialog(html->window,
- _("Network HTTP access is disabled.\n"
- "You can enable it in the Network section of\n"
- "the Preferences dialog."));
+ gnc_error_dialog( html->window,
+ _("Network HTTP access is disabled.\n"
+ "You can enable it in the Network section of\n"
+ "the Preferences dialog."));
break;
}
}
@@ -1146,18 +1127,18 @@
if(html->base_location) g_free(html->base_location);
html->base_location = extract_base_name(type, location);
- /* FIXME : document new_window = 1 */
+ /* FIXME : handle new_window = 1 */
gnc_html_history_append(html->history,
gnc_html_history_node_new(type, location, label));
- document = html->view->document;
- gnc_html_load_to_stream(html, document, type, location, label);
+ handle = gtk_html_begin(GTK_HTML(html->html));
+ gnc_html_load_to_stream(html, handle, type, location, label);
} while (FALSE);
} else if (!safe_strcmp (type, URL_TYPE_ACTION)) {
gnc_html_history_append(html->history,
gnc_html_history_node_new(type, location, label));
- gnc_html_submit_cb(html->view->document, "get",
+ gnc_html_submit_cb(GTK_HTML(html->html), "get",
gnc_build_url(type, location, label), NULL,
(gpointer)html);
@@ -1182,9 +1163,8 @@
gnc_html_history_node * n;
DEBUG(" ");
-
n = gnc_html_history_get_current(html->history);
- if (n != NULL) {
+ if(n) {
gnc_html_show_url(html, n->type, n->location, n->label, 0);
}
}
@@ -1196,59 +1176,59 @@
********************************************************************/
gnc_html *
-gnc_html_new(GtkWidget *window)
+gnc_html_new( GtkWindow *parent )
{
- gnc_html *html = g_new0(gnc_html, 1);
+ gnc_html * retval = g_new0(gnc_html, 1);
- html->window = window;
- html->container = gtk_scrolled_window_new (NULL, NULL);
- html->view = HTML_VIEW (html_view_new());
-
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(html->container),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- gtk_container_add(GTK_CONTAINER(html->container),
- GTK_WIDGET(html->view));
+ retval->window = GTK_WIDGET(parent);
+ retval->container = gtk_scrolled_window_new(NULL, NULL);
+ retval->html = gtk_html_new();
+
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(retval->container),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+
+ gtk_container_add(GTK_CONTAINER(retval->container),
+ GTK_WIDGET(retval->html));
+
+ retval->request_info = g_hash_table_new(g_str_hash, g_str_equal);
+ retval->http = gnc_http_new();
+ retval->history = gnc_html_history_new();
- html->request_info = g_hash_table_new (g_str_hash, g_str_equal);
- html->http = gnc_http_new();
- html->history = gnc_html_history_new();
-
- g_object_ref (html->container);
- gtk_object_sink (GTK_OBJECT (html->container));
+ g_object_ref (retval->container);
+ gtk_object_sink (GTK_OBJECT (retval->container));
/* signals */
- g_signal_connect (G_OBJECT (html->view->document), "request_url",
- G_CALLBACK (gnc_html_request_url_cb),
- (gpointer)html);
-
- g_signal_connect (G_OBJECT (html->view), "on_url",
- G_CALLBACK (gnc_html_on_url_cb),
- (gpointer)html);
-
- g_signal_connect (G_OBJECT (html->view->document), "set_base",
- G_CALLBACK (gnc_html_set_base_cb),
- (gpointer)html);
-
- g_signal_connect (G_OBJECT(html->view->document), "link_clicked",
- G_CALLBACK (gnc_html_link_clicked_cb),
- (gpointer)html);
-
- g_signal_connect (G_OBJECT (html->view), "object_requested",
- G_CALLBACK (gnc_html_object_requested_cb),
- (gpointer)html);
-
- g_signal_connect (G_OBJECT (html->view), "button_press_event",
- G_CALLBACK (gnc_html_button_press_cb),
- (gpointer)html);
-
- g_signal_connect (G_OBJECT(html->view->document), "submit",
- G_CALLBACK (gnc_html_submit_cb), (gpointer)html);
-
- /* html_view_set_document (html->view, html_document_new ()); */
+ gtk_signal_connect(GTK_OBJECT(retval->html), "url_requested",
+ GTK_SIGNAL_FUNC(gnc_html_url_requested_cb),
+ (gpointer)retval);
+
+ gtk_signal_connect(GTK_OBJECT(retval->html), "on_url",
+ GTK_SIGNAL_FUNC(gnc_html_on_url_cb),
+ (gpointer)retval);
+
+ gtk_signal_connect(GTK_OBJECT(retval->html), "set_base",
+ GTK_SIGNAL_FUNC(gnc_html_set_base_cb),
+ (gpointer)retval);
+
+ gtk_signal_connect(GTK_OBJECT(retval->html), "link_clicked",
+ GTK_SIGNAL_FUNC(gnc_html_link_clicked_cb),
+ (gpointer)retval);
+
+ gtk_signal_connect (GTK_OBJECT (retval->html), "object_requested",
+ GTK_SIGNAL_FUNC (gnc_html_object_requested_cb),
+ (gpointer)retval);
+
+ gtk_signal_connect (GTK_OBJECT (retval->html), "button_press_event",
+ GTK_SIGNAL_FUNC (gnc_html_button_press_cb),
+ (gpointer)retval);
- return html;
+ gtk_signal_connect (GTK_OBJECT(retval->html), "submit",
+ GTK_SIGNAL_FUNC(gnc_html_submit_cb), (gpointer)retval);
+
+ gtk_html_load_empty(GTK_HTML(retval->html));
+
+ return retval;
}
@@ -1262,7 +1242,6 @@
{
g_free(key);
g_list_free((GList *)value);
-
return TRUE;
}
@@ -1284,7 +1263,8 @@
void
gnc_html_destroy(gnc_html * html)
{
- g_return_if_fail (html != NULL);
+
+ if(!html) return;
/* cancel any outstanding HTTP requests */
gnc_html_cancel(html);
@@ -1297,8 +1277,9 @@
g_free(html->current_link);
g_free(html->base_location);
+ html->window = NULL;
html->container = NULL;
- html->view = NULL;
+ html->html = NULL;
html->history = NULL;
html->current_link = NULL;
html->base_location = NULL;
@@ -1339,7 +1320,7 @@
/**************************************************************
* gnc_html_export : wrapper around the builtin function in gtkhtml
**************************************************************/
-#if 0
+
static gboolean
raw_html_receiver (gpointer engine,
const gchar *data,
@@ -1350,14 +1331,10 @@
fwrite (data, len, 1, fh);
return TRUE;
}
-#endif
gboolean
gnc_html_export(gnc_html * html, const char *filepath)
{
- /* Export need to be added to gtkhtml 2.0 */
-
-#if 0
FILE *fh;
g_return_val_if_fail (html != NULL, FALSE);
@@ -1372,31 +1349,23 @@
fclose (fh);
return TRUE;
-#endif
-
- return FALSE;
}
void
gnc_html_print(gnc_html * html)
{
- /* Printing need to be added to gtkhtml 2.0 */
-
-#if 0
PrintSession * ps = gnc_print_session_create(FALSE);
-
+
gtk_html_print(GTK_HTML(html->html),
GNOME_PRINT_CONTEXT(ps->meta));
gnc_print_session_done(ps, FALSE);
gnc_print_session_print(ps);
-#endif
}
gnc_html_history *
gnc_html_get_history(gnc_html * html)
{
- g_return_val_if_fail (html != NULL, NULL);
-
+ if (!html) return NULL;
return html->history;
}
@@ -1404,8 +1373,7 @@
GtkWidget *
gnc_html_get_widget(gnc_html * html)
{
- g_return_val_if_fail (html != NULL, NULL);
-
+ if (!html) return NULL;
return html->container;
}
@@ -1414,13 +1382,14 @@
GncHTMLObjectCB hand)
{
g_return_if_fail (classid != NULL);
- g_return_if_fail (hand != NULL);
- if (gnc_html_object_handlers == NULL) {
+ if(!gnc_html_object_handlers) {
gnc_html_object_handlers = g_hash_table_new(g_str_hash, g_str_equal);
}
gnc_html_unregister_object_handler (classid);
+ if (!hand)
+ return;
g_hash_table_insert(gnc_html_object_handlers, g_strdup(classid), hand);
}
@@ -1435,7 +1404,7 @@
if (!g_hash_table_lookup_extended(gnc_html_object_handlers,
classid,
- (gpointer *)p_keyptr,
+ (gpointer *)p_keyptr,
(gpointer *)p_valptr))
return;
Index: gnc-menu-extensions.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gnc-menu-extensions.c,v
retrieving revision 1.9.4.2
retrieving revision 1.9.4.3
diff -Lsrc/gnome-utils/gnc-menu-extensions.c -Lsrc/gnome-utils/gnc-menu-extensions.c -u -r1.9.4.2 -r1.9.4.3
--- src/gnome-utils/gnc-menu-extensions.c
+++ src/gnome-utils/gnc-menu-extensions.c
@@ -22,12 +22,14 @@
#include "config.h"
+#include <ctype.h>
#include <gnome.h>
#include "guile-util.h"
#include "gnc-engine-util.h"
#include "gnc-menu-extensions.h"
#include "gnc-ui.h"
+// #include "egg-menu-merge.h"
typedef struct _ExtensionInfo ExtensionInfo;
struct _ExtensionInfo
@@ -36,7 +38,10 @@
gchar *window;
gchar *path;
- GnomeUIInfo info[2];
+ EggMenuMergeNodeType type;
+
+ // GnomeUIInfo info[2];
+ // EggActionEntry action;
gpointer extra_info;
};
@@ -75,10 +80,11 @@
}
-static GnomeUIInfoType
+//static GnomeUIInfoType
+static EggMenuMergeNodeType
gnc_extension_type(ExtensionInfo *ext_info)
{
- GnomeUIInfoType type;
+ EggMenuMergeNodeType type;
char *string;
initialize_getters();
@@ -87,19 +93,18 @@
if (string == NULL)
{
PERR("bad type");
- return GNOME_APP_UI_ENDOFINFO;
+ return EGG_MENU_MERGE_UNDECIDED;
}
- if (safe_strcmp(string, "menu-item") == 0)
- type = GNOME_APP_UI_ITEM;
- else if (safe_strcmp(string, "menu") == 0)
- type = GNOME_APP_UI_SUBTREE;
- else if (safe_strcmp(string, "separator") == 0)
- type = GNOME_APP_UI_SEPARATOR;
- else
- {
+ if (safe_strcmp(string, "menu-item") == 0) {
+ type = EGG_MENU_MERGE_MENUITEM;
+ } else if (safe_strcmp(string, "menu") == 0) {
+ type = EGG_MENU_MERGE_MENU;
+ } else if (safe_strcmp(string, "separator") == 0) {
+ type = EGG_MENU_MERGE_SEPARATOR;
+ } else {
PERR("bad type");
- type = GNOME_APP_UI_ENDOFINFO;
+ type = EGG_MENU_MERGE_UNDECIDED;
}
free(string);
@@ -107,7 +112,6 @@
return type;
}
-
/* returns malloc'd name */
static char *
gnc_extension_name(ExtensionInfo *ext_info)
@@ -127,6 +131,50 @@
return gnc_guile_call1_to_string(getters.documentation, ext_info->extension);
}
+/** @return A GSList of copies of the path elts [gchar*s]. **/
+static GSList*
+gnc_extension_path_elts( ExtensionInfo *extInfo )
+{
+ SCM path;
+ GSList *pathElts = NULL;
+
+ initialize_getters();
+
+ path = gnc_guile_call1_to_list( getters.path, extInfo->extension );
+ if (path == SCM_UNDEFINED) {
+ return NULL;
+ }
+
+ if (SCM_NULLP(path)) {
+ return NULL;
+ }
+
+ while (!SCM_NULLP(path))
+ {
+ SCM item;
+
+ item = SCM_CAR(path);
+ path = SCM_CDR(path);
+
+ if (SCM_STRINGP(item))
+ {
+ char *pathEltStr = gh_scm2newstr(item, NULL);
+ pathElts = g_slist_append( pathElts, (gpointer)pathEltStr );
+ }
+ else
+ {
+ for ( ; pathElts; pathElts = pathElts->next )
+ free( pathElts->data );
+ g_slist_free( pathElts );
+ pathElts = NULL;
+
+ return NULL;
+ }
+ }
+
+ return pathElts;
+}
+
/* returns g_malloc'd path */
static void
@@ -179,6 +227,8 @@
i++;
}
+ //GSList pathElts =
+
if (i > 0) {
*window = g_strdup(strings[0]);
*fullpath = g_strjoinv("/", strings+1);
@@ -211,9 +261,21 @@
scm_call_0(script);
}
+static void
+//gnc_main_window_cmd_test( EggAction *action, GncMainWindow *window )
+gnc_extension_action_cb( EggAction *action, /* GtkWindow *window */ gpointer data )
+{
+ ExtensionInfo *ext_info = data;
+ if (ext_info == NULL)
+ return;
+
+ gnc_extension_run_script(ext_info);
+}
+
+#if 0
static void
-gnc_extension_cb(GtkWidget *w, gpointer data)
+gnc_extension_cb(GtkWidget *w, ExtensionInfo *data )
{
ExtensionInfo *ext_info = data;
@@ -222,24 +284,41 @@
gnc_extension_run_script(ext_info);
}
+#endif // 0
static ExtensionInfo *
gnc_create_extension_info(SCM extension)
{
- GnomeUIInfo *info;
+ // GnomeUIInfo *info;
+
ExtensionInfo *ext_info;
- char *string;
+ //char *string;
ext_info = g_new0(ExtensionInfo, 1);
ext_info->extension = extension;
gnc_extension_path(extension, &ext_info->window, &ext_info->path);
- ext_info->info[0].type = gnc_extension_type(ext_info);
+ //ext_info->info[0].type = gnc_extension_type(ext_info);
+ ext_info->type = gnc_extension_type( ext_info );
- switch (ext_info->info[0].type)
+ // FIXME: convert this over to GtkAction / new UI-builder framework.
+ // http://developer.gnome.org/doc/API/2.0/gtk/migrating-gnomeuiinfo.html
+ // 1/ Define our own enum-values for the three types of widgets:
+ // MENU, MENU_ITEM, SEPERATOR
+ //
+ // 2/ Figure out and use egg-menu-merge to auto-merge/unmerge menus
+ // together.
+ // * get a merge-id
+ // * overlay the new menu
+ // * ensure_update
+
+ //switch (ext_info->info[0].type)
+ switch ( ext_info->type )
{
- case GNOME_APP_UI_ITEM:
+ //case GNOME_APP_UI_ITEM:
+ case EGG_MENU_MERGE_MENUITEM:
+ /*
ext_info->info[0].moreinfo = gnc_extension_cb;
string = gnc_extension_documentation(ext_info);
@@ -251,10 +330,14 @@
ext_info->info[0].label = string;
if (string != NULL)
free(string);
+ */
+ DEBUG( "menuitem" );
break;
- case GNOME_APP_UI_SUBTREE:
+ //case GNOME_APP_UI_SUBTREE:
+ case EGG_MENU_MERGE_MENU:
+ /*
info = g_new(GnomeUIInfo, 1);
info->type = GNOME_APP_UI_ENDOFINFO;
ext_info->info[0].moreinfo = info;
@@ -264,11 +347,17 @@
ext_info->info[0].label = string;
if (string != NULL)
free(string);
+ */
+ DEBUG( "menu" );
break;
- case GNOME_APP_UI_SEPARATOR:
+ //case GNOME_APP_UI_SEPARATOR:
+ case EGG_MENU_MERGE_SEPARATOR:
+ /*
ext_info->info[0].type = GNOME_APP_UI_SEPARATOR;
+ */
+ DEBUG( "sep" );
break;
default:
@@ -277,9 +366,11 @@
return NULL;
}
+ /*
ext_info->info[0].user_data = ext_info;
ext_info->info[0].pixmap_type = GNOME_APP_PIXMAP_NONE;
ext_info->info[1].type = GNOME_APP_UI_ENDOFINFO;
+ */
scm_protect_object(extension);
@@ -316,6 +407,7 @@
}
}
+#if 0 /* -- unused.*/
void
gnc_add_c_extension(GnomeUIInfo *info, gchar *path)
{
@@ -336,11 +428,10 @@
ext_info->info[0].label = info->label;
ext_info->info[0].hint = info->hint;
ext_info->info[1].type = GNOME_APP_UI_ENDOFINFO;
-
/* need to append so we can run them in order */
extension_list = g_slist_append(extension_list, ext_info);
}
-
+#endif // 0
/* This code is directly copied from libgnomeui's gnome-app-helper.c
* without modifications. */
@@ -496,23 +587,161 @@
app->accel_group, TRUE, pos);
}
+static GString*
+gnc_ext_gen_action_name( gchar *name )
+{
+ //gchar *extName;
+ gchar *extChar;
+ GString *actionName;
+
+ //extName = gnc_extension_name(extInf);
+ actionName = g_string_sized_new( strlen( name ) + 7 );
+
+ // 'Mum & ble' => 'Mumble'
+ for ( extChar = name; *extChar != '\0'; extChar++ ) {
+ if ( ! isalpha( *extChar ) )
+ continue;
+ g_string_append_c( actionName, *extChar );
+ }
+
+ // 'Mumble + 'Action' => 'MumbleAction'
+ g_string_append_printf( actionName, "Action" );
+
+ return actionName;
+}
+
+/**
+ * @return A GTK-2.4-UiManager style path through the applicaiton window for
+ * this specific extension.
+ **/
+static GString*
+gnc_ext_gen_ui_path( ExtensionInfo *extInfo )
+{
+ GString *path;
+ GSList *pathElts;
+
+ path = g_string_new( "" );
+ g_string_append_printf( path, "/menubar/AdditionalMenusPlaceholder" );
+
+ for ( pathElts = gnc_extension_path_elts( extInfo );
+ pathElts; pathElts = pathElts->next ) {
+ GString *eltActionName;
+
+ eltActionName = gnc_ext_gen_action_name( (gchar*)pathElts->data );
+
+ if ( safe_strcmp( (gchar*)pathElts->data, "Main" ) != 0 )
+ {
+ g_string_append_printf( path, "/%s", eltActionName->str );
+ }
+ g_string_free( eltActionName, TRUE );
+ // free the copied-from-scheme strings as we're going over the list.
+ free( pathElts->data );
+ }
+ g_slist_free( pathElts );
+ pathElts = NULL;
+
+ return path;
+}
+
void
-gnc_extensions_menu_setup(GnomeApp * app, gchar *window)
+gnc_extensions_menu_setup( GtkWindow *app, gchar *window, EggMenuMerge *uiMerge )
{
+ //char *windowTmp;
+ //char *pathTmp;
GSList * l = NULL;
ExtensionInfo * info;
- for(l=extension_list; l; l=l->next) {
+ for (l = extension_list; l; l = l->next) {
info = l->data;
- if ((strcmp(info->window, window) != 0) &&
- (strcmp(info->window, WINDOW_NAME_ALL) != 0))
+ if ((strcmp(info->window, window) != 0)
+ && (strcmp(info->window, WINDOW_NAME_ALL) != 0)) {
continue;
- /* fprintf(stderr, "Inserting extension menu at path '%s'\n", info->path); */
- gnc_gnome_app_insert_menus(app, info->path, info->info);
- gnome_app_install_menu_hints(app, info->info);
+ }
+
+ {
+ guint new_merge_id;
+ EggActionGroup *eag;
+ GString *extActionName;
+ GString *extUIPath;
+ gchar *docString;
+ GCallback gcb;
+ //EggMenuMergeType extType;
+
+ extActionName = gnc_ext_gen_action_name( gnc_extension_name(info) );
+ extUIPath = gnc_ext_gen_ui_path( info );
+ docString = gnc_extension_documentation( info );
+
+ DEBUG( "extension [%s]: %s / %s [%s]\n",
+ gnc_extension_name( info ),
+ extUIPath->str, extActionName->str,
+ docString );
+
+ //gnc_extension_path( info->extension, (char**)&windowTmp, (char**)&pathTmp );
+ /*printf( "extension [%s] path: %s:%s\n",
+ gnc_extension_name( info ), windowTmp, pathTmp );*/
+ switch ( gnc_extension_type( info ) )
+ {
+ case EGG_MENU_MERGE_MENUITEM:
+ gcb = G_CALLBACK( gnc_extension_action_cb );
+ break;
+ default:
+ gcb = NULL;
+ break;
+ }
+
+ {
+ //EggMenuMerge *ui_merge;
+ EggActionEntry newEntry[] =
+ {
+ { extActionName->str,
+ gnc_extension_name( info ),
+ NULL,
+ "", // NULL /*FIXME: accel*/,
+ docString,
+ gcb
+ }
+ };
+
+
+ // ui_merge = egg_menu_merge_new();
+
+ eag = egg_action_group_new ("MainWindowActionsN" );
+ egg_action_group_add_actions( eag, newEntry, G_N_ELEMENTS (newEntry), info );
+ egg_menu_merge_insert_action_group( uiMerge, eag, 0 );
+ new_merge_id = egg_menu_merge_new_merge_id( uiMerge );
+
+ {
+ gchar *typeStr;
+
+ switch ( gnc_extension_type( info ) )
+ {
+ case EGG_MENU_MERGE_MENU: typeStr = "menu"; break;
+ case EGG_MENU_MERGE_MENUITEM: typeStr = "menuitem"; break;
+ default: typeStr = "unk"; break;
+ }
+
+ DEBUG( "Adding [%s]/[%s] as [%s]\n",
+ extUIPath->str,
+ extActionName->str,
+ typeStr );
+ }
+
+ egg_menu_merge_add_ui( uiMerge,
+ new_merge_id,
+ extUIPath->str, //"/menubar/AdditionalMenusPlaceholder/ReportAction",
+ extActionName->str, // "BarAction",
+ extActionName->str, // "BarAction",
+ gnc_extension_type( info ), //EGG_MENU_MERGE_MENUITEM,
+ FALSE );
+
+ egg_menu_merge_ensure_update( uiMerge );
+
+ }
+ }
}
}
+#if 0 /* re-add */
void
gnc_extensions_menu_setup_with_data(GnomeApp * app,
gchar *window, gpointer user_data)
@@ -526,10 +755,11 @@
(strcmp(info->window, WINDOW_NAME_ALL) != 0))
continue;
/* fprintf(stderr, "Inserting extension menu/w/d at path '%s'\n", info->path); */
- gnome_app_insert_menus_with_data(app, info->path, info->info, user_data);
- gnome_app_install_menu_hints(app, info->info);
+ /*gnome_app_insert_menus_with_data(app, info->path, info->info, user_data);
+ gnome_app_install_menu_hints(app, info->info); */
}
}
+#endif /* 0; re-add */
void
gnc_extensions_shutdown(void)
@@ -540,3 +770,4 @@
extension_list = NULL;
}
+
--- /dev/null
+++ src/report/report-gnome/gnc-plugin-page-report.h
@@ -0,0 +1,86 @@
+/**
+ * gnc-plugin-page-report.h -- A GncPlugin page for a report.
+ *
+ * Copyright (C) 2004 Joshua Sled
+ * Author: 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
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, contact:
+ *
+ * Free Software Foundation Voice: +1-617-542-5942
+ * 59 Temple Place - Suite 330 Fax: +1-617-542-2652
+ * Boston, MA 02111-1307, USA gnu at gnu.org
+ **/
+
+/** @addtogroup UI
+ @{ */
+/** @file gnc-plugin-page-report.h
+ @brief Report page.
+ @author Copyright (C) 2004 Joshua Sled <jsled at asynchronous.org>
+*/
+
+#ifndef __GNC_PLUGIN_PAGE_REPORT_H
+#define __GNC_PLUGIN_PAGE_REPORT_H
+
+#include <gtk/gtkwindow.h>
+#include "gnc-plugin-page.h"
+
+G_BEGIN_DECLS
+
+/* type macros */
+#define GNC_TYPE_PLUGIN_PAGE_REPORT (gnc_plugin_page_report_get_type ())
+#define GNC_PLUGIN_PAGE_REPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_PAGE_REPORT, GncPluginPageReport))
+#define GNC_PLUGIN_PAGE_REPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE_REPORT, GncPluginPageReportClass))
+#define GNC_IS_PLUGIN_PAGE_REPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_PAGE_REPORT))
+#define GNC_IS_PLUGIN_PAGE_REPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE_REPORT))
+#define GNC_PLUGIN_PAGE_REPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_PAGE_REPORT, GncPluginPageReportClass))
+
+#define GNC_PLUGIN_PAGE_REPORT_NAME "gnc-plugin-page-report"
+
+/* typedefs & structures */
+typedef struct GncPluginPageReportPrivate GncPluginPageReportPrivate;
+
+typedef struct {
+ GncPluginPage parent;
+
+ GncPluginPageReportPrivate *priv;
+} GncPluginPageReport;
+
+typedef struct {
+ GncPluginPageClass parent;
+
+ /* callbacks */
+ /*
+ void (*account_selected) (GncPluginPage *page,
+ Account *account);
+ */
+
+} GncPluginPageReportClass;
+
+/* function prototypes */
+
+/**
+ * @return the type number for an "report" plugin page.
+ **/
+GType gnc_plugin_page_report_get_type( void );
+
+/**
+ * @param reportId The scheme-defined report identifier
+ * @return a new "report" plugin page.
+ */
+GncPluginPage *gnc_plugin_page_report_new( int reportId );
+
+G_END_DECLS
+
+#endif /* __GNC_PLUGIN_PAGE_REPORT_H */
+/** @} */
Index: window-report.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/report-gnome/window-report.c,v
retrieving revision 1.15.4.7
retrieving revision 1.15.4.8
diff -Lsrc/report/report-gnome/window-report.c -Lsrc/report/report-gnome/window-report.c -u -r1.15.4.7 -r1.15.4.8
--- src/report/report-gnome/window-report.c
+++ src/report/report-gnome/window-report.c
@@ -235,6 +235,8 @@
void
gnc_main_window_open_report(int report_id, gint toplevel)
{
+ // [+JSLED] id_name=[id=1]
+ // [+JSLED] url: gnc-report:id=1
char * id_name = g_strdup_printf("id=%d", report_id);
char * child_name = gnc_build_url (URL_TYPE_REPORT, id_name, NULL);
g_free (id_name);
@@ -789,7 +791,7 @@
GtkObject * tlo;
report->mc = mc;
- report->html = gnc_html_new(gnc_ui_get_toplevel());
+ 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;
@@ -923,7 +925,6 @@
child->menu_info = NULL;
}
-
/********************************************************************
* gnc_report_window_destroy
* free and destroy a window
@@ -1008,7 +1009,7 @@
gnc_html *html;
char * location;
- html = gnc_html_new (gnc_ui_get_toplevel());
+ html = gnc_html_new( GTK_WINDOW(gnc_ui_get_toplevel()) );
gnc_set_busy_cursor (NULL, TRUE);
location = g_strdup_printf("id=%d", report_id);
Index: Makefile.am
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/report-gnome/Makefile.am,v
retrieving revision 1.14.4.3
retrieving revision 1.14.4.4
diff -Lsrc/report/report-gnome/Makefile.am -Lsrc/report/report-gnome/Makefile.am -u -r1.14.4.3 -r1.14.4.4
--- src/report/report-gnome/Makefile.am
+++ src/report/report-gnome/Makefile.am
@@ -1,4 +1,6 @@
-SUBDIRS = . test
+SUBDIRS = .
+# test -- removed 'test' from SUBDIRS by jsled 2004.05.02 .. I don't know how
+# to get the test-link-mumble to link correctly; plz assist.
PWD := $(shell pwd)
pkglib_LTLIBRARIES = libgncmod-report-gnome.la libgw-report-gnome.la
@@ -9,6 +11,7 @@
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src/gnome-utils \
+ -I${top_srcdir}/src/gnome \
-I${top_srcdir}/src/app-file \
-I${top_srcdir}/src/report/report-system \
-I${top_srcdir}/lib/egg \
@@ -23,6 +26,7 @@
libgncmod_report_gnome_la_SOURCES = \
dialog-column-view.c \
dialog-style-sheet.c \
+ gnc-plugin-page-report.c \
gncmod-report-gnome.c \
window-report.c
@@ -30,6 +34,7 @@
gncinclude_HEADERS = \
dialog-column-view.h \
dialog-style-sheet.h \
+ gnc-plugin-page-report.h \
window-report.h
libgncmod_report_gnome_la_LDFLAGS = -module
--- /dev/null
+++ src/report/report-gnome/gnc-plugin-page-report.c
@@ -0,0 +1,208 @@
+/* gnc-plugin-page-report.c
+ *
+ * Copyright (C) 2004 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
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, contact:
+ *
+ * Free Software Foundation Voice: +1-617-542-5942
+ * 59 Temple Place - Suite 330 Fax: +1-617-542-2652
+ * Boston, MA 02111-1307, USA gnu at gnu.org
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "egg-menu-merge.h"
+#include "gnc-plugin-page-report.h"
+#include "messages.h"
+#include "gnc-ui-util.h"
+#include "gnc-engine-util.h"
+
+static short module = MOD_GUI;
+
+static GObjectClass *parent_class = NULL;
+static GList *active_pages = NULL;
+
+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 GtkWidget* gnc_plugin_page_report_create_widget( GncPluginPage *plugin_page );
+static void gnc_plugin_page_report_destroy_widget( GncPluginPage *plugin_page );
+static void gnc_plugin_page_report_merge_actions( GncPluginPage *plugin_page, EggMenuMerge *merge );
+static void gnc_plugin_page_report_unmerge_actions( GncPluginPage *plugin_page, EggMenuMerge *merge );
+static void gnc_plugin_page_report_destroy_widget( GncPluginPage *plugin_page );
+
+struct GncPluginPageReportPrivate
+{
+ //ExtensionInfo *extInf;
+};
+
+GType
+gnc_plugin_page_report_get_type (void)
+{
+ static GType gnc_plugin_page_report_type = 0;
+
+ if (gnc_plugin_page_report_type == 0) {
+ static const GTypeInfo our_info = {
+ sizeof (GncPluginPageReportClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) gnc_plugin_page_report_class_init,
+ NULL,
+ NULL,
+ sizeof (GncPluginPageReport),
+ 0,
+ (GInstanceInitFunc) gnc_plugin_page_report_init
+ };
+
+ gnc_plugin_page_report_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
+ "GncPluginPageReport",
+ &our_info, 0);
+ }
+
+ return gnc_plugin_page_report_type;
+}
+
+static void
+gnc_plugin_page_report_class_init (GncPluginPageReportClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GncPluginPageClass *gnc_plugin_page_class = GNC_PLUGIN_PAGE_CLASS(klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = gnc_plugin_page_report_finalize;
+
+ // FIXME: stock reporting icon?
+ //gnc_plugin_page_class->tab_icon = GNC_STOCK_ACCOUNT;
+ gnc_plugin_page_class->plugin_name = GNC_PLUGIN_PAGE_REPORT_NAME;
+
+ gnc_plugin_page_class->create_widget = gnc_plugin_page_report_create_widget;
+ gnc_plugin_page_class->destroy_widget = gnc_plugin_page_report_destroy_widget;
+ gnc_plugin_page_class->merge_actions = gnc_plugin_page_report_merge_actions;
+ gnc_plugin_page_class->unmerge_actions = gnc_plugin_page_report_unmerge_actions;
+
+/* JSLED: report-selected?
+ plugin_page_signals[ACCOUNT_SELECTED] =
+ g_signal_new ("account_selected",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GncPluginPageReportClass, account_selected),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
+*/
+}
+
+static void
+gnc_plugin_page_report_finalize (GObject *object)
+{
+ GncPluginPageReport *page;
+ GncPluginPageReportPrivate *priv;
+
+ ENTER("object %p", object);
+ page = GNC_PLUGIN_PAGE_REPORT (object);
+ g_return_if_fail (GNC_IS_PLUGIN_PAGE_REPORT (page));
+ priv = page->priv;
+ g_return_if_fail (priv != NULL);
+
+ active_pages = g_list_remove (active_pages, page);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+ LEAVE(" ");
+}
+
+static
+GtkWidget*
+gnc_plugin_page_report_create_widget( GncPluginPage *plugin_page )
+{
+ // FIXME: add a notebook tab to the window; display the report.
+ return NULL;
+}
+
+
+static
+void
+gnc_plugin_page_report_destroy_widget( GncPluginPage *plugin_page )
+{
+ // FIXME: cleanup resources.
+}
+
+static
+void
+gnc_plugin_page_report_merge_actions( GncPluginPage *plugin_page,
+ EggMenuMerge *merge )
+{
+ // FIXME: ui-merge
+}
+
+static
+void
+gnc_plugin_page_report_unmerge_actions( GncPluginPage *plugin_page,
+ EggMenuMerge *merge )
+{
+ // FIXME: ui-merge
+}
+
+static void
+gnc_plugin_page_report_init ( GncPluginPageReport *plugin_page )
+{
+ // JSLED: +FIXME
+ //EggActionGroup *action_group;
+ GncPluginPageReportPrivate *priv;
+ GncPluginPage *parent;
+
+ priv = plugin_page->priv = g_new0 (GncPluginPageReportPrivate, 1);
+
+ /* Init parent declared variables */
+ parent = GNC_PLUGIN_PAGE(plugin_page);
+ // FIXME: + _(Report:) + priv->ext->name;
+ parent->title = g_strdup(_("Report"));
+ // FIXME: + _(Report:) + priv->ext->name;
+ parent->tab_name = g_strdup(_("Report"));
+ // FIXME: URI? gnc_report://classs/type ?
+ parent->uri = g_strdup("default:");
+
+ /* change me when the system supports multiple books */
+ gnc_plugin_page_add_book(parent, gnc_get_current_book());
+
+ /* Create menu and toolbar information */
+/*
+ JSLED: FIXME
+ action_group = egg_action_group_new ("GncPluginPageAccountTreeActions");
+ priv->action_group = action_group;
+ egg_action_group_add_actions (action_group,
+ gnc_plugin_page_account_tree_actions,
+ gnc_plugin_page_account_tree_n_actions,
+ plugin_page);
+ gnc_gnome_utils_init_short_names (action_group, short_labels);
+*/
+
+ active_pages = g_list_append (active_pages, plugin_page);
+
+ // JSLED: -FIXME
+}
+
+GncPluginPage*
+gnc_plugin_page_report_new( int reportId )
+{
+ GncPluginPageReport *plugin_page;
+ plugin_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_REPORT, NULL);
+ DEBUG( "creating report with id %d", reportId );
+ return GNC_PLUGIN_PAGE (plugin_page);
+}
+
Index: report-gnome.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/report-gnome/report-gnome.scm,v
retrieving revision 1.9.4.1
retrieving revision 1.9.4.2
diff -Lsrc/report/report-gnome/report-gnome.scm -Lsrc/report/report-gnome/report-gnome.scm -u -r1.9.4.1 -r1.9.4.2
--- src/report/report-gnome/report-gnome.scm
+++ src/report/report-gnome/report-gnome.scm
@@ -51,10 +51,10 @@
(menu-tip (gnc:report-template-menu-tip template))
(item #f))
- (if (not menu-path)
- (set! menu-path '(""))
- (set! menu-path
- (append menu-path '(""))))
+ ;;(if (not menu-path)
+ ;;(set! menu-path '(""))
+ ;;(set! menu-path
+ ;; (append menu-path '(""))))
(set! menu-path (append (list gnc:window-name-main gnc:menuname-reports) menu-path))
@@ -87,26 +87,25 @@
(add-template-menu-item (car item) (cdr item)))
(sort *template-items* sort-templates)))
-
(define (gnc:report-menu-setup)
;; since this menu gets added to every child window, we say it
- ;; comes after the "_Actions" menu.
+ ;; comes after the "_Actions" menu;
(define menu (gnc:make-menu gnc:menuname-reports
- (list gnc:window-name-main "_Actions")))
+ (list gnc:window-name-main)))
(define menu-namer (gnc:new-menu-namer))
(define tax-menu (gnc:make-menu gnc:menuname-taxes
- (list gnc:window-name-main
- gnc:menuname-reports "")))
+ (list gnc:window-name-main gnc:menuname-reports)))
(define income-expense-menu
(gnc:make-menu gnc:menuname-income-expense
- (list gnc:window-name-main gnc:menuname-reports "")))
+ (list gnc:window-name-main gnc:menuname-reports)))
(define asset-liability-menu
(gnc:make-menu gnc:menuname-asset-liability
- (list gnc:window-name-main gnc:menuname-reports "")))
+ (list gnc:window-name-main gnc:menuname-reports)))
(define utility-menu
(gnc:make-menu gnc:menuname-utility
- (list gnc:window-name-main gnc:menuname-reports "")))
+ (list gnc:window-name-main gnc:menuname-reports)))
+ (gnc:warn "report-menu-setup")
(gnc:add-extension menu)
;; (gnc:add-extension tax-menu)
More information about the Gnucash-changes
mailing list