r21637 - gnucash/trunk/src - Read-only mode: Buttons in business result list are insensitive, accordingly.

Christian Stimming cstim at code.gnucash.org
Mon Nov 28 16:44:34 EST 2011


Author: cstim
Date: 2011-11-28 16:44:34 -0500 (Mon, 28 Nov 2011)
New Revision: 21637
Trac: http://svn.gnucash.org/trac/changeset/21637

Modified:
   gnucash/trunk/src/business/business-gnome/dialog-customer.c
   gnucash/trunk/src/business/business-gnome/dialog-employee.c
   gnucash/trunk/src/business/business-gnome/dialog-invoice.c
   gnucash/trunk/src/business/business-gnome/dialog-job.c
   gnucash/trunk/src/business/business-gnome/dialog-order.c
   gnucash/trunk/src/business/business-gnome/dialog-vendor.c
   gnucash/trunk/src/gnome-search/dialog-search.c
   gnucash/trunk/src/gnome-search/dialog-search.h
Log:
Read-only mode: Buttons in business result list are insensitive, accordingly.

Modified: gnucash/trunk/src/business/business-gnome/dialog-customer.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-customer.c	2011-11-28 21:44:21 UTC (rev 21636)
+++ gnucash/trunk/src/business/business-gnome/dialog-customer.c	2011-11-28 21:44:34 UTC (rev 21637)
@@ -903,11 +903,11 @@
     static GList *columns = NULL;
     static GNCSearchCallbackButton buttons[] =
     {
-        { N_("View/Edit Customer"), edit_customer_cb, NULL},
-        { N_("Customer's Jobs"), jobs_customer_cb, NULL},
-        //    { N_("Customer's Orders"), order_customer_cb, NULL},
-        { N_("Customer's Invoices"), invoice_customer_cb, NULL},
-        { N_("Process Payment"), payment_customer_cb, NULL},
+        { N_("View/Edit Customer"), edit_customer_cb, NULL, TRUE},
+        { N_("Customer's Jobs"), jobs_customer_cb, NULL, TRUE},
+        //    { N_("Customer's Orders"), order_customer_cb, NULL, TRUE},
+        { N_("Customer's Invoices"), invoice_customer_cb, NULL, TRUE},
+        { N_("Process Payment"), payment_customer_cb, NULL, FALSE},
         { NULL },
     };
     (void)order_customer_cb;

Modified: gnucash/trunk/src/business/business-gnome/dialog-employee.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-employee.c	2011-11-28 21:44:21 UTC (rev 21636)
+++ gnucash/trunk/src/business/business-gnome/dialog-employee.c	2011-11-28 21:44:34 UTC (rev 21637)
@@ -706,9 +706,9 @@
     static GList *columns = NULL;
     static GNCSearchCallbackButton buttons[] =
     {
-        { N_("View/Edit Employee"), edit_employee_cb, NULL},
-        { N_("Expense Vouchers"), invoice_employee_cb, NULL},
-        { N_("Process Payment"), payment_employee_cb, NULL},
+        { N_("View/Edit Employee"), edit_employee_cb, NULL, TRUE},
+        { N_("Expense Vouchers"), invoice_employee_cb, NULL, TRUE},
+        { N_("Process Payment"), payment_employee_cb, NULL, FALSE},
         { NULL },
     };
 

Modified: gnucash/trunk/src/business/business-gnome/dialog-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-invoice.c	2011-11-28 21:44:21 UTC (rev 21636)
+++ gnucash/trunk/src/business/business-gnome/dialog-invoice.c	2011-11-28 21:44:34 UTC (rev 21637)
@@ -2693,31 +2693,31 @@
     static GNCSearchCallbackButton *buttons;
     static GNCSearchCallbackButton inv_buttons[] =
     {
-        { N_("View/Edit Invoice"), edit_invoice_cb, NULL},
-        { N_("Process Payment"), pay_invoice_cb, NULL},
-        { N_("Duplicate"), NULL, multi_duplicate_invoice_cb},
-        { N_("Post"), NULL, multi_post_invoice_cb},
-        { N_("Print"), NULL, multi_print_invoice_cb},
+        { N_("View/Edit Invoice"), edit_invoice_cb, NULL, TRUE},
+        { N_("Process Payment"), pay_invoice_cb, NULL, FALSE},
+        { N_("Duplicate"), NULL, multi_duplicate_invoice_cb, FALSE},
+        { N_("Post"), NULL, multi_post_invoice_cb, FALSE},
+        { N_("Print"), NULL, multi_print_invoice_cb, TRUE},
         { NULL },
     };
     static GNCSearchCallbackButton bill_buttons[] =
     {
-        { N_("View/Edit Bill"), edit_invoice_cb, NULL},
-        { N_("Process Payment"), pay_invoice_cb, NULL},
-        { N_("Duplicate"), NULL, multi_duplicate_invoice_cb},
-        { N_("Post"), NULL, multi_post_invoice_cb},
-        { N_("Print"), NULL, multi_print_invoice_cb},
+        { N_("View/Edit Bill"), edit_invoice_cb, NULL, TRUE},
+        { N_("Process Payment"), pay_invoice_cb, NULL, FALSE},
+        { N_("Duplicate"), NULL, multi_duplicate_invoice_cb, FALSE},
+        { N_("Post"), NULL, multi_post_invoice_cb, FALSE},
+        { N_("Print"), NULL, multi_print_invoice_cb, TRUE},
         { NULL },
     };
     static GNCSearchCallbackButton emp_buttons[] =
     {
         /* Translators: The terms 'Voucher' and 'Expense Voucher' are used
            interchangeably in gnucash and mean the same thing. */
-        { N_("View/Edit Voucher"), edit_invoice_cb, NULL},
-        { N_("Process Payment"), pay_invoice_cb, NULL},
-        { N_("Duplicate"), NULL, multi_duplicate_invoice_cb},
-        { N_("Post"), NULL, multi_post_invoice_cb},
-        { N_("Print"), NULL, multi_print_invoice_cb},
+        { N_("View/Edit Voucher"), edit_invoice_cb, NULL, TRUE},
+        { N_("Process Payment"), pay_invoice_cb, NULL, FALSE},
+        { N_("Duplicate"), NULL, multi_duplicate_invoice_cb, FALSE},
+        { N_("Post"), NULL, multi_post_invoice_cb, FALSE},
+        { N_("Print"), NULL, multi_print_invoice_cb, TRUE},
         { NULL },
     };
 

Modified: gnucash/trunk/src/business/business-gnome/dialog-job.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-job.c	2011-11-28 21:44:21 UTC (rev 21636)
+++ gnucash/trunk/src/business/business-gnome/dialog-job.c	2011-11-28 21:44:34 UTC (rev 21637)
@@ -534,9 +534,9 @@
     static GList *columns = NULL;
     static GNCSearchCallbackButton buttons[] =
     {
-        { N_("View/Edit Job"), edit_job_cb, NULL},
-        { N_("View Invoices"), invoice_job_cb, NULL},
-        { N_("Process Payment"), payment_job_cb, NULL},
+        { N_("View/Edit Job"), edit_job_cb, NULL, TRUE},
+        { N_("View Invoices"), invoice_job_cb, NULL, TRUE},
+        { N_("Process Payment"), payment_job_cb, NULL, FALSE},
         { NULL },
     };
 

Modified: gnucash/trunk/src/business/business-gnome/dialog-order.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-order.c	2011-11-28 21:44:21 UTC (rev 21636)
+++ gnucash/trunk/src/business/business-gnome/dialog-order.c	2011-11-28 21:44:34 UTC (rev 21637)
@@ -827,7 +827,7 @@
     static GList *columns = NULL;
     static GNCSearchCallbackButton buttons[] =
     {
-        { N_("View/Edit Order"), edit_order_cb, NULL},
+        { N_("View/Edit Order"), edit_order_cb, NULL, TRUE},
         { NULL },
     };
 

Modified: gnucash/trunk/src/business/business-gnome/dialog-vendor.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-vendor.c	2011-11-28 21:44:21 UTC (rev 21636)
+++ gnucash/trunk/src/business/business-gnome/dialog-vendor.c	2011-11-28 21:44:34 UTC (rev 21637)
@@ -708,11 +708,11 @@
     static GList *columns = NULL;
     static GNCSearchCallbackButton buttons[] =
     {
-        { N_("View/Edit Vendor"), edit_vendor_cb, NULL},
-        { N_("Vendor's Jobs"), jobs_vendor_cb, NULL},
-        //    { N_("Vendor Orders"), order_vendor_cb, NULL},
-        { N_("Vendor's Bills"), invoice_vendor_cb, NULL},
-        { N_("Pay Bill"), payment_vendor_cb, NULL},
+        { N_("View/Edit Vendor"), edit_vendor_cb, NULL, TRUE},
+        { N_("Vendor's Jobs"), jobs_vendor_cb, NULL, TRUE},
+        //    { N_("Vendor Orders"), order_vendor_cb, NULL, TRUE},
+        { N_("Vendor's Bills"), invoice_vendor_cb, NULL, TRUE},
+        { N_("Pay Bill"), payment_vendor_cb, NULL, FALSE},
         { NULL },
     };
     (void)order_vendor_cb;

Modified: gnucash/trunk/src/gnome-search/dialog-search.c
===================================================================
--- gnucash/trunk/src/gnome-search/dialog-search.c	2011-11-28 21:44:21 UTC (rev 21636)
+++ gnucash/trunk/src/gnome-search/dialog-search.c	2011-11-28 21:44:34 UTC (rev 21637)
@@ -342,8 +342,13 @@
 
             for (i = 0; sw->buttons[i].label; i++)
             {
-                button = gtk_button_new_with_label (_(sw->buttons[i].label));
-                g_object_set_data (G_OBJECT (button), "data", &(sw->buttons[i]));
+                GNCSearchCallbackButton* button_spec = sw->buttons + i;
+                button = gtk_button_new_with_label (_(button_spec->label));
+                g_object_set_data (G_OBJECT (button), "data", button_spec);
+                if (qof_book_is_readonly (gnc_get_current_book ()))
+                {
+                    gtk_widget_set_sensitive (GTK_WIDGET(button), button_spec->sensitive_if_readonly);
+                }
                 g_signal_connect (G_OBJECT (button), "clicked",
                                   G_CALLBACK (gnc_search_dialog_result_clicked), sw);
                 gtk_box_pack_start (GTK_BOX (button_box), button, FALSE, FALSE, 3);
@@ -1278,11 +1283,11 @@
     static GNCSearchCallbackButton buttons[] =
     {
         /* Don't mark these as translatable since these are only test strings! */
-        { ("View Split"), do_nothing, NULL },
-        { ("New Split"), do_nothing, NULL },
-        { ("Do Something"), do_nothing, NULL },
-        { ("Do Nothing"), do_nothing, NULL },
-        { ("Who Cares?"), do_nothing, NULL },
+        { ("View Split"), do_nothing, NULL, TRUE },
+        { ("New Split"), do_nothing, NULL, TRUE },
+        { ("Do Something"), do_nothing, NULL, TRUE },
+        { ("Do Nothing"), do_nothing, NULL, TRUE },
+        { ("Who Cares?"), do_nothing, NULL, FALSE },
         { NULL }
     };
 

Modified: gnucash/trunk/src/gnome-search/dialog-search.h
===================================================================
--- gnucash/trunk/src/gnome-search/dialog-search.h	2011-11-28 21:44:21 UTC (rev 21636)
+++ gnucash/trunk/src/gnome-search/dialog-search.h	2011-11-28 21:44:34 UTC (rev 21637)
@@ -75,6 +75,11 @@
     const char *		label;
     GNCSearchCallback	cb_fcn;
     GNCSearchMultiSelectedCB cb_multiselect_fn;
+
+    /** TRUE if this action should be sensitive even in a read-only book. If
+    FALSE, this action is sensitive in read-write book but not in a read-only
+    book. */
+    gboolean sensitive_if_readonly;
 } GNCSearchCallbackButton;
 
 /* Caller MUST supply _EITHER_ a result_callback or a list of callback



More information about the gnucash-changes mailing list