From 804f72373e8c6cc57c3f2befaff2e8066e9f54bb Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 15 Jul 2017 11:00:46 +0100 Subject: [PATCH 1/9] Replace missing key accelerators With the change from using GTK_STOCK_, some default key accelerators were not specified so add them explicitly. --- .../business-gnome/gnc-plugin-page-invoice.c | 6 +++--- src/gnome-utils/gnc-main-window.c | 12 ++++++------ src/gnome/gnc-plugin-page-register.c | 6 +++--- src/gnome/gnc-plugin-page-register2.c | 6 +++--- src/report/report-gnome/gnc-plugin-page-report.c | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/business/business-gnome/gnc-plugin-page-invoice.c b/src/business/business-gnome/gnc-plugin-page-invoice.c index 11aae9e4ea..efa06b2a1b 100644 --- a/src/business/business-gnome/gnc-plugin-page-invoice.c +++ b/src/business/business-gnome/gnc-plugin-page-invoice.c @@ -112,17 +112,17 @@ static GtkActionEntry gnc_plugin_page_invoice_actions [] = /* Edit menu */ { - "EditCutAction", "edit-cut", N_("_Cut"), NULL, + "EditCutAction", "edit-cut", N_("_Cut"), "X", NULL, G_CALLBACK (gnc_plugin_page_invoice_cmd_cut) }, { - "EditCopyAction", "edit-copy", N_("Copy"), NULL, + "EditCopyAction", "edit-copy", N_("Copy"), "C", NULL, G_CALLBACK (gnc_plugin_page_invoice_cmd_copy) }, { - "EditPasteAction", "edit-paste", N_("_Paste"), NULL, + "EditPasteAction", "edit-paste", N_("_Paste"), "V", NULL, G_CALLBACK (gnc_plugin_page_invoice_cmd_paste) }, diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index 274f52ebb7..ce7d5f7f62 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -294,12 +294,12 @@ static GtkActionEntry gnc_menu_actions [] = G_CALLBACK (gnc_main_window_cmd_file_properties) }, { - "FileCloseAction", "window-close", N_("_Close"), NULL, + "FileCloseAction", "window-close", N_("_Close"), "W", N_("Close the currently active page"), G_CALLBACK (gnc_main_window_cmd_file_close) }, { - "FileQuitAction", "application-exit", N_("_Quit"), NULL, + "FileQuitAction", "application-exit", N_("_Quit"), "Q", N_("Quit this application"), G_CALLBACK (gnc_main_window_cmd_file_quit) }, @@ -307,17 +307,17 @@ static GtkActionEntry gnc_menu_actions [] = /* Edit menu */ { - "EditCutAction", "edit-cut", N_("Cu_t"), NULL, + "EditCutAction", "edit-cut", N_("Cu_t"), "X", N_("Cut the current selection and copy it to clipboard"), G_CALLBACK (gnc_main_window_cmd_edit_cut) }, { - "EditCopyAction", "edit-copy", N_("_Copy"), NULL, + "EditCopyAction", "edit-copy", N_("_Copy"), "C", N_("Copy the current selection to clipboard"), G_CALLBACK (gnc_main_window_cmd_edit_copy) }, { - "EditPasteAction", "edit-paste", N_("_Paste"), NULL, + "EditPasteAction", "edit-paste", N_("_Paste"), "V", N_("Paste the clipboard content at the cursor position"), G_CALLBACK (gnc_main_window_cmd_edit_paste) }, @@ -373,7 +373,7 @@ static GtkActionEntry gnc_menu_actions [] = /* Help menu */ { - "HelpTutorialAction", "help-browser", N_("Tutorial and Concepts _Guide"), NULL, + "HelpTutorialAction", "help-browser", N_("Tutorial and Concepts _Guide"), "H", N_("Open the GnuCash Tutorial"), G_CALLBACK (gnc_main_window_cmd_help_tutorial) }, diff --git a/src/gnome/gnc-plugin-page-register.c b/src/gnome/gnc-plugin-page-register.c index e1a573d7d3..461b942fc7 100644 --- a/src/gnome/gnc-plugin-page-register.c +++ b/src/gnome/gnc-plugin-page-register.c @@ -232,17 +232,17 @@ static GtkActionEntry gnc_plugin_page_register_actions [] = /* Edit menu */ { - "EditCutAction", "edit-cut", N_("Cu_t"), NULL, + "EditCutAction", "edit-cut", N_("Cu_t"), "X", N_("Cut the current selection and copy it to clipboard"), G_CALLBACK (gnc_plugin_page_register_cmd_cut) }, { - "EditCopyAction", "edit-copy", N_("_Copy"), NULL, + "EditCopyAction", "edit-copy", N_("_Copy"), "C", N_("Copy the current selection to clipboard"), G_CALLBACK (gnc_plugin_page_register_cmd_copy) }, { - "EditPasteAction", "edit-paste", N_("_Paste"), NULL, + "EditPasteAction", "edit-paste", N_("_Paste"), "V", N_("Paste the clipboard content at the cursor position"), G_CALLBACK (gnc_plugin_page_register_cmd_paste) }, diff --git a/src/gnome/gnc-plugin-page-register2.c b/src/gnome/gnc-plugin-page-register2.c index f01b811b86..20380d5344 100644 --- a/src/gnome/gnc-plugin-page-register2.c +++ b/src/gnome/gnc-plugin-page-register2.c @@ -225,17 +225,17 @@ static GtkActionEntry gnc_plugin_page_register2_actions [] = /* Edit menu */ { - "EditCutAction", "edit-cut", N_("Cu_t"), NULL, + "EditCutAction", "edit-cut", N_("Cu_t"), "X", N_("Cut the current selection and copy it to clipboard"), G_CALLBACK (gnc_plugin_page_register2_cmd_cut) }, { - "EditCopyAction", "edit-copy", N_("_Copy"), NULL, + "EditCopyAction", "edit-copy", N_("_Copy"), "C", N_("Copy the current selection to clipboard"), G_CALLBACK (gnc_plugin_page_register2_cmd_copy) }, { - "EditPasteAction", "edit-paste", N_("_Paste"), NULL, + "EditPasteAction", "edit-paste", N_("_Paste"), "V", N_("Paste the clipboard content at the cursor position"), G_CALLBACK (gnc_plugin_page_register2_cmd_paste) }, diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c index c4de711a82..f530cfef6d 100644 --- a/src/report/report-gnome/gnc-plugin-page-report.c +++ b/src/report/report-gnome/gnc-plugin-page-report.c @@ -1138,17 +1138,17 @@ gnc_plugin_page_report_constr_init(GncPluginPageReport *plugin_page, gint report G_CALLBACK(gnc_plugin_page_report_exportpdf_cb) }, { - "EditCutAction", "edit-cut", N_("Cu_t"), NULL, + "EditCutAction", "edit-cut", N_("Cu_t"), "X", N_("Cut the current selection and copy it to clipboard"), NULL }, { - "EditCopyAction", "edit-copy", N_("_Copy"), NULL, + "EditCopyAction", "edit-copy", N_("_Copy"), "C", N_("Copy the current selection to clipboard"), G_CALLBACK(gnc_plugin_page_report_copy_cb) }, { - "EditPasteAction", "edit-paste", N_("_Paste"), NULL, + "EditPasteAction", "edit-paste", N_("_Paste"), "V", N_("Paste the clipboard content at the cursor position"), NULL }, From 0b33a663268d81553f3c8459da148877404f4be6 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 15 Jul 2017 11:04:02 +0100 Subject: [PATCH 2/9] Modify the Account color button Specify the default account color when loading the gui for account colors that have not been set as the color button defaults to black. --- src/gnome-utils/dialog-account.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gnome-utils/dialog-account.c b/src/gnome-utils/dialog-account.c index ba658f9301..4d9c86cbd5 100644 --- a/src/gnome-utils/dialog-account.c +++ b/src/gnome-utils/dialog-account.c @@ -54,7 +54,7 @@ #define DIALOG_NEW_ACCOUNT_CM_CLASS "dialog-new-account" #define DIALOG_EDIT_ACCOUNT_CM_CLASS "dialog-edit-account" #define GNC_PREFS_GROUP "dialogs.account" -#define DEFAULT_COLOR "#ededececebeb" +#define DEFAULT_COLOR "rgb(237,236,235)" enum account_cols { @@ -229,7 +229,9 @@ gnc_account_to_ui(AccountWindow *aw) gtk_entry_set_text(GTK_ENTRY(aw->description_entry), string); string = xaccAccountGetColor (account); - if (string == NULL) string = ""; + + if ((string == NULL) || (g_strcmp0 ("Not Set", string) == 0)) + string = DEFAULT_COLOR; if (gdk_rgba_parse(&color, string)) { gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(aw->color_entry_button), &color); From 4df714037b77d98ca5322448acd53b037a95cc61 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 15 Jul 2017 11:06:26 +0100 Subject: [PATCH 3/9] Add function to clear the display of the currency edit widget When first created, the display is blank and in this position will return the default currency. If a currency is selected, there is no way to go back to this state. The only way to do this is destroy the widget and create a new one so added a function to do this without destroying the widget. This is used in the next commit. --- src/gnome-utils/gnc-currency-edit.c | 36 +++++++++++++++++++++++++++++ src/gnome-utils/gnc-currency-edit.h | 10 ++++++++ 2 files changed, 46 insertions(+) diff --git a/src/gnome-utils/gnc-currency-edit.c b/src/gnome-utils/gnc-currency-edit.c index bf62342cfd..2abf9d6ddf 100644 --- a/src/gnome-utils/gnc-currency-edit.c +++ b/src/gnome-utils/gnc-currency-edit.c @@ -467,6 +467,42 @@ gnc_currency_edit_get_currency (GNCCurrencyEdit *gce) return commodity; } +/** Clear the displayed currency of the widget. + * + * This will clear the currency being displayed just like when first created + * but it still returns the default currency as usual + * + * @param gce The currency editor widget whose values should be retrieved. + */ +void +gnc_currency_edit_clear_display (GNCCurrencyEdit *gce) +{ + GtkTreeModel *model; + GtkWidget *entry; + + g_return_if_fail(gce != NULL); + g_return_if_fail(GNC_IS_CURRENCY_EDIT(gce)); + + model = gtk_combo_box_get_model (GTK_COMBO_BOX(gce)); + + entry = gtk_bin_get_child (GTK_BIN(gce)); + + g_object_ref (model); + + g_signal_handlers_block_by_func (G_OBJECT(gce), + G_CALLBACK(gnc_currency_edit_active_changed), gce); + + gtk_combo_box_set_model (GTK_COMBO_BOX(gce), NULL); + gtk_entry_set_text (GTK_ENTRY(entry),""); + gtk_combo_box_set_active (GTK_COMBO_BOX(gce), -1); + gtk_combo_box_set_model (GTK_COMBO_BOX(gce), model); + + g_signal_handlers_block_by_func (G_OBJECT(gce), + G_CALLBACK(gnc_currency_edit_active_changed), gce); + + g_object_unref (model); +} + /** @} */ /** @} */ /** @} */ diff --git a/src/gnome-utils/gnc-currency-edit.h b/src/gnome-utils/gnc-currency-edit.h index a8c1e1cd8f..652050e811 100644 --- a/src/gnome-utils/gnc-currency-edit.h +++ b/src/gnome-utils/gnc-currency-edit.h @@ -114,6 +114,16 @@ void gnc_currency_edit_set_currency (GNCCurrencyEdit *gce, */ gnc_commodity *gnc_currency_edit_get_currency (GNCCurrencyEdit *gce); + +/** Clear the displayed currency of the widget. + * + * This will clear the currency being displayed just like when first created + * but it still returns the default currency as usual + * + * @param gce The currency editor widget whose values should be retrieved. + */ +void gnc_currency_edit_clear_display (GNCCurrencyEdit *gce); + /** @} */ #endif From fc0e25e7b21c8d3b0ab216949280237b2c00fafb Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 15 Jul 2017 11:22:21 +0100 Subject: [PATCH 4/9] Replace Gtk3 deprecated widgets in currency_accounting_widget Deprecated widgets in gnc_option_create_currency_accounting_widget have been replaced with current ones which mainly was GtkTable to GtkGrid. --- src/gnome-utils/dialog-options.c | 274 +++++++++++++++---------------- 1 file changed, 129 insertions(+), 145 deletions(-) diff --git a/src/gnome-utils/dialog-options.c b/src/gnome-utils/dialog-options.c index bf3fcf35f1..a6bed1d473 100644 --- a/src/gnome-utils/dialog-options.c +++ b/src/gnome-utils/dialog-options.c @@ -155,7 +155,6 @@ void gnc_options_dialog_response_cb(GtkDialog *dialog, gint response, static void gnc_options_dialog_reset_cb(GtkWidget * w, gpointer data); void gnc_options_dialog_list_select_cb (GtkTreeSelection *selection, gpointer data); -void gnc_set_book_currency_widget(void); void gnc_set_default_cost_policy_widget(SCM list_symbol); void gnc_set_default_gain_loss_account_widget(gnc_commodity *commodity); void gnc_option_changed_book_currency_widget_cb(GtkWidget *widget); @@ -519,7 +518,7 @@ gnc_gain_loss_account_view_filter (Account *account, gpointer data) /* gain/loss accts must be in book-currency; if a book currency has been specified in the widget, use it to filter */ - if (book_currency_data->book_currency_widget) + if (gtk_combo_box_get_active (GTK_COMBO_BOX(book_currency_data->book_currency_widget)) != -1) commodity = gnc_currency_edit_get_currency( GNC_CURRENCY_EDIT( book_currency_data->book_currency_widget)); @@ -552,21 +551,6 @@ gnc_gain_loss_account_all_fail_filter (Account *account, gpointer data) return FALSE; } -void -gnc_set_book_currency_widget() -{ - g_signal_connect(G_OBJECT(book_currency_data->book_currency_widget), - "changed", - G_CALLBACK(gnc_option_changed_book_currency_widget_cb), - NULL); - gtk_table_attach (GTK_TABLE(book_currency_data->book_currency_table), - book_currency_data->book_currency_widget, - 1, 2, // left, right attach - 0, 1, // top, bottom attach - GTK_FILL|GTK_EXPAND, GTK_FILL, // x,y - 0, 0); -} - void gnc_set_default_cost_policy_widget(SCM list_symbol) { @@ -626,16 +610,14 @@ gnc_set_default_gain_loss_account_widget(gnc_commodity *commodity) { book_currency_data->default_gain_loss_account_text = gtk_label_new( _("Because no accounts have " \ - "been set up yet,\nyou will need to return to this " \ - "dialog\n(via File->Properties), after account setup, " \ - "if\nyou want to set a default gain/loss account.") ); - gtk_table_attach (GTK_TABLE( - book_currency_data->gain_loss_account_table), - book_currency_data->default_gain_loss_account_text, - 1, 3, // left, right attach - 1, 2, // top, bottom attach - GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, // x,y - 0, 0); + "been set up yet,you will need to return to this " \ + "dialog (via File->Properties), after account setup, " \ + "if you want to set a default gain/loss account.") ); + + gtk_label_set_line_wrap (GTK_LABEL(book_currency_data->default_gain_loss_account_text), TRUE); + + gtk_grid_attach (GTK_GRID(book_currency_data->gain_loss_account_table), + book_currency_data->default_gain_loss_account_text, 0, 1, 2, 1); } else { @@ -672,19 +654,16 @@ gnc_set_default_gain_loss_account_widget(gnc_commodity *commodity) book_currency_data->gain_loss_account_del_button = gtk_button_new_with_label( _("Select no account") ); + g_signal_connect (GTK_BUTTON ( book_currency_data->gain_loss_account_del_button), "clicked", G_CALLBACK ( gnc_option_changed_gain_loss_account_del_button_widget_cb), NULL); - gtk_table_attach (GTK_TABLE( - book_currency_data->gain_loss_account_table), - book_currency_data->gain_loss_account_del_button, - 2, 3, // left, right attach - 0, 1, // top, bottom attach - GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, // x,y - 0, 0); + gtk_grid_attach (GTK_GRID(book_currency_data->gain_loss_account_table), + book_currency_data->gain_loss_account_del_button, 1, 0, 1, 1); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW( book_currency_data->default_gain_loss_account_widget), TRUE); @@ -700,6 +679,7 @@ gnc_set_default_gain_loss_account_widget(gnc_commodity *commodity) NULL); g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1)); + col = gnc_tree_view_add_toggle_column(GNC_TREE_VIEW( book_currency_data->default_gain_loss_account_widget), @@ -715,6 +695,7 @@ gnc_set_default_gain_loss_account_widget(gnc_commodity *commodity) NULL); g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1)); + gnc_tree_view_configure_columns (GNC_TREE_VIEW( book_currency_data->default_gain_loss_account_widget)); gnc_tree_view_set_show_column_menu(GNC_TREE_VIEW( @@ -774,27 +755,20 @@ gnc_set_default_gain_loss_account_widget(gnc_commodity *commodity) "book currency; you will have to return to this " \ "dialog\n(via File->Properties), after account setup, " \ "to select a\ndefault gain/loss account.") ); - gtk_table_attach (GTK_TABLE(book_currency_data->gain_loss_account_table), - book_currency_data->default_gain_loss_account_text, - 1, 3, // left, right attach - 1, 2, // top, bottom attach - GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, // x,y - 0, 0); + gtk_grid_attach (GTK_GRID(book_currency_data->gain_loss_account_table), + book_currency_data->default_gain_loss_account_text, 0, 1, 2, 1); } } if (book_currency_data->default_gain_loss_account_widget) { - + gtk_widget_set_hexpand (GTK_WIDGET(book_currency_data->default_gain_loss_account_widget), TRUE); g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (gnc_option_changed_gain_loss_account_widget_cb), NULL); - gtk_table_attach (GTK_TABLE(book_currency_data->gain_loss_account_table), - book_currency_data->default_gain_loss_account_widget, - 1, 3, // left, right attach - 1, 2, // top, bottom attach - GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, // x,y - 0, 0); + gtk_grid_attach (GTK_GRID(book_currency_data->gain_loss_account_table), + book_currency_data->default_gain_loss_account_widget, 0, 1, 2, 1); + } } } @@ -804,11 +778,14 @@ gnc_option_changed_book_currency_widget_cb(GtkWidget *widget) { /* Once the book currency widget is set, need to set the default_gain_loss_account_widget and/or del-button or text*/ - - gnc_commodity *commodity = gnc_currency_edit_get_currency( + if (gtk_combo_box_get_active (GTK_COMBO_BOX(book_currency_data->book_currency_widget)) != -1) + { + gnc_commodity *commodity = gnc_currency_edit_get_currency( GNC_CURRENCY_EDIT( book_currency_data->book_currency_widget)); - gnc_set_default_gain_loss_account_widget(commodity); + + gnc_set_default_gain_loss_account_widget(commodity); + } gtk_widget_show_all(book_currency_data->book_currency_vbox); gnc_option_changed_widget_cb(widget, book_currency_data->option); } @@ -900,13 +877,8 @@ gnc_option_changed_gain_loss_account_del_button_widget_cb (GtkButton *button, gp static void gnc_option_currency_accounting_non_book_cb(GtkWidget *widget, gpointer data) { - /* since there is no 'gnc_currency_edit_set_currency(widget, -1)' like - there is for 'gnc_combott_set_active', do this as a work around so - the dialog is cleared of currency when switched out of 'book- - currency' choice */ - gtk_widget_destroy (book_currency_data->book_currency_widget); - book_currency_data->book_currency_widget = gnc_currency_edit_new(); - gnc_set_book_currency_widget(); + gnc_currency_edit_clear_display (GNC_CURRENCY_EDIT( + book_currency_data->book_currency_widget)); gnc_combott_set_active(GNC_COMBOTT( book_currency_data->default_cost_policy_widget), -1); @@ -1203,11 +1175,22 @@ gnc_option_create_currency_accounting_widget (char *name, GNCOption *option) /* Create the button frame */ frame = gtk_frame_new (name); + gtk_widget_set_halign (GTK_WIDGET(frame), GTK_ALIGN_FILL); + gtk_widget_set_hexpand (GTK_WIDGET(frame), TRUE); /* Create the verticle button box */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); gtk_box_set_homogeneous (GTK_BOX (vbox), FALSE); gtk_container_add (GTK_CONTAINER (frame), vbox); + gtk_widget_set_halign (GTK_WIDGET(vbox), GTK_ALIGN_FILL); + gtk_widget_set_hexpand (GTK_WIDGET(vbox), TRUE); + +#if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_end (GTK_WIDGET(vbox), 12); +#else + gtk_widget_set_margin_right (GTK_WIDGET(vbox), 12); +#endif + gtk_widget_set_margin_bottom (GTK_WIDGET(vbox), 12); /* Iterate over the three options and create a radio button for each one */ for (i = 0; i < num_values; i++) @@ -1248,8 +1231,7 @@ gnc_option_create_currency_accounting_widget (char *name, GNCOption *option) "Use a Book Currency") == 0) { GtkWidget *widget_label, - *alignm = gtk_alignment_new (.5, .5, 1.0, 1.0), - *policy_table = gtk_table_new (1, 2, FALSE); + *policy_table = gtk_grid_new(); book_currency_data->book_currency_widget = gnc_currency_edit_new(); book_currency_data->default_cost_policy_widget = @@ -1258,104 +1240,107 @@ gnc_option_create_currency_accounting_widget (char *name, GNCOption *option) book_currency_data->gain_loss_account_del_button = NULL; book_currency_data->default_gain_loss_account_text = NULL; book_currency_data->prior_gain_loss_account = NULL; - book_currency_data->book_currency_table = - gtk_table_new (1, 2, FALSE); - book_currency_data->book_currency_vbox = gtk_vbox_new (FALSE, 0); - book_currency_data->gain_loss_account_table = - gtk_table_new (2, 3, FALSE); - table = gtk_table_new (2, 2, FALSE); - gtk_table_attach_defaults (GTK_TABLE (table), widget, 0, 2, 0, 1); - g_signal_connect(G_OBJECT(widget), - "toggled", + + book_currency_data->book_currency_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_box_set_homogeneous (GTK_BOX (book_currency_data->book_currency_vbox), FALSE); + + table = gtk_grid_new (); + gtk_grid_attach (GTK_GRID(table), widget, 0, 0, 2, 1); + g_signal_connect(G_OBJECT(widget), "toggled", G_CALLBACK(gnc_option_currency_accounting_book_cb), book_currency_data); - gtk_table_set_row_spacings ( - GTK_TABLE (book_currency_data->book_currency_table), - 6); - gtk_table_set_col_spacings ( - GTK_TABLE (book_currency_data->book_currency_table), - 6); - gtk_table_set_row_spacings (GTK_TABLE (policy_table), 6); - gtk_table_set_col_spacings (GTK_TABLE (policy_table), 6); - gtk_table_set_row_spacings ( - GTK_TABLE (book_currency_data->gain_loss_account_table), - 6); - gtk_table_set_col_spacings ( - GTK_TABLE (book_currency_data->gain_loss_account_table), - 6); + + book_currency_data->book_currency_table = gtk_grid_new (); + gtk_grid_set_row_spacing (GTK_GRID (book_currency_data->book_currency_table), 6); + gtk_grid_set_column_spacing (GTK_GRID (book_currency_data->book_currency_table), 6); + tip = gnc_currency_accounting_option_currency_documentation(option); widget_label = gtk_label_new( _("Book currency:") ); gtk_widget_set_tooltip_text(book_currency_data->book_currency_table, tip && *tip ? _(tip) : ""); - gtk_table_attach ( - GTK_TABLE(book_currency_data->book_currency_table), - widget_label, - 0, 1, // left, right attach - 0, 1, // top, bottom attach - GTK_FILL, GTK_FILL, // x,y - 0, 0); - gnc_set_book_currency_widget(); - gtk_box_pack_start ( - GTK_BOX (book_currency_data->book_currency_vbox), - book_currency_data->book_currency_table, - FALSE, FALSE, 0); + + gtk_widget_set_halign (GTK_WIDGET(widget_label), GTK_ALIGN_START); + gtk_widget_set_hexpand (GTK_WIDGET(widget_label), TRUE); + + gtk_grid_attach (GTK_GRID(book_currency_data->book_currency_table), widget_label, 0, 0, 1, 1); + + g_signal_connect(G_OBJECT(book_currency_data->book_currency_widget), + "changed", + G_CALLBACK(gnc_option_changed_book_currency_widget_cb), + NULL); + + gtk_grid_attach (GTK_GRID(book_currency_data->book_currency_table), + book_currency_data->book_currency_widget, 1, 0, 1, 1); + + gtk_box_pack_start (GTK_BOX (book_currency_data->book_currency_vbox), + book_currency_data->book_currency_table, + TRUE, TRUE, 0); +#if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start (GTK_WIDGET(book_currency_data->book_currency_table), 12); +#else + gtk_widget_set_margin_left (GTK_WIDGET(book_currency_data->book_currency_table), 12); +#endif + gtk_grid_set_row_spacing (GTK_GRID (policy_table), 6); + gtk_grid_set_column_spacing (GTK_GRID (policy_table), 6); + tip = gnc_currency_accounting_option_policy_documentation(option); widget_label = gtk_label_new( _("Default lot tracking policy:") ); - gtk_widget_set_tooltip_text( - policy_table, tip && *tip ? _(tip) : ""); - gtk_table_attach (GTK_TABLE(policy_table), widget_label, - 0, 1, // left, right attach - 0, 1, // top, bottom attach - GTK_FILL, GTK_FILL, // x,y - 0, 0); + gtk_widget_set_tooltip_text(policy_table, tip && *tip ? _(tip) : ""); + + gtk_widget_set_halign (GTK_WIDGET(widget_label), GTK_ALIGN_START); + gtk_widget_set_hexpand (GTK_WIDGET(widget_label), TRUE); + + gtk_grid_attach (GTK_GRID(policy_table), widget_label, 0, 1, 1, 1); + g_signal_connect(G_OBJECT( - book_currency_data->default_cost_policy_widget), - "changed", - G_CALLBACK(gnc_option_multichoice_cb), option); - gtk_table_attach (GTK_TABLE(policy_table), - book_currency_data->default_cost_policy_widget, - 1, 2, // left, right attach - 0, 1, // top, bottom attach - GTK_FILL|GTK_EXPAND, GTK_FILL, // x,y - 0, 0); - gtk_box_pack_start ( - GTK_BOX (book_currency_data->book_currency_vbox), - policy_table, FALSE, FALSE, 0); - tip = - gnc_currency_accounting_option_gain_loss_account_documentation( - option); + book_currency_data->default_cost_policy_widget), + "changed", + G_CALLBACK(gnc_option_multichoice_cb), option); + + gtk_grid_attach (GTK_GRID(policy_table), + book_currency_data->default_cost_policy_widget, 1, 1, 1, 1); + + gtk_box_pack_start (GTK_BOX (book_currency_data->book_currency_vbox), + policy_table, TRUE, TRUE, 0); +#if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start (GTK_WIDGET(policy_table), 12); +#else + gtk_widget_set_margin_left (GTK_WIDGET(policy_table), 12); +#endif + book_currency_data->gain_loss_account_table = gtk_grid_new (); + gtk_grid_set_row_spacing (GTK_GRID (book_currency_data->gain_loss_account_table), 6); + gtk_grid_set_column_spacing (GTK_GRID (book_currency_data->gain_loss_account_table), 6); + + tip = gnc_currency_accounting_option_gain_loss_account_documentation(option); widget_label = gtk_label_new( _("Default gain/loss account:") ); - gtk_misc_set_alignment (GTK_MISC(widget_label), 0.0, 0.5); - gtk_widget_set_tooltip_text( - book_currency_data->gain_loss_account_table, - tip && *tip ? _(tip) : ""); - gtk_table_attach ( - GTK_TABLE(book_currency_data->gain_loss_account_table), - widget_label, - 0, 2, // left, right attach - 0, 1, // top, bottom attach - GTK_FILL, GTK_FILL, // x,y - 0, 6); + gnc_label_set_alignment (GTK_WIDGET(widget_label), 0.0, 0.5); + + gtk_widget_set_tooltip_text(book_currency_data->gain_loss_account_table, + tip && *tip ? _(tip) : ""); + + gtk_grid_attach (GTK_GRID(book_currency_data->gain_loss_account_table), widget_label, 0, 0, 1, 1); + widget_label = NULL; - gtk_box_pack_start ( - GTK_BOX (book_currency_data->book_currency_vbox), - book_currency_data->gain_loss_account_table, - FALSE, FALSE, 0); - gtk_alignment_set_padding (GTK_ALIGNMENT (alignm), 0, 0, 36, 0); - gtk_container_add (GTK_CONTAINER (alignm), - book_currency_data->book_currency_vbox); - gtk_table_attach_defaults (GTK_TABLE (table), alignm, 0, 2, 1, 2); + gtk_box_pack_start (GTK_BOX (book_currency_data->book_currency_vbox), + book_currency_data->gain_loss_account_table, + TRUE, TRUE, 0); +#if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start (GTK_WIDGET(book_currency_data->gain_loss_account_table), 12); +#else + gtk_widget_set_margin_left (GTK_WIDGET(book_currency_data->gain_loss_account_table), 12); +#endif + gtk_grid_attach (GTK_GRID(table), book_currency_data->book_currency_vbox, 1, 2, 1, 1); } else /* trading or neither */ { - table = gtk_table_new (1, 2, FALSE); - gtk_table_attach_defaults (GTK_TABLE (table), widget, 0, 2, 0, 1); - g_signal_connect(G_OBJECT(widget), - "toggled", - G_CALLBACK(gnc_option_currency_accounting_non_book_cb), - book_currency_data); + table = gtk_grid_new (); + gtk_grid_attach (GTK_GRID(table), widget, 0, 1, 1, 1); + + g_signal_connect(G_OBJECT(widget), "toggled", + G_CALLBACK(gnc_option_currency_accounting_non_book_cb), + book_currency_data); } - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); if (label) free (label); @@ -2107,7 +2092,6 @@ refresh_handler (GHashTable *changes, gpointer user_data) /* The default_gain_loss_account_widget needs to be refreshed if any changes have been made via account maintenance, if it exists and if the book currency widget has a selection */ - if (book_currency_data->default_gain_loss_account_widget && gtk_combo_box_get_active_iter( GTK_COMBO_BOX(book_currency_data->book_currency_widget), &iter)) @@ -3085,7 +3069,7 @@ gnc_option_set_ui_widget_currency_accounting (GNCOption *option, gnc_option_set_widget (option, value); gnc_option_set_ui_value(option, FALSE); - gtk_box_pack_start(GTK_BOX(*enclosing), value, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(*enclosing), value, TRUE, TRUE, 0); gtk_widget_show_all(*enclosing); return value; } @@ -4108,7 +4092,7 @@ gnc_option_get_ui_value_currency_accounting ( } value = scm_cons(val, value); - if (book_currency_data->book_currency_widget) + if (gtk_combo_box_get_active (GTK_COMBO_BOX(book_currency_data->book_currency_widget)) != -1) { commodity = gnc_currency_edit_get_currency( From 5a7a8d8d9bab3d6d38fe38499ecf5015e4584679 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 15 Jul 2017 11:32:00 +0100 Subject: [PATCH 5/9] Add function to add the color background data function to account column Some tree views based on GncTreeViewAccount specify there own columns and when displayed you can end up with the Account column background color set and the new ones uncolored which can look odd. Added a function to add the color data function to the new columns. --- src/gnome-utils/dialog-options.c | 8 ++++++++ src/gnome-utils/gnc-tree-view-account.c | 21 +++++++++++++++++++++ src/gnome-utils/gnc-tree-view-account.h | 5 +++++ src/import-export/import-account-matcher.c | 3 +++ 4 files changed, 37 insertions(+) diff --git a/src/gnome-utils/dialog-options.c b/src/gnome-utils/dialog-options.c index a6bed1d473..a3ac41fe3c 100644 --- a/src/gnome-utils/dialog-options.c +++ b/src/gnome-utils/dialog-options.c @@ -680,6 +680,10 @@ gnc_set_default_gain_loss_account_widget(gnc_commodity *commodity) g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1)); + // add the color background data function to the column + gnc_tree_view_account_column_add_color (GNC_TREE_VIEW_ACCOUNT( + book_currency_data->default_gain_loss_account_widget), col); + col = gnc_tree_view_add_toggle_column(GNC_TREE_VIEW( book_currency_data->default_gain_loss_account_widget), @@ -696,6 +700,10 @@ gnc_set_default_gain_loss_account_widget(gnc_commodity *commodity) g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1)); + // add the color background data function to the column + gnc_tree_view_account_column_add_color (GNC_TREE_VIEW_ACCOUNT( + book_currency_data->default_gain_loss_account_widget), col); + gnc_tree_view_configure_columns (GNC_TREE_VIEW( book_currency_data->default_gain_loss_account_widget)); gnc_tree_view_set_show_column_menu(GNC_TREE_VIEW( diff --git a/src/gnome-utils/gnc-tree-view-account.c b/src/gnome-utils/gnc-tree-view-account.c index 83fdf388f0..5914ce7eb5 100644 --- a/src/gnome-utils/gnc-tree-view-account.c +++ b/src/gnome-utils/gnc-tree-view-account.c @@ -659,6 +659,18 @@ gnc_tree_view_account_color_update (gpointer gsettings, gchar *key, gpointer use priv->show_account_color = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, key); } +/** Add the account color background data function to the GncTreeViewAccount column to + * show or not the column background in the account color. + */ +void +gnc_tree_view_account_column_add_color (GncTreeViewAccount *view, GtkTreeViewColumn *col) +{ + GtkCellRenderer *renderer = gnc_tree_view_column_get_renderer(col); + + gtk_tree_view_column_set_cell_data_func (col, renderer, acc_color_data_func, + GTK_TREE_VIEW(view), NULL); +} + /************************************************************/ /* New View Creation */ /************************************************************/ @@ -1743,6 +1755,7 @@ account_cell_property_data_func (GtkTreeViewColumn *tree_column, GtkTreeIter *s_iter, gpointer key) { + GncTreeViewAccount *view; Account *account; gchar *string = NULL; @@ -1755,6 +1768,11 @@ account_cell_property_data_func (GtkTreeViewColumn *tree_column, string = ""; g_object_set (G_OBJECT (cell), "text", string, "xalign", 0.0, NULL); + + view = g_object_get_data(G_OBJECT(tree_column), "tree-view"); + + if (GNC_IS_TREE_VIEW_ACCOUNT (view)) + acc_color_data_func (tree_column, cell, s_model, s_iter, view); } @@ -1778,6 +1796,9 @@ gnc_tree_view_account_add_property_column (GncTreeViewAccount *view, renderer = gnc_tree_view_column_get_renderer(column); g_object_set (G_OBJECT (renderer), "xalign", 1.0, NULL); + // add a pointer to the view to make it easier to access in data_func + g_object_set_data(G_OBJECT(column), "tree-view", (gpointer)view); + gtk_tree_view_column_set_cell_data_func (column, renderer, account_cell_property_data_func, g_strdup(propname), g_free); diff --git a/src/gnome-utils/gnc-tree-view-account.h b/src/gnome-utils/gnc-tree-view-account.h index 0ebfc97d58..b6381f2b15 100644 --- a/src/gnome-utils/gnc-tree-view-account.h +++ b/src/gnome-utils/gnc-tree-view-account.h @@ -471,6 +471,11 @@ void gnc_tree_view_account_select_subaccounts (GncTreeViewAccount *view, */ void gnc_tree_view_account_expand_to_account (GncTreeViewAccount *view, Account *account); +/** Add the account color background data function to the GncTreeViewAccount column to + * show or not the column background in the account color. + */ +void gnc_tree_view_account_column_add_color (GncTreeViewAccount *view, GtkTreeViewColumn *col); + /** @} */ /** @} */ diff --git a/src/import-export/import-account-matcher.c b/src/import-export/import-account-matcher.c index 13c955761f..9d4034af51 100644 --- a/src/import-export/import-account-matcher.c +++ b/src/import-export/import-account-matcher.c @@ -118,6 +118,9 @@ build_acct_tree(AccountPickerDialog *picker) _("Account ID"), "online-id"); g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1)); + // the color background data function is part of the add_property_column + // function which will color the background based on preference setting + gtk_container_add(GTK_CONTAINER(picker->account_tree_sw), GTK_WIDGET(picker->account_tree)); From 5ef645b8d086ca91fbf5f90c8262690be4d7b882 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 15 Jul 2017 13:28:34 +0100 Subject: [PATCH 6/9] Replace some missed GTK_STOCK_ items --- src/import-export/aqb/gnc-plugin-aqbanking.c | 12 ++++++------ src/plugins/bi_import/gnc-plugin-bi-import.c | 2 +- .../customer_import/gnc-plugin-customer_import.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/import-export/aqb/gnc-plugin-aqbanking.c b/src/import-export/aqb/gnc-plugin-aqbanking.c index c1cb7595c1..b0303fa293 100644 --- a/src/import-export/aqb/gnc-plugin-aqbanking.c +++ b/src/import-export/aqb/gnc-plugin-aqbanking.c @@ -137,30 +137,30 @@ static GtkActionEntry gnc_plugin_actions [] = /* File -> Import menu item */ { - "Mt940ImportAction", GTK_STOCK_CONVERT, N_("Import _MT940"), NULL, + "Mt940ImportAction", "go-previous", N_("Import _MT940"), NULL, N_("Import a MT940 file into GnuCash"), G_CALLBACK(gnc_plugin_ab_cmd_mt940_import) }, { - "Mt942ImportAction", GTK_STOCK_CONVERT, N_("Import MT94_2"), NULL, + "Mt942ImportAction", "go-previous", N_("Import MT94_2"), NULL, N_("Import a MT942 file into GnuCash"), G_CALLBACK(gnc_plugin_ab_cmd_mt942_import) }, { - "DtausImportAction", GTK_STOCK_CONVERT, N_("Import _DTAUS"), NULL, + "DtausImportAction", "go-previous", N_("Import _DTAUS"), NULL, N_("Import a DTAUS file into GnuCash"), G_CALLBACK(gnc_plugin_ab_cmd_dtaus_import) }, /* #ifdef CSV_IMPORT_FUNCTIONAL */ - /* { "CsvImportAction", GTK_STOCK_CONVERT, N_("Import _CSV"), NULL, */ + /* { "CsvImportAction", "go-previous", N_("Import _CSV"), NULL, */ /* N_("Import a CSV file into GnuCash"), */ /* G_CALLBACK(gnc_plugin_ab_cmd_csv_import) }, */ - /* { "CsvImportSendAction", GTK_STOCK_CONVERT, N_("Import CSV and s_end..."), NULL, */ + /* { "CsvImportSendAction", "go-previous", N_("Import CSV and s_end..."), NULL, */ /* N_("Import a CSV file into GnuCash and send the transfers online through Online Banking"), */ /* G_CALLBACK(gnc_plugin_ab_cmd_csv_importsend) }, */ /* #endif */ { - "DtausImportSendAction", GTK_STOCK_CONVERT, N_("Import DTAUS and _send..."), NULL, + "DtausImportSendAction", "go-previous", N_("Import DTAUS and _send..."), NULL, N_("Import a DTAUS file into GnuCash and send the transfers online through Online Banking"), G_CALLBACK(gnc_plugin_ab_cmd_dtaus_importsend) }, diff --git a/src/plugins/bi_import/gnc-plugin-bi-import.c b/src/plugins/bi_import/gnc-plugin-bi-import.c index 56ebf936a9..70e62fb209 100644 --- a/src/plugins/bi_import/gnc-plugin-bi-import.c +++ b/src/plugins/bi_import/gnc-plugin-bi-import.c @@ -54,7 +54,7 @@ static GtkActionEntry gnc_plugin_actions [] = { /* Menu Items */ { "ImportMenuAction", NULL, N_("_Import"), NULL, NULL, NULL }, - { "bi_importAction", NULL, N_("Import Bills & Invoices..."), NULL, N_("Import bills and invoices from a CSV text file"), G_CALLBACK(gnc_plugin_bi_import_cmd_test) }, + { "bi_importAction", "go-previous", N_("Import Bills & Invoices..."), NULL, N_("Import bills and invoices from a CSV text file"), G_CALLBACK(gnc_plugin_bi_import_cmd_test) }, }; static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions); diff --git a/src/plugins/customer_import/gnc-plugin-customer_import.c b/src/plugins/customer_import/gnc-plugin-customer_import.c index b168e81b48..4ab4260b13 100644 --- a/src/plugins/customer_import/gnc-plugin-customer_import.c +++ b/src/plugins/customer_import/gnc-plugin-customer_import.c @@ -54,7 +54,7 @@ static GtkActionEntry gnc_plugin_actions [] = { /* Menu Items */ { "ImportMenuAction", NULL, N_("I_mport"), NULL, NULL, NULL }, - { "customer_importAction", NULL, N_("Import Customers and Vendors"), NULL, N_("customer_import tooltip"), G_CALLBACK(gnc_plugin_customer_import_cmd_test) }, + { "customer_importAction", "go-previous", N_("Import Customers and Vendors"), NULL, N_("customer_import tooltip"), G_CALLBACK(gnc_plugin_customer_import_cmd_test) }, }; static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions); From 503aa28a088310753a9d715c69522aabe252c91b Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 15 Jul 2017 13:29:13 +0100 Subject: [PATCH 7/9] Replace deprecated stock-id with icon-name --- src/import-export/csv-imp/assistant-csv-trans-import.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/import-export/csv-imp/assistant-csv-trans-import.cpp b/src/import-export/csv-imp/assistant-csv-trans-import.cpp index 3a7de369b4..50d9b90f9c 100644 --- a/src/import-export/csv-imp/assistant-csv-trans-import.cpp +++ b/src/import-export/csv-imp/assistant-csv-trans-import.cpp @@ -1384,7 +1384,7 @@ CsvImpTransAssist::preview_style_column (uint32_t col_num, GtkTreeModel* model) if (col_num == 0) { gtk_tree_view_column_set_attributes (col, renderer, - "stock-id", PREV_COL_ERR_ICON, + "icon-name", PREV_COL_ERR_ICON, "cell-background", PREV_COL_BCOLOR, nullptr); g_object_set (G_OBJECT(renderer), "stock-size", GTK_ICON_SIZE_MENU, nullptr); g_object_set (G_OBJECT(col), "sizing", GTK_TREE_VIEW_COLUMN_FIXED, From 6c4c82267ef4d1f8638aab57484dfbbb18bb4fa1 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 15 Jul 2017 14:09:50 +0100 Subject: [PATCH 8/9] Remove redundant GTK_CHECK_VERSION's --- src/gnome-utils/dialog-account.c | 16 ---------------- .../gnc-cell-renderer-popup-entry.c | 9 +-------- src/gnome-utils/gnc-combott.c | 5 +---- src/gnome-utils/gnc-date-edit.c | 5 +---- src/gnome-utils/gnc-dense-cal.c | 7 +------ src/gnome-utils/gnc-main-window.c | 9 ++------- src/gnome-utils/gnc-tree-view-split-reg.c | 4 ---- src/gnome/assistant-hierarchy.c | 4 ---- src/import-export/import-main-matcher.c | 18 ------------------ src/register/register-gnome/gnucash-header.c | 4 ---- .../register-gnome/gnucash-item-edit.c | 13 +------------ src/register/register-gnome/gnucash-sheet.c | 4 ---- 12 files changed, 7 insertions(+), 91 deletions(-) diff --git a/src/gnome-utils/dialog-account.c b/src/gnome-utils/dialog-account.c index 4d9c86cbd5..abd9310187 100644 --- a/src/gnome-utils/dialog-account.c +++ b/src/gnome-utils/dialog-account.c @@ -668,7 +668,6 @@ verify_children_compatible (AccountWindow *aw) gtk_label_set_selectable (GTK_LABEL (label), TRUE); gnc_label_set_alignment (label, 0.0, 0.0); { -#if GTK_CHECK_VERSION(3,16,0) GtkCssProvider *provider = gtk_css_provider_new(); const gchar *label_css = { "label {\n" @@ -681,21 +680,6 @@ verify_children_compatible (AccountWindow *aw) GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); -#else - gint size; - PangoFontDescription *font_desc; - GtkStyleContext *style; - - style = gtk_widget_get_style_context(label); - gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, GTK_STYLE_PROPERTY_FONT, &font_desc, NULL); - - size = pango_font_description_get_size (font_desc); - font_desc = pango_font_description_new (); - pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD); - pango_font_description_set_size (font_desc, size * PANGO_SCALE_LARGE); - gtk_widget_override_font(label, font_desc); - pango_font_description_free (font_desc); -#endif } gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); diff --git a/src/gnome-utils/gnc-cell-renderer-popup-entry.c b/src/gnome-utils/gnc-cell-renderer-popup-entry.c index c704176bee..e1e0da57fd 100644 --- a/src/gnome-utils/gnc-cell-renderer-popup-entry.c +++ b/src/gnome-utils/gnc-cell-renderer-popup-entry.c @@ -108,11 +108,7 @@ gnc_popup_entry_init (GncPopupEntry *widget) widget->button = gtk_button_new (); gtk_widget_show (widget->button); -#if GTK_CHECK_VERSION(3,14,0) arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON); -#else - arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT); -#endif gtk_widget_show (arrow); gtk_container_add (GTK_CONTAINER (widget->button), arrow); @@ -302,12 +298,9 @@ gnc_popup_get_button_width (void) gtk_widget_show (button); gtk_container_add (GTK_CONTAINER (window), button); -#if GTK_CHECK_VERSION(3,14,0) arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON); -#else - arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT); -#endif gtk_widget_show (arrow); + gtk_container_add (GTK_CONTAINER (button), arrow); gtk_window_move (GTK_WINDOW (window), -500, -500); diff --git a/src/gnome-utils/gnc-combott.c b/src/gnome-utils/gnc-combott.c index 33b6f18017..d10c080f7c 100644 --- a/src/gnome-utils/gnc-combott.c +++ b/src/gnome-utils/gnc-combott.c @@ -227,11 +227,8 @@ gctt_init (GncCombott *combott) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous (GTK_BOX(hbox), FALSE); -#if GTK_CHECK_VERSION(3,14,0) arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON); -#else - arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT); -#endif + #if GTK_CHECK_VERSION(3,12,0) gtk_widget_set_margin_start (GTK_WIDGET(arrow), 5); #else diff --git a/src/gnome-utils/gnc-date-edit.c b/src/gnome-utils/gnc-date-edit.c index dfe32e0564..47f3a22c28 100644 --- a/src/gnome-utils/gnc-date-edit.c +++ b/src/gnome-utils/gnc-date-edit.c @@ -928,11 +928,8 @@ create_children (GNCDateEdit *gde) gtk_widget_show (GTK_WIDGET(gde->cal_label)); /* Graphic for the popup button. */ -#if GTK_CHECK_VERSION(3,14,0) arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON); -#else - arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); -#endif + gtk_box_pack_start (GTK_BOX (hbox), arrow, TRUE, FALSE, 0); gtk_widget_show (GTK_WIDGET(arrow)); diff --git a/src/gnome-utils/gnc-dense-cal.c b/src/gnome-utils/gnc-dense-cal.c index 1415af171c..07f86f1a4b 100644 --- a/src/gnome-utils/gnc-dense-cal.c +++ b/src/gnome-utils/gnc-dense-cal.c @@ -378,7 +378,6 @@ gnc_dense_cal_init(GncDenseCal *dcal) GTK_STYLE_PROPERTY_FONT, &font_desc, NULL); font_size = pango_font_description_get_size(font_desc); -#if GTK_CHECK_VERSION(3,16,0) provider = gtk_css_provider_new(); dpi = gdk_screen_get_resolution (gdk_screen_get_default ()); px_size = ((font_size / PANGO_SCALE) - font_size_reduction_units) * (dpi / 72.); @@ -391,11 +390,7 @@ gnc_dense_cal_init(GncDenseCal *dcal) g_object_unref (provider); g_free (px_str); g_free (widget_css); -#else - font_size -= font_size_reduction_units * PANGO_SCALE; - pango_font_description_set_size(font_desc, font_size); - gtk_widget_override_font(GTK_WIDGET(dcal), font_desc); -#endif + pango_font_description_free (font_desc); maxWidth = maxHeight = 0; diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index ce7d5f7f62..fbde441130 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -2301,11 +2301,10 @@ main_window_update_page_color (GncPluginPage *page, if (want_color && gdk_rgba_parse(&tab_color, color_string) && priv->show_color_tabs) { -#if GTK_CHECK_VERSION(3,16,0) GtkCssProvider *provider = gtk_css_provider_new(); GtkStyleContext *stylectxt; gchar *col_str, *widget_css; -#endif + if (!GTK_IS_EVENT_BOX (tab_widget)) { GtkWidget *event_box = gtk_event_box_new (); @@ -2316,7 +2315,7 @@ main_window_update_page_color (GncPluginPage *page, g_object_unref (tab_widget); tab_widget = event_box; } -#if GTK_CHECK_VERSION(3,16,0) + stylectxt = gtk_widget_get_style_context (GTK_WIDGET (tab_widget)); col_str = gdk_rgba_to_string (&tab_color); widget_css = g_strconcat ("*{\n background-color:", col_str, ";\n}\n", NULL); @@ -2327,10 +2326,6 @@ main_window_update_page_color (GncPluginPage *page, g_object_unref (provider); g_free (col_str); g_free (widget_css); -#else - gtk_widget_override_background_color (tab_widget, GTK_STATE_NORMAL, &tab_color); - gtk_widget_override_background_color (tab_widget, GTK_STATE_ACTIVE, &tab_color); -#endif } else { diff --git a/src/gnome-utils/gnc-tree-view-split-reg.c b/src/gnome-utils/gnc-tree-view-split-reg.c index 2dfc06ec68..32e42c3e51 100644 --- a/src/gnome-utils/gnc-tree-view-split-reg.c +++ b/src/gnome-utils/gnc-tree-view-split-reg.c @@ -5799,7 +5799,6 @@ gtv_sr_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable { if (entry != NULL) { -#if GTK_CHECK_VERSION(3,16,0) GtkStyleContext *stylectxt = gtk_widget_get_style_context (GTK_WIDGET (entry)); GtkCssProvider *provider = gtk_css_provider_new(); gchar *col_str = gdk_rgba_to_string (&color); @@ -5811,9 +5810,6 @@ gtv_sr_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable g_object_unref (provider); g_free (col_str); g_free (widget_css); -#else - gtk_widget_override_background_color (GTK_WIDGET (entry), GTK_STATE_FLAG_NORMAL, &color); -#endif } } } diff --git a/src/gnome/assistant-hierarchy.c b/src/gnome/assistant-hierarchy.c index f9b61551e0..b0625f2111 100644 --- a/src/gnome/assistant-hierarchy.c +++ b/src/gnome/assistant-hierarchy.c @@ -1197,14 +1197,10 @@ assistant_insert_book_options_page (hierarchy_data *data) options = gnc_options_dialog_notebook (data->optionwin); parent = gtk_widget_get_parent (options); -#if GTK_CHECK_VERSION(3, 14, 0) g_object_ref (options); gtk_container_remove (GTK_CONTAINER(parent), options); gtk_container_add (GTK_CONTAINER(vbox), options); g_object_unref (options); -#else - gtk_widget_reparent (options, vbox); -#endif gtk_widget_show_all (vbox); gtk_assistant_insert_page (GTK_ASSISTANT(data->dialog), vbox, 1); diff --git a/src/import-export/import-main-matcher.c b/src/import-export/import-main-matcher.c index d0cbb70f82..5c4ed61efa 100644 --- a/src/import-export/import-main-matcher.c +++ b/src/import-export/import-main-matcher.c @@ -203,7 +203,6 @@ on_matcher_help_close_clicked (GtkButton *button, gpointer user_data) gtk_widget_destroy(help_dialog); } -#if GTK_CHECK_VERSION(3,16,0) static void gnc_override_background_color (GtkWidget *widget, GdkRGBA *rgba) @@ -220,8 +219,6 @@ gnc_override_background_color (GtkWidget *widget, g_free (col_str); g_free (widget_css); } -#endif - void on_matcher_help_clicked (GtkButton *button, gpointer user_data) @@ -238,28 +235,13 @@ on_matcher_help_clicked (GtkButton *button, gpointer user_data) gnc_builder_add_from_file (builder, "dialog-import.glade", "matcher_help_dialog"); box = GTK_WIDGET(gtk_builder_get_object (builder, "red")); -#if GTK_CHECK_VERSION(3,16,0) gnc_override_background_color (box, &info->color_back_red); -#else - gtk_widget_override_background_color(box, GTK_STATE_FLAG_NORMAL, - &info->color_back_red); -#endif box = GTK_WIDGET(gtk_builder_get_object (builder, "yellow")); -#if GTK_CHECK_VERSION(3,16,0) gnc_override_background_color (box, &info->color_back_yellow); -#else - gtk_widget_override_background_color(box, GTK_STATE_FLAG_NORMAL, - &info->color_back_yellow); -#endif box = GTK_WIDGET(gtk_builder_get_object (builder, "green")); -#if GTK_CHECK_VERSION(3,16,0) gnc_override_background_color (box, &info->color_back_green); -#else - gtk_widget_override_background_color(box, GTK_STATE_FLAG_NORMAL, - &info->color_back_green); -#endif help_dialog = GTK_WIDGET(gtk_builder_get_object (builder, "matcher_help_dialog")); gtk_window_set_transient_for(GTK_WINDOW(help_dialog), diff --git a/src/register/register-gnome/gnucash-header.c b/src/register/register-gnome/gnucash-header.c index e04eb7e82e..06b9fcaf79 100644 --- a/src/register/register-gnome/gnucash-header.c +++ b/src/register/register-gnome/gnucash-header.c @@ -585,11 +585,7 @@ gnc_header_init (GncHeader *header) header->cursor_name = NULL; header->in_resize = FALSE; header->resize_col = -1; -#if GTK_CHECK_VERSION(3,16,0) header->resize_cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_SB_H_DOUBLE_ARROW); -#else - header->resize_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW); -#endif header->normal_cursor = NULL; header->height = 20; header->width = 400; diff --git a/src/register/register-gnome/gnucash-item-edit.c b/src/register/register-gnome/gnucash-item-edit.c index f9e87ab7d9..dc0e88de4c 100644 --- a/src/register/register-gnome/gnucash-item-edit.c +++ b/src/register/register-gnome/gnucash-item-edit.c @@ -527,11 +527,7 @@ gnc_item_edit_new (GnucashSheet *sheet) /* Create the popup button It will only be displayed when the cell being edited provides a popup item (like a calendar or account list) */ -#if GTK_CHECK_VERSION(3,14,0) item_edit->popup_toggle.arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON); -#else - item_edit->popup_toggle.arrow = GTK_WIDGET(gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_IN)); -#endif item_edit->popup_toggle.tbutton = gtk_toggle_button_new(); gtk_toggle_button_set_mode ( @@ -645,11 +641,7 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit) unblock_toggle_signals (item_edit); } -#if GTK_CHECK_VERSION(3,14,0) item_edit->popup_toggle.arrow = gtk_image_new_from_icon_name ("go-up", GTK_ICON_SIZE_BUTTON); -#else - gtk_arrow_set (GTK_ARROW(item_edit->popup_toggle.arrow), GTK_ARROW_UP, GTK_SHADOW_OUT); -#endif if (item_edit->popup_set_focus) item_edit->popup_set_focus (item_edit->popup_item, @@ -691,11 +683,8 @@ gnc_item_edit_hide_popup (GncItemEdit *item_edit) return; gtk_container_remove (GTK_CONTAINER(item_edit->sheet), item_edit->popup_item); -#if GTK_CHECK_VERSION(3,14,0) + item_edit->popup_toggle.arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON); -#else - gtk_arrow_set (GTK_ARROW(item_edit->popup_toggle.arrow), GTK_ARROW_DOWN, GTK_SHADOW_IN); -#endif gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton), FALSE); diff --git a/src/register/register-gnome/gnucash-sheet.c b/src/register/register-gnome/gnucash-sheet.c index 360a7e2482..4b4152ba44 100644 --- a/src/register/register-gnome/gnucash-sheet.c +++ b/src/register/register-gnome/gnucash-sheet.c @@ -597,10 +597,6 @@ gnucash_sheet_update_adjustments (GnucashSheet *sheet) gtk_adjustment_get_page_size (vadj) / sheet->num_visible_blocks); else gtk_adjustment_set_step_increment (vadj, 0); - -#if !GTK_CHECK_VERSION(3,18,0) - gtk_adjustment_changed(vadj); -#endif } From 338e10aade61f0e854b4d00ccec0cce49e296410 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 15 Jul 2017 18:03:34 +0100 Subject: [PATCH 9/9] Fix missing id values for GtkTreeSelection in glade files --- src/import-export/csv-imp/assistant-csv-trans-import.glade | 6 +++--- src/import-export/dialog-import.glade | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/import-export/csv-imp/assistant-csv-trans-import.glade b/src/import-export/csv-imp/assistant-csv-trans-import.glade index 49d092db98..c15f378ead 100644 --- a/src/import-export/csv-imp/assistant-csv-trans-import.glade +++ b/src/import-export/csv-imp/assistant-csv-trans-import.glade @@ -870,7 +870,7 @@ For example False both - + @@ -886,7 +886,7 @@ For example GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK both - + @@ -1021,7 +1021,7 @@ For example True - + diff --git a/src/import-export/dialog-import.glade b/src/import-export/dialog-import.glade index 77d72127d2..8224c727ce 100644 --- a/src/import-export/dialog-import.glade +++ b/src/import-export/dialog-import.glade @@ -641,7 +641,7 @@ True True - + @@ -676,7 +676,7 @@ True True - + @@ -1103,7 +1103,7 @@ True False - +