mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Rename all Transaction and Invoice Association identifiers to DocLink.
To better reflect the purpose and for consistency with other software (e.g. Libre Office).
This commit is contained in:
parent
50bf59d62e
commit
db626de68a
@ -30,7 +30,7 @@ set (gnome_utils_SOURCES
|
||||
assistant-xml-encoding.c
|
||||
cursors.c
|
||||
dialog-account.c
|
||||
dialog-assoc-utils.c
|
||||
dialog-doclink-utils.c
|
||||
dialog-book-close.c
|
||||
dialog-commodity.c
|
||||
dialog-dup-trans.c
|
||||
@ -124,7 +124,7 @@ set (gnome_utils_HEADERS
|
||||
account-quickfill.h
|
||||
assistant-xml-encoding.h
|
||||
dialog-account.h
|
||||
dialog-assoc-utils.h
|
||||
dialog-doclink-utils.h
|
||||
dialog-book-close.h
|
||||
dialog-commodity.h
|
||||
dialog-dup-trans.h
|
||||
|
@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* dialog-assoc-utils.c -- Associations dialog Utils *
|
||||
* dialog-doclink-utils.c -- Document link dialog Utils *
|
||||
* Copyright (C) 2020 Robert Fewell *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
@ -25,7 +25,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "dialog-assoc-utils.h"
|
||||
#include "dialog-doclink-utils.h"
|
||||
|
||||
#include "dialog-utils.h"
|
||||
#include "Transaction.h"
|
||||
@ -75,7 +75,7 @@ convert_uri_to_abs_path (const gchar *path_head, const gchar *uri,
|
||||
}
|
||||
|
||||
gchar *
|
||||
gnc_assoc_get_unescape_uri (const gchar *path_head, const gchar *uri, gchar *uri_scheme)
|
||||
gnc_doclink_get_unescape_uri (const gchar *path_head, const gchar *uri, gchar *uri_scheme)
|
||||
{
|
||||
gchar *display_str = NULL;
|
||||
|
||||
@ -100,7 +100,7 @@ gnc_assoc_get_unescape_uri (const gchar *path_head, const gchar *uri, gchar *uri
|
||||
}
|
||||
|
||||
gchar *
|
||||
gnc_assoc_get_use_uri (const gchar *path_head, const gchar *uri, gchar *uri_scheme)
|
||||
gnc_doclink_get_use_uri (const gchar *path_head, const gchar *uri, gchar *uri_scheme)
|
||||
{
|
||||
gchar *use_str = NULL;
|
||||
|
||||
@ -121,11 +121,11 @@ gnc_assoc_get_use_uri (const gchar *path_head, const gchar *uri, gchar *uri_sche
|
||||
}
|
||||
|
||||
gchar *
|
||||
gnc_assoc_get_unescaped_just_uri (const gchar *uri)
|
||||
gnc_doclink_get_unescaped_just_uri (const gchar *uri)
|
||||
{
|
||||
gchar *path_head = gnc_assoc_get_path_head ();
|
||||
gchar *path_head = gnc_doclink_get_path_head ();
|
||||
gchar *uri_scheme = gnc_uri_get_scheme (uri);
|
||||
gchar *ret_uri = gnc_assoc_get_unescape_uri (path_head, uri, uri_scheme);
|
||||
gchar *ret_uri = gnc_doclink_get_unescape_uri (path_head, uri, uri_scheme);
|
||||
|
||||
g_free (path_head);
|
||||
g_free (uri_scheme);
|
||||
@ -133,9 +133,9 @@ gnc_assoc_get_unescaped_just_uri (const gchar *uri)
|
||||
}
|
||||
|
||||
gchar *
|
||||
gnc_assoc_convert_trans_associate_uri (gpointer trans, gboolean book_ro)
|
||||
gnc_doclink_convert_trans_link_uri (gpointer trans, gboolean book_ro)
|
||||
{
|
||||
const gchar *uri = xaccTransGetAssociation (trans); // get the existing uri
|
||||
const gchar *uri = xaccTransGetDocLink (trans); // get the existing uri
|
||||
const gchar *part = NULL;
|
||||
|
||||
if (!uri)
|
||||
@ -153,7 +153,7 @@ gnc_assoc_convert_trans_associate_uri (gpointer trans, gboolean book_ro)
|
||||
part = uri + strlen ("file:");
|
||||
|
||||
if (!xaccTransGetReadOnly (trans) && !book_ro)
|
||||
xaccTransSetAssociation (trans, part);
|
||||
xaccTransSetDocLink (trans, part);
|
||||
|
||||
return g_strdup (part);
|
||||
}
|
||||
@ -163,10 +163,10 @@ gnc_assoc_convert_trans_associate_uri (gpointer trans, gboolean book_ro)
|
||||
/* =================================================================== */
|
||||
|
||||
static gchar *
|
||||
assoc_get_path_head_and_set (gboolean *path_head_set)
|
||||
doclink_get_path_head_and_set (gboolean *path_head_set)
|
||||
{
|
||||
gchar *ret_path = NULL;
|
||||
gchar *path_head = gnc_prefs_get_string (GNC_PREFS_GROUP_GENERAL, "assoc-head");
|
||||
gchar *path_head = gnc_prefs_get_string (GNC_PREFS_GROUP_GENERAL, "doclink-head");
|
||||
*path_head_set = FALSE;
|
||||
|
||||
if (path_head && *path_head) // not default entry
|
||||
@ -191,11 +191,11 @@ assoc_get_path_head_and_set (gboolean *path_head_set)
|
||||
ret_path = g_strdup (folder_with_slash);
|
||||
g_free (folder_with_slash);
|
||||
|
||||
if (*path_head_set) // prior to 3.5, assoc-head could be with or without a trailing '/'
|
||||
if (*path_head_set) // prior to 3.5, doclink-head could be with or without a trailing '/'
|
||||
{
|
||||
if (!gnc_prefs_set_string (GNC_PREFS_GROUP_GENERAL, "assoc-head", ret_path))
|
||||
if (!gnc_prefs_set_string (GNC_PREFS_GROUP_GENERAL, "doclink-head", ret_path))
|
||||
PINFO ("Failed to save preference at %s, %s with %s",
|
||||
GNC_PREFS_GROUP_GENERAL, "assoc-head", ret_path);
|
||||
GNC_PREFS_GROUP_GENERAL, "doclink-head", ret_path);
|
||||
}
|
||||
}
|
||||
g_free (path_head);
|
||||
@ -203,15 +203,15 @@ assoc_get_path_head_and_set (gboolean *path_head_set)
|
||||
}
|
||||
|
||||
gchar *
|
||||
gnc_assoc_get_path_head (void)
|
||||
gnc_doclink_get_path_head (void)
|
||||
{
|
||||
gboolean path_head_set = FALSE;
|
||||
|
||||
return assoc_get_path_head_and_set (&path_head_set);
|
||||
return doclink_get_path_head_and_set (&path_head_set);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_assoc_set_path_head_label (GtkWidget *path_head_label, const gchar *incoming_path_head, const gchar *prefix)
|
||||
gnc_doclink_set_path_head_label (GtkWidget *path_head_label, const gchar *incoming_path_head, const gchar *prefix)
|
||||
{
|
||||
gboolean path_head_set = FALSE;
|
||||
gchar *path_head = NULL;
|
||||
@ -225,10 +225,10 @@ gnc_assoc_set_path_head_label (GtkWidget *path_head_label, const gchar *incoming
|
||||
path_head_set = TRUE;
|
||||
}
|
||||
else
|
||||
path_head = assoc_get_path_head_and_set (&path_head_set);
|
||||
path_head = doclink_get_path_head_and_set (&path_head_set);
|
||||
|
||||
scheme = gnc_uri_get_scheme (path_head);
|
||||
path_head_str = gnc_assoc_get_unescape_uri (NULL, path_head, scheme);
|
||||
path_head_str = gnc_doclink_get_unescape_uri (NULL, path_head, scheme);
|
||||
|
||||
if (path_head_set)
|
||||
{
|
||||
@ -271,14 +271,14 @@ typedef struct
|
||||
const gchar *new_path_head_uri;
|
||||
gboolean change_new;
|
||||
gboolean book_ro;
|
||||
}AssocUpdate;
|
||||
}DoclinkUpdate;
|
||||
|
||||
static void
|
||||
update_invoice_uri (QofInstance* data, gpointer user_data)
|
||||
{
|
||||
AssocUpdate *assoc_update = user_data;
|
||||
DoclinkUpdate *doclink_update = user_data;
|
||||
GncInvoice *invoice = GNC_INVOICE(data);
|
||||
const gchar* uri = gncInvoiceGetAssociation (invoice);
|
||||
const gchar* uri = gncInvoiceGetDocLink (invoice);
|
||||
|
||||
if (uri && *uri)
|
||||
{
|
||||
@ -289,22 +289,22 @@ update_invoice_uri (QofInstance* data, gpointer user_data)
|
||||
rel = TRUE;
|
||||
|
||||
// check for relative and we want to change them
|
||||
if (rel && assoc_update->change_old)
|
||||
if (rel && doclink_update->change_old)
|
||||
{
|
||||
gchar *new_uri = gnc_assoc_get_use_uri (assoc_update->old_path_head_uri, uri, scheme);
|
||||
gncInvoiceSetAssociation (invoice, new_uri);
|
||||
gchar *new_uri = gnc_doclink_get_use_uri (doclink_update->old_path_head_uri, uri, scheme);
|
||||
gncInvoiceSetDocLink (invoice, new_uri);
|
||||
g_free (new_uri);
|
||||
}
|
||||
g_free (scheme);
|
||||
|
||||
// check for not relative and we want to change them
|
||||
if (!rel && assoc_update->change_new && g_str_has_prefix (uri, assoc_update->new_path_head_uri))
|
||||
if (!rel && doclink_update->change_new && g_str_has_prefix (uri, doclink_update->new_path_head_uri))
|
||||
{
|
||||
// relative paths do not start with a '/'
|
||||
const gchar *part = uri + strlen (assoc_update->new_path_head_uri);
|
||||
const gchar *part = uri + strlen (doclink_update->new_path_head_uri);
|
||||
gchar *new_uri = g_strdup (part);
|
||||
|
||||
gncInvoiceSetAssociation (invoice, new_uri);
|
||||
gncInvoiceSetDocLink (invoice, new_uri);
|
||||
g_free (new_uri);
|
||||
}
|
||||
}
|
||||
@ -313,12 +313,12 @@ update_invoice_uri (QofInstance* data, gpointer user_data)
|
||||
static void
|
||||
update_trans_uri (QofInstance* data, gpointer user_data)
|
||||
{
|
||||
AssocUpdate *assoc_update = user_data;
|
||||
DoclinkUpdate *doclink_update = user_data;
|
||||
Transaction *trans = GNC_TRANSACTION(data);
|
||||
gchar *uri;
|
||||
|
||||
// fix an earlier error when storing relative paths before version 3.5
|
||||
uri = gnc_assoc_convert_trans_associate_uri (trans, assoc_update->book_ro);
|
||||
uri = gnc_doclink_convert_trans_link_uri (trans, doclink_update->book_ro);
|
||||
|
||||
if (uri && *uri)
|
||||
{
|
||||
@ -329,26 +329,26 @@ update_trans_uri (QofInstance* data, gpointer user_data)
|
||||
rel = TRUE;
|
||||
|
||||
// check for relative and we want to change them
|
||||
if (rel && assoc_update->change_old)
|
||||
if (rel && doclink_update->change_old)
|
||||
{
|
||||
gchar *new_uri = gnc_assoc_get_use_uri (assoc_update->old_path_head_uri, uri, scheme);
|
||||
gchar *new_uri = gnc_doclink_get_use_uri (doclink_update->old_path_head_uri, uri, scheme);
|
||||
|
||||
if (!xaccTransGetReadOnly (trans))
|
||||
xaccTransSetAssociation (trans, new_uri);
|
||||
xaccTransSetDocLink (trans, new_uri);
|
||||
|
||||
g_free (new_uri);
|
||||
}
|
||||
g_free (scheme);
|
||||
|
||||
// check for not relative and we want to change them
|
||||
if (!rel && assoc_update->change_new && g_str_has_prefix (uri, assoc_update->new_path_head_uri))
|
||||
if (!rel && doclink_update->change_new && g_str_has_prefix (uri, doclink_update->new_path_head_uri))
|
||||
{
|
||||
// relative paths do not start with a '/'
|
||||
const gchar *part = uri + strlen (assoc_update->new_path_head_uri);
|
||||
const gchar *part = uri + strlen (doclink_update->new_path_head_uri);
|
||||
gchar *new_uri = g_strdup (part);
|
||||
|
||||
if (!xaccTransGetReadOnly (trans))
|
||||
xaccTransSetAssociation (trans, new_uri);
|
||||
xaccTransSetDocLink (trans, new_uri);
|
||||
|
||||
g_free (new_uri);
|
||||
}
|
||||
@ -362,33 +362,33 @@ change_relative_and_absolute_uri_paths (const gchar *old_path_head_uri, gboolean
|
||||
{
|
||||
QofBook *book = gnc_get_current_book();
|
||||
gboolean book_ro = qof_book_is_readonly (book);
|
||||
AssocUpdate *assoc_update;
|
||||
DoclinkUpdate *doclink_update;
|
||||
|
||||
/* if book is read only, nothing to do */
|
||||
if (book_ro)
|
||||
return;
|
||||
|
||||
assoc_update = g_new0 (AssocUpdate, 1);
|
||||
doclink_update = g_new0 (DoclinkUpdate, 1);
|
||||
|
||||
assoc_update->old_path_head_uri = old_path_head_uri;
|
||||
assoc_update->new_path_head_uri = new_path_head_uri;
|
||||
assoc_update->change_old = change_old;
|
||||
assoc_update->change_new = change_new;
|
||||
assoc_update->book_ro = book_ro;
|
||||
doclink_update->old_path_head_uri = old_path_head_uri;
|
||||
doclink_update->new_path_head_uri = new_path_head_uri;
|
||||
doclink_update->change_old = change_old;
|
||||
doclink_update->change_new = change_new;
|
||||
doclink_update->book_ro = book_ro;
|
||||
|
||||
/* Loop through the transactions */
|
||||
qof_collection_foreach (qof_book_get_collection (book, GNC_ID_TRANS),
|
||||
update_trans_uri, assoc_update);
|
||||
update_trans_uri, doclink_update);
|
||||
|
||||
/* Loop through the invoices */
|
||||
qof_collection_foreach (qof_book_get_collection (book, GNC_ID_INVOICE),
|
||||
update_invoice_uri, assoc_update);
|
||||
update_invoice_uri, doclink_update);
|
||||
|
||||
g_free (assoc_update);
|
||||
g_free (doclink_update);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_assoc_pref_path_head_changed (GtkWindow *parent, const gchar *old_path_head_uri)
|
||||
gnc_doclink_pref_path_head_changed (GtkWindow *parent, const gchar *old_path_head_uri)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkBuilder *builder;
|
||||
@ -396,7 +396,7 @@ gnc_assoc_pref_path_head_changed (GtkWindow *parent, const gchar *old_path_head_
|
||||
GtkWidget *old_head_label, *new_head_label;
|
||||
GtkWidget *old_hbox, *new_hbox;
|
||||
gint result;
|
||||
gchar *new_path_head_uri = gnc_assoc_get_path_head ();
|
||||
gchar *new_path_head_uri = gnc_doclink_get_path_head ();
|
||||
|
||||
if (g_strcmp0 (old_path_head_uri, new_path_head_uri) == 0)
|
||||
{
|
||||
@ -406,15 +406,15 @@ gnc_assoc_pref_path_head_changed (GtkWindow *parent, const gchar *old_path_head_
|
||||
|
||||
/* Create the dialog box */
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder, "dialog-assoc.glade", "association_path_head_changed_dialog");
|
||||
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "association_path_head_changed_dialog"));
|
||||
gnc_builder_add_from_file (builder, "dialog-doclink.glade", "link_path_head_changed_dialog");
|
||||
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "link_path_head_changed_dialog"));
|
||||
|
||||
if (parent != NULL)
|
||||
gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent));
|
||||
|
||||
// Set the name and style context for this widget so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-association-change");
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(dialog), "gnc-class-association");
|
||||
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-doclink-change");
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(dialog), "gnc-class-doclink");
|
||||
|
||||
old_head_label = GTK_WIDGET(gtk_builder_get_object (builder, "existing_path_head"));
|
||||
new_head_label = GTK_WIDGET(gtk_builder_get_object (builder, "new_path_head"));
|
||||
@ -423,8 +423,8 @@ gnc_assoc_pref_path_head_changed (GtkWindow *parent, const gchar *old_path_head_
|
||||
use_new_path_head = GTK_WIDGET(gtk_builder_get_object (builder, "use_new_path_head"));
|
||||
|
||||
// display path head text and test if present
|
||||
gnc_assoc_set_path_head_label (old_head_label, old_path_head_uri, _("Existing"));
|
||||
gnc_assoc_set_path_head_label (new_head_label, new_path_head_uri, _("New"));
|
||||
gnc_doclink_set_path_head_label (old_head_label, old_path_head_uri, _("Existing"));
|
||||
gnc_doclink_set_path_head_label (new_head_label, new_path_head_uri, _("New"));
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
g_object_unref (G_OBJECT(builder));
|
@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* dialog-assoc-utils.h -- Associations dialog Utils *
|
||||
* dialog-doclink-utils.h -- Document link dialog Utils *
|
||||
* Copyright (C) 2020 Robert Fewell *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
@ -20,21 +20,21 @@
|
||||
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef DIALOG_ASSOC_UTILS_H
|
||||
#define DIALOG_ASSOC_UTILS_H
|
||||
#ifndef DIALOG_DOCLINK_UTILS_H
|
||||
#define DIALOG_DOCLINK_UTILS_H
|
||||
|
||||
/** Return the current associate path head uri.
|
||||
/** Return the current documentation-link file path head uri.
|
||||
*
|
||||
* This function will get the current associate path head from pref's.
|
||||
* This function will get the current documentation-link path head from prefs.
|
||||
* If it is not set then a default path head is set based on either
|
||||
* the home directory or the user data directory.
|
||||
*
|
||||
* The calling function should free the returned value with g_free when
|
||||
* the it is no longer needed.
|
||||
*
|
||||
* @return The current associate path head.
|
||||
* @return The current documentation-link file path head.
|
||||
*/
|
||||
gchar * gnc_assoc_get_path_head (void);
|
||||
gchar * gnc_doclink_get_path_head (void);
|
||||
|
||||
/** Sets the label text for displaying the path head in a dialog.
|
||||
*
|
||||
@ -42,9 +42,9 @@ gchar * gnc_assoc_get_path_head (void);
|
||||
* @param incoming_path_head The starting common path head
|
||||
* @param prefix A text string to place infront of the path head text
|
||||
*/
|
||||
void gnc_assoc_set_path_head_label (GtkWidget *path_head_label,
|
||||
const gchar *incoming_path_head,
|
||||
const gchar *prefix);
|
||||
void gnc_doclink_set_path_head_label (GtkWidget *path_head_label,
|
||||
const gchar *incoming_path_head,
|
||||
const gchar *prefix);
|
||||
|
||||
/** Return a uri that can be used for opening it.
|
||||
*
|
||||
@ -55,23 +55,23 @@ void gnc_assoc_set_path_head_label (GtkWidget *path_head_label,
|
||||
* otherwise the uri is returned.
|
||||
*
|
||||
* @param path_head The starting common path head
|
||||
* @param uri The association
|
||||
* @param uri_scheme
|
||||
* @param uri The document link URI
|
||||
* @param uri_scheme http:, https:, or file:
|
||||
*
|
||||
* @return The uri used for opening the association.
|
||||
* @return The uri used for opening the link.
|
||||
*/
|
||||
gchar * gnc_assoc_get_use_uri (const gchar *path_head, const gchar *uri, gchar *uri_scheme);
|
||||
gchar * gnc_doclink_get_use_uri (const gchar *path_head, const gchar *uri, gchar *uri_scheme);
|
||||
|
||||
/** Corrects an earlier relative file association forrmat.
|
||||
/** Corrects an earlier relative file documentation link uri forrmat.
|
||||
*
|
||||
* Prior to version 3.5, relative paths were stored starting as 'file:'
|
||||
* or 'file:/' depending on OS. This function changes them so that
|
||||
* relative paths are stored without a leading "/" and in native form.
|
||||
*
|
||||
* @param trans The Transaction holding the association
|
||||
* @param trans The Transaction holding the document link
|
||||
* @param book_ro TRUE if the book is read only
|
||||
*/
|
||||
gchar * gnc_assoc_convert_trans_associate_uri (gpointer trans, gboolean book_ro);
|
||||
gchar * gnc_doclink_convert_trans_link_uri (gpointer trans, gboolean book_ro);
|
||||
|
||||
/** Return an unescaped uri for display use.
|
||||
*
|
||||
@ -82,12 +82,12 @@ gchar * gnc_assoc_convert_trans_associate_uri (gpointer trans, gboolean book_ro)
|
||||
* '/' to '\' to look like a traditional windows path
|
||||
*
|
||||
* @param path_head The starting common path head
|
||||
* @param uri The association
|
||||
* @param uri The document link
|
||||
* @param uri_scheme
|
||||
*
|
||||
* @return The unescaped uri used for display purposes.
|
||||
*/
|
||||
gchar * gnc_assoc_get_unescape_uri (const gchar *path_head, const gchar *uri, gchar *uri_scheme);
|
||||
gchar * gnc_doclink_get_unescape_uri (const gchar *path_head, const gchar *uri, gchar *uri_scheme);
|
||||
|
||||
/** Return an unescaped uri for display use just based on the uri.
|
||||
*
|
||||
@ -97,22 +97,22 @@ gchar * gnc_assoc_get_unescape_uri (const gchar *path_head, const gchar *uri, gc
|
||||
* Return an unesacped uri for displaying and if OS is windows change the
|
||||
* '/' to '\' to look like a traditional windows path
|
||||
*
|
||||
* @param uri The association
|
||||
* @param uri The document link
|
||||
*
|
||||
* @return The unescaped uri used for display purposes.
|
||||
*/
|
||||
gchar * gnc_assoc_get_unescaped_just_uri (const gchar *uri);
|
||||
gchar * gnc_doclink_get_unescaped_just_uri (const gchar *uri);
|
||||
|
||||
/** Presents a dialog when the path head is changed.
|
||||
*
|
||||
* When the path head is changed a dialog is raised that allows for
|
||||
* existing relative file associations to be made absolute based on the
|
||||
* old_path_head_uri and existing absolute file associations to be made
|
||||
* existing relative file document links to be made absolute based on the
|
||||
* old_path_head_uri and existing absolute file document links to be made
|
||||
* relative based on the new_path_head_uri.
|
||||
*
|
||||
* @param parent The GtkWindow for the parent widget
|
||||
* @param old_path_head_uri The old path head uri
|
||||
*/
|
||||
void gnc_assoc_pref_path_head_changed (GtkWindow *parent, const gchar *old_path_head_uri);
|
||||
void gnc_doclink_pref_path_head_changed (GtkWindow *parent, const gchar *old_path_head_uri);
|
||||
|
||||
#endif
|
@ -45,14 +45,14 @@ typedef struct
|
||||
GtkWidget * date_edit;
|
||||
GtkWidget * num_edit;
|
||||
GtkWidget * tnum_edit;
|
||||
GtkWidget * assoc_edit;
|
||||
GtkWidget * link_edit;
|
||||
|
||||
GtkWidget *duplicate_title_label; // GtkLabel
|
||||
GtkWidget *duplicate_table; // GtkTable
|
||||
GtkWidget *date_label; // GtkLabel
|
||||
GtkWidget *num_label; // GtkLabel
|
||||
GtkWidget *tnum_label; // GtkLabel
|
||||
GtkWidget *assoc_label; //GtkLabel
|
||||
GtkWidget *link_label; //GtkLabel
|
||||
} DupTransDialog;
|
||||
|
||||
/* Parses the string value and returns true if it is a
|
||||
@ -172,10 +172,10 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
|
||||
else
|
||||
gtk_entry_set_text (GTK_ENTRY (tnum_spin), "");
|
||||
}
|
||||
/* Transaction Association */
|
||||
/* Transaction Linked Document */
|
||||
{
|
||||
dt_dialog->assoc_label = GTK_WIDGET(gtk_builder_get_object (builder, "assoc_label"));
|
||||
dt_dialog->assoc_edit = GTK_WIDGET(gtk_builder_get_object (builder, "assoc_check_button"));
|
||||
dt_dialog->link_label = GTK_WIDGET(gtk_builder_get_object (builder, "link_label"));
|
||||
dt_dialog->link_edit = GTK_WIDGET(gtk_builder_get_object (builder, "link_check_button"));
|
||||
}
|
||||
|
||||
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, dt_dialog);
|
||||
@ -189,7 +189,7 @@ gnc_dup_trans_dialog_internal (GtkWidget * parent,
|
||||
gboolean show_date, time64 *date_p,
|
||||
GDate *gdate_p, const char *num, char **out_num,
|
||||
const char *tnum, char **out_tnum,
|
||||
const char *tassoc, char **out_tassoc)
|
||||
const char *tlink, char **out_tlink)
|
||||
{
|
||||
DupTransDialog *dt_dialog;
|
||||
GtkWidget *entry;
|
||||
@ -256,15 +256,15 @@ gnc_dup_trans_dialog_internal (GtkWidget * parent,
|
||||
gtk_entry_set_activates_default(GTK_ENTRY(dt_dialog->tnum_edit), TRUE);
|
||||
}
|
||||
|
||||
if (tassoc)
|
||||
if (tlink)
|
||||
{
|
||||
gtk_widget_set_visible(dt_dialog->assoc_label, TRUE);
|
||||
gtk_widget_set_visible(dt_dialog->assoc_edit, TRUE);
|
||||
gtk_widget_set_visible(dt_dialog->link_label, TRUE);
|
||||
gtk_widget_set_visible(dt_dialog->link_edit, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_visible(dt_dialog->assoc_label, FALSE);
|
||||
gtk_widget_set_visible(dt_dialog->assoc_edit, FALSE);
|
||||
gtk_widget_set_visible(dt_dialog->link_label, FALSE);
|
||||
gtk_widget_set_visible(dt_dialog->link_edit, FALSE);
|
||||
}
|
||||
|
||||
result = gtk_dialog_run (GTK_DIALOG (dt_dialog->dialog));
|
||||
@ -279,10 +279,10 @@ gnc_dup_trans_dialog_internal (GtkWidget * parent,
|
||||
*out_num = g_strdup (gtk_entry_get_text (GTK_ENTRY (dt_dialog->num_edit)));
|
||||
if (tnum)
|
||||
*out_tnum = g_strdup (gtk_entry_get_text (GTK_ENTRY (dt_dialog->tnum_edit)));
|
||||
if (tassoc)
|
||||
if (tlink)
|
||||
{
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dt_dialog->assoc_edit)))
|
||||
*out_tassoc = g_strdup (tassoc);
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dt_dialog->link_edit)))
|
||||
*out_tlink = g_strdup (tlink);
|
||||
}
|
||||
ok = TRUE;
|
||||
}
|
||||
@ -299,10 +299,10 @@ gboolean
|
||||
gnc_dup_trans_dialog (GtkWidget * parent, const char* title, gboolean show_date,
|
||||
time64 *date_p, const char *num, char **out_num,
|
||||
const char *tnum, char **out_tnum,
|
||||
const char *tassoc, char **out_tassoc)
|
||||
const char *tlink, char **out_tlink)
|
||||
{
|
||||
return gnc_dup_trans_dialog_internal(parent, NULL, title, show_date, date_p, NULL,
|
||||
num, out_num, tnum, out_tnum, tassoc, out_tassoc);
|
||||
num, out_num, tnum, out_tnum, tlink, out_tlink);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -77,7 +77,7 @@
|
||||
#include "gnc-ui-util.h"
|
||||
#include "gnc-component-manager.h"
|
||||
#include "dialog-preferences.h"
|
||||
#include "dialog-assoc-utils.h"
|
||||
#include "dialog-doclink-utils.h"
|
||||
|
||||
#define DIALOG_PREFERENCES_CM_CLASS "dialog-newpreferences"
|
||||
#define GNC_PREFS_GROUP "dialogs.preferences"
|
||||
@ -752,7 +752,7 @@ file_chooser_selected_cb (GtkFileChooser *fc, gpointer user_data)
|
||||
const gchar *group = g_object_get_data (G_OBJECT(fc), "group");
|
||||
const gchar *pref = g_object_get_data (G_OBJECT(fc), "pref");
|
||||
gchar *folder_uri = gtk_file_chooser_get_uri (fc);
|
||||
gchar *old_path_head_uri = gnc_assoc_get_path_head ();
|
||||
gchar *old_path_head_uri = gnc_doclink_get_path_head ();
|
||||
|
||||
// make sure path_head ends with a trailing '/', 3.5 onwards
|
||||
if (!g_str_has_suffix (folder_uri, "/"))
|
||||
@ -768,9 +768,10 @@ file_chooser_selected_cb (GtkFileChooser *fc, gpointer user_data)
|
||||
if (!gnc_prefs_set_string (group, pref, folder_uri))
|
||||
PINFO("Failed to save preference at %s, %s with %s", group, pref, folder_uri);
|
||||
else
|
||||
gnc_assoc_pref_path_head_changed (GTK_WINDOW(gtk_widget_get_toplevel (
|
||||
GTK_WIDGET(fc))), old_path_head_uri);
|
||||
|
||||
gnc_doclink_pref_path_head_changed (
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (fc))),
|
||||
old_path_head_uri);
|
||||
|
||||
g_free (old_path_head_uri);
|
||||
g_free (folder_uri);
|
||||
}
|
||||
@ -821,7 +822,7 @@ gnc_prefs_connect_file_chooser_button (GtkFileChooserButton *fcb, const gchar *b
|
||||
gtk_widget_hide (GTK_WIDGET(image));
|
||||
else
|
||||
{
|
||||
gchar *path_head = gnc_assoc_get_unescape_uri (NULL, uri, "file");
|
||||
gchar *path_head = gnc_doclink_get_unescape_uri (NULL, uri, "file");
|
||||
gchar *ttip = g_strconcat (_("Path does not exist, "), path_head, NULL);
|
||||
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET(image), ttip);
|
||||
@ -862,7 +863,7 @@ file_chooser_clear_cb (GtkButton *button, gpointer user_data)
|
||||
GtkWidget *box;
|
||||
GtkWidget *fcb_new;
|
||||
gchar *boxname;
|
||||
gchar *old_path_head_uri = gnc_assoc_get_path_head ();
|
||||
gchar *old_path_head_uri = gnc_doclink_get_path_head ();
|
||||
|
||||
/* We need to destroy the GtkFileChooserButton and recreate as there
|
||||
does not seem to be away of resetting the folder path to NONE */
|
||||
@ -872,8 +873,9 @@ file_chooser_clear_cb (GtkButton *button, gpointer user_data)
|
||||
if (!gnc_prefs_set_string (group, pref, ""))
|
||||
PINFO("Failed to Clear preference at %s, %s", group, pref);
|
||||
else
|
||||
gnc_assoc_pref_path_head_changed (GTK_WINDOW(gtk_widget_get_toplevel (
|
||||
GTK_WIDGET(fcb))), old_path_head_uri);
|
||||
gnc_doclink_pref_path_head_changed (
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (fcb))),
|
||||
old_path_head_uri);
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET(fcb));
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "gnc-splash.h"
|
||||
#include "gnc-window.h"
|
||||
#include "gnc-icons.h"
|
||||
#include "dialog-assoc-utils.h"
|
||||
#include "dialog-doclink-utils.h"
|
||||
#include "dialog-options.h"
|
||||
#include "dialog-commodity.h"
|
||||
#include "dialog-totd.h"
|
||||
@ -437,13 +437,13 @@ gnc_gnome_help (const char *file_name, const char *anchor)
|
||||
* toolkit.
|
||||
*/
|
||||
void
|
||||
gnc_launch_assoc (GtkWindow *parent, const char *uri)
|
||||
gnc_launch_doclink (GtkWindow *parent, const char *uri)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSString *uri_str = [NSString stringWithUTF8String: uri];
|
||||
NSURL *url = [[[NSURL alloc] initWithString: uri_str] autorelease];
|
||||
const gchar *message =
|
||||
_("GnuCash could not find the associated file.");
|
||||
_("GnuCash could not find the linked document.");
|
||||
|
||||
if (url)
|
||||
{
|
||||
@ -459,7 +459,7 @@ gnc_launch_assoc (GtkWindow *parent, const char *uri)
|
||||
}
|
||||
#elif defined G_OS_WIN32 /* G_OS_WIN32 */
|
||||
void
|
||||
gnc_launch_assoc (GtkWindow *parent, const char *uri)
|
||||
gnc_launch_doclink (GtkWindow *parent, const char *uri)
|
||||
{
|
||||
wchar_t *winuri = NULL;
|
||||
gchar *filename = NULL;
|
||||
@ -468,7 +468,7 @@ gnc_launch_assoc (GtkWindow *parent, const char *uri)
|
||||
if (gnc_uri_is_file_uri (uri))
|
||||
{
|
||||
gchar *uri_scheme = gnc_uri_get_scheme (uri);
|
||||
filename = gnc_assoc_get_unescape_uri (NULL, uri, uri_scheme);
|
||||
filename = gnc_doclink_get_unescape_uri (NULL, uri, uri_scheme);
|
||||
winuri = (wchar_t *)g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
|
||||
g_free (uri_scheme);
|
||||
}
|
||||
@ -483,7 +483,7 @@ gnc_launch_assoc (GtkWindow *parent, const char *uri)
|
||||
NULL, NULL, SW_SHOWNORMAL) <= 32)
|
||||
{
|
||||
const gchar *message =
|
||||
_("GnuCash could not find the associated file.");
|
||||
_("GnuCash could not find the linked document.");
|
||||
gnc_error_dialog (parent, "%s:\n%s", message, filename);
|
||||
}
|
||||
g_free (wincmd);
|
||||
@ -494,7 +494,7 @@ gnc_launch_assoc (GtkWindow *parent, const char *uri)
|
||||
|
||||
#else
|
||||
void
|
||||
gnc_launch_assoc (GtkWindow *parent, const char *uri)
|
||||
gnc_launch_doclink (GtkWindow *parent, const char *uri)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
@ -513,12 +513,12 @@ gnc_launch_assoc (GtkWindow *parent, const char *uri)
|
||||
{
|
||||
gchar *error_uri = NULL;
|
||||
const gchar *message =
|
||||
_("GnuCash could not open the associated file:");
|
||||
_("GnuCash could not open the linked document:");
|
||||
|
||||
if (gnc_uri_is_file_uri (uri))
|
||||
{
|
||||
gchar *uri_scheme = gnc_uri_get_scheme (uri);
|
||||
error_uri = gnc_assoc_get_unescape_uri (NULL, uri, uri_scheme);
|
||||
error_uri = gnc_doclink_get_unescape_uri (NULL, uri, uri_scheme);
|
||||
g_free (uri_scheme);
|
||||
}
|
||||
else
|
||||
|
@ -61,7 +61,7 @@ void gnc_gnome_help (const char *file_name,
|
||||
const char *anchor);
|
||||
/** Launch the default browser and open the provided URI.
|
||||
*/
|
||||
void gnc_launch_assoc (GtkWindow *parent, const char *uri);
|
||||
void gnc_launch_doclink (GtkWindow *parent, const char *uri);
|
||||
|
||||
/** Set the help callback to 'gnc_book_options_help_cb' to open a help browser
|
||||
* and point it to the Book Options link in the Help file.
|
||||
|
@ -4490,7 +4490,7 @@ get_file_strsplit (const gchar *partial)
|
||||
static gboolean
|
||||
url_signal_cb (GtkAboutDialog *dialog, gchar *uri, gpointer data)
|
||||
{
|
||||
gnc_launch_assoc (GTK_WINDOW(dialog), uri);
|
||||
gnc_launch_doclink (GTK_WINDOW(dialog), uri);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1314,7 +1314,7 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
|
||||
const char *in_tnum = NULL;
|
||||
char *out_num;
|
||||
char *out_tnum;
|
||||
char *out_tassoc = NULL;
|
||||
char *out_tdoclink = NULL;
|
||||
time64 date;
|
||||
gboolean use_autoreadonly = qof_book_uses_autoreadonly (gnc_get_current_book());
|
||||
|
||||
@ -1337,7 +1337,7 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
|
||||
|
||||
if (!gnc_dup_trans_dialog (GTK_WIDGET (window), NULL, TRUE,
|
||||
&date, in_num, &out_num, in_tnum, &out_tnum,
|
||||
xaccTransGetAssociation (trans), &out_tassoc))
|
||||
xaccTransGetDocLink (trans), &out_tdoclink))
|
||||
{
|
||||
LEAVE("dup cancelled");
|
||||
return FALSE;
|
||||
@ -1382,11 +1382,11 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
|
||||
* because otherwise the ordering is not deterministic */
|
||||
xaccTransSetDateEnteredSecs(new_trans, gnc_time(NULL));
|
||||
|
||||
/* clear the associated entry if returned value NULL */
|
||||
if (out_tassoc == NULL)
|
||||
xaccTransSetAssociation (new_trans, "");
|
||||
/* clear the linked document entry if returned value NULL */
|
||||
if (out_tdoclink == NULL)
|
||||
xaccTransSetDocLink (new_trans, "");
|
||||
else
|
||||
g_free (out_tassoc);
|
||||
g_free (out_tdoclink);
|
||||
|
||||
/* set per book option */
|
||||
gnc_set_num_action (new_trans, NULL, out_num, out_tnum);
|
||||
@ -2171,9 +2171,9 @@ gnc_tree_control_auto_complete (GncTreeViewSplitReg *view, Transaction *trans,
|
||||
if (g_strcmp0 (text, new_text) == 0)
|
||||
{
|
||||
xaccTransCopyOnto (trans_from, trans);
|
||||
/* if there is an association, lets clear it */
|
||||
if (xaccTransGetAssociation (trans_from) != NULL)
|
||||
xaccTransSetAssociation (trans, "");
|
||||
/* if there is a doclink, lets clear it */
|
||||
if (xaccTransGetDocLink (trans_from) != NULL)
|
||||
xaccTransSetDocLink (trans, "");
|
||||
g_free (text);
|
||||
break;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ set (gnc_gnome_noinst_HEADERS
|
||||
business-options-gnome.h
|
||||
business-urls.h
|
||||
business-gnome-utils.h
|
||||
dialog-assoc.h
|
||||
dialog-doclink.h
|
||||
dialog-billterms.h
|
||||
dialog-choose-owner.h
|
||||
dialog-customer.h
|
||||
@ -75,7 +75,7 @@ set (gnc_gnome_SOURCES
|
||||
business-options-gnome.c
|
||||
business-urls.c
|
||||
business-gnome-utils.c
|
||||
dialog-assoc.c
|
||||
dialog-doclink.c
|
||||
dialog-billterms.c
|
||||
dialog-choose-owner.c
|
||||
dialog-commodities.c
|
||||
|
@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* dialog-assoc.c -- Associations dialog *
|
||||
* dialog-doclink.c -- Document link dialog *
|
||||
* Copyright (C) 2020 Robert Fewell *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
@ -25,8 +25,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "dialog-assoc.h"
|
||||
#include "dialog-assoc-utils.h"
|
||||
#include "dialog-doclink.h"
|
||||
#include "dialog-doclink-utils.h"
|
||||
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-component-manager.h"
|
||||
@ -45,12 +45,12 @@
|
||||
#include "Account.h"
|
||||
#include "dialog-invoice.h"
|
||||
|
||||
#define DIALOG_ASSOC_CM_CLASS "dialog-assoc"
|
||||
#define GNC_PREFS_GROUP_BUS "dialogs.business-assoc"
|
||||
#define GNC_PREFS_GROUP_TRANS "dialogs.trans-assoc"
|
||||
#define DIALOG_DOCLINK_CM_CLASS "dialog-doclink"
|
||||
#define GNC_PREFS_GROUP_BUS "dialogs.business-doclink"
|
||||
#define GNC_PREFS_GROUP_TRANS "dialogs.trans-doclink"
|
||||
|
||||
/** Enumeration for the tree-store */
|
||||
enum GncAssocColumn
|
||||
enum GncDoclinkColumn
|
||||
{
|
||||
DATE_ITEM,
|
||||
DATE_INT64, // used just for sorting date_trans
|
||||
@ -76,7 +76,7 @@ typedef struct
|
||||
GtkTreeModel *model;
|
||||
gint component_id;
|
||||
QofSession *session;
|
||||
}AssocDialog;
|
||||
}DoclinkDialog;
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
static QofLogModule log_module = GNC_MOD_GUI;
|
||||
@ -84,20 +84,20 @@ static QofLogModule log_module = GNC_MOD_GUI;
|
||||
/* =================================================================== */
|
||||
|
||||
void
|
||||
gnc_assoc_open_uri (GtkWindow *parent, const gchar *uri)
|
||||
gnc_doclink_open_uri (GtkWindow *parent, const gchar *uri)
|
||||
{
|
||||
if (uri && *uri)
|
||||
{
|
||||
gchar *scheme = gnc_uri_get_scheme (uri);
|
||||
gchar *path_head = gnc_assoc_get_path_head ();
|
||||
gchar *run_uri = gnc_assoc_get_use_uri (path_head, uri, scheme);
|
||||
gchar *path_head = gnc_doclink_get_path_head ();
|
||||
gchar *run_uri = gnc_doclink_get_use_uri (path_head, uri, scheme);
|
||||
gchar *run_scheme = gnc_uri_get_scheme (run_uri);
|
||||
|
||||
PINFO("Open uri scheme is '%s', uri is '%s'", run_scheme, run_uri);
|
||||
|
||||
if (run_scheme) // make sure we have a scheme entry
|
||||
{
|
||||
gnc_launch_assoc (GTK_WINDOW (parent), run_uri);
|
||||
gnc_launch_doclink (GTK_WINDOW (parent), run_uri);
|
||||
g_free (run_scheme);
|
||||
}
|
||||
g_free (run_uri);
|
||||
@ -194,14 +194,14 @@ static void
|
||||
setup_file_dialog (GtkBuilder *builder, GtkFileChooserButton *fcb,
|
||||
const gchar *path_head, const gchar *uri, gchar *scheme)
|
||||
{
|
||||
gchar *display_uri = gnc_assoc_get_unescape_uri (path_head, uri, scheme);
|
||||
gchar *display_uri = gnc_doclink_get_unescape_uri (path_head, uri, scheme);
|
||||
|
||||
if (display_uri)
|
||||
{
|
||||
GtkWidget *label;
|
||||
GtkWidget *existing_hbox = GTK_WIDGET(gtk_builder_get_object (builder, "existing_hbox"));
|
||||
GtkWidget *image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||
gchar *use_uri = gnc_assoc_get_use_uri (path_head, uri, scheme);
|
||||
gchar *use_uri = gnc_doclink_get_use_uri (path_head, uri, scheme);
|
||||
gchar *uri_label = g_strdup_printf ("%s '%s'", _("Existing Document Link is"), display_uri);
|
||||
|
||||
label = gtk_label_new (uri_label);
|
||||
@ -230,7 +230,8 @@ setup_file_dialog (GtkBuilder *builder, GtkFileChooserButton *fcb,
|
||||
}
|
||||
|
||||
gchar *
|
||||
gnc_assoc_get_uri_dialog (GtkWindow *parent, const gchar *title, const gchar *uri)
|
||||
gnc_doclink_get_uri_dialog (GtkWindow *parent, const gchar *title,
|
||||
const gchar *uri)
|
||||
{
|
||||
GtkWidget *dialog, *button_loc, *button_file, *ok_button, *warning_hbox;
|
||||
GtkBuilder *builder;
|
||||
@ -240,21 +241,22 @@ gnc_assoc_get_uri_dialog (GtkWindow *parent, const gchar *title, const gchar *ur
|
||||
GtkWidget *head_label;
|
||||
int result;
|
||||
gchar *ret_uri = NULL;
|
||||
gchar *path_head = gnc_assoc_get_path_head ();
|
||||
gchar *path_head = gnc_doclink_get_path_head ();
|
||||
gchar *scheme = NULL;
|
||||
|
||||
/* Create the dialog box */
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder, "dialog-assoc.glade", "association_dialog");
|
||||
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "association_dialog"));
|
||||
gnc_builder_add_from_file (builder, "dialog-doclink.glade",
|
||||
"linked_doc_dialog");
|
||||
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "linked_doc_dialog"));
|
||||
gtk_window_set_title (GTK_WINDOW(dialog), title);
|
||||
|
||||
if (parent != NULL)
|
||||
gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent));
|
||||
|
||||
// Set the name and style context for this widget so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-association");
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(dialog), "gnc-class-association");
|
||||
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-doclink");
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(dialog), "gnc-class-doclink");
|
||||
|
||||
head_label = GTK_WIDGET(gtk_builder_get_object (builder, "path_head_label"));
|
||||
ok_button = GTK_WIDGET(gtk_builder_get_object (builder, "ok_button"));
|
||||
@ -263,7 +265,7 @@ gnc_assoc_get_uri_dialog (GtkWindow *parent, const gchar *title, const gchar *ur
|
||||
g_object_set_data (G_OBJECT(fcb), "okbut", ok_button);
|
||||
g_signal_connect (fcb, "file-set", G_CALLBACK(file_set_cb), ok_button);
|
||||
|
||||
button_file = GTK_WIDGET(gtk_builder_get_object (builder, "file_assoc"));
|
||||
button_file = GTK_WIDGET(gtk_builder_get_object (builder, "linked_file"));
|
||||
g_signal_connect (button_file, "toggled", G_CALLBACK(uri_type_selected_cb), fcb);
|
||||
|
||||
gtk_widget_show_all (GTK_WIDGET(gtk_builder_get_object (builder, "file_hbox")));
|
||||
@ -275,11 +277,11 @@ gnc_assoc_get_uri_dialog (GtkWindow *parent, const gchar *title, const gchar *ur
|
||||
|
||||
g_signal_connect (entry, "changed", G_CALLBACK(location_ok_cb), ok_button);
|
||||
|
||||
button_loc = GTK_WIDGET(gtk_builder_get_object (builder, "loc_assoc"));
|
||||
button_loc = GTK_WIDGET(gtk_builder_get_object (builder, "linked_loc"));
|
||||
g_signal_connect (button_loc, "toggled", G_CALLBACK(uri_type_selected_cb), entry);
|
||||
|
||||
// display path head text and test if present
|
||||
gnc_assoc_set_path_head_label (head_label, NULL, NULL);
|
||||
gnc_doclink_set_path_head_label (head_label, NULL, NULL);
|
||||
|
||||
// Check for uri is empty or NULL
|
||||
if (uri && *uri)
|
||||
@ -360,31 +362,32 @@ gnc_assoc_get_uri_dialog (GtkWindow *parent, const gchar *title, const gchar *ur
|
||||
static void close_handler (gpointer user_data);
|
||||
|
||||
static void
|
||||
gnc_assoc_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data)
|
||||
gnc_doclink_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data)
|
||||
{
|
||||
AssocDialog *assoc_dialog = user_data;
|
||||
DoclinkDialog *doclink_dialog = user_data;
|
||||
|
||||
ENTER(" ");
|
||||
gnc_unregister_gui_component (assoc_dialog->component_id);
|
||||
gnc_unregister_gui_component (doclink_dialog->component_id);
|
||||
|
||||
if (assoc_dialog->window)
|
||||
if (doclink_dialog->window)
|
||||
{
|
||||
g_free (assoc_dialog->path_head);
|
||||
gtk_widget_destroy (assoc_dialog->window);
|
||||
assoc_dialog->window = NULL;
|
||||
g_free (doclink_dialog->path_head);
|
||||
gtk_widget_destroy (doclink_dialog->window);
|
||||
doclink_dialog->window = NULL;
|
||||
}
|
||||
g_free (assoc_dialog);
|
||||
g_free (doclink_dialog);
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gnc_assoc_dialog_window_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
|
||||
gnc_doclink_dialog_window_key_press_cb (GtkWidget *widget, GdkEventKey *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
AssocDialog *assoc_dialog = user_data;
|
||||
DoclinkDialog *doclink_dialog = user_data;
|
||||
|
||||
if (event->keyval == GDK_KEY_Escape)
|
||||
{
|
||||
close_handler (assoc_dialog);
|
||||
close_handler (doclink_dialog);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@ -392,16 +395,16 @@ gnc_assoc_dialog_window_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpo
|
||||
}
|
||||
|
||||
static void
|
||||
assoc_dialog_update (AssocDialog *assoc_dialog)
|
||||
doclink_dialog_update (DoclinkDialog *doclink_dialog)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
gboolean valid;
|
||||
|
||||
/* disconnect the model from the treeview */
|
||||
model = gtk_tree_view_get_model (GTK_TREE_VIEW(assoc_dialog->view));
|
||||
model = gtk_tree_view_get_model (GTK_TREE_VIEW (doclink_dialog->view));
|
||||
g_object_ref (G_OBJECT(model));
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), NULL);
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (doclink_dialog->view), NULL);
|
||||
|
||||
/* Get first row in list store */
|
||||
valid = gtk_tree_model_get_iter_first (model, &iter);
|
||||
@ -417,7 +420,9 @@ assoc_dialog_update (AssocDialog *assoc_dialog)
|
||||
|
||||
if (!scheme || gnc_uri_is_file_scheme (scheme))
|
||||
{
|
||||
gchar *filename = gnc_assoc_get_unescape_uri (assoc_dialog->path_head, uri, scheme);
|
||||
gchar *filename =
|
||||
gnc_doclink_get_unescape_uri (doclink_dialog->path_head,
|
||||
uri, scheme);
|
||||
|
||||
if (g_file_test (filename, G_FILE_TEST_EXISTS))
|
||||
gtk_list_store_set (GTK_LIST_STORE(model), &iter, AVAILABLE, _("File Found"), -1);
|
||||
@ -447,12 +452,13 @@ assoc_dialog_update (AssocDialog *assoc_dialog)
|
||||
valid = gtk_tree_model_iter_next (model, &iter);
|
||||
}
|
||||
/* reconnect the model to the treeview */
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), model);
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (doclink_dialog->view), model);
|
||||
g_object_unref (G_OBJECT(model));
|
||||
}
|
||||
|
||||
static void
|
||||
update_model_with_changes (AssocDialog *assoc_dialog, GtkTreeIter *iter, const gchar *uri)
|
||||
update_model_with_changes (DoclinkDialog *doclink_dialog, GtkTreeIter *iter,
|
||||
const gchar *uri)
|
||||
{
|
||||
gchar *display_uri;
|
||||
gboolean rel = FALSE;
|
||||
@ -461,53 +467,61 @@ update_model_with_changes (AssocDialog *assoc_dialog, GtkTreeIter *iter, const g
|
||||
if (!scheme) // path is relative
|
||||
rel = TRUE;
|
||||
|
||||
display_uri = gnc_assoc_get_unescape_uri (assoc_dialog->path_head, uri, scheme);
|
||||
gtk_list_store_set (GTK_LIST_STORE(assoc_dialog->model), iter,
|
||||
display_uri = gnc_doclink_get_unescape_uri (doclink_dialog->path_head,
|
||||
uri, scheme);
|
||||
gtk_list_store_set (GTK_LIST_STORE (doclink_dialog->model), iter,
|
||||
DISPLAY_URI, display_uri, AVAILABLE, _("File Found"),
|
||||
URI, uri,
|
||||
URI_RELATIVE, rel, // used just for sorting relative column
|
||||
URI_RELATIVE_PIX, (rel == TRUE ? "emblem-default" : NULL), -1);
|
||||
|
||||
if (!rel && !gnc_uri_is_file_scheme (scheme))
|
||||
gtk_list_store_set (GTK_LIST_STORE(assoc_dialog->model), iter, AVAILABLE, _("Unknown"), -1);
|
||||
gtk_list_store_set (GTK_LIST_STORE (doclink_dialog->model), iter,
|
||||
AVAILABLE, _("Unknown"), -1);
|
||||
|
||||
g_free (display_uri);
|
||||
g_free (scheme);
|
||||
}
|
||||
|
||||
static void
|
||||
update_total_entries (AssocDialog *assoc_dialog)
|
||||
update_total_entries (DoclinkDialog *doclink_dialog)
|
||||
{
|
||||
gint entries = gtk_tree_model_iter_n_children (GTK_TREE_MODEL(assoc_dialog->model), NULL);
|
||||
gint entries =
|
||||
gtk_tree_model_iter_n_children (GTK_TREE_MODEL (doclink_dialog->model),
|
||||
NULL);
|
||||
|
||||
if (entries > 0)
|
||||
{
|
||||
gchar *total = g_strdup_printf ("%s %d", _("Total Entries"), entries);
|
||||
gtk_label_set_text (GTK_LABEL(assoc_dialog->total_entries_label), total);
|
||||
gtk_widget_show (assoc_dialog->total_entries_label);
|
||||
gtk_label_set_text (GTK_LABEL (doclink_dialog->total_entries_label),
|
||||
total);
|
||||
gtk_widget_show (doclink_dialog->total_entries_label);
|
||||
g_free (total);
|
||||
}
|
||||
else
|
||||
gtk_widget_hide (assoc_dialog->total_entries_label);
|
||||
gtk_widget_hide (doclink_dialog->total_entries_label);
|
||||
}
|
||||
|
||||
static void
|
||||
row_selected_bus_cb (GtkTreeView *view, GtkTreePath *path,
|
||||
GtkTreeViewColumn *col, gpointer user_data)
|
||||
{
|
||||
AssocDialog *assoc_dialog = user_data;
|
||||
GtkTreeIter iter;
|
||||
DoclinkDialog *doclink_dialog = user_data;
|
||||
GtkTreeIter iter;
|
||||
GncInvoice *invoice;
|
||||
gchar *uri = NULL;
|
||||
|
||||
// path describes a non-existing row - should not happen
|
||||
g_return_if_fail (gtk_tree_model_get_iter (assoc_dialog->model, &iter, path));
|
||||
g_return_if_fail (gtk_tree_model_get_iter (doclink_dialog->model,
|
||||
&iter, path));
|
||||
|
||||
gtk_tree_model_get (assoc_dialog->model, &iter, URI, &uri, ITEM_POINTER, &invoice, -1);
|
||||
gtk_tree_model_get (doclink_dialog->model, &iter, URI,
|
||||
&uri, ITEM_POINTER, &invoice, -1);
|
||||
|
||||
// Open associated link, subtract 1 to allow for date_int64
|
||||
if (gtk_tree_view_get_column (GTK_TREE_VIEW(assoc_dialog->view), DISPLAY_URI - 1) == col)
|
||||
gnc_assoc_open_uri (GTK_WINDOW(assoc_dialog->window), uri);
|
||||
// Open linked document, subtract 1 to allow for date_int64
|
||||
if (gtk_tree_view_get_column (GTK_TREE_VIEW (doclink_dialog->view),
|
||||
DISPLAY_URI - 1) == col)
|
||||
gnc_doclink_open_uri (GTK_WINDOW (doclink_dialog->window), uri);
|
||||
|
||||
if (!invoice)
|
||||
{
|
||||
@ -516,53 +530,60 @@ row_selected_bus_cb (GtkTreeView *view, GtkTreePath *path,
|
||||
}
|
||||
|
||||
// Open Invoice, subtract 1 to allow for date_int64
|
||||
if (gtk_tree_view_get_column (GTK_TREE_VIEW(assoc_dialog->view), DESC_ID - 1) == col)
|
||||
if (gtk_tree_view_get_column (GTK_TREE_VIEW (doclink_dialog->view),
|
||||
DESC_ID - 1) == col)
|
||||
{
|
||||
GncPluginPage *page;
|
||||
InvoiceWindow *iw;
|
||||
|
||||
iw = gnc_ui_invoice_edit (GTK_WINDOW(assoc_dialog->window), invoice);
|
||||
iw = gnc_ui_invoice_edit (GTK_WINDOW (doclink_dialog->window),
|
||||
invoice);
|
||||
gnc_plugin_page_invoice_new (iw);
|
||||
}
|
||||
|
||||
// Open Invoice association dialog, subtract 1 to allow for date_int64
|
||||
if (gtk_tree_view_get_column (GTK_TREE_VIEW(assoc_dialog->view), AVAILABLE - 1) == col)
|
||||
// Open Invoice document link dialog, subtract 1 to allow for date_int64
|
||||
if (gtk_tree_view_get_column (GTK_TREE_VIEW (doclink_dialog->view),
|
||||
AVAILABLE - 1) == col)
|
||||
{
|
||||
gchar *ret_uri = NULL;
|
||||
|
||||
if (assoc_dialog->book_ro)
|
||||
if (doclink_dialog->book_ro)
|
||||
{
|
||||
gnc_warning_dialog (GTK_WINDOW(assoc_dialog->window), "%s", _("Business item can not be modified."));
|
||||
gnc_warning_dialog (GTK_WINDOW (doclink_dialog->window), "%s",
|
||||
_("Business item can not be modified."));
|
||||
g_free (uri);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Translators: This is the title of a dialog box for linking an external
|
||||
file or URI with the current bill, invoice, transaction, or voucher. */
|
||||
ret_uri = gnc_assoc_get_uri_dialog (GTK_WINDOW(assoc_dialog->window), _("Manage Document Link"), uri);
|
||||
ret_uri =
|
||||
gnc_doclink_get_uri_dialog (GTK_WINDOW (doclink_dialog->window),
|
||||
_("Manage Document Link"), uri);
|
||||
|
||||
if (ret_uri && g_strcmp0 (uri, ret_uri) != 0)
|
||||
{
|
||||
gncInvoiceSetAssociation (invoice, ret_uri);
|
||||
gncInvoiceSetDocLink (invoice, ret_uri);
|
||||
|
||||
if (g_strcmp0 (ret_uri, "") == 0) // delete uri
|
||||
{
|
||||
// update the asooc parts for invoice window if present
|
||||
gnc_invoice_update_assoc_for_window (invoice, ret_uri);
|
||||
gtk_list_store_remove (GTK_LIST_STORE(assoc_dialog->model), &iter);
|
||||
update_total_entries (assoc_dialog);
|
||||
gnc_invoice_update_doclink_for_window (invoice, ret_uri);
|
||||
gtk_list_store_remove (GTK_LIST_STORE (doclink_dialog->model),
|
||||
&iter);
|
||||
update_total_entries (doclink_dialog);
|
||||
}
|
||||
else // update uri
|
||||
{
|
||||
gchar *display_uri;
|
||||
gchar *scheme = gnc_uri_get_scheme (ret_uri);
|
||||
|
||||
display_uri = gnc_assoc_get_unescape_uri (assoc_dialog->path_head, ret_uri, scheme);
|
||||
display_uri = gnc_doclink_get_unescape_uri (doclink_dialog->path_head, ret_uri, scheme);
|
||||
|
||||
update_model_with_changes (assoc_dialog, &iter, ret_uri);
|
||||
update_model_with_changes (doclink_dialog, &iter, ret_uri);
|
||||
|
||||
// update the asooc parts for invoice window if present
|
||||
gnc_invoice_update_assoc_for_window (invoice, display_uri);
|
||||
gnc_invoice_update_doclink_for_window (invoice, display_uri);
|
||||
|
||||
g_free (scheme);
|
||||
g_free (display_uri);
|
||||
@ -577,19 +598,22 @@ static void
|
||||
row_selected_trans_cb (GtkTreeView *view, GtkTreePath *path,
|
||||
GtkTreeViewColumn *col, gpointer user_data)
|
||||
{
|
||||
AssocDialog *assoc_dialog = user_data;
|
||||
GtkTreeIter iter;
|
||||
DoclinkDialog *doclink_dialog = user_data;
|
||||
GtkTreeIter iter;
|
||||
Split *split;
|
||||
gchar *uri = NULL;
|
||||
|
||||
// path describes a non-existing row - should not happen
|
||||
g_return_if_fail (gtk_tree_model_get_iter (assoc_dialog->model, &iter, path));
|
||||
g_return_if_fail (gtk_tree_model_get_iter (doclink_dialog->model,
|
||||
&iter, path));
|
||||
|
||||
gtk_tree_model_get (assoc_dialog->model, &iter, URI, &uri, ITEM_POINTER, &split, -1);
|
||||
gtk_tree_model_get (doclink_dialog->model, &iter, URI,
|
||||
&uri, ITEM_POINTER, &split, -1);
|
||||
|
||||
// Open linked document, subtract 1 to allow for date_int64
|
||||
if (gtk_tree_view_get_column (GTK_TREE_VIEW(assoc_dialog->view), DISPLAY_URI - 1) == col)
|
||||
gnc_assoc_open_uri (GTK_WINDOW(assoc_dialog->window), uri);
|
||||
if (gtk_tree_view_get_column (GTK_TREE_VIEW (doclink_dialog->view),
|
||||
DISPLAY_URI - 1) == col)
|
||||
gnc_doclink_open_uri (GTK_WINDOW (doclink_dialog->window), uri);
|
||||
|
||||
if (!split)
|
||||
{
|
||||
@ -598,7 +622,8 @@ row_selected_trans_cb (GtkTreeView *view, GtkTreePath *path,
|
||||
}
|
||||
|
||||
// Open transaction, subtract 1 to allow for date_int64
|
||||
if (gtk_tree_view_get_column (GTK_TREE_VIEW(assoc_dialog->view), DESC_ITEM - 1) == col)
|
||||
if (gtk_tree_view_get_column (GTK_TREE_VIEW(doclink_dialog->view),
|
||||
DESC_ITEM - 1) == col)
|
||||
{
|
||||
GncPluginPage *page;
|
||||
GNCSplitReg *gsr;
|
||||
@ -616,32 +641,38 @@ row_selected_trans_cb (GtkTreeView *view, GtkTreePath *path,
|
||||
gnc_split_reg_jump_to_split (gsr, split);
|
||||
}
|
||||
|
||||
// Open transaction association dialog, subtract 1 to allow for date_int64
|
||||
if (gtk_tree_view_get_column (GTK_TREE_VIEW(assoc_dialog->view), AVAILABLE - 1) == col)
|
||||
// Open transaction document link dialog, subtract 1 to allow for date_int64
|
||||
if (gtk_tree_view_get_column (GTK_TREE_VIEW(doclink_dialog->view), AVAILABLE - 1) == col)
|
||||
{
|
||||
Transaction *trans;
|
||||
gchar *ret_uri = NULL;
|
||||
|
||||
trans = xaccSplitGetParent (split);
|
||||
|
||||
if (xaccTransIsReadonlyByPostedDate (trans) || xaccTransGetReadOnly (trans) || assoc_dialog->book_ro)
|
||||
if (xaccTransIsReadonlyByPostedDate (trans) ||
|
||||
xaccTransGetReadOnly (trans) ||
|
||||
doclink_dialog->book_ro)
|
||||
{
|
||||
gnc_warning_dialog (GTK_WINDOW(assoc_dialog->window), "%s", _("Transaction can not be modified."));
|
||||
gnc_warning_dialog (GTK_WINDOW (doclink_dialog->window), "%s",
|
||||
_("Transaction can not be modified."));
|
||||
g_free (uri);
|
||||
return;
|
||||
}
|
||||
ret_uri = gnc_assoc_get_uri_dialog (GTK_WINDOW(assoc_dialog->window), _("Manage Document Link"), uri);
|
||||
ret_uri =
|
||||
gnc_doclink_get_uri_dialog (GTK_WINDOW (doclink_dialog->window),
|
||||
_("Manage Document Link"), uri);
|
||||
|
||||
if (ret_uri && g_strcmp0 (uri, ret_uri) != 0)
|
||||
{
|
||||
xaccTransSetAssociation (trans, ret_uri);
|
||||
xaccTransSetDocLink (trans, ret_uri);
|
||||
if (g_strcmp0 (ret_uri, "") == 0) // deleted uri
|
||||
{
|
||||
gtk_list_store_remove (GTK_LIST_STORE(assoc_dialog->model), &iter);
|
||||
update_total_entries (assoc_dialog);
|
||||
gtk_list_store_remove (GTK_LIST_STORE (doclink_dialog->model),
|
||||
&iter);
|
||||
update_total_entries (doclink_dialog);
|
||||
}
|
||||
else // updated uri
|
||||
update_model_with_changes (assoc_dialog, &iter, ret_uri);
|
||||
update_model_with_changes (doclink_dialog, &iter, ret_uri);
|
||||
}
|
||||
g_free (ret_uri);
|
||||
}
|
||||
@ -651,9 +682,9 @@ row_selected_trans_cb (GtkTreeView *view, GtkTreePath *path,
|
||||
static void
|
||||
add_bus_info_to_model (QofInstance* data, gpointer user_data)
|
||||
{
|
||||
AssocDialog *assoc_dialog = user_data;
|
||||
GncInvoice *invoice = GNC_INVOICE(data);
|
||||
const gchar* uri = gncInvoiceGetAssociation (invoice);
|
||||
DoclinkDialog *doclink_dialog = user_data;
|
||||
GncInvoice *invoice = GNC_INVOICE(data);
|
||||
const gchar *uri = gncInvoiceGetDocLink (invoice);
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (uri && *uri)
|
||||
@ -690,11 +721,12 @@ add_bus_info_to_model (QofInstance* data, gpointer user_data)
|
||||
if (!scheme) // path is relative
|
||||
rel = TRUE;
|
||||
|
||||
display_uri = gnc_assoc_get_unescape_uri (assoc_dialog->path_head, uri, scheme);
|
||||
display_uri = gnc_doclink_get_unescape_uri (doclink_dialog->path_head,
|
||||
uri, scheme);
|
||||
|
||||
gtk_list_store_append (GTK_LIST_STORE(assoc_dialog->model), &iter);
|
||||
gtk_list_store_append (GTK_LIST_STORE (doclink_dialog->model), &iter);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE(assoc_dialog->model), &iter,
|
||||
gtk_list_store_set (GTK_LIST_STORE (doclink_dialog->model), &iter,
|
||||
DATE_ITEM, datebuff,
|
||||
DATE_INT64, t, // used just for sorting date column
|
||||
DESC_ID, gncInvoiceGetID (invoice),
|
||||
@ -711,13 +743,13 @@ add_bus_info_to_model (QofInstance* data, gpointer user_data)
|
||||
static void
|
||||
add_trans_info_to_model (QofInstance* data, gpointer user_data)
|
||||
{
|
||||
AssocDialog *assoc_dialog = user_data;
|
||||
Transaction *trans = GNC_TRANSACTION(data);
|
||||
gchar *uri;
|
||||
GtkTreeIter iter;
|
||||
DoclinkDialog *doclink_dialog = user_data;
|
||||
Transaction *trans = GNC_TRANSACTION(data);
|
||||
gchar *uri;
|
||||
GtkTreeIter iter;
|
||||
|
||||
// fix an earlier error when storing relative paths before version 3.5
|
||||
uri = gnc_assoc_convert_trans_associate_uri (trans, assoc_dialog->book_ro);
|
||||
uri = gnc_doclink_convert_trans_link_uri (trans, doclink_dialog->book_ro);
|
||||
|
||||
if (uri && *uri)
|
||||
{
|
||||
@ -731,14 +763,15 @@ add_trans_info_to_model (QofInstance* data, gpointer user_data)
|
||||
if (t == 0)
|
||||
t = gnc_time (NULL);
|
||||
qof_print_date_buff (datebuff, MAX_DATE_LENGTH, t);
|
||||
gtk_list_store_append (GTK_LIST_STORE(assoc_dialog->model), &iter);
|
||||
gtk_list_store_append (GTK_LIST_STORE (doclink_dialog->model), &iter);
|
||||
|
||||
if (!scheme) // path is relative
|
||||
rel = TRUE;
|
||||
|
||||
display_uri = gnc_assoc_get_unescape_uri (assoc_dialog->path_head, uri, scheme);
|
||||
display_uri = gnc_doclink_get_unescape_uri (doclink_dialog->path_head,
|
||||
uri, scheme);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE(assoc_dialog->model), &iter,
|
||||
gtk_list_store_set (GTK_LIST_STORE (doclink_dialog->model), &iter,
|
||||
DATE_ITEM, datebuff,
|
||||
DATE_INT64, t, // used just for sorting date column
|
||||
DESC_ITEM, xaccTransGetDescription (trans),
|
||||
@ -753,102 +786,108 @@ add_trans_info_to_model (QofInstance* data, gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
get_bus_info (AssocDialog *assoc_dialog)
|
||||
get_bus_info (DoclinkDialog *doclink_dialog)
|
||||
{
|
||||
QofBook *book = gnc_get_current_book();
|
||||
|
||||
/* disconnect the model from the treeview */
|
||||
assoc_dialog->model = gtk_tree_view_get_model (GTK_TREE_VIEW(assoc_dialog->view));
|
||||
g_object_ref (G_OBJECT(assoc_dialog->model));
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), NULL);
|
||||
doclink_dialog->model =
|
||||
gtk_tree_view_get_model (GTK_TREE_VIEW (doclink_dialog->view));
|
||||
g_object_ref (G_OBJECT (doclink_dialog->model));
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (doclink_dialog->view), NULL);
|
||||
|
||||
/* Clear the list store */
|
||||
gtk_list_store_clear (GTK_LIST_STORE(assoc_dialog->model));
|
||||
gtk_list_store_clear (GTK_LIST_STORE (doclink_dialog->model));
|
||||
|
||||
/* Loop through the invoices */
|
||||
qof_collection_foreach (qof_book_get_collection (book, GNC_ID_INVOICE),
|
||||
add_bus_info_to_model, assoc_dialog);
|
||||
add_bus_info_to_model, doclink_dialog);
|
||||
|
||||
update_total_entries (assoc_dialog);
|
||||
update_total_entries (doclink_dialog);
|
||||
|
||||
/* reconnect the model to the treeview */
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), assoc_dialog->model);
|
||||
g_object_unref (G_OBJECT(assoc_dialog->model));
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (doclink_dialog->view),
|
||||
doclink_dialog->model);
|
||||
g_object_unref (G_OBJECT (doclink_dialog->model));
|
||||
}
|
||||
|
||||
static void
|
||||
get_trans_info (AssocDialog *assoc_dialog)
|
||||
get_trans_info (DoclinkDialog *doclink_dialog)
|
||||
{
|
||||
QofBook *book = gnc_get_current_book();
|
||||
|
||||
assoc_dialog->book_ro = qof_book_is_readonly (book);
|
||||
doclink_dialog->book_ro = qof_book_is_readonly (book);
|
||||
|
||||
/* disconnect the model from the treeview */
|
||||
assoc_dialog->model = gtk_tree_view_get_model (GTK_TREE_VIEW(assoc_dialog->view));
|
||||
g_object_ref (G_OBJECT(assoc_dialog->model));
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), NULL);
|
||||
doclink_dialog->model =
|
||||
gtk_tree_view_get_model (GTK_TREE_VIEW (doclink_dialog->view));
|
||||
g_object_ref (G_OBJECT (doclink_dialog->model));
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (doclink_dialog->view), NULL);
|
||||
|
||||
/* Clear the list store */
|
||||
gtk_list_store_clear (GTK_LIST_STORE(assoc_dialog->model));
|
||||
gtk_list_store_clear (GTK_LIST_STORE (doclink_dialog->model));
|
||||
|
||||
/* Loop through the transactions */
|
||||
qof_collection_foreach (qof_book_get_collection (book, GNC_ID_TRANS),
|
||||
add_trans_info_to_model, assoc_dialog);
|
||||
add_trans_info_to_model, doclink_dialog);
|
||||
|
||||
update_total_entries (assoc_dialog);
|
||||
update_total_entries (doclink_dialog);
|
||||
|
||||
/* reconnect the model to the treeview */
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW(assoc_dialog->view), assoc_dialog->model);
|
||||
g_object_unref (G_OBJECT(assoc_dialog->model));
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (doclink_dialog->view),
|
||||
doclink_dialog->model);
|
||||
g_object_unref (G_OBJECT (doclink_dialog->model));
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_assoc_dialog_reload_button_cb (GtkWidget *widget, gpointer user_data)
|
||||
gnc_doclink_dialog_reload_button_cb (GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
AssocDialog *assoc_dialog = user_data;
|
||||
gchar *path_head = gnc_assoc_get_path_head ();
|
||||
DoclinkDialog *doclink_dialog = user_data;
|
||||
gchar *path_head = gnc_doclink_get_path_head ();
|
||||
|
||||
if (g_strcmp0 (path_head, assoc_dialog->path_head) != 0)
|
||||
if (g_strcmp0 (path_head, doclink_dialog->path_head) != 0)
|
||||
{
|
||||
g_free (assoc_dialog->path_head);
|
||||
assoc_dialog->path_head = g_strdup (path_head);
|
||||
g_free (doclink_dialog->path_head);
|
||||
doclink_dialog->path_head = g_strdup (path_head);
|
||||
|
||||
// display path head text and test if present
|
||||
gnc_assoc_set_path_head_label (assoc_dialog->path_head_label, NULL, NULL);
|
||||
gnc_doclink_set_path_head_label (doclink_dialog->path_head_label,
|
||||
NULL, NULL);
|
||||
}
|
||||
g_free (path_head);
|
||||
|
||||
if (assoc_dialog->is_list_trans)
|
||||
get_trans_info (assoc_dialog);
|
||||
if (doclink_dialog->is_list_trans)
|
||||
get_trans_info (doclink_dialog);
|
||||
else
|
||||
get_bus_info (assoc_dialog);
|
||||
get_bus_info (doclink_dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_assoc_dialog_reload_check_button_cb (GtkWidget *widget, gpointer user_data)
|
||||
gnc_doclink_dialog_reload_check_button_cb (GtkWidget *widget,
|
||||
gpointer user_data)
|
||||
{
|
||||
AssocDialog *assoc_dialog = user_data;
|
||||
DoclinkDialog *doclink_dialog = user_data;
|
||||
|
||||
gnc_assoc_dialog_reload_button_cb (widget, user_data);
|
||||
assoc_dialog_update (assoc_dialog);
|
||||
gnc_doclink_dialog_reload_button_cb (widget, user_data);
|
||||
doclink_dialog_update (doclink_dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_assoc_dialog_check_button_cb (GtkWidget *widget, gpointer user_data)
|
||||
gnc_doclink_dialog_check_button_cb (GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
AssocDialog *assoc_dialog = user_data;
|
||||
assoc_dialog_update (assoc_dialog);
|
||||
DoclinkDialog *doclink_dialog = user_data;
|
||||
doclink_dialog_update (doclink_dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_assoc_dialog_close_button_cb (GtkWidget *widget, gpointer user_data)
|
||||
gnc_doclink_dialog_close_button_cb (GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
AssocDialog *assoc_dialog = user_data;
|
||||
gnc_close_gui_component (assoc_dialog->component_id);
|
||||
DoclinkDialog *doclink_dialog = user_data;
|
||||
gnc_close_gui_component (doclink_dialog->component_id);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
|
||||
gnc_doclink_dialog_create (GtkWindow *parent, DoclinkDialog *doclink_dialog)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkBuilder *builder;
|
||||
@ -858,73 +897,92 @@ gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
|
||||
|
||||
ENTER(" ");
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder, "dialog-assoc.glade", "list-store");
|
||||
gnc_builder_add_from_file (builder, "dialog-assoc.glade", "association_window");
|
||||
gnc_builder_add_from_file (builder, "dialog-doclink.glade", "list-store");
|
||||
gnc_builder_add_from_file (builder, "dialog-doclink.glade",
|
||||
"linked_doc_window");
|
||||
|
||||
window = GTK_WIDGET(gtk_builder_get_object (builder, "association_window"));
|
||||
assoc_dialog->window = window;
|
||||
assoc_dialog->session = gnc_get_current_session();
|
||||
window = GTK_WIDGET(gtk_builder_get_object (builder, "linked_doc_window"));
|
||||
doclink_dialog->window = window;
|
||||
doclink_dialog->session = gnc_get_current_session();
|
||||
|
||||
button = GTK_WIDGET(gtk_builder_get_object (builder, "reload_button"));
|
||||
g_signal_connect(button, "clicked", G_CALLBACK(gnc_assoc_dialog_reload_button_cb), assoc_dialog);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (gnc_doclink_dialog_reload_button_cb),
|
||||
doclink_dialog);
|
||||
button = GTK_WIDGET(gtk_builder_get_object (builder, "reload_and_check_button"));
|
||||
g_signal_connect(button, "clicked", G_CALLBACK(gnc_assoc_dialog_reload_check_button_cb), assoc_dialog);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (gnc_doclink_dialog_reload_check_button_cb),
|
||||
doclink_dialog);
|
||||
|
||||
button = GTK_WIDGET(gtk_builder_get_object (builder, "check_button"));
|
||||
g_signal_connect(button, "clicked", G_CALLBACK(gnc_assoc_dialog_check_button_cb), assoc_dialog);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (gnc_doclink_dialog_check_button_cb),
|
||||
doclink_dialog);
|
||||
button = GTK_WIDGET(gtk_builder_get_object (builder, "close_button"));
|
||||
g_signal_connect(button, "clicked", G_CALLBACK(gnc_assoc_dialog_close_button_cb), assoc_dialog);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (gnc_doclink_dialog_close_button_cb),
|
||||
doclink_dialog);
|
||||
|
||||
// Set the widget name and style context for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(window), "gnc-id-transaction-associations");
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(window), "gnc-class-association");
|
||||
gtk_widget_set_name (GTK_WIDGET (window), "gnc-id-transaction-doclinks");
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET (window),
|
||||
"gnc-class-doclink");
|
||||
|
||||
assoc_dialog->view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
|
||||
assoc_dialog->path_head_label = GTK_WIDGET(gtk_builder_get_object (builder, "path-head"));
|
||||
assoc_dialog->total_entries_label = GTK_WIDGET(gtk_builder_get_object (builder, "total_entries_label"));
|
||||
assoc_dialog->path_head = gnc_assoc_get_path_head ();
|
||||
doclink_dialog->view =
|
||||
GTK_WIDGET (gtk_builder_get_object (builder, "treeview"));
|
||||
doclink_dialog->path_head_label =
|
||||
GTK_WIDGET (gtk_builder_get_object (builder, "path-head"));
|
||||
doclink_dialog->total_entries_label =
|
||||
GTK_WIDGET (gtk_builder_get_object (builder, "total_entries_label"));
|
||||
doclink_dialog->path_head = gnc_doclink_get_path_head ();
|
||||
|
||||
// display path head text and test if present
|
||||
gnc_assoc_set_path_head_label (assoc_dialog->path_head_label, NULL, NULL);
|
||||
gnc_doclink_set_path_head_label (doclink_dialog->path_head_label, NULL, NULL);
|
||||
|
||||
// set the Associate column to be the one that expands
|
||||
tree_column = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object (builder, "assoc"));
|
||||
// set the Linked column to be the one that expands
|
||||
tree_column =
|
||||
GTK_TREE_VIEW_COLUMN (gtk_builder_get_object (builder, "doclink"));
|
||||
gtk_tree_view_column_set_expand (tree_column, TRUE);
|
||||
|
||||
/* default sort order */
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(gtk_tree_view_get_model(
|
||||
GTK_TREE_VIEW(assoc_dialog->view))),
|
||||
GTK_TREE_VIEW (doclink_dialog->view))),
|
||||
DATE_INT64, GTK_SORT_ASCENDING);
|
||||
|
||||
// Set grid lines option to preference
|
||||
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(assoc_dialog->view), gnc_tree_view_get_grid_lines_pref ());
|
||||
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (doclink_dialog->view),
|
||||
gnc_tree_view_get_grid_lines_pref ());
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(assoc_dialog->view));
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (doclink_dialog->view));
|
||||
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
|
||||
|
||||
g_signal_connect (assoc_dialog->window, "destroy",
|
||||
G_CALLBACK(gnc_assoc_dialog_window_destroy_cb), assoc_dialog);
|
||||
g_signal_connect (doclink_dialog->window, "destroy",
|
||||
G_CALLBACK (gnc_doclink_dialog_window_destroy_cb),
|
||||
doclink_dialog);
|
||||
|
||||
g_signal_connect (assoc_dialog->window, "key_press_event",
|
||||
G_CALLBACK(gnc_assoc_dialog_window_key_press_cb), assoc_dialog);
|
||||
g_signal_connect (doclink_dialog->window, "key_press_event",
|
||||
G_CALLBACK (gnc_doclink_dialog_window_key_press_cb),
|
||||
doclink_dialog);
|
||||
|
||||
// Setup the correct parts for each dialog
|
||||
if (assoc_dialog->is_list_trans)
|
||||
if (doclink_dialog->is_list_trans)
|
||||
{
|
||||
GObject *desc_item_tree_column = G_OBJECT(gtk_builder_get_object (builder, "desc_item"));
|
||||
GObject *desc_id_tree_column = G_OBJECT(gtk_builder_get_object (builder, "desc_id"));
|
||||
|
||||
/* Translators: This is the label of a dialog box that lists all of the
|
||||
transaction that have files or URIs linked with them. */
|
||||
gtk_window_set_title (GTK_WINDOW(window), _("Transaction Document Links"));
|
||||
gtk_window_set_title (GTK_WINDOW (window), _("Transaction Document Links"));
|
||||
|
||||
gtk_tree_view_column_set_visible (GTK_TREE_VIEW_COLUMN(desc_id_tree_column), FALSE);
|
||||
gtk_tree_view_column_set_title (GTK_TREE_VIEW_COLUMN(desc_item_tree_column), _("Description"));
|
||||
|
||||
g_signal_connect (assoc_dialog->view, "row-activated",
|
||||
G_CALLBACK(row_selected_trans_cb), (gpointer)assoc_dialog);
|
||||
gnc_restore_window_size (GNC_PREFS_GROUP_TRANS, GTK_WINDOW(assoc_dialog->window), parent);
|
||||
get_trans_info (assoc_dialog);
|
||||
g_signal_connect (doclink_dialog->view, "row-activated",
|
||||
G_CALLBACK (row_selected_trans_cb),
|
||||
(gpointer)doclink_dialog);
|
||||
gnc_restore_window_size (GNC_PREFS_GROUP_TRANS,
|
||||
GTK_WINDOW (doclink_dialog->window), parent);
|
||||
get_trans_info (doclink_dialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -938,36 +996,42 @@ gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
|
||||
/* Translators: This is the label of a dialog box that lists all of the
|
||||
invoices, bills, and vouchers that have files or URIs linked with
|
||||
them. */
|
||||
gtk_window_set_title (GTK_WINDOW(assoc_dialog->window), _("Business Document Links"));
|
||||
gtk_window_set_title (GTK_WINDOW (doclink_dialog->window),
|
||||
_("Business Document Links"));
|
||||
gtk_label_set_text (GTK_LABEL(help_label), gettext (item_string));
|
||||
|
||||
g_signal_connect (assoc_dialog->view, "row-activated",
|
||||
G_CALLBACK(row_selected_bus_cb), (gpointer)assoc_dialog);
|
||||
gnc_restore_window_size (GNC_PREFS_GROUP_BUS, GTK_WINDOW(assoc_dialog->window), parent);
|
||||
get_bus_info (assoc_dialog);
|
||||
g_signal_connect (doclink_dialog->view, "row-activated",
|
||||
G_CALLBACK (row_selected_bus_cb),
|
||||
(gpointer)doclink_dialog);
|
||||
gnc_restore_window_size (GNC_PREFS_GROUP_BUS,
|
||||
GTK_WINDOW (doclink_dialog->window), parent);
|
||||
get_bus_info (doclink_dialog);
|
||||
}
|
||||
|
||||
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, assoc_dialog);
|
||||
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func,
|
||||
doclink_dialog);
|
||||
|
||||
g_object_unref (G_OBJECT(builder));
|
||||
|
||||
gtk_widget_show_all (GTK_WIDGET(window));
|
||||
|
||||
gtk_tree_view_columns_autosize (GTK_TREE_VIEW(assoc_dialog->view));
|
||||
gtk_tree_view_columns_autosize (GTK_TREE_VIEW(doclink_dialog->view));
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
||||
static void
|
||||
close_handler (gpointer user_data)
|
||||
{
|
||||
AssocDialog *assoc_dialog = user_data;
|
||||
DoclinkDialog *doclink_dialog = user_data;
|
||||
|
||||
ENTER(" ");
|
||||
if (assoc_dialog->is_list_trans)
|
||||
gnc_save_window_size (GNC_PREFS_GROUP_TRANS, GTK_WINDOW(assoc_dialog->window));
|
||||
if (doclink_dialog->is_list_trans)
|
||||
gnc_save_window_size (GNC_PREFS_GROUP_TRANS,
|
||||
GTK_WINDOW (doclink_dialog->window));
|
||||
else
|
||||
gnc_save_window_size (GNC_PREFS_GROUP_BUS, GTK_WINDOW(assoc_dialog->window));
|
||||
gtk_widget_destroy (GTK_WIDGET(assoc_dialog->window));
|
||||
gnc_save_window_size (GNC_PREFS_GROUP_BUS,
|
||||
GTK_WINDOW (doclink_dialog->window));
|
||||
gtk_widget_destroy (GTK_WIDGET (doclink_dialog->window));
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
||||
@ -982,74 +1046,78 @@ static gboolean
|
||||
show_handler (const char *klass, gint component_id,
|
||||
gpointer user_data, gpointer iter_data)
|
||||
{
|
||||
AssocDialog *assoc_dialog = user_data;
|
||||
DoclinkDialog *doclink_dialog = user_data;
|
||||
gboolean is_bus = GPOINTER_TO_INT(iter_data);
|
||||
|
||||
ENTER(" ");
|
||||
if (!assoc_dialog)
|
||||
if (!doclink_dialog)
|
||||
{
|
||||
LEAVE("No data structure");
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
// test if the dialog is the right one
|
||||
if (is_bus == assoc_dialog->is_list_trans)
|
||||
if (is_bus == doclink_dialog->is_list_trans)
|
||||
return (FALSE);
|
||||
|
||||
gtk_window_present (GTK_WINDOW(assoc_dialog->window));
|
||||
gtk_window_present (GTK_WINDOW(doclink_dialog->window));
|
||||
LEAVE(" ");
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_assoc_business_dialog (GtkWindow *parent)
|
||||
gnc_doclink_business_dialog (GtkWindow *parent)
|
||||
{
|
||||
AssocDialog *assoc_dialog;
|
||||
DoclinkDialog *doclink_dialog;
|
||||
|
||||
ENTER(" ");
|
||||
if (gnc_forall_gui_components (DIALOG_ASSOC_CM_CLASS, show_handler, GINT_TO_POINTER(1)))
|
||||
if (gnc_forall_gui_components (DIALOG_DOCLINK_CM_CLASS,
|
||||
show_handler, GINT_TO_POINTER(1)))
|
||||
{
|
||||
LEAVE("Existing dialog raised");
|
||||
return;
|
||||
}
|
||||
assoc_dialog = g_new0 (AssocDialog, 1);
|
||||
doclink_dialog = g_new0 (DoclinkDialog, 1);
|
||||
|
||||
assoc_dialog->is_list_trans = FALSE;
|
||||
doclink_dialog->is_list_trans = FALSE;
|
||||
|
||||
gnc_assoc_dialog_create (parent, assoc_dialog);
|
||||
gnc_doclink_dialog_create (parent, doclink_dialog);
|
||||
|
||||
assoc_dialog->component_id = gnc_register_gui_component (DIALOG_ASSOC_CM_CLASS,
|
||||
refresh_handler, close_handler,
|
||||
assoc_dialog);
|
||||
doclink_dialog->component_id =
|
||||
gnc_register_gui_component (DIALOG_DOCLINK_CM_CLASS,
|
||||
refresh_handler, close_handler,
|
||||
doclink_dialog);
|
||||
|
||||
gnc_gui_component_set_session (assoc_dialog->component_id,
|
||||
assoc_dialog->session);
|
||||
gnc_gui_component_set_session (doclink_dialog->component_id,
|
||||
doclink_dialog->session);
|
||||
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
||||
void
|
||||
gnc_assoc_trans_dialog (GtkWindow *parent)
|
||||
gnc_doclink_trans_dialog (GtkWindow *parent)
|
||||
{
|
||||
AssocDialog *assoc_dialog;
|
||||
DoclinkDialog *doclink_dialog;
|
||||
|
||||
ENTER(" ");
|
||||
if (gnc_forall_gui_components (DIALOG_ASSOC_CM_CLASS, show_handler, GINT_TO_POINTER(0)))
|
||||
if (gnc_forall_gui_components (DIALOG_DOCLINK_CM_CLASS,
|
||||
show_handler, GINT_TO_POINTER(0)))
|
||||
{
|
||||
LEAVE("Existing dialog raised");
|
||||
return;
|
||||
}
|
||||
assoc_dialog = g_new0 (AssocDialog, 1);
|
||||
assoc_dialog->is_list_trans = TRUE;
|
||||
doclink_dialog = g_new0 (DoclinkDialog, 1);
|
||||
doclink_dialog->is_list_trans = TRUE;
|
||||
|
||||
gnc_assoc_dialog_create (parent, assoc_dialog);
|
||||
gnc_doclink_dialog_create (parent, doclink_dialog);
|
||||
|
||||
assoc_dialog->component_id = gnc_register_gui_component (DIALOG_ASSOC_CM_CLASS,
|
||||
refresh_handler, close_handler,
|
||||
assoc_dialog);
|
||||
doclink_dialog->component_id =
|
||||
gnc_register_gui_component (DIALOG_DOCLINK_CM_CLASS,
|
||||
refresh_handler, close_handler,
|
||||
doclink_dialog);
|
||||
|
||||
gnc_gui_component_set_session (assoc_dialog->component_id,
|
||||
assoc_dialog->session);
|
||||
gnc_gui_component_set_session (doclink_dialog->component_id,
|
||||
doclink_dialog->session);
|
||||
|
||||
LEAVE(" ");
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* dialog-assoc.h -- Associations dialog *
|
||||
* dialog-doclink.h -- Document links dialog *
|
||||
* Copyright (C) 2020 Robert Fewell *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
@ -20,8 +20,8 @@
|
||||
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef DIALOG_ASSOC_H
|
||||
#define DIALOG_ASSOC_H
|
||||
#ifndef DIALOG_DOCLINK_H
|
||||
#define DIALOG_DOCLINK_H
|
||||
|
||||
/** Present the right edit dialog for the uri.
|
||||
*
|
||||
@ -34,37 +34,38 @@
|
||||
*
|
||||
* @return The ammeded uri, can be NULL if deletion required.
|
||||
*/
|
||||
gchar * gnc_assoc_get_uri_dialog (GtkWindow *parent, const gchar *title, const gchar *uri);
|
||||
gchar * gnc_doclink_get_uri_dialog (GtkWindow *parent, const gchar *title,
|
||||
const gchar *uri);
|
||||
|
||||
/** Open the association uri.
|
||||
/** Open the doclink uri.
|
||||
*
|
||||
* A check is made for the uri being valid and then gnc_launch_assoc is used
|
||||
* A check is made for the uri being valid and then gnc_launch_doclink is used
|
||||
*
|
||||
* @param parent The GtkWindow for the parent widget
|
||||
* @param uri The association
|
||||
* @param uri The doclink
|
||||
*/
|
||||
void gnc_assoc_open_uri (GtkWindow *parent, const gchar *uri);
|
||||
void gnc_doclink_open_uri (GtkWindow *parent, const gchar *uri);
|
||||
|
||||
/** Present a dialog to list all the Invoice associations.
|
||||
/** Present a dialog to list all the Invoice linked documents.
|
||||
*
|
||||
* A query is run to return all the invoice associations which
|
||||
* A query is run to return all the invoice linked documents which
|
||||
* are then added to a tree view. From this tree view the invoice
|
||||
* and association can be opened along with a dialog to edit the
|
||||
* association.
|
||||
* and linked document can be opened along with a dialog to edit the
|
||||
* document link.
|
||||
*
|
||||
* @param parent The GtkWindow for the parent widget
|
||||
*/
|
||||
void gnc_assoc_business_dialog (GtkWindow *parent);
|
||||
void gnc_doclink_business_dialog (GtkWindow *parent);
|
||||
|
||||
/** Present a dialog to list all the Transaction associations.
|
||||
/** Present a dialog to list all the Transaction linked documents.
|
||||
*
|
||||
* A query is run to return all the transaction associations which
|
||||
* A query is run to return all the transaction linked documents which
|
||||
* are then added to a tree view. From this tree view the transaction
|
||||
* and association can be opened along with a dialog to edit the
|
||||
* association.
|
||||
* and linked document can be opened along with a dialog to edit the
|
||||
* document link.
|
||||
*
|
||||
* @param parent The GtkWindow for the parent widget
|
||||
*/
|
||||
void gnc_assoc_trans_dialog (GtkWindow *parent);
|
||||
void gnc_doclink_trans_dialog (GtkWindow *parent);
|
||||
|
||||
#endif
|
@ -73,8 +73,8 @@
|
||||
#include "gnc-main-window.h"
|
||||
#include "gnc-state.h"
|
||||
|
||||
#include "dialog-assoc.h"
|
||||
#include "dialog-assoc-utils.h"
|
||||
#include "dialog-doclink.h"
|
||||
#include "dialog-doclink-utils.h"
|
||||
#include "dialog-transfer.h"
|
||||
#include "gnc-uri-utils.h"
|
||||
|
||||
@ -169,7 +169,7 @@ struct _invoice_window
|
||||
GtkWidget * active_check;
|
||||
GtkWidget * paid_label;
|
||||
|
||||
GtkWidget * assoc_link_button;
|
||||
GtkWidget * doclink_button;
|
||||
|
||||
GtkWidget * owner_box;
|
||||
GtkWidget * owner_label;
|
||||
@ -328,12 +328,12 @@ gnc_invoice_window_get_invoice (InvoiceWindow *iw)
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gnc_invoice_window_get_assoc_link_button (InvoiceWindow *iw)
|
||||
gnc_invoice_window_get_doclink_button (InvoiceWindow *iw)
|
||||
{
|
||||
if (!iw)
|
||||
return NULL;
|
||||
|
||||
return iw->assoc_link_button;
|
||||
return iw->doclink_button;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2407,10 +2407,10 @@ gnc_invoice_save_page (InvoiceWindow *iw,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
assoc_link_button_cb (GtkLinkButton *button, InvoiceWindow *iw)
|
||||
doclink_button_cb (GtkLinkButton *button, InvoiceWindow *iw)
|
||||
{
|
||||
GncInvoice *invoice = gncInvoiceLookup (iw->book, &iw->invoice_guid);
|
||||
gnc_assoc_open_uri (GTK_WINDOW(iw->dialog), gncInvoiceGetAssociation (invoice));
|
||||
gnc_doclink_open_uri (GTK_WINDOW(iw->dialog), gncInvoiceGetDocLink (invoice));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -2427,7 +2427,7 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
|
||||
const gchar *prefs_group = NULL;
|
||||
gboolean is_credit_note = FALSE;
|
||||
const gchar *style_label = NULL;
|
||||
const gchar *assoc_uri;
|
||||
const gchar *doclink_uri;
|
||||
|
||||
invoice = gncInvoiceLookup (iw->book, &iw->invoice_guid);
|
||||
is_credit_note = gncInvoiceGetIsCreditNote (invoice);
|
||||
@ -2458,22 +2458,24 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
|
||||
iw->job_box = GTK_WIDGET (gtk_builder_get_object (builder, "page_job_hbox"));
|
||||
iw->paid_label = GTK_WIDGET (gtk_builder_get_object (builder, "paid_label"));
|
||||
|
||||
iw->assoc_link_button = GTK_WIDGET(gtk_builder_get_object (builder, "assoc_link_button"));
|
||||
g_signal_connect (G_OBJECT(iw->assoc_link_button), "activate-link",
|
||||
G_CALLBACK(assoc_link_button_cb), iw);
|
||||
iw->doclink_button = GTK_WIDGET(gtk_builder_get_object (builder, "doclink_button"));
|
||||
g_signal_connect (G_OBJECT (iw->doclink_button), "activate-link",
|
||||
G_CALLBACK (doclink_button_cb), iw);
|
||||
|
||||
/* invoice association */
|
||||
assoc_uri = gncInvoiceGetAssociation (invoice);
|
||||
if (assoc_uri)
|
||||
/* invoice doclink */
|
||||
doclink_uri = gncInvoiceGetDocLink (invoice);
|
||||
if (doclink_uri)
|
||||
{
|
||||
gchar *display_uri = gnc_assoc_get_unescaped_just_uri (assoc_uri);
|
||||
gtk_button_set_label (GTK_BUTTON(iw->assoc_link_button), _("Open Linked Document:"));
|
||||
gtk_link_button_set_uri (GTK_LINK_BUTTON(iw->assoc_link_button), display_uri);
|
||||
gtk_widget_show (GTK_WIDGET (iw->assoc_link_button));
|
||||
gchar *display_uri = gnc_doclink_get_unescaped_just_uri (doclink_uri);
|
||||
gtk_button_set_label (GTK_BUTTON (iw->doclink_button),
|
||||
_("Open Linked Document:"));
|
||||
gtk_link_button_set_uri (GTK_LINK_BUTTON (iw->doclink_button),
|
||||
display_uri);
|
||||
gtk_widget_show (GTK_WIDGET (iw->doclink_button));
|
||||
g_free (display_uri);
|
||||
}
|
||||
else
|
||||
gtk_widget_hide (GTK_WIDGET (iw->assoc_link_button));
|
||||
gtk_widget_hide (GTK_WIDGET (iw->doclink_button));
|
||||
|
||||
// Add a style context for this label so it can be easily manipulated with css
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(iw->paid_label), "gnc-class-highlight");
|
||||
@ -2665,30 +2667,30 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_invoice_update_assoc_for_window (GncInvoice *invoice, const gchar *uri)
|
||||
gnc_invoice_update_doclink_for_window (GncInvoice *invoice, const gchar *uri)
|
||||
{
|
||||
InvoiceWindow *iw = gnc_plugin_page_invoice_get_window (invoice);
|
||||
|
||||
if (iw)
|
||||
{
|
||||
GtkWidget *assoc_link_button = gnc_invoice_window_get_assoc_link_button (iw);
|
||||
GtkWidget *doclink_button = gnc_invoice_window_get_doclink_button (iw);
|
||||
|
||||
if (g_strcmp0 (uri, "") == 0) // deleted uri
|
||||
{
|
||||
GtkAction *uri_action;
|
||||
|
||||
// update the menu actions
|
||||
uri_action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(iw->page), "BusinessAssociationOpenAction");
|
||||
gtk_action_set_sensitive (uri_action, FALSE);
|
||||
uri_action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(iw->page), "BusinessLinkOpenAction");
|
||||
gtk_action_set_sensitive (uri_action, FALSE);
|
||||
|
||||
gtk_widget_hide (assoc_link_button);
|
||||
gtk_widget_hide (doclink_button);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *display_uri = gnc_assoc_get_unescaped_just_uri (uri);
|
||||
gtk_link_button_set_uri (GTK_LINK_BUTTON(assoc_link_button), display_uri);
|
||||
gtk_widget_show (GTK_WIDGET(assoc_link_button));
|
||||
gchar *display_uri = gnc_doclink_get_unescaped_just_uri (uri);
|
||||
gtk_link_button_set_uri (GTK_LINK_BUTTON (doclink_button),
|
||||
display_uri);
|
||||
gtk_widget_show (GTK_WIDGET (doclink_button));
|
||||
g_free (display_uri);
|
||||
}
|
||||
}
|
||||
|
@ -84,9 +84,10 @@ gchar *gnc_invoice_get_title (InvoiceWindow *iw);
|
||||
|
||||
GncInvoice * gnc_invoice_window_get_invoice (InvoiceWindow *iw);
|
||||
|
||||
GtkWidget * gnc_invoice_window_get_assoc_link_button (InvoiceWindow *iw);
|
||||
GtkWidget * gnc_invoice_window_get_doclink_button (InvoiceWindow *iw);
|
||||
|
||||
void gnc_invoice_update_assoc_for_window (GncInvoice *invoice, const gchar *uri);
|
||||
void gnc_invoice_update_doclink_for_window (GncInvoice *invoice,
|
||||
const gchar *uri);
|
||||
|
||||
GncInvoiceType gnc_invoice_get_type_from_window(InvoiceWindow *iw);
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "gnc-plugin-basic-commands.h"
|
||||
#include "gnc-ui-util.h"
|
||||
|
||||
#include "dialog-assoc.h"
|
||||
#include "dialog-doclink.h"
|
||||
#include "dialog-book-close.h"
|
||||
#include "dialog-file-access.h"
|
||||
#include "dialog-fincalc.h"
|
||||
@ -213,8 +213,8 @@ static GtkActionEntry gnc_plugin_actions [] =
|
||||
G_CALLBACK (gnc_main_window_cmd_tools_imap_editor)
|
||||
},
|
||||
{
|
||||
"ToolsTransAssocAction", NULL, N_("_Transaction Associations"), NULL,
|
||||
N_("View all Transaction Associations"),
|
||||
"ToolsTransLinkedDocsAction", NULL, N_("_Transaction Linked Documents"), NULL,
|
||||
N_("View all Transaction Linked Documents"),
|
||||
G_CALLBACK (gnc_main_window_cmd_tools_trans_assoc)
|
||||
},
|
||||
|
||||
@ -606,7 +606,7 @@ static void
|
||||
gnc_main_window_cmd_tools_trans_assoc (GtkAction *action, GncMainWindowActionData *data)
|
||||
{
|
||||
gnc_set_busy_cursor (NULL, TRUE);
|
||||
gnc_assoc_trans_dialog (GTK_WINDOW (data->window));
|
||||
gnc_doclink_trans_dialog (GTK_WINDOW (data->window));
|
||||
gnc_unset_busy_cursor (NULL);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "dialog-assoc.h"
|
||||
#include "dialog-doclink.h"
|
||||
#include "dialog-billterms.h"
|
||||
#include "dialog-customer.h"
|
||||
#include "dialog-employee.h"
|
||||
@ -275,8 +275,8 @@ static GtkActionEntry gnc_plugin_actions [] =
|
||||
|
||||
/* Other menu items */
|
||||
{
|
||||
"BusinessAssocOpenAction", NULL, N_("Business _Associations"), NULL,
|
||||
N_("View all Business Associations"),
|
||||
"BusinessLinkOpenAction", NULL, N_("Business Links"), NULL,
|
||||
N_("View all Linked Business Documents"),
|
||||
G_CALLBACK (gnc_plugin_business_cmd_assoc)
|
||||
},
|
||||
{
|
||||
@ -759,7 +759,7 @@ gnc_plugin_business_cmd_assoc (GtkAction *action,
|
||||
g_return_if_fail (mw != NULL);
|
||||
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
|
||||
|
||||
gnc_assoc_business_dialog (GTK_WINDOW (mw->window));
|
||||
gnc_doclink_business_dialog (GTK_WINDOW (mw->window));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -43,8 +43,8 @@
|
||||
#include "gnc-uri-utils.h"
|
||||
#include "gnc-window.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "dialog-assoc.h"
|
||||
#include "dialog-assoc-utils.h"
|
||||
#include "dialog-doclink.h"
|
||||
#include "dialog-doclink-utils.h"
|
||||
#include "gncInvoice.h"
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
@ -88,9 +88,9 @@ static void gnc_plugin_page_invoice_cmd_duplicateEntry (GtkAction *action, GncPl
|
||||
static void gnc_plugin_page_invoice_cmd_pay_invoice (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||
static void gnc_plugin_page_invoice_cmd_save_layout (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||
static void gnc_plugin_page_invoice_cmd_reset_layout (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||
static void gnc_plugin_page_invoice_cmd_associate (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||
static void gnc_plugin_page_invoice_cmd_associate_remove (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||
static void gnc_plugin_page_invoice_cmd_associate_open (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||
static void gnc_plugin_page_invoice_cmd_link (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||
static void gnc_plugin_page_invoice_cmd_link_remove (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||
static void gnc_plugin_page_invoice_cmd_link_open (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||
static void gnc_plugin_page_invoice_cmd_company_report (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||
|
||||
static void gnc_plugin_page_redraw_help_cb( GnucashRegister *gsr, GncPluginPageInvoice *invoice_page );
|
||||
@ -218,14 +218,14 @@ static GtkActionEntry gnc_plugin_page_invoice_actions [] =
|
||||
G_CALLBACK (gnc_plugin_page_invoice_cmd_new_invoice)
|
||||
},
|
||||
{
|
||||
"BusinessAssociationAction", NULL, "_Manage Document Link...", NULL,
|
||||
"BusinessLinkAction", NULL, "_Manage Document Link...", NULL,
|
||||
"Manage link of an external document to this item.",
|
||||
G_CALLBACK (gnc_plugin_page_invoice_cmd_associate)
|
||||
G_CALLBACK (gnc_plugin_page_invoice_cmd_link)
|
||||
},
|
||||
{
|
||||
"BusinessAssociationOpenAction", NULL, "_Open Linked Document", NULL,
|
||||
"BusinessLinkOpenAction", NULL, "_Open Linked Document", NULL,
|
||||
"Open the linked document",
|
||||
G_CALLBACK (gnc_plugin_page_invoice_cmd_associate_open)
|
||||
G_CALLBACK (gnc_plugin_page_invoice_cmd_link_open)
|
||||
},
|
||||
{
|
||||
"ToolsProcessPaymentAction", GNC_ICON_INVOICE_PAY, "_Pay Invoice", NULL,
|
||||
@ -260,8 +260,7 @@ static const gchar *invoice_book_readwrite_actions[] =
|
||||
"EditDuplicateInvoiceAction",
|
||||
"BusinessNewInvoiceAction",
|
||||
"ToolsProcessPaymentAction",
|
||||
"BusinessAssociationAction",
|
||||
"BusinessAssociationRemoveAction",
|
||||
"BusinessLinkAction",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -301,8 +300,8 @@ static action_toolbar_labels invoice_action_labels[] =
|
||||
{"EditUnpostInvoiceAction", N_("_Unpost Invoice")},
|
||||
{"BusinessNewInvoiceAction", N_("New _Invoice")},
|
||||
{"ToolsProcessPaymentAction", N_("_Pay Invoice")},
|
||||
{"BusinessAssociationAction", N_("_Manage Document Link")},
|
||||
{"BusinessAssociationOpenAction", N_("_Open Linked Document")},
|
||||
{"BusinessLinkAction", N_("_Manage Document Link")},
|
||||
{"BusinessLinkOpenAction", N_("_Open Linked Document")},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
@ -322,8 +321,8 @@ static action_toolbar_labels bill_action_labels[] =
|
||||
{"EditUnpostInvoiceAction", N_("_Unpost Bill")},
|
||||
{"BusinessNewInvoiceAction", N_("New _Bill")},
|
||||
{"ToolsProcessPaymentAction", N_("_Pay Bill")},
|
||||
{"BusinessAssociationAction", N_("_Manage Document Link")},
|
||||
{"BusinessAssociationOpenAction", N_("_Open Linked Document")},
|
||||
{"BusinessLinkAction", N_("_Manage Document Link")},
|
||||
{"BusinessLinkOpenAction", N_("_Open Linked Document")},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
@ -343,8 +342,8 @@ static action_toolbar_labels voucher_action_labels[] =
|
||||
{"EditUnpostInvoiceAction", N_("_Unpost Voucher")},
|
||||
{"BusinessNewInvoiceAction", N_("New _Voucher")},
|
||||
{"ToolsProcessPaymentAction", N_("_Pay Voucher")},
|
||||
{"BusinessAssociationAction", N_("_Manage Document Link")},
|
||||
{"BusinessAssociationOpenAction", N_("_Open Linked Document")},
|
||||
{"BusinessLinkAction", N_("_Manage Document Link")},
|
||||
{"BusinessLinkOpenAction", N_("_Open Linked Document")},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
@ -364,8 +363,8 @@ static action_toolbar_labels creditnote_action_labels[] =
|
||||
{"EditUnpostInvoiceAction", N_("_Unpost Credit Note")},
|
||||
{"BusinessNewInvoiceAction", N_("New _Credit Note")},
|
||||
{"ToolsProcessPaymentAction", N_("_Pay Credit Note")},
|
||||
{"BusinessAssociationAction", N_("_Manage Document Link")},
|
||||
{"BusinessAssociationOpenAction", N_("_Open Linked Document")},
|
||||
{"BusinessLinkAction", N_("_Manage Document Link")},
|
||||
{"BusinessLinkOpenAction", N_("_Open Linked Document")},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
@ -380,8 +379,8 @@ static action_toolbar_labels invoice_action_tooltips[] = {
|
||||
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the invoice")},
|
||||
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this invoice") },
|
||||
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this invoice") },
|
||||
{"BusinessAssociationAction", N_("Manage Document Link")},
|
||||
{"BusinessAssociationOpenAction", N_("Open Linked Document")},
|
||||
{"BusinessLinkAction", N_("Manage Document Link")},
|
||||
{"BusinessLinkOpenAction", N_("Open Linked Document")},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
@ -401,8 +400,8 @@ static action_toolbar_labels bill_action_tooltips[] = {
|
||||
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the bill")},
|
||||
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this bill") },
|
||||
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this bill") },
|
||||
{"BusinessAssociationAction", N_("Manage Document Link")},
|
||||
{"BusinessAssociationOpenAction", N_("Open Linked Document")},
|
||||
{"BusinessLinkAction", N_("Manage Document Link")},
|
||||
{"BusinessLinkOpenAction", N_("Open Linked Document")},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
@ -422,8 +421,8 @@ static action_toolbar_labels voucher_action_tooltips[] = {
|
||||
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the voucher")},
|
||||
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this voucher") },
|
||||
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this voucher") },
|
||||
{"BusinessAssociationAction", N_("Manage Document Link")},
|
||||
{"BusinessAssociationOpenAction", N_("Open Linked Document")},
|
||||
{"BusinessLinkAction", N_("Manage Document Link")},
|
||||
{"BusinessLinkOpenAction", N_("Open Linked Document")},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
@ -443,8 +442,8 @@ static action_toolbar_labels creditnote_action_tooltips[] = {
|
||||
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the credit note")},
|
||||
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this credit note") },
|
||||
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this credit note") },
|
||||
{"BusinessAssociationAction", N_("_Manage Document Link")},
|
||||
{"BusinessAssociationOpenAction", N_("Open Linked Document")},
|
||||
{"BusinessLinkAction", N_("_Manage Document Link")},
|
||||
{"BusinessLinkOpenAction", N_("Open Linked Document")},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
@ -607,8 +606,7 @@ update_assoc_actions (GncPluginPage *plugin_page, gboolean has_uri)
|
||||
{
|
||||
GtkAction *uri_action;
|
||||
|
||||
uri_action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(plugin_page), "BusinessAssociationOpenAction");
|
||||
gtk_action_set_sensitive (uri_action, has_uri);
|
||||
uri_action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(plugin_page), "BusinessLinkOpenAction");
|
||||
gtk_action_set_sensitive (uri_action, has_uri);
|
||||
}
|
||||
|
||||
@ -743,9 +741,9 @@ gnc_plugin_page_invoice_update_menus (GncPluginPage *page, gboolean is_posted, g
|
||||
/* update the layout action tooltips */
|
||||
gnc_plugin_page_invoice_action_update (action_group, tooltip_layout_list, (void*)gtk_action_set_tooltip);
|
||||
|
||||
// update association buttons
|
||||
// update doclink buttons
|
||||
invoice = gnc_invoice_window_get_invoice (priv->iw);
|
||||
if (gncInvoiceGetAssociation (invoice))
|
||||
if (gncInvoiceGetDocLink (invoice))
|
||||
has_uri = TRUE;
|
||||
|
||||
update_assoc_actions (page, has_uri);
|
||||
@ -1341,7 +1339,7 @@ gnc_plugin_page_invoice_cmd_reset_layout (GtkAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_page_invoice_cmd_associate (GtkAction *action,
|
||||
gnc_plugin_page_invoice_cmd_link (GtkAction *action,
|
||||
GncPluginPageInvoice *plugin_page)
|
||||
{
|
||||
GncPluginPageInvoicePrivate *priv;
|
||||
@ -1358,27 +1356,30 @@ gnc_plugin_page_invoice_cmd_associate (GtkAction *action,
|
||||
parent = GTK_WINDOW(gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(plugin_page)));
|
||||
|
||||
invoice = gnc_invoice_window_get_invoice (priv->iw);
|
||||
uri = gncInvoiceGetAssociation (invoice);
|
||||
uri = gncInvoiceGetDocLink (invoice);
|
||||
|
||||
ret_uri = gnc_assoc_get_uri_dialog (parent, _("Manage Document Link"), uri);
|
||||
ret_uri = gnc_doclink_get_uri_dialog (parent, _("Manage Document Link"), uri);
|
||||
|
||||
if (ret_uri && g_strcmp0 (uri, ret_uri) != 0)
|
||||
{
|
||||
GtkWidget *assoc_link_button = gnc_invoice_window_get_assoc_link_button (priv->iw);
|
||||
GtkWidget *doclink_button =
|
||||
gnc_invoice_window_get_doclink_button (priv->iw);
|
||||
|
||||
if (assoc_link_button)
|
||||
if (doclink_button)
|
||||
{
|
||||
if (g_strcmp0 (ret_uri, "") == 0)
|
||||
gtk_widget_hide (GTK_WIDGET(assoc_link_button));
|
||||
gtk_widget_hide (GTK_WIDGET(doclink_button));
|
||||
else
|
||||
{
|
||||
gchar *display_uri = gnc_assoc_get_unescaped_just_uri (ret_uri);
|
||||
gtk_link_button_set_uri (GTK_LINK_BUTTON(assoc_link_button), display_uri);
|
||||
gtk_widget_show (GTK_WIDGET(assoc_link_button));
|
||||
gchar *display_uri =
|
||||
gnc_doclink_get_unescaped_just_uri (ret_uri);
|
||||
gtk_link_button_set_uri (GTK_LINK_BUTTON(doclink_button),
|
||||
display_uri);
|
||||
gtk_widget_show (GTK_WIDGET(doclink_button));
|
||||
g_free (display_uri);
|
||||
}
|
||||
}
|
||||
gncInvoiceSetAssociation (invoice, ret_uri);
|
||||
gncInvoiceSetDocLink (invoice, ret_uri);
|
||||
has_uri = TRUE;
|
||||
}
|
||||
|
||||
@ -1390,14 +1391,14 @@ gnc_plugin_page_invoice_cmd_associate (GtkAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_page_invoice_cmd_associate_remove (GtkAction *action,
|
||||
gnc_plugin_page_invoice_cmd_link_remove (GtkAction *action,
|
||||
GncPluginPageInvoice *plugin_page)
|
||||
{
|
||||
GncPluginPageInvoicePrivate *priv;
|
||||
GtkWindow *parent;
|
||||
GtkAction *uri_action;
|
||||
GncInvoice *invoice;
|
||||
GtkWidget *assoc_link_button;
|
||||
GtkWidget *doclink_button;
|
||||
|
||||
g_return_if_fail (GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
|
||||
ENTER("(action %p, plugin_page %p)", action, plugin_page);
|
||||
@ -1405,12 +1406,12 @@ gnc_plugin_page_invoice_cmd_associate_remove (GtkAction *action,
|
||||
parent = GTK_WINDOW(gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(plugin_page)));
|
||||
|
||||
invoice = gnc_invoice_window_get_invoice (priv->iw);
|
||||
gncInvoiceSetAssociation (invoice, "");
|
||||
gncInvoiceSetDocLink (invoice, "");
|
||||
|
||||
assoc_link_button = gnc_invoice_window_get_assoc_link_button (priv->iw);
|
||||
doclink_button = gnc_invoice_window_get_doclink_button (priv->iw);
|
||||
|
||||
if (assoc_link_button)
|
||||
gtk_widget_hide (GTK_WIDGET(assoc_link_button));
|
||||
if (doclink_button)
|
||||
gtk_widget_hide (GTK_WIDGET(doclink_button));
|
||||
|
||||
// update the menu actions
|
||||
update_assoc_actions (GNC_PLUGIN_PAGE(plugin_page), FALSE);
|
||||
@ -1419,7 +1420,7 @@ gnc_plugin_page_invoice_cmd_associate_remove (GtkAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_page_invoice_cmd_associate_open (GtkAction *action,
|
||||
gnc_plugin_page_invoice_cmd_link_open (GtkAction *action,
|
||||
GncPluginPageInvoice *plugin_page)
|
||||
{
|
||||
GncPluginPageInvoicePrivate *priv;
|
||||
@ -1433,10 +1434,10 @@ gnc_plugin_page_invoice_cmd_associate_open (GtkAction *action,
|
||||
parent = GTK_WINDOW(gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(plugin_page)));
|
||||
|
||||
invoice = gnc_invoice_window_get_invoice (priv->iw);
|
||||
uri = gncInvoiceGetAssociation (invoice);
|
||||
uri = gncInvoiceGetDocLink (invoice);
|
||||
|
||||
if (uri)
|
||||
gnc_assoc_open_uri (parent, uri);
|
||||
gnc_doclink_open_uri (parent, uri);
|
||||
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
@ -256,13 +256,13 @@ static void gnc_plugin_page_register_cmd_account_report (GtkAction* action,
|
||||
GncPluginPageRegister* plugin_page);
|
||||
static void gnc_plugin_page_register_cmd_transaction_report (GtkAction* action,
|
||||
GncPluginPageRegister* plugin_page);
|
||||
static void gnc_plugin_page_register_cmd_associate_transaction (GtkAction *action,
|
||||
static void gnc_plugin_page_register_cmd_linked_transaction (GtkAction *action,
|
||||
GncPluginPageRegister *plugin_page);
|
||||
static void gnc_plugin_page_register_cmd_associate_transaction_open (GtkAction *action,
|
||||
static void gnc_plugin_page_register_cmd_linked_transaction_open (GtkAction *action,
|
||||
GncPluginPageRegister *plugin_page);
|
||||
static void gnc_plugin_page_register_cmd_associate_transaction_remove (GtkAction *action,
|
||||
static void gnc_plugin_page_register_cmd_linked_transaction_remove (GtkAction *action,
|
||||
GncPluginPageRegister *plugin_page);
|
||||
static void gnc_plugin_page_register_cmd_jump_associated_invoice (GtkAction* action,
|
||||
static void gnc_plugin_page_register_cmd_jump_linked_invoice (GtkAction* action,
|
||||
GncPluginPageRegister* plugin_page);
|
||||
static void gnc_plugin_page_help_changed_cb (GNCSplitReg* gsr,
|
||||
GncPluginPageRegister* register_page);
|
||||
@ -295,14 +295,14 @@ static GList* invoices_from_transaction (Transaction* trans);
|
||||
/* Translators: This is a menu item that opens a dialog for linking an
|
||||
external file or URL with the bill, invoice, transaction, or voucher or
|
||||
removing such an link. */
|
||||
#define ASSOCIATE_TRANSACTION_LABEL N_("_Manage Document Link...")
|
||||
#define LINK_TRANSACTION_LABEL N_("_Manage Document Link...")
|
||||
/* Translators: This is a menu item that opens an external file or URI that may
|
||||
be linked to the current bill, invoice, transaction, or voucher using
|
||||
the operating system's default application for the file or URI mime type. */
|
||||
#define ASSOCIATE_TRANSACTION_OPEN_LABEL N_("_Open Linked Document")
|
||||
#define LINK_TRANSACTION_OPEN_LABEL N_("_Open Linked Document")
|
||||
/* Translators: This is a menu item that will open the bill, invoice, or voucher
|
||||
that is posted to the current transaction if there is one. */
|
||||
#define JUMP_ASSOCIATED_INVOICE_LABEL N_("Jump to Invoice")
|
||||
#define JUMP_LINKED_INVOICE_LABEL N_("Jump to Invoice")
|
||||
#define CUT_SPLIT_LABEL N_("Cu_t Split")
|
||||
#define COPY_SPLIT_LABEL N_("_Copy Split")
|
||||
#define PASTE_SPLIT_LABEL N_("_Paste Split")
|
||||
@ -313,9 +313,9 @@ static GList* invoices_from_transaction (Transaction* trans);
|
||||
#define PASTE_TRANSACTION_TIP N_("Paste the transaction from the clipboard")
|
||||
#define DUPLICATE_TRANSACTION_TIP N_("Make a copy of the current transaction")
|
||||
#define DELETE_TRANSACTION_TIP N_("Delete the current transaction")
|
||||
#define ASSOCIATE_TRANSACTION_TIP N_("Add, change, or unlink the document linked with the current transaction")
|
||||
#define ASSOCIATE_TRANSACTION_OPEN_TIP N_("Open the linked document for the current transaction")
|
||||
#define JUMP_ASSOCIATED_INVOICE_TIP N_("Jump to the linked bill, invoice, or voucher")
|
||||
#define LINK_TRANSACTION_TIP N_("Add, change, or unlink the document linked with the current transaction")
|
||||
#define LINK_TRANSACTION_OPEN_TIP N_("Open the linked document for the current transaction")
|
||||
#define JUMP_LINKED_INVOICE_TIP N_("Jump to the linked bill, invoice, or voucher")
|
||||
#define CUT_SPLIT_TIP N_("Cut the selected split into clipboard")
|
||||
#define COPY_SPLIT_TIP N_("Copy the selected split into clipboard")
|
||||
#define PASTE_SPLIT_TIP N_("Paste the split from the clipboard")
|
||||
@ -419,19 +419,19 @@ static GtkActionEntry gnc_plugin_page_register_actions [] =
|
||||
G_CALLBACK (gnc_plugin_page_register_cmd_reverse_transaction)
|
||||
},
|
||||
{
|
||||
"AssociateTransactionAction", NULL, ASSOCIATE_TRANSACTION_LABEL, NULL,
|
||||
ASSOCIATE_TRANSACTION_TIP,
|
||||
G_CALLBACK (gnc_plugin_page_register_cmd_associate_transaction)
|
||||
"LinkTransactionAction", NULL, LINK_TRANSACTION_LABEL, NULL,
|
||||
LINK_TRANSACTION_TIP,
|
||||
G_CALLBACK (gnc_plugin_page_register_cmd_linked_transaction)
|
||||
},
|
||||
{
|
||||
"AssociateTransactionOpenAction", NULL, ASSOCIATE_TRANSACTION_OPEN_LABEL, NULL,
|
||||
ASSOCIATE_TRANSACTION_OPEN_TIP,
|
||||
G_CALLBACK (gnc_plugin_page_register_cmd_associate_transaction_open)
|
||||
"LinkedTransactionOpenAction", NULL, LINK_TRANSACTION_OPEN_LABEL, NULL,
|
||||
LINK_TRANSACTION_OPEN_TIP,
|
||||
G_CALLBACK (gnc_plugin_page_register_cmd_linked_transaction_open)
|
||||
},
|
||||
{
|
||||
"JumpAssociatedInvoiceAction", NULL, JUMP_ASSOCIATED_INVOICE_LABEL, NULL,
|
||||
JUMP_ASSOCIATED_INVOICE_TIP,
|
||||
G_CALLBACK (gnc_plugin_page_register_cmd_jump_associated_invoice)
|
||||
"JumpLinkedInvoiceAction", NULL, JUMP_LINKED_INVOICE_LABEL, NULL,
|
||||
JUMP_LINKED_INVOICE_TIP,
|
||||
G_CALLBACK (gnc_plugin_page_register_cmd_jump_linked_invoice)
|
||||
},
|
||||
|
||||
/* View menu */
|
||||
@ -614,9 +614,9 @@ static action_toolbar_labels toolbar_labels[] =
|
||||
{ "BlankTransactionAction", N_ ("Blank") },
|
||||
{ "ActionsReconcileAction", N_ ("Reconcile") },
|
||||
{ "ActionsAutoClearAction", N_ ("Auto-clear") },
|
||||
{ "AssociateTransactionAction", N_ ("Manage Document Link") },
|
||||
{ "AssociateTransactionOpenAction", N_ ("Open Linked Document") },
|
||||
{ "JumpAssociatedInvoiceAction", N_ ("Invoice") },
|
||||
{ "LinkTransactionAction", N_ ("Manage Document Link") },
|
||||
{ "LinkedTransactionOpenAction", N_ ("Open Linked Document") },
|
||||
{ "JumpLinkedInvoiceAction", N_ ("Invoice") },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
@ -999,7 +999,7 @@ static const char* readonly_inactive_actions[] =
|
||||
"ScheduleTransactionAction",
|
||||
"ScrubAllAction",
|
||||
"ScrubCurrentAction",
|
||||
"AssociateTransactionAction",
|
||||
"LinkTransactionAction",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -1023,9 +1023,9 @@ static const char* tran_action_labels[] =
|
||||
PASTE_TRANSACTION_LABEL,
|
||||
DUPLICATE_TRANSACTION_LABEL,
|
||||
DELETE_TRANSACTION_LABEL,
|
||||
ASSOCIATE_TRANSACTION_LABEL,
|
||||
ASSOCIATE_TRANSACTION_OPEN_LABEL,
|
||||
JUMP_ASSOCIATED_INVOICE_LABEL,
|
||||
LINK_TRANSACTION_LABEL,
|
||||
LINK_TRANSACTION_OPEN_LABEL,
|
||||
JUMP_LINKED_INVOICE_LABEL,
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -1037,9 +1037,9 @@ static const char* tran_action_tips[] =
|
||||
PASTE_TRANSACTION_TIP,
|
||||
DUPLICATE_TRANSACTION_TIP,
|
||||
DELETE_TRANSACTION_TIP,
|
||||
ASSOCIATE_TRANSACTION_TIP,
|
||||
ASSOCIATE_TRANSACTION_OPEN_TIP,
|
||||
JUMP_ASSOCIATED_INVOICE_TIP,
|
||||
LINK_TRANSACTION_TIP,
|
||||
LINK_TRANSACTION_OPEN_TIP,
|
||||
JUMP_LINKED_INVOICE_TIP,
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -1141,11 +1141,11 @@ gnc_plugin_page_register_ui_update (gpointer various,
|
||||
"UnvoidTransactionAction");
|
||||
gtk_action_set_sensitive (GTK_ACTION (action), voided);
|
||||
|
||||
/* Set 'Open and Remove Associated' */
|
||||
uri = xaccTransGetAssociation (trans);
|
||||
/* Set 'Open and Remove Linked Documents' */
|
||||
uri = xaccTransGetDocLink (trans);
|
||||
|
||||
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
|
||||
"AssociateTransactionOpenAction");
|
||||
"LinkedTransactionOpenAction");
|
||||
gtk_action_set_sensitive (GTK_ACTION(action), (uri ? TRUE:FALSE));
|
||||
|
||||
/* Set 'ExecAssociatedInvoice'
|
||||
@ -1154,7 +1154,7 @@ gnc_plugin_page_register_ui_update (gpointer various,
|
||||
- it has splits with an invoice associated with it
|
||||
*/
|
||||
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page),
|
||||
"JumpAssociatedInvoiceAction");
|
||||
"JumpLinkedInvoiceAction");
|
||||
|
||||
invoices = invoices_from_transaction (trans);
|
||||
gtk_action_set_sensitive (GTK_ACTION (action), (invoices != NULL));
|
||||
@ -4547,8 +4547,8 @@ gnc_plugin_page_register_cmd_delete_transaction (GtkAction* action,
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_page_register_cmd_associate_transaction (GtkAction *action,
|
||||
GncPluginPageRegister* plugin_page)
|
||||
gnc_plugin_page_register_cmd_linked_transaction (GtkAction *action,
|
||||
GncPluginPageRegister* plugin_page)
|
||||
{
|
||||
GncPluginPageRegisterPrivate* priv;
|
||||
|
||||
@ -4563,8 +4563,8 @@ gnc_plugin_page_register_cmd_associate_transaction (GtkAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_page_register_cmd_associate_transaction_open (GtkAction *action,
|
||||
GncPluginPageRegister* plugin_page)
|
||||
gnc_plugin_page_register_cmd_linked_transaction_open (GtkAction *action,
|
||||
GncPluginPageRegister* plugin_page)
|
||||
{
|
||||
GncPluginPageRegisterPrivate* priv;
|
||||
|
||||
@ -4578,8 +4578,8 @@ gnc_plugin_page_register_cmd_associate_transaction_open (GtkAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_page_register_cmd_associate_transaction_remove (GtkAction *action,
|
||||
GncPluginPageRegister* plugin_page)
|
||||
gnc_plugin_page_register_cmd_linked_transaction_remove (GtkAction *action,
|
||||
GncPluginPageRegister* plugin_page)
|
||||
{
|
||||
GncPluginPageRegisterPrivate* priv;
|
||||
|
||||
@ -4628,8 +4628,8 @@ GList* invoices_from_transaction (Transaction* trans)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_page_register_cmd_jump_associated_invoice (GtkAction* action,
|
||||
GncPluginPageRegister* plugin_page)
|
||||
gnc_plugin_page_register_cmd_jump_linked_invoice (GtkAction* action,
|
||||
GncPluginPageRegister* plugin_page)
|
||||
{
|
||||
GncPluginPageRegisterPrivate* priv;
|
||||
SplitRegister* reg;
|
||||
@ -4678,7 +4678,7 @@ gnc_plugin_page_register_cmd_jump_associated_invoice (GtkAction* action,
|
||||
details = g_list_reverse (details);
|
||||
choice = gnc_choose_radio_option_dialog
|
||||
(GNC_PLUGIN_PAGE (plugin_page)->window, _("Select document"),
|
||||
_("Several documents are associated with this transaction. \
|
||||
_("Several documents are linked with this transaction. \
|
||||
Please choose one:"), _("Select"), 0, details);
|
||||
if (choice >= 0)
|
||||
invoice = (GncInvoice *)(g_list_nth (invoices, choice))->data;
|
||||
|
@ -408,7 +408,7 @@ static GtkToggleActionEntry toggle_entries[] =
|
||||
{
|
||||
{
|
||||
"ViewStyleDoubleLineAction", NULL, N_("_Double Line"), NULL,
|
||||
N_("Show a second line with \"Action\", \"Notes\", and \"File Association\" for each transaction."),
|
||||
N_("Show a second line with \"Action\", \"Notes\", and \"Linked Document\" for each transaction."),
|
||||
G_CALLBACK (gnc_plugin_page_register2_cmd_style_double_line), FALSE
|
||||
},
|
||||
|
||||
|
@ -37,8 +37,8 @@
|
||||
#include "qof.h"
|
||||
#include "SX-book.h"
|
||||
#include "dialog-account.h"
|
||||
#include "dialog-assoc.h"
|
||||
#include "dialog-assoc-utils.h"
|
||||
#include "dialog-doclink.h"
|
||||
#include "dialog-doclink-utils.h"
|
||||
#include "dialog-sx-editor.h"
|
||||
#include "dialog-sx-from-trans.h"
|
||||
#include "gnc-component-manager.h"
|
||||
@ -1292,12 +1292,15 @@ gsr_default_associate_handler (GNCSplitReg *gsr)
|
||||
return;
|
||||
|
||||
// fix an earlier error when storing relative paths before version 3.5
|
||||
uri = gnc_assoc_convert_trans_associate_uri (trans, gsr->read_only);
|
||||
uri = gnc_doclink_convert_trans_link_uri (trans, gsr->read_only);
|
||||
|
||||
ret_uri = gnc_assoc_get_uri_dialog (GTK_WINDOW(gsr->window), _("Change a Transaction Association"), uri);
|
||||
ret_uri =
|
||||
gnc_doclink_get_uri_dialog (GTK_WINDOW (gsr->window),
|
||||
_("Change a Transaction Linked Document"),
|
||||
uri);
|
||||
|
||||
if (ret_uri && g_strcmp0 (uri, ret_uri) != 0)
|
||||
xaccTransSetAssociation (trans, ret_uri);
|
||||
xaccTransSetDocLink (trans, ret_uri);
|
||||
|
||||
g_free (ret_uri);
|
||||
g_free (uri);
|
||||
@ -1327,9 +1330,9 @@ gsr_default_associate_open_handler (GNCSplitReg *gsr)
|
||||
return;
|
||||
|
||||
// fix an earlier error when storing relative paths before version 3.5
|
||||
uri = gnc_assoc_convert_trans_associate_uri (trans, gsr->read_only);
|
||||
uri = gnc_doclink_convert_trans_link_uri (trans, gsr->read_only);
|
||||
|
||||
gnc_assoc_open_uri (GTK_WINDOW (gsr->window), uri);
|
||||
gnc_doclink_open_uri (GTK_WINDOW (gsr->window), uri);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
@ -1358,7 +1361,7 @@ gsr_default_associate_remove_handler (GNCSplitReg *gsr)
|
||||
if (is_trans_readonly_and_warn (GTK_WINDOW(gsr->window), trans))
|
||||
return;
|
||||
|
||||
xaccTransSetAssociation (trans, "");
|
||||
xaccTransSetDocLink (trans, "");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1378,10 +1381,10 @@ gsr_default_associate_from_sheet_handler (GNCSplitReg *gsr)
|
||||
trans = xaccSplitGetParent (split);
|
||||
|
||||
// fix an earlier error when storing relative paths before version 3.5
|
||||
uri = gnc_assoc_convert_trans_associate_uri (trans, gsr->read_only);
|
||||
uri = gnc_doclink_convert_trans_link_uri (trans, gsr->read_only);
|
||||
|
||||
if (uri)
|
||||
gnc_assoc_open_uri (GTK_WINDOW (gsr->window), uri);
|
||||
gnc_doclink_open_uri (GTK_WINDOW (gsr->window), uri);
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "business-urls.h"
|
||||
#include "combocell.h"
|
||||
#include "dialog-account.h"
|
||||
#include "dialog-assoc.h"
|
||||
#include "dialog-doclink.h"
|
||||
#include "dialog-commodity.h"
|
||||
#include "dialog-invoice.h"
|
||||
#include "dialog-preferences.h"
|
||||
@ -167,13 +167,16 @@ gnc_html_register_url_cb (const char *location, const char *label,
|
||||
}
|
||||
}
|
||||
|
||||
else if (strncmp ("trans-association-guid=", location, strlen ("trans-association-guid=")) == 0)
|
||||
else if (strncmp ("trans-doclink-guid=", location,
|
||||
strlen ("trans-doclink-guid=")) == 0)
|
||||
{
|
||||
if (!validate_type("trans-association-guid=", location, GNC_ID_TRANS, result, &guid, &entity))
|
||||
if (!validate_type("trans-doclink-guid=", location, GNC_ID_TRANS,
|
||||
result, &guid, &entity))
|
||||
return FALSE;
|
||||
|
||||
trans = (Transaction *) entity;
|
||||
gnc_assoc_open_uri (gnc_ui_get_gtk_window (GTK_WIDGET(result->parent)), xaccTransGetAssociation (trans));
|
||||
gnc_doclink_open_uri (gnc_ui_get_gtk_window (GTK_WIDGET (result->parent)),
|
||||
xaccTransGetDocLink (trans));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
<child name="new-hierarchy" schema="org.gnucash.dialogs.new-hierarchy"/>
|
||||
<child name="search" schema="org.gnucash.dialogs.search"/>
|
||||
<child name="transfer" schema="org.gnucash.dialogs.transfer"/>
|
||||
<child name="business-assoc" schema="org.gnucash.dialogs.business-assoc"/>
|
||||
<child name="trans-assoc" schema="org.gnucash.dialogs.trans-assoc"/>
|
||||
<child name="business-doclink" schema="org.gnucash.dialogs.business-doclink"/>
|
||||
<child name="trans-doclink" schema="org.gnucash.dialogs.trans-doclink"/>
|
||||
<child name="options" schema="org.gnucash.dialogs.options"/>
|
||||
</schema>
|
||||
|
||||
@ -238,7 +238,7 @@
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
<schema id="org.gnucash.dialogs.business-assoc" path="/org/gnucash/dialogs/business-assoc/">
|
||||
<schema id="org.gnucash.dialogs.business-doclink" path="/org/gnucash/dialogs/business-doclink/">
|
||||
<key type="(iiii)" name="last-geometry">
|
||||
<default>(-1,-1,-1,-1)</default>
|
||||
<summary>Last window position and size</summary>
|
||||
@ -248,7 +248,7 @@
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
<schema id="org.gnucash.dialogs.trans-assoc" path="/org/gnucash/dialogs/trans-assoc/">
|
||||
<schema id="org.gnucash.dialogs.trans-doclink" path="/org/gnucash/dialogs/trans-doclink/">
|
||||
<key type="(iiii)" name="last-geometry">
|
||||
<default>(-1,-1,-1,-1)</default>
|
||||
<summary>Last window position and size</summary>
|
||||
|
@ -20,7 +20,7 @@
|
||||
<summary>Character to use as separator between account names</summary>
|
||||
<description>This setting determines the character that will be used between components of an account name. Possible values are any single non-alphanumeric unicode character, or any of the following strings: "colon", "slash", "backslash", "dash" and "period".</description>
|
||||
</key>
|
||||
<key name="assoc-head" type="s">
|
||||
<key name="doclink-head" type="s">
|
||||
<default>''</default>
|
||||
<summary>Transaction Linked Files head path</summary>
|
||||
<description>This is the path head for the Transaction Linked Files with relative paths</description>
|
||||
|
@ -13,7 +13,7 @@ set (gtkbuilder_SOURCES
|
||||
business-prefs.glade
|
||||
dialog-account-picker.glade
|
||||
dialog-account.glade
|
||||
dialog-assoc.glade
|
||||
dialog-doclink.glade
|
||||
dialog-bi-import-gui.glade
|
||||
dialog-billterms.glade
|
||||
dialog-book-close.glade
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!-- Generated with glade 3.22.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<object class="GtkDialog" id="association_dialog">
|
||||
<object class="GtkDialog" id="linked_doc_dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="default_width">600</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
@ -489,7 +489,7 @@
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkWindow" id="association_window">
|
||||
<object class="GtkWindow" id="linked_doc_window">
|
||||
<property name="can_focus">False</property>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
@ -652,7 +652,7 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="assoc">
|
||||
<object class="GtkTreeViewColumn" id="doclink">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Linked Document</property>
|
||||
<property name="alignment">0.5</property>
|
@ -411,11 +411,11 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="assoc_hbox">
|
||||
<object class="GtkBox" id="link_hbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="doc_link_button">
|
||||
<object class="GtkLinkButton" id="doclink_button">
|
||||
<property name="label" translatable="yes">Open Document Link</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
@ -1081,7 +1081,7 @@ If 0, all previous days included</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="assoc_check_button">
|
||||
<object class="GtkCheckButton" id="link_check_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
@ -1096,7 +1096,7 @@ If 0, all previous days included</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="assoc_label">
|
||||
<object class="GtkLabel" id="link_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
|
@ -888,9 +888,9 @@ gnc_split_register_auto_completion (SplitRegister *reg,
|
||||
g_assert(pending_trans == trans);
|
||||
|
||||
gnc_copy_trans_onto_trans (auto_trans, trans, FALSE, FALSE);
|
||||
/* if there is an association, lets clear it */
|
||||
if (xaccTransGetAssociation (auto_trans) != NULL)
|
||||
xaccTransSetAssociation (trans, "");
|
||||
/* if there is an doclink, let's clear it */
|
||||
if (xaccTransGetDocLink (auto_trans) != NULL)
|
||||
xaccTransSetDocLink (trans, "");
|
||||
blank_split = NULL;
|
||||
|
||||
if (gnc_split_register_get_default_account (reg) != NULL)
|
||||
|
@ -229,10 +229,10 @@ const char *gnc_float_txn_get_notes (const FloatingTxn *ft)
|
||||
return ft->m_notes;
|
||||
}
|
||||
|
||||
const char *gnc_float_txn_get_association (const FloatingTxn *ft)
|
||||
const char *gnc_float_txn_get_doclink (const FloatingTxn *ft)
|
||||
{
|
||||
g_return_val_if_fail (ft, NULL);
|
||||
return ft->m_association;
|
||||
return ft->m_doclink;
|
||||
}
|
||||
|
||||
SplitList *gnc_float_txn_get_splits (const FloatingTxn *ft)
|
||||
@ -309,10 +309,10 @@ void gnc_float_txn_set_notes (FloatingTxn *ft, const char *notes)
|
||||
ft->m_notes = notes;
|
||||
};
|
||||
|
||||
void gnc_float_txn_set_association (FloatingTxn *ft, const char *association)
|
||||
void gnc_float_txn_set_doclink (FloatingTxn *ft, const char *doclink)
|
||||
{
|
||||
g_return_if_fail (ft);
|
||||
ft->m_association = association;
|
||||
ft->m_doclink = doclink;
|
||||
};
|
||||
|
||||
void gnc_float_txn_set_splits (FloatingTxn *ft, SplitList *splits)
|
||||
@ -346,7 +346,7 @@ FloatingTxn *gnc_txn_to_float_txn (Transaction *txn, gboolean use_cut_semantics)
|
||||
}
|
||||
ft->m_description = xaccTransGetDescription (txn);
|
||||
ft->m_notes = xaccTransGetNotes (txn);
|
||||
ft->m_association = xaccTransGetAssociation (txn);
|
||||
ft->m_doclink = xaccTransGetDocLink (txn);
|
||||
|
||||
for (iter = xaccTransGetSplitList (txn); iter ; iter = iter->next)
|
||||
{
|
||||
@ -388,8 +388,8 @@ void gnc_float_txn_to_txn_swap_accounts (const FloatingTxn *ft, Transaction *txn
|
||||
xaccTransSetNum (txn, ft->m_num);
|
||||
if (ft->m_notes)
|
||||
xaccTransSetNotes (txn, ft->m_notes);
|
||||
if (ft->m_association)
|
||||
xaccTransSetAssociation (txn, ft->m_association);
|
||||
if (ft->m_doclink)
|
||||
xaccTransSetDocLink (txn, ft->m_doclink);
|
||||
if (ft->m_date_posted)
|
||||
xaccTransSetDatePostedSecs (txn, ft->m_date_posted);
|
||||
|
||||
|
@ -55,7 +55,7 @@ typedef struct
|
||||
const char *m_num;
|
||||
const char *m_description;
|
||||
const char *m_notes;
|
||||
const char *m_association;
|
||||
const char *m_doclink;
|
||||
SplitList *m_splits;
|
||||
} FloatingTxn;
|
||||
|
||||
@ -92,7 +92,7 @@ time64 gnc_float_txn_get_date_posted (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_num (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_description (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_notes (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_association (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_doclink (const FloatingTxn *ft);
|
||||
SplitList *gnc_float_txn_get_splits (const FloatingTxn *ft);
|
||||
|
||||
FloatingSplit *gnc_float_txn_get_float_split (const FloatingTxn *ft, guint index);
|
||||
@ -106,7 +106,7 @@ void gnc_float_txn_set_date_posted (FloatingTxn *ft, time64 date_posted);
|
||||
void gnc_float_txn_set_num (FloatingTxn *ft, const char *num);
|
||||
void gnc_float_txn_set_description (FloatingTxn *ft, const char *description);
|
||||
void gnc_float_txn_set_notes (FloatingTxn *ft, const char *notes);
|
||||
void gnc_float_txn_set_association (FloatingTxn *ft, const char *association);
|
||||
void gnc_float_txn_set_doclink (FloatingTxn *ft, const char *doclink);
|
||||
void gnc_float_txn_set_splits (FloatingTxn *ft, SplitList *splits);
|
||||
|
||||
void gnc_float_txn_append_float_split (FloatingTxn *ft, FloatingSplit *fs);
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "gnc-gui-query.h"
|
||||
#include "numcell.h"
|
||||
#include "quickfillcell.h"
|
||||
#include "assoccell.h"
|
||||
#include "doclinkcell.h"
|
||||
#include "recncell.h"
|
||||
#include "split-register.h"
|
||||
#include "split-register-p.h"
|
||||
@ -72,22 +72,22 @@ gnc_split_register_load_recn_cells (SplitRegister* reg)
|
||||
static void
|
||||
gnc_split_register_load_associate_cells (SplitRegister* reg)
|
||||
{
|
||||
AssocCell *cell;
|
||||
Doclinkcell *cell;
|
||||
const char * s;
|
||||
|
||||
if (!reg) return;
|
||||
|
||||
cell = (AssocCell *)
|
||||
cell = (Doclinkcell *)
|
||||
gnc_table_layout_get_cell (reg->table->layout, ASSOC_CELL);
|
||||
|
||||
if (!cell) return;
|
||||
|
||||
/* FIXME: These should get moved to an i18n function */
|
||||
s = gnc_get_association_valid_flags ();
|
||||
gnc_assoc_cell_set_valid_flags (cell, s, ' ');
|
||||
gnc_assoc_cell_set_flag_order (cell, gnc_get_association_flag_order ());
|
||||
gnc_assoc_cell_set_string_getter (cell, gnc_get_association_str);
|
||||
gnc_assoc_cell_set_read_only (cell, TRUE);
|
||||
s = gnc_get_doclink_valid_flags ();
|
||||
gnc_doclink_cell_set_valid_flags (cell, s, ' ');
|
||||
gnc_doclink_cell_set_flag_order (cell, gnc_get_doclink_flag_order ());
|
||||
gnc_doclink_cell_set_string_getter (cell, gnc_get_doclink_str);
|
||||
gnc_doclink_cell_set_read_only (cell, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -416,8 +416,8 @@ gnc_split_register_load (SplitRegister* reg, GList* slist,
|
||||
((PriceCell*) gnc_table_layout_get_cell (table->layout, CRED_CELL),
|
||||
gnc_account_print_info (default_account, FALSE));
|
||||
|
||||
gnc_assoc_cell_set_use_glyphs
|
||||
((AssocCell *) gnc_table_layout_get_cell (table->layout, ASSOC_CELL));
|
||||
gnc_doclink_cell_set_use_glyphs
|
||||
((Doclinkcell *) gnc_table_layout_get_cell (table->layout, ASSOC_CELL));
|
||||
|
||||
/* make sure we have a blank split */
|
||||
if (blank_split == NULL)
|
||||
|
@ -27,14 +27,14 @@
|
||||
|
||||
#include "datecell.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "dialog-assoc-utils.h"
|
||||
#include "dialog-doclink-utils.h"
|
||||
#include "gnc-engine.h"
|
||||
#include "gnc-prefs.h"
|
||||
#include "gnc-ui.h"
|
||||
#include "gnc-uri-utils.h"
|
||||
#include "gnc-filepath-utils.h"
|
||||
#include "gnc-warnings.h"
|
||||
#include "assoccell.h"
|
||||
#include "doclinkcell.h"
|
||||
#include "pricecell.h"
|
||||
#include "recncell.h"
|
||||
#include "split-register.h"
|
||||
@ -557,11 +557,11 @@ gnc_split_register_get_associate_tooltip (VirtualLocation virt_loc,
|
||||
return NULL;
|
||||
|
||||
// get the existing uri
|
||||
uri = xaccTransGetAssociation (trans);
|
||||
uri = xaccTransGetDocLink (trans);
|
||||
|
||||
// Check for uri is empty or NULL
|
||||
if (uri && *uri)
|
||||
return gnc_assoc_get_unescaped_just_uri (uri);
|
||||
return gnc_doclink_get_unescaped_just_uri (uri);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@ -804,11 +804,11 @@ gnc_split_register_get_associate_entry (VirtualLocation virt_loc,
|
||||
{
|
||||
SplitRegister* reg = user_data;
|
||||
Transaction* trans;
|
||||
char associate;
|
||||
char link_flag;
|
||||
const char* uri;
|
||||
AssocCell *cell;
|
||||
Doclinkcell *cell;
|
||||
|
||||
cell = (AssocCell *)gnc_table_layout_get_cell (reg->table->layout, ASSOC_CELL);
|
||||
cell = (Doclinkcell *)gnc_table_layout_get_cell (reg->table->layout, ASSOC_CELL);
|
||||
|
||||
if (!cell)
|
||||
return NULL;
|
||||
@ -818,7 +818,7 @@ gnc_split_register_get_associate_entry (VirtualLocation virt_loc,
|
||||
return NULL;
|
||||
|
||||
// get the existing uri
|
||||
uri = xaccTransGetAssociation (trans);
|
||||
uri = xaccTransGetDocLink (trans);
|
||||
|
||||
// Check for uri is empty or NULL
|
||||
if (uri && *uri)
|
||||
@ -826,25 +826,25 @@ gnc_split_register_get_associate_entry (VirtualLocation virt_loc,
|
||||
gchar* scheme = gnc_uri_get_scheme (uri);
|
||||
|
||||
if (!scheme || g_strcmp0 (scheme, "file") == 0)
|
||||
associate = FASSOC;
|
||||
link_flag = FLINK;
|
||||
else
|
||||
associate = WASSOC;
|
||||
link_flag = WLINK;
|
||||
|
||||
g_free (scheme);
|
||||
}
|
||||
else
|
||||
associate = ' ';
|
||||
link_flag = ' ';
|
||||
|
||||
if (gnc_assoc_get_use_glyphs (cell))
|
||||
return gnc_assoc_get_glyph_from_flag (associate);
|
||||
if (gnc_doclink_get_use_glyphs (cell))
|
||||
return gnc_doclink_get_glyph_from_flag (link_flag);
|
||||
|
||||
if (translate)
|
||||
return gnc_get_association_str (associate);
|
||||
return gnc_get_doclink_str (link_flag);
|
||||
else
|
||||
{
|
||||
static char s[2];
|
||||
|
||||
s[0] = associate;
|
||||
s[0] = link_flag;
|
||||
s[1] = '\0';
|
||||
return s;
|
||||
}
|
||||
@ -864,13 +864,13 @@ static char
|
||||
gnc_split_register_get_associate_value (SplitRegister* reg,
|
||||
VirtualLocation virt_loc)
|
||||
{
|
||||
AssocCell *cell;
|
||||
Doclinkcell *cell;
|
||||
|
||||
cell = (AssocCell *)gnc_table_layout_get_cell (reg->table->layout, ASSOC_CELL);
|
||||
cell = (Doclinkcell *)gnc_table_layout_get_cell (reg->table->layout, ASSOC_CELL);
|
||||
if (!cell)
|
||||
return '\0';
|
||||
|
||||
return gnc_assoc_cell_get_flag (cell);
|
||||
return gnc_doclink_cell_get_flag (cell);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -602,7 +602,7 @@ gnc_split_register_duplicate_current (SplitRegister* reg)
|
||||
|
||||
if (!gnc_dup_trans_dialog (gnc_split_register_get_parent (reg), NULL,
|
||||
TRUE, &date, in_num, &out_num, in_tnum, &out_tnum,
|
||||
xaccTransGetAssociation (trans), &out_tassoc))
|
||||
xaccTransGetDocLink (trans), &out_tassoc))
|
||||
{
|
||||
gnc_resume_gui_refresh ();
|
||||
LEAVE ("dup cancelled");
|
||||
@ -656,7 +656,7 @@ gnc_split_register_duplicate_current (SplitRegister* reg)
|
||||
|
||||
/* clear the associated entry if returned value NULL */
|
||||
if (out_tassoc == NULL)
|
||||
xaccTransSetAssociation (new_trans, "");
|
||||
xaccTransSetDocLink (new_trans, "");
|
||||
else
|
||||
g_free (out_tassoc);
|
||||
|
||||
|
@ -141,7 +141,7 @@ flsetup( FlFixture *fixture, gconstpointer pData )
|
||||
fixture->ft.m_num = CACHE_INSERT ("FtNum");
|
||||
fixture->ft.m_description = CACHE_INSERT ("FtDescription");
|
||||
fixture->ft.m_notes = CACHE_INSERT ("FtNotes");
|
||||
fixture->ft.m_association = CACHE_INSERT ("FtAssociation");
|
||||
fixture->ft.m_doclink = CACHE_INSERT ("FtDocLink");
|
||||
|
||||
fixture->fs1.m_split = NULL;
|
||||
fixture->fs1.m_account = fixture->acc1;
|
||||
@ -340,8 +340,8 @@ void gnc_float_txn_set_description (FloatingTxn *ft, const char *description)//
|
||||
void gnc_float_txn_set_notes (FloatingTxn *ft, const char *notes)// Local: 0:0:0
|
||||
*/
|
||||
// Not Used
|
||||
/* gnc_float_txn_set_association - trivial setter, skipping
|
||||
void gnc_float_txn_set_association (FloatingTxn *ft, const char *association)// Local: 0:0:0
|
||||
/* gnc_float_txn_set_doclink - trivial setter, skipping
|
||||
void gnc_float_txn_set_doclink (FloatingTxn *ft, const char *doclink)// Local: 0:0:0
|
||||
*/
|
||||
// Not Used
|
||||
/* gnc_float_txn_set_splits - trivial setter, skipping
|
||||
@ -376,7 +376,7 @@ test_gnc_txn_to_float_txn (Fixture *fixture, gconstpointer pData)
|
||||
g_assert_null (ft->m_num);
|
||||
g_assert_cmpstr (ft->m_description, ==, xaccTransGetDescription (fixture->txn));
|
||||
g_assert_cmpstr (ft->m_notes, ==, xaccTransGetNotes (fixture->txn));
|
||||
g_assert_cmpstr (ft->m_association, ==, xaccTransGetAssociation (fixture->txn));
|
||||
g_assert_cmpstr (ft->m_doclink, ==, xaccTransGetDocLink (fixture->txn));
|
||||
|
||||
/* Check split fields of first split */
|
||||
siter = sl;
|
||||
@ -435,7 +435,7 @@ test_gnc_txn_to_float_txn_cut_semantics (Fixture *fixture, gconstpointer pData)
|
||||
g_assert_cmpstr (ft->m_num, ==, xaccTransGetNum (fixture->txn));
|
||||
g_assert_cmpstr (ft->m_description, ==, xaccTransGetDescription (fixture->txn));
|
||||
g_assert_cmpstr (ft->m_notes, ==, xaccTransGetNotes (fixture->txn));
|
||||
g_assert_cmpstr (ft->m_association, ==, xaccTransGetAssociation (fixture->txn));
|
||||
g_assert_cmpstr (ft->m_doclink, ==, xaccTransGetDocLink (fixture->txn));
|
||||
|
||||
/* Check split fields of first split */
|
||||
siter = sl;
|
||||
@ -557,7 +557,7 @@ test_gnc_float_txn_to_txn_swap_accounts (FlFixture *fixture, gconstpointer pData
|
||||
g_assert_cmpstr (fixture->ft.m_description, ==, "FtDescription");
|
||||
g_assert_cmpstr (fixture->ft.m_num, ==, "FtNum");
|
||||
g_assert_cmpstr (fixture->ft.m_notes, ==, "FtNotes");
|
||||
g_assert_cmpstr (fixture->ft.m_association, ==, "FtAssociation");
|
||||
g_assert_cmpstr (fixture->ft.m_doclink, ==, "FtDocLink");
|
||||
g_assert_cmpint (fixture->ft.m_date_posted, ==, xaccTransGetDate (txn));
|
||||
|
||||
/* Next compare values for first split */
|
||||
|
@ -1,5 +1,5 @@
|
||||
set (register_core_SOURCES
|
||||
assoccell.c
|
||||
doclinkcell.c
|
||||
basiccell.c
|
||||
cell-factory.c
|
||||
cellblock.c
|
||||
@ -19,7 +19,7 @@ set (register_core_SOURCES
|
||||
|
||||
|
||||
set (register_core_HEADERS
|
||||
assoccell.h
|
||||
doclinkcell.h
|
||||
basiccell.h
|
||||
cell-factory.h
|
||||
cellblock.h
|
||||
|
@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* assoccell.c -- association checkbox cell *
|
||||
* doclinkcell.c -- Document Link checkbox cell *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
/*
|
||||
* FILE:
|
||||
* assoccell.c
|
||||
* doclinkcell.c
|
||||
*
|
||||
* FUNCTION:
|
||||
* Implements a mouse-click cell that allows a series
|
||||
@ -44,19 +44,19 @@
|
||||
|
||||
#include "basiccell.h"
|
||||
#include "gnc-engine.h"
|
||||
#include "assoccell.h"
|
||||
#include "doclinkcell.h"
|
||||
#include "gnc-ui-util.h"
|
||||
|
||||
static void gnc_assoc_cell_set_value (BasicCell *_cell, const char *value);
|
||||
static void gnc_doclink_cell_set_value (BasicCell *_cell, const char *value);
|
||||
|
||||
const char *
|
||||
gnc_assoc_get_glyph_from_flag (char association_flag)
|
||||
gnc_doclink_get_glyph_from_flag (char link_flag)
|
||||
{
|
||||
switch (association_flag)
|
||||
switch (link_flag)
|
||||
{
|
||||
case WASSOC:
|
||||
case WLINK:
|
||||
return GLYPH_LINK;
|
||||
case FASSOC:
|
||||
case FLINK:
|
||||
return GLYPH_PAPERCLIP;
|
||||
default:
|
||||
return " ";
|
||||
@ -64,29 +64,29 @@ gnc_assoc_get_glyph_from_flag (char association_flag)
|
||||
}
|
||||
|
||||
static const char
|
||||
gnc_assoc_get_flag_from_glyph (const char *glyph)
|
||||
gnc_doclink_get_flag_from_glyph (const char *glyph)
|
||||
{
|
||||
if (strcmp (glyph, GLYPH_LINK) == 0)
|
||||
return WASSOC;
|
||||
return WLINK;
|
||||
else if (strcmp (glyph, GLYPH_PAPERCLIP) == 0)
|
||||
return FASSOC;
|
||||
return FLINK;
|
||||
else
|
||||
return ' ';
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_assoc_get_use_glyphs (AssocCell *cell)
|
||||
gnc_doclink_get_use_glyphs (Doclinkcell *cell)
|
||||
{
|
||||
return cell->use_glyphs;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gnc_assoc_cell_get_string (AssocCell *cell, char flag)
|
||||
gnc_doclink_cell_get_string (Doclinkcell *cell, char flag)
|
||||
{
|
||||
static char str[2] = { 0, 0 };
|
||||
|
||||
if (cell->use_glyphs)
|
||||
return gnc_assoc_get_glyph_from_flag (flag);
|
||||
return gnc_doclink_get_glyph_from_flag (flag);
|
||||
|
||||
if (cell->get_string != NULL)
|
||||
return (cell->get_string)(flag);
|
||||
@ -97,12 +97,12 @@ gnc_assoc_cell_get_string (AssocCell *cell, char flag)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gnc_assoc_cell_enter (BasicCell *_cell,
|
||||
gnc_doclink_cell_enter (BasicCell *_cell,
|
||||
int *cursor_position,
|
||||
int *start_selection,
|
||||
int *end_selection)
|
||||
{
|
||||
AssocCell *cell = (AssocCell *) _cell;
|
||||
Doclinkcell *cell = (Doclinkcell *) _cell;
|
||||
char * this_flag;
|
||||
|
||||
if (cell->confirm_cb &&
|
||||
@ -133,17 +133,17 @@ gnc_assoc_cell_enter (BasicCell *_cell,
|
||||
}
|
||||
|
||||
/* And set the display */
|
||||
gnc_assoc_cell_set_flag (cell, cell->flag);
|
||||
gnc_doclink_cell_set_flag (cell, cell->flag);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_assoc_cell_init (AssocCell *cell)
|
||||
gnc_doclink_cell_init (Doclinkcell *cell)
|
||||
{
|
||||
gnc_basic_cell_init (&cell->cell);
|
||||
|
||||
gnc_assoc_cell_set_flag (cell, '\0');
|
||||
gnc_doclink_cell_set_flag (cell, '\0');
|
||||
cell->confirm_cb = NULL;
|
||||
cell->get_string = NULL;
|
||||
cell->valid_flags = "";
|
||||
@ -151,27 +151,27 @@ gnc_assoc_cell_init (AssocCell *cell)
|
||||
cell->read_only = FALSE;
|
||||
cell->use_glyphs = FALSE;
|
||||
|
||||
cell->cell.enter_cell = gnc_assoc_cell_enter;
|
||||
cell->cell.set_value = gnc_assoc_cell_set_value;
|
||||
cell->cell.enter_cell = gnc_doclink_cell_enter;
|
||||
cell->cell.set_value = gnc_doclink_cell_set_value;
|
||||
}
|
||||
|
||||
BasicCell *
|
||||
gnc_assoc_cell_new (void)
|
||||
gnc_doclink_cell_new (void)
|
||||
{
|
||||
AssocCell * cell;
|
||||
Doclinkcell * cell;
|
||||
|
||||
cell = g_new0 (AssocCell, 1);
|
||||
cell = g_new0 (Doclinkcell, 1);
|
||||
|
||||
gnc_assoc_cell_init (cell);
|
||||
gnc_doclink_cell_init (cell);
|
||||
|
||||
return &cell->cell;
|
||||
}
|
||||
|
||||
/* assumes we are given the untranslated form */
|
||||
static void
|
||||
gnc_assoc_cell_set_value (BasicCell *_cell, const char *value)
|
||||
gnc_doclink_cell_set_value (BasicCell *_cell, const char *value)
|
||||
{
|
||||
AssocCell *cell = (AssocCell *) _cell;
|
||||
Doclinkcell *cell = (Doclinkcell *) _cell;
|
||||
char flag;
|
||||
|
||||
if (!value || *value == '\0')
|
||||
@ -182,31 +182,31 @@ gnc_assoc_cell_set_value (BasicCell *_cell, const char *value)
|
||||
}
|
||||
|
||||
if (cell->use_glyphs)
|
||||
flag = gnc_assoc_get_flag_from_glyph (value);
|
||||
flag = gnc_doclink_get_flag_from_glyph (value);
|
||||
else
|
||||
{
|
||||
flag = cell->default_flag;
|
||||
if (strchr (cell->valid_flags, *value) != NULL)
|
||||
flag = *value;
|
||||
}
|
||||
gnc_assoc_cell_set_flag (cell, flag);
|
||||
gnc_doclink_cell_set_flag (cell, flag);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_assoc_cell_set_flag (AssocCell *cell, char flag)
|
||||
gnc_doclink_cell_set_flag (Doclinkcell *cell, char flag)
|
||||
{
|
||||
const char *string;
|
||||
|
||||
g_return_if_fail (cell != NULL);
|
||||
|
||||
cell->flag = flag;
|
||||
string = gnc_assoc_cell_get_string (cell, flag);
|
||||
string = gnc_doclink_cell_get_string (cell, flag);
|
||||
|
||||
gnc_basic_cell_set_value_internal (&cell->cell, string);
|
||||
}
|
||||
|
||||
char
|
||||
gnc_assoc_cell_get_flag (AssocCell *cell)
|
||||
gnc_doclink_cell_get_flag (Doclinkcell *cell)
|
||||
{
|
||||
g_return_val_if_fail (cell != NULL, '\0');
|
||||
|
||||
@ -214,8 +214,8 @@ gnc_assoc_cell_get_flag (AssocCell *cell)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_assoc_cell_set_string_getter (AssocCell *cell,
|
||||
AssocCellStringGetter get_string)
|
||||
gnc_doclink_cell_set_string_getter (Doclinkcell *cell,
|
||||
DoclinkcellStringGetter get_string)
|
||||
{
|
||||
g_return_if_fail (cell != NULL);
|
||||
|
||||
@ -223,7 +223,7 @@ gnc_assoc_cell_set_string_getter (AssocCell *cell,
|
||||
}
|
||||
|
||||
void
|
||||
gnc_assoc_cell_set_confirm_cb (AssocCell *cell, AssocCellConfirm confirm_cb,
|
||||
gnc_doclink_cell_set_confirm_cb (Doclinkcell *cell, DoclinkcellConfirm confirm_cb,
|
||||
gpointer data)
|
||||
{
|
||||
g_return_if_fail (cell != NULL);
|
||||
@ -233,7 +233,7 @@ gnc_assoc_cell_set_confirm_cb (AssocCell *cell, AssocCellConfirm confirm_cb,
|
||||
}
|
||||
|
||||
void
|
||||
gnc_assoc_cell_set_valid_flags (AssocCell *cell, const char *flags,
|
||||
gnc_doclink_cell_set_valid_flags (Doclinkcell *cell, const char *flags,
|
||||
char default_flag)
|
||||
{
|
||||
g_return_if_fail (cell != NULL);
|
||||
@ -244,7 +244,7 @@ gnc_assoc_cell_set_valid_flags (AssocCell *cell, const char *flags,
|
||||
}
|
||||
|
||||
void
|
||||
gnc_assoc_cell_set_flag_order (AssocCell *cell, const char *flags)
|
||||
gnc_doclink_cell_set_flag_order (Doclinkcell *cell, const char *flags)
|
||||
{
|
||||
g_return_if_fail (cell != NULL);
|
||||
g_return_if_fail (flags != NULL);
|
||||
@ -253,7 +253,7 @@ gnc_assoc_cell_set_flag_order (AssocCell *cell, const char *flags)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_assoc_cell_set_read_only (AssocCell *cell, gboolean read_only)
|
||||
gnc_doclink_cell_set_read_only (Doclinkcell *cell, gboolean read_only)
|
||||
{
|
||||
g_return_if_fail (cell != NULL);
|
||||
|
||||
@ -261,7 +261,7 @@ gnc_assoc_cell_set_read_only (AssocCell *cell, gboolean read_only)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_assoc_cell_set_use_glyphs (AssocCell *cell)
|
||||
gnc_doclink_cell_set_use_glyphs (Doclinkcell *cell)
|
||||
{
|
||||
#ifdef MAC_INTEGRATION
|
||||
cell->use_glyphs = FALSE;
|
@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* assoccell.h -- association checkbox cell *
|
||||
* doclinkcell.h -- Document link checkbox cell *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -22,9 +22,9 @@
|
||||
|
||||
/** @addtogroup Cell Cell
|
||||
* @{
|
||||
* @file assoccell.h
|
||||
* @struct AssocCell
|
||||
* @brief The AssocCell object implements a cell handler
|
||||
* @file doclinkcell.h
|
||||
* @struct Doclinkcell
|
||||
* @brief The Doclinkcell object implements a cell handler
|
||||
* that will cycle through a series of single-character
|
||||
* values when clicked upon by the mouse and will return a glyph
|
||||
* if font can show it.
|
||||
@ -36,8 +36,8 @@
|
||||
* Copyright (c) 2020 Robert Fewell
|
||||
*/
|
||||
|
||||
#ifndef ASSOC_CELL_H
|
||||
#define ASSOC_CELL_H
|
||||
#ifndef DOC_LINK_CELL_H
|
||||
#define DOC_LINK_CELL_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
@ -46,8 +46,8 @@
|
||||
#define GLYPH_PAPERCLIP "\360\237\223\216" // Codepoint U+1F4CE
|
||||
#define GLYPH_LINK "\360\237\224\227" // Codepoint U+1F517
|
||||
|
||||
typedef const char * (*AssocCellStringGetter) (char flag);
|
||||
typedef gboolean (*AssocCellConfirm) (char old_flag, gpointer data);
|
||||
typedef const char * (*DoclinkcellStringGetter) (char flag);
|
||||
typedef gboolean (*DoclinkcellConfirm) (char old_flag, gpointer data);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -59,42 +59,42 @@ typedef struct
|
||||
char * flag_order; /** Automatic flag selection order */
|
||||
char default_flag; /** Default flag for unknown user input */
|
||||
|
||||
AssocCellStringGetter get_string;
|
||||
AssocCellConfirm confirm_cb;
|
||||
DoclinkcellStringGetter get_string;
|
||||
DoclinkcellConfirm confirm_cb;
|
||||
gpointer confirm_data;
|
||||
gboolean read_only;
|
||||
gboolean use_glyphs;
|
||||
} AssocCell;
|
||||
} Doclinkcell;
|
||||
|
||||
BasicCell * gnc_assoc_cell_new (void);
|
||||
BasicCell * gnc_doclink_cell_new (void);
|
||||
|
||||
void gnc_assoc_cell_set_flag (AssocCell *cell, char flag);
|
||||
char gnc_assoc_cell_get_flag (AssocCell *cell);
|
||||
void gnc_doclink_cell_set_flag (Doclinkcell *cell, char flag);
|
||||
char gnc_doclink_cell_get_flag (Doclinkcell *cell);
|
||||
|
||||
void gnc_assoc_cell_set_confirm_cb (AssocCell *cell,
|
||||
AssocCellConfirm confirm_cb,
|
||||
void gnc_doclink_cell_set_confirm_cb (Doclinkcell *cell,
|
||||
DoclinkcellConfirm confirm_cb,
|
||||
gpointer data);
|
||||
|
||||
void gnc_assoc_cell_set_string_getter (AssocCell *cell,
|
||||
AssocCellStringGetter getter);
|
||||
void gnc_doclink_cell_set_string_getter (Doclinkcell *cell,
|
||||
DoclinkcellStringGetter getter);
|
||||
|
||||
/** note that @param flags is copied into the RecnCell directly, but
|
||||
* remains the "property" of the caller. The caller must maintain the
|
||||
* chars pointer, and the caller must setup a mechanism to 'free' the
|
||||
* chars pointer. The rationale is that you may have many AssocCell
|
||||
* chars pointer. The rationale is that you may have many Doclinkcell
|
||||
* objects that use the same set of flags.
|
||||
*/
|
||||
void gnc_assoc_cell_set_valid_flags (AssocCell *cell, const char *flags,
|
||||
void gnc_doclink_cell_set_valid_flags (Doclinkcell *cell, const char *flags,
|
||||
char default_flag);
|
||||
void gnc_assoc_cell_set_flag_order (AssocCell *cell, const char *flags);
|
||||
void gnc_doclink_cell_set_flag_order (Doclinkcell *cell, const char *flags);
|
||||
|
||||
void gnc_assoc_cell_set_read_only (AssocCell *cell, gboolean read_only);
|
||||
void gnc_doclink_cell_set_read_only (Doclinkcell *cell, gboolean read_only);
|
||||
|
||||
void gnc_assoc_cell_set_use_glyphs (AssocCell *cell);
|
||||
void gnc_doclink_cell_set_use_glyphs (Doclinkcell *cell);
|
||||
|
||||
gboolean gnc_assoc_get_use_glyphs (AssocCell *cell);
|
||||
gboolean gnc_doclink_get_use_glyphs (Doclinkcell *cell);
|
||||
|
||||
const char * gnc_assoc_get_glyph_from_flag (char association_flag);
|
||||
const char * gnc_doclink_get_glyph_from_flag (char link_flag);
|
||||
|
||||
/** @} */
|
||||
#endif
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "assoccell.h"
|
||||
#include "doclinkcell.h"
|
||||
#include "basiccell.h"
|
||||
#include "cell-factory.h"
|
||||
#include "combocell.h"
|
||||
@ -58,7 +58,7 @@ gnc_register_init (void)
|
||||
|
||||
gnc_register_add_cell_type (RECN_CELL_TYPE_NAME, gnc_recn_cell_new);
|
||||
|
||||
gnc_register_add_cell_type (ASSOC_CELL_TYPE_NAME, gnc_assoc_cell_new);
|
||||
gnc_register_add_cell_type (ASSOC_CELL_TYPE_NAME, gnc_doclink_cell_new);
|
||||
|
||||
gnc_register_add_cell_type (QUICKFILL_CELL_TYPE_NAME,
|
||||
gnc_quickfill_cell_new);
|
||||
|
@ -45,8 +45,8 @@
|
||||
(define (gnc:transaction-anchor-text trans)
|
||||
(gnc:register-guid "trans-guid=" (gncTransGetGUID trans)))
|
||||
|
||||
(define (gnc:transaction-association-anchor-text trans)
|
||||
(gnc:register-guid "trans-association-guid=" (gncTransGetGUID trans)))
|
||||
(define (gnc:transaction-doclink-anchor-text trans)
|
||||
(gnc:register-guid "trans-doclink-guid=" (gncTransGetGUID trans)))
|
||||
|
||||
(define (gnc:report-anchor-text report-id)
|
||||
(gnc-build-url URL-TYPE-REPORT
|
||||
@ -154,9 +154,9 @@
|
||||
(gnc:transaction-anchor-text trans)
|
||||
text)))
|
||||
|
||||
(define (gnc:html-transaction-association-anchor trans text)
|
||||
(define (gnc:html-transaction-doclink-anchor trans text)
|
||||
(gnc:make-html-text (gnc:html-markup-anchor
|
||||
(gnc:transaction-association-anchor-text trans)
|
||||
(gnc:transaction-doclink-anchor-text trans)
|
||||
text)))
|
||||
|
||||
(define (gnc:html-price-anchor price value)
|
||||
|
@ -86,13 +86,13 @@
|
||||
(export gnc:account-anchor-text)
|
||||
(export gnc:split-anchor-text)
|
||||
(export gnc:transaction-anchor-text)
|
||||
(export gnc:transaction-association-anchor-text)
|
||||
(export gnc:transaction-doclink-anchor-text)
|
||||
(export gnc:report-anchor-text)
|
||||
(export gnc:make-report-anchor)
|
||||
(export gnc:html-account-anchor)
|
||||
(export gnc:html-split-anchor)
|
||||
(export gnc:html-transaction-anchor)
|
||||
(export gnc:html-transaction-association-anchor)
|
||||
(export gnc:html-transaction-doclink-anchor)
|
||||
(export gnc:html-price-anchor)
|
||||
(export gnc:customer-anchor-text)
|
||||
(export gnc:job-anchor-text)
|
||||
|
@ -1243,13 +1243,13 @@ be excluded from periodic reporting.")
|
||||
(add-if (column-uses? 'link)
|
||||
(vector ""
|
||||
(lambda (split transaction-row?)
|
||||
(let ((url (xaccTransGetAssociation
|
||||
(let ((url (xaccTransGetDocLink
|
||||
(xaccSplitGetParent split))))
|
||||
(and (not (string-null? url))
|
||||
(gnc:make-html-table-cell/markup
|
||||
"text-cell"
|
||||
(if opt-use-links?
|
||||
(gnc:html-transaction-association-anchor
|
||||
(gnc:html-transaction-doclink-anchor
|
||||
(xaccSplitGetParent split)
|
||||
;; Translators: 'L' is short for Linked Document
|
||||
(G_ "L"))
|
||||
|
@ -44,8 +44,8 @@
|
||||
<menu name="Business" action="BusinessAction">
|
||||
<placeholder name="BusinessPlaceholderMiddle">
|
||||
<separator name="BusinessSep1"/>
|
||||
<menuitem name="BusinessAssociation" action="BusinessAssociationAction"/>
|
||||
<menuitem name="BusinessAssociationOpen" action="BusinessAssociationOpenAction"/>
|
||||
<menuitem name="BusinessLink" action="BusinessLinkAction"/>
|
||||
<menuitem name="BusinessLinkOpen" action="BusinessLinkOpenAction"/>
|
||||
<separator name="BusinessSep2"/>
|
||||
<menuitem name="ToolsProcessPayment" action="ToolsProcessPaymentAction"/>
|
||||
</placeholder>
|
||||
|
@ -22,11 +22,10 @@
|
||||
<menuitem name="UnvoidTransaction" action="UnvoidTransactionAction"/>
|
||||
<menuitem name="ReverseTransaction" action="ReverseTransactionAction"/>
|
||||
<separator name="TransactionSep3"/>
|
||||
<menuitem name="AssociateTransaction" action="AssociateTransactionAction"/>
|
||||
<menuitem name="AssociateTransactionOpen" action="AssociateTransactionOpenAction"/>
|
||||
<menuitem name="AssociateTransactionRemove" action="AssociateTransactionRemoveAction"/>
|
||||
<menuitem name="LinkTransaction" action="LinkTransactionAction"/>
|
||||
<menuitem name="LinkedTransactionOpen" action="LinkedTransactionOpenAction"/>
|
||||
<separator name="TransactionSep4"/>
|
||||
<menuitem name="JumpAssociateInvoice" action="JumpAssociatedInvoiceAction"/>
|
||||
<menuitem name="JumpLinkInvoice" action="JumpLinkedInvoiceAction"/>
|
||||
</menu>
|
||||
|
||||
<menu name="View" action="ViewAction">
|
||||
@ -100,11 +99,10 @@
|
||||
<menuitem name="RecordTransaction" action="RecordTransactionAction"/>
|
||||
<menuitem name="CancelTransaction" action="CancelTransactionAction"/>
|
||||
<separator name="PopupSep3"/>
|
||||
<menuitem name="AssociateTransaction" action="AssociateTransactionAction"/>
|
||||
<menuitem name="AssociateTransactionOpen" action="AssociateTransactionOpenAction"/>
|
||||
<menuitem name="AssociateTransactionRemove" action="AssociateTransactionRemoveAction"/>
|
||||
<menuitem name="LinkTransaction" action="LinkTransactionAction"/>
|
||||
<menuitem name="LinkedTransactionOpen" action="LinkedTransactionOpenAction"/>
|
||||
<separator name="PopupSep4"/>
|
||||
<menuitem name="JumpAssociateInvoice" action="JumpAssociatedInvoiceAction"/>
|
||||
<menuitem name="JumpLinkedInvoice" action="JumpLinkedInvoiceAction"/>
|
||||
<separator name="PopupSep5"/>
|
||||
<menuitem name="BlankTransaction" action="BlankTransactionAction"/>
|
||||
<menuitem name="GotoDate" action="GotoDateAction"/>
|
||||
|
@ -903,13 +903,13 @@ gnc_get_reconcile_flag_order (void)
|
||||
}
|
||||
|
||||
const char *
|
||||
gnc_get_association_str (char association_flag)
|
||||
gnc_get_doclink_str (char link_flag)
|
||||
{
|
||||
switch (association_flag)
|
||||
switch (link_flag)
|
||||
{
|
||||
case WASSOC:
|
||||
case WLINK:
|
||||
return C_("Document Link flag for 'web'", "w");
|
||||
case FASSOC:
|
||||
case FLINK:
|
||||
return C_("Document Link flag for 'file'", "f");
|
||||
case ' ':
|
||||
return " ";
|
||||
@ -920,16 +920,16 @@ gnc_get_association_str (char association_flag)
|
||||
}
|
||||
|
||||
const char *
|
||||
gnc_get_association_valid_flags (void)
|
||||
gnc_get_doclink_valid_flags (void)
|
||||
{
|
||||
static const char flags[] = { FASSOC, WASSOC, ' ', 0 };
|
||||
static const char flags[] = { FLINK, WLINK, ' ', 0 };
|
||||
return flags;
|
||||
}
|
||||
|
||||
const char *
|
||||
gnc_get_association_flag_order (void)
|
||||
gnc_get_doclink_flag_order (void)
|
||||
{
|
||||
static const char flags[] = { FASSOC, WASSOC, ' ', 0 };
|
||||
static const char flags[] = { FLINK, WLINK, ' ', 0 };
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
@ -189,28 +189,28 @@ const char * gnc_get_reconcile_str (char reconciled_flag);
|
||||
const char * gnc_get_reconcile_valid_flags (void);
|
||||
const char * gnc_get_reconcile_flag_order (void);
|
||||
|
||||
#define WASSOC 'w'
|
||||
#define FASSOC 'f'
|
||||
#define WLINK 'w'
|
||||
#define FLINK 'f'
|
||||
|
||||
/** Get a string containing association valid flags
|
||||
/** Get a string containing documentation link valid flags
|
||||
*
|
||||
* @return a string containing the list of associated flags
|
||||
* @return a string containing the list of valid link_flags
|
||||
*/
|
||||
const char *gnc_get_association_valid_flags (void);
|
||||
const char *gnc_get_doclink_valid_flags (void);
|
||||
|
||||
/** Get a string containing association flag order
|
||||
/** Get a string containing document link flag order
|
||||
*
|
||||
* @return a string containing the association flag change order
|
||||
* @return a string containing the document link flag change order
|
||||
*/
|
||||
const char *gnc_get_association_flag_order (void);
|
||||
const char *gnc_get_doclink_flag_order (void);
|
||||
|
||||
/** Get a string representing the association type
|
||||
/** Get a string representing the document link type
|
||||
*
|
||||
* @param association_flag The flag to convert into a string
|
||||
* @param link_flag The flag to convert into a string
|
||||
*
|
||||
* @return the i18n'd association string
|
||||
* @return the i18n'd doclink string
|
||||
*/
|
||||
const char *gnc_get_association_str (char association_flag);
|
||||
const char *gnc_get_doclink_str (char link_flag);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ const char *void_reason_str = "void-reason";
|
||||
const char *void_time_str = "void-time";
|
||||
const char *void_former_notes_str = "void-former-notes";
|
||||
const char *trans_is_closing_str = "book_closing";
|
||||
const char *assoc_uri_str = "assoc_uri";
|
||||
const char *doclink_uri_str = "doclink_uri";
|
||||
|
||||
/* KVP entry for date-due value */
|
||||
#define TRANS_DATE_DUE_KVP "trans-date-due"
|
||||
@ -769,7 +769,7 @@ xaccTransCopyFromClipBoard(const Transaction *from_trans, Transaction *to_trans,
|
||||
xaccTransSetNum(to_trans, xaccTransGetNum(from_trans));
|
||||
|
||||
xaccTransSetNotes(to_trans, xaccTransGetNotes(from_trans));
|
||||
xaccTransSetAssociation(to_trans, xaccTransGetAssociation (from_trans));
|
||||
xaccTransSetDocLink(to_trans, xaccTransGetDocLink (from_trans));
|
||||
if(!no_date)
|
||||
{
|
||||
xaccTransSetDatePostedSecs(to_trans, xaccTransRetDatePosted (from_trans));
|
||||
@ -2156,18 +2156,18 @@ xaccTransSetDescription (Transaction *trans, const char *desc)
|
||||
}
|
||||
|
||||
void
|
||||
xaccTransSetAssociation (Transaction *trans, const char *assoc)
|
||||
xaccTransSetDocLink (Transaction *trans, const char *doclink)
|
||||
{
|
||||
if (!trans || !assoc) return;
|
||||
if (!trans || !doclink) return;
|
||||
xaccTransBeginEdit(trans);
|
||||
if (g_strcmp0 (assoc, "") == 0)
|
||||
qof_instance_set_kvp (QOF_INSTANCE (trans), NULL, 1, assoc_uri_str);
|
||||
if (g_strcmp0 (doclink, "") == 0)
|
||||
qof_instance_set_kvp (QOF_INSTANCE (trans), NULL, 1, doclink_uri_str);
|
||||
else
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
g_value_init (&v, G_TYPE_STRING);
|
||||
g_value_set_string (&v, assoc);
|
||||
qof_instance_set_kvp (QOF_INSTANCE (trans), &v, 1, assoc_uri_str);
|
||||
g_value_set_string (&v, doclink);
|
||||
qof_instance_set_kvp (QOF_INSTANCE (trans), &v, 1, doclink_uri_str);
|
||||
}
|
||||
qof_instance_set_dirty(QOF_INSTANCE(trans));
|
||||
xaccTransCommitEdit(trans);
|
||||
@ -2347,11 +2347,11 @@ xaccTransGetDescription (const Transaction *trans)
|
||||
}
|
||||
|
||||
const char *
|
||||
xaccTransGetAssociation (const Transaction *trans)
|
||||
xaccTransGetDocLink (const Transaction *trans)
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
if (!trans) return NULL;
|
||||
qof_instance_get_kvp (QOF_INSTANCE (trans), &v, 1, assoc_uri_str);
|
||||
qof_instance_get_kvp (QOF_INSTANCE (trans), &v, 1, doclink_uri_str);
|
||||
if (G_VALUE_HOLDS_STRING (&v))
|
||||
return g_value_get_string (&v);
|
||||
return NULL;
|
||||
@ -3033,9 +3033,9 @@ gboolean xaccTransRegister (void)
|
||||
(QofSetterFunc)qofTransSetNotes
|
||||
},
|
||||
{
|
||||
TRANS_ASSOCIATION, QOF_TYPE_STRING,
|
||||
(QofAccessFunc)xaccTransGetAssociation,
|
||||
(QofSetterFunc)xaccTransSetAssociation
|
||||
TRANS_DOCLINK, QOF_TYPE_STRING,
|
||||
(QofAccessFunc)xaccTransGetDocLink,
|
||||
(QofSetterFunc)xaccTransSetDocLink
|
||||
},
|
||||
{
|
||||
TRANS_IS_CLOSING, QOF_TYPE_BOOLEAN,
|
||||
|
@ -320,8 +320,8 @@ void xaccTransSetNum (Transaction *trans, const char *num);
|
||||
/** Sets the transaction Description */
|
||||
void xaccTransSetDescription (Transaction *trans, const char *desc);
|
||||
|
||||
/** Sets the transaction Association */
|
||||
void xaccTransSetAssociation (Transaction *trans, const char *assoc);
|
||||
/** Sets the transaction Document Link */
|
||||
void xaccTransSetDocLink (Transaction *trans, const char *doclink);
|
||||
|
||||
/** Sets the transaction Notes
|
||||
*
|
||||
@ -336,8 +336,8 @@ void xaccTransSetNotes (Transaction *trans, const char *notes);
|
||||
const char * xaccTransGetNum (const Transaction *trans);
|
||||
/** Gets the transaction Description */
|
||||
const char * xaccTransGetDescription (const Transaction *trans);
|
||||
/** Gets the transaction association */
|
||||
const char * xaccTransGetAssociation(const Transaction *trans);
|
||||
/** Gets the transaction Document Link */
|
||||
const char * xaccTransGetDocLink(const Transaction *trans);
|
||||
/** Gets the transaction Notes
|
||||
*
|
||||
The Notes field is only visible in the register in double-line mode */
|
||||
@ -755,7 +755,7 @@ time64 xaccTransGetVoidTime(const Transaction *tr);
|
||||
#define TRANS_IS_BALANCED "trans-balanced?"
|
||||
#define TRANS_IS_CLOSING "trans-is-closing?"
|
||||
#define TRANS_NOTES "notes"
|
||||
#define TRANS_ASSOCIATION "assoc"
|
||||
#define TRANS_DOCLINK "doclink"
|
||||
#define TRANS_TYPE "type"
|
||||
#define TRANS_VOID_STATUS "void-p"
|
||||
#define TRANS_VOID_REASON "void-reason"
|
||||
|
@ -84,7 +84,7 @@ static QofLogModule log_module = GNC_MOD_BUSINESS;
|
||||
#define _GNC_MOD_NAME GNC_ID_INVOICE
|
||||
|
||||
#define GNC_INVOICE_IS_CN "credit-note"
|
||||
#define GNC_INVOICE_ASSOC "assoc_uri"
|
||||
#define GNC_INVOICE_DOCLINK "doclink_uri"
|
||||
|
||||
#define SET_STR(obj, member, str) { \
|
||||
char * tmp; \
|
||||
@ -538,18 +538,18 @@ void gncInvoiceSetNotes (GncInvoice *invoice, const char *notes)
|
||||
gncInvoiceCommitEdit (invoice);
|
||||
}
|
||||
|
||||
void gncInvoiceSetAssociation (GncInvoice *invoice, const char *assoc)
|
||||
void gncInvoiceSetDocLink (GncInvoice *invoice, const char *doclink)
|
||||
{
|
||||
if (!invoice || !assoc) return;
|
||||
if (!invoice || !doclink) return;
|
||||
gncInvoiceBeginEdit (invoice);
|
||||
if (g_strcmp0 (assoc, "") == 0)
|
||||
qof_instance_set_kvp (QOF_INSTANCE (invoice), NULL, 1, GNC_INVOICE_ASSOC);
|
||||
if (g_strcmp0 (doclink, "") == 0)
|
||||
qof_instance_set_kvp (QOF_INSTANCE (invoice), NULL, 1, GNC_INVOICE_DOCLINK);
|
||||
else
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
g_value_init (&v, G_TYPE_STRING);
|
||||
g_value_set_string (&v, assoc);
|
||||
qof_instance_set_kvp (QOF_INSTANCE (invoice), &v, 1, GNC_INVOICE_ASSOC);
|
||||
g_value_set_string (&v, doclink);
|
||||
qof_instance_set_kvp (QOF_INSTANCE (invoice), &v, 1, GNC_INVOICE_DOCLINK);
|
||||
}
|
||||
qof_instance_set_dirty (QOF_INSTANCE(invoice));
|
||||
gncInvoiceCommitEdit (invoice);
|
||||
@ -863,11 +863,11 @@ const char * gncInvoiceGetNotes (const GncInvoice *invoice)
|
||||
return invoice->notes;
|
||||
}
|
||||
|
||||
const char * gncInvoiceGetAssociation (const GncInvoice *invoice)
|
||||
const char * gncInvoiceGetDocLink (const GncInvoice *invoice)
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
if (!invoice) return NULL;
|
||||
qof_instance_get_kvp (QOF_INSTANCE(invoice), &v, 1, GNC_INVOICE_ASSOC);
|
||||
qof_instance_get_kvp (QOF_INSTANCE(invoice), &v, 1, GNC_INVOICE_DOCLINK);
|
||||
if (G_VALUE_HOLDS_STRING(&v))
|
||||
return g_value_get_string (&v);
|
||||
return NULL;
|
||||
@ -2237,7 +2237,7 @@ gboolean gncInvoiceRegister (void)
|
||||
{ INVOICE_IS_PAID, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncInvoiceIsPaid, NULL },
|
||||
{ INVOICE_BILLINGID, QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetBillingID, (QofSetterFunc)gncInvoiceSetBillingID },
|
||||
{ INVOICE_NOTES, QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetNotes, (QofSetterFunc)gncInvoiceSetNotes },
|
||||
{ INVOICE_ASSOCIATION, QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetAssociation, (QofSetterFunc)gncInvoiceSetAssociation },
|
||||
{ INVOICE_DOCLINK, QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetDocLink, (QofSetterFunc)gncInvoiceSetDocLink },
|
||||
{ INVOICE_ACC, GNC_ID_ACCOUNT, (QofAccessFunc)gncInvoiceGetPostedAcc, (QofSetterFunc)gncInvoiceSetPostedAcc },
|
||||
{ INVOICE_POST_TXN, GNC_ID_TRANS, (QofAccessFunc)gncInvoiceGetPostedTxn, (QofSetterFunc)gncInvoiceSetPostedTxn },
|
||||
{ INVOICE_POST_LOT, GNC_ID_LOT, (QofAccessFunc)gncInvoiceGetPostedLot, NULL/*(QofSetterFunc)gncInvoiceSetPostedLot*/ },
|
||||
|
@ -108,7 +108,7 @@ void gncInvoiceSetDatePosted (GncInvoice *invoice, time64 date);
|
||||
void gncInvoiceSetTerms (GncInvoice *invoice, GncBillTerm *terms);
|
||||
void gncInvoiceSetBillingID (GncInvoice *invoice, const char *billing_id);
|
||||
void gncInvoiceSetNotes (GncInvoice *invoice, const char *notes);
|
||||
void gncInvoiceSetAssociation (GncInvoice *invoice, const char *assoc);
|
||||
void gncInvoiceSetDocLink (GncInvoice *invoice, const char *doclink);
|
||||
void gncInvoiceSetCurrency (GncInvoice *invoice, gnc_commodity *currency);
|
||||
void gncInvoiceSetActive (GncInvoice *invoice, gboolean active);
|
||||
void gncInvoiceSetIsCreditNote (GncInvoice *invoice, gboolean credit_note);
|
||||
@ -144,7 +144,7 @@ time64 gncInvoiceGetDateDue (const GncInvoice *invoice);
|
||||
GncBillTerm * gncInvoiceGetTerms (const GncInvoice *invoice);
|
||||
const char * gncInvoiceGetBillingID (const GncInvoice *invoice);
|
||||
const char * gncInvoiceGetNotes (const GncInvoice *invoice);
|
||||
const char * gncInvoiceGetAssociation (const GncInvoice *invoice);
|
||||
const char * gncInvoiceGetDocLink (const GncInvoice *invoice);
|
||||
GncOwnerType gncInvoiceGetOwnerType (const GncInvoice *invoice);
|
||||
GList * gncInvoiceGetTypeListForOwnerType (const GncOwnerType type);
|
||||
GncInvoiceType gncInvoiceGetType (const GncInvoice *invoice);
|
||||
@ -293,7 +293,7 @@ gboolean gncInvoiceIsPaid (const GncInvoice *invoice);
|
||||
#define INVOICE_TERMS "terms"
|
||||
#define INVOICE_BILLINGID "billing_id"
|
||||
#define INVOICE_NOTES "notes"
|
||||
#define INVOICE_ASSOCIATION "assoc"
|
||||
#define INVOICE_DOCLINK "doclink"
|
||||
#define INVOICE_ACC "account"
|
||||
#define INVOICE_POST_TXN "posted_txn"
|
||||
#define INVOICE_POST_LOT "posted_lot"
|
||||
|
@ -55,13 +55,13 @@ gnucash/gnome/assistant-stock-split.c
|
||||
gnucash/gnome/business-gnome-utils.c
|
||||
gnucash/gnome/business-options-gnome.c
|
||||
gnucash/gnome/business-urls.c
|
||||
gnucash/gnome/dialog-assoc.c
|
||||
gnucash/gnome/dialog-billterms.c
|
||||
gnucash/gnome/dialog-choose-owner.c
|
||||
gnucash/gnome/dialog-commodities.c
|
||||
gnucash/gnome/dialog-customer.c
|
||||
gnucash/gnome/dialog-custom-report.c
|
||||
gnucash/gnome/dialog-date-close.c
|
||||
gnucash/gnome/dialog-doclink.c
|
||||
gnucash/gnome/dialog-employee.c
|
||||
gnucash/gnome/dialog-fincalc.c
|
||||
gnucash/gnome/dialog-find-account.c
|
||||
@ -130,9 +130,9 @@ gnucash/gnome-utils/account-quickfill.c
|
||||
gnucash/gnome-utils/assistant-xml-encoding.c
|
||||
gnucash/gnome-utils/cursors.c
|
||||
gnucash/gnome-utils/dialog-account.c
|
||||
gnucash/gnome-utils/dialog-assoc-utils.c
|
||||
gnucash/gnome-utils/dialog-book-close.c
|
||||
gnucash/gnome-utils/dialog-commodity.c
|
||||
gnucash/gnome-utils/dialog-doclink-utils.c
|
||||
gnucash/gnome-utils/dialog-dup-trans.c
|
||||
gnucash/gnome-utils/dialog-file-access.c
|
||||
gnucash/gnome-utils/dialog-object-references.c
|
||||
@ -248,7 +248,6 @@ gnucash/gtkbuilder/business-options-gnome.glade
|
||||
gnucash/gtkbuilder/business-prefs.glade
|
||||
gnucash/gtkbuilder/dialog-account.glade
|
||||
gnucash/gtkbuilder/dialog-account-picker.glade
|
||||
gnucash/gtkbuilder/dialog-assoc.glade
|
||||
gnucash/gtkbuilder/dialog-bi-import-gui.glade
|
||||
gnucash/gtkbuilder/dialog-billterms.glade
|
||||
gnucash/gtkbuilder/dialog-book-close.glade
|
||||
@ -259,6 +258,7 @@ gnucash/gtkbuilder/dialog-customer.glade
|
||||
gnucash/gtkbuilder/dialog-customer-import-gui.glade
|
||||
gnucash/gtkbuilder/dialog-custom-report.glade
|
||||
gnucash/gtkbuilder/dialog-date-close.glade
|
||||
gnucash/gtkbuilder/dialog-doclink.glade
|
||||
gnucash/gtkbuilder/dialog-employee.glade
|
||||
gnucash/gtkbuilder/dialog-file-access.glade
|
||||
gnucash/gtkbuilder/dialog-fincalc.glade
|
||||
@ -402,11 +402,11 @@ gnucash/register/ledger-core/split-register-load.c
|
||||
gnucash/register/ledger-core/split-register-model.c
|
||||
gnucash/register/ledger-core/split-register-model-save.c
|
||||
gnucash/register/ledger-core/split-register-util.c
|
||||
gnucash/register/register-core/assoccell.c
|
||||
gnucash/register/register-core/basiccell.c
|
||||
gnucash/register/register-core/cellblock.c
|
||||
gnucash/register/register-core/cell-factory.c
|
||||
gnucash/register/register-core/checkboxcell.c
|
||||
gnucash/register/register-core/doclinkcell.c
|
||||
gnucash/register/register-core/formulacell.c
|
||||
gnucash/register/register-core/gtable.c
|
||||
gnucash/register/register-core/numcell.c
|
||||
|
Loading…
Reference in New Issue
Block a user