From 1ec2817c77b766e50e91e66602255cc495ffca59 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Thu, 31 Aug 2017 13:55:30 +0100 Subject: [PATCH] Move inline css for padding to gnucash.css --- gnucash/gnome-utils/ui/gnucash.css | 8 +++++++ .../register-gnome/gnucash-item-edit.c | 24 ++++--------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/gnucash/gnome-utils/ui/gnucash.css b/gnucash/gnome-utils/ui/gnucash.css index c8cc0936aa..469de9f3d4 100644 --- a/gnucash/gnome-utils/ui/gnucash.css +++ b/gnucash/gnome-utils/ui/gnucash.css @@ -2,3 +2,11 @@ unless they have been named or have style classes added. Only the widget type can be configured unless they are named in code */ +/* Register Cursor padding settings, make sure entry matches sheet.h */ +cursor entry { + padding: 2px 5px 2px 5px; +} + +cursor button { + padding: 1px 1px 1px 1px; +} diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c index 16d86c8a1a..8d00bb0839 100644 --- a/gnucash/register/register-gnome/gnucash-item-edit.c +++ b/gnucash/register/register-gnome/gnucash-item-edit.c @@ -555,18 +555,8 @@ gnc_item_edit_new (GnucashSheet *sheet) gtk_entry_set_width_chars (GTK_ENTRY(item_edit->editor), 1); gtk_box_pack_start (GTK_BOX(item_edit), item_edit->editor, TRUE, TRUE, 0); - /* Force padding on the entry to align with the rest of the register */ - hpad_str = g_strdup_printf("%i", CELL_HPADDING); - vpad_str = g_strdup_printf("%i", CELL_VPADDING); - entry_css = g_strconcat ("* { padding: ", vpad_str, "px ", hpad_str, "px ", vpad_str, "px ", hpad_str, "px }", NULL); - provider = gtk_css_provider_new(); - gtk_css_provider_load_from_data (provider, entry_css, -1, NULL); - stylecontext = gtk_widget_get_style_context (item_edit->editor); - gtk_style_context_add_provider (stylecontext, GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_free (hpad_str); - g_free (vpad_str); - g_free (entry_css); + /* Force padding on the entry to align with the rest of the register this + is done in the gnucash.css file which should be in line with sheet.h */ /* Create the popup button It will only be displayed when the cell being edited provides @@ -574,14 +564,8 @@ gnc_item_edit_new (GnucashSheet *sheet) item_edit->popup_toggle.tbutton = gtk_toggle_button_new(); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (item_edit->popup_toggle.tbutton), FALSE); - /* Force padding on the button to - 1. keep it small - 2. display as much as possible of the arrow */ - provider = gtk_css_provider_new(); - gtk_css_provider_load_from_data (provider, "* { padding: 1px }", -1, NULL); - stylecontext = gtk_widget_get_style_context (item_edit->popup_toggle.tbutton); - gtk_style_context_add_provider (stylecontext, GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + /* Force padding on the button to keep it small and display as much as + possible of the arrow which is done in the gnucash.css file */ /* Wrap the popup button in an event box to give it its own gdkwindow. * Without one the button would disappear behind the grid object. */