[Gnucash-changes] r14318 - gnucash/trunk - Add gnc_html_copy and enable report pages to copy to clipboard. Fixes

Andreas Köhler andi5 at cvs.gnucash.org
Sun Jun 4 08:23:59 EDT 2006


Author: andi5
Date: 2006-06-04 08:23:58 -0400 (Sun, 04 Jun 2006)
New Revision: 14318
Trac: http://svn.gnucash.org/trac/changeset/14318

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/gnome-utils/gnc-html.c
   gnucash/trunk/src/gnome-utils/gnc-html.h
   gnucash/trunk/src/gnome/gnc-plugin-page-register.c
   gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
Log:
Add gnc_html_copy and enable report pages to copy to clipboard. Fixes
#343645. Readd descriptions for Cut/Copy/Paste actions in register
pages.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-06-04 05:15:08 UTC (rev 14317)
+++ gnucash/trunk/ChangeLog	2006-06-04 12:23:58 UTC (rev 14318)
@@ -1,3 +1,13 @@
+2006-06-04  Andreas Köhler  <andi5.py at gmx.net>
+
+	* src/gnome-utils/gnc-html.[ch]:
+	* src/report/report-gnome/gnc-plugin-page-report.c: Add
+	  gnc_html_copy and enable report pages to copy to clipboard.
+	  Fixes #343645.
+
+	* src/gnome/gnc-plugin-page-register.c: Readd descriptions for
+	  Cut/Copy/Paste actions in register pages.
+
 2006-06-03  Derek Atkins  <derek at ihtfp.com>
 
 	* src/engine/Split.c:

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2006-06-04 05:15:08 UTC (rev 14317)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2006-06-04 12:23:58 UTC (rev 14318)
@@ -171,13 +171,13 @@
 	/* Edit menu */
 
 	{ "EditCutAction", GTK_STOCK_CUT, N_("Cu_t"), NULL,
-	  NULL,
+	  N_("Cut the current selection and copy it to clipboard"),
 	  G_CALLBACK (gnc_plugin_page_register_cmd_cut) },
 	{ "EditCopyAction", GTK_STOCK_COPY, N_("_Copy"), NULL,
-	  NULL,
+	  N_("Copy the current selection to clipboard"),
 	  G_CALLBACK (gnc_plugin_page_register_cmd_copy) },
 	{ "EditPasteAction", GTK_STOCK_PASTE, N_("_Paste"), NULL,
-	  NULL,
+	  N_("Paste the clipboard content at the cursor position"),
 	  G_CALLBACK (gnc_plugin_page_register_cmd_paste) },
 	{ "EditEditAccountAction", GNC_STOCK_EDIT_ACCOUNT, N_("Edit Account"), "<control>e",
 	  N_("Edit the selected account"),

Modified: gnucash/trunk/src/gnome-utils/gnc-html.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-html.c	2006-06-04 05:15:08 UTC (rev 14317)
+++ gnucash/trunk/src/gnome-utils/gnc-html.c	2006-06-04 12:23:58 UTC (rev 14318)
@@ -1267,6 +1267,14 @@
   html->button_cb_data  = data;
 }
 
+void
+gnc_html_copy(gnc_html *html)
+{
+  g_return_if_fail(html);
+
+  gtk_html_copy(GTK_HTML(html->html));
+}
+
 /**************************************************************
  * gnc_html_export : wrapper around the builtin function in gtkhtml
  **************************************************************/

Modified: gnucash/trunk/src/gnome-utils/gnc-html.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-html.h	2006-06-04 05:15:08 UTC (rev 14317)
+++ gnucash/trunk/src/gnome-utils/gnc-html.h	2006-06-04 12:23:58 UTC (rev 14318)
@@ -97,6 +97,7 @@
 void          gnc_html_show_data(gnc_html * html, 
                                  const char * data, int datalen);
 void          gnc_html_reload(gnc_html * html);
+void          gnc_html_copy(gnc_html *html);
 gboolean      gnc_html_export(gnc_html * html, const char *file);
 void          gnc_html_print(gnc_html * html);
 void          gnc_html_cancel(gnc_html * html);

Modified: gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c	2006-06-04 05:15:08 UTC (rev 14317)
+++ gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c	2006-06-04 12:23:58 UTC (rev 14318)
@@ -135,6 +135,7 @@
 static void gnc_plugin_page_report_save_page (GncPluginPage *plugin_page, GKeyFile *file, const gchar *group);
 static GncPluginPage *gnc_plugin_page_report_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group);
 static void gnc_plugin_page_report_name_changed (GncPluginPage *page, const gchar *name);
+static void gnc_plugin_page_report_update_edit_menu (GncPluginPage *page, gboolean hide);
 static gboolean gnc_plugin_page_report_finish_pending (GncPluginPage *page);
 
 static int gnc_plugin_page_report_check_urltype(URLType t);
@@ -162,6 +163,7 @@
 static void gnc_plugin_page_report_export_cb(GtkAction *action, GncPluginPageReport *rep);
 static void gnc_plugin_page_report_options_cb(GtkAction *action, GncPluginPageReport *rep);
 static void gnc_plugin_page_report_print_cb(GtkAction *action, GncPluginPageReport *rep);
+static void gnc_plugin_page_report_copy_cb(GtkAction *action, GncPluginPageReport *rep);
 
 GType
 gnc_plugin_page_report_get_type (void)
@@ -262,6 +264,7 @@
 	gnc_plugin_page_class->save_page       = gnc_plugin_page_report_save_page;
 	gnc_plugin_page_class->recreate_page   = gnc_plugin_page_report_recreate_page;
 	gnc_plugin_page_class->page_name_changed = gnc_plugin_page_report_name_changed;
+	gnc_plugin_page_class->update_edit_menu_actions = gnc_plugin_page_report_update_edit_menu;
 	gnc_plugin_page_class->finish_pending   = gnc_plugin_page_report_finish_pending;
 
 	g_type_class_add_private(klass, sizeof(GncPluginPageReportPrivate));
@@ -854,7 +857,22 @@
   LEAVE(" ");
 }
 
+static void
+gnc_plugin_page_report_update_edit_menu (GncPluginPage *page, gboolean hide)
+{
+  GtkAction *action;
 
+  action = gnc_plugin_page_get_action (page, "EditCopyAction");
+  gtk_action_set_sensitive (action, TRUE);
+  gtk_action_set_visible (action, TRUE);
+  action = gnc_plugin_page_get_action (page, "EditCutAction");
+  gtk_action_set_sensitive (action, FALSE);
+  gtk_action_set_visible (action, !hide);
+  action = gnc_plugin_page_get_action (page, "EditPasteAction");
+  gtk_action_set_sensitive (action, FALSE);
+  gtk_action_set_visible (action, !hide);
+}
+
 static gboolean
 gnc_plugin_page_report_finish_pending (GncPluginPage *page)
 {
@@ -914,6 +932,15 @@
         { "FilePrintAction", GTK_STOCK_PRINT, N_("_Print Report..."), "<control>p",
 	  N_("Print the current report"),
           G_CALLBACK(gnc_plugin_page_report_print_cb) },
+        { "EditCutAction", GTK_STOCK_CUT, N_("Cu_t"), NULL,
+          N_("Cut the current selection and copy it to clipboard"),
+          NULL },
+        { "EditCopyAction", GTK_STOCK_COPY, N_("_Copy"), NULL,
+          N_("Copy the current selection to clipboard"),
+          G_CALLBACK(gnc_plugin_page_report_copy_cb) },
+        { "EditPasteAction", GTK_STOCK_PASTE, N_("_Paste"), NULL,
+          N_("Paste the clipboard content at the cursor position"),
+          NULL },
         { "ReportSaveAction", GTK_STOCK_SAVE, N_("Add _Report"), "", 
 	  N_("Add the current report to the `Custom' menu for later use. "
 	     "The report will be saved in the file ~/.gnucash/saved-reports-2.0. "
@@ -1416,6 +1443,15 @@
         gnc_html_print(priv->html);
 }
 
+static void
+gnc_plugin_page_report_copy_cb(GtkAction *action, GncPluginPageReport *report)
+{
+        GncPluginPageReportPrivate *priv;
+
+        priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+        gnc_html_copy(priv->html);
+}
+
 /********************************************************************
  * gnc_main_window_open_report()
  * open an report in a top level window from an ID number 



More information about the gnucash-changes mailing list