mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Move another couple of functions used more than once to gnc-gtk-utils
This commit is contained in:
parent
08d7830f7b
commit
64563cae50
@ -889,41 +889,6 @@ gnc_dense_cal_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data)
|
||||
#define LOG_AND_RESET(timer, msg) do { g_debug("%s: %f", msg, g_timer_elapsed(timer, NULL) * 1000.); g_timer_reset(timer); } while (0);
|
||||
|
||||
static void
|
||||
gnc_style_context_get_background_color (GtkStyleContext *context,
|
||||
GtkStateFlags state,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
GdkRGBA *c;
|
||||
|
||||
g_return_if_fail (color != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_style_context_get (context,
|
||||
state,
|
||||
GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,
|
||||
NULL);
|
||||
*color = *c;
|
||||
gdk_rgba_free (c);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_style_context_get_border_color (GtkStyleContext *context,
|
||||
GtkStateFlags state,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
GdkRGBA *c;
|
||||
|
||||
g_return_if_fail (color != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_style_context_get (context,
|
||||
state,
|
||||
GTK_STYLE_PROPERTY_BORDER_COLOR, &c,
|
||||
NULL);
|
||||
*color = *c;
|
||||
gdk_rgba_free (c);
|
||||
}
|
||||
|
||||
gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
@ -242,3 +242,55 @@ gnc_is_dark_theme (GdkRGBA *fg_color)
|
||||
|
||||
return is_dark;
|
||||
}
|
||||
|
||||
/** Wrapper to get the background color of a widget for a given state
|
||||
*
|
||||
* @param context Style context of widget.
|
||||
*
|
||||
* @param state The stateflag of the widget.
|
||||
*
|
||||
* @param color The returned background color of the widget.
|
||||
*/
|
||||
void
|
||||
gnc_style_context_get_background_color (GtkStyleContext *context,
|
||||
GtkStateFlags state,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
GdkRGBA *c;
|
||||
|
||||
g_return_if_fail (color != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_style_context_get (context,
|
||||
state,
|
||||
GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,
|
||||
NULL);
|
||||
*color = *c;
|
||||
gdk_rgba_free (c);
|
||||
}
|
||||
|
||||
/** Wrapper to get the border color of a widget for a given state
|
||||
*
|
||||
* @param context Style context of widget.
|
||||
*
|
||||
* @param state The stateflag of the widget.
|
||||
*
|
||||
* @param color The returned border color of the widget.
|
||||
*/
|
||||
void
|
||||
gnc_style_context_get_border_color (GtkStyleContext *context,
|
||||
GtkStateFlags state,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
GdkRGBA *c;
|
||||
|
||||
g_return_if_fail (color != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_style_context_get (context,
|
||||
state,
|
||||
GTK_STYLE_PROPERTY_BORDER_COLOR, &c,
|
||||
NULL);
|
||||
*color = *c;
|
||||
gdk_rgba_free (c);
|
||||
}
|
||||
|
@ -46,6 +46,13 @@ void gnc_cbwe_add_completion (GtkComboBox *cbwe);
|
||||
void gnc_cbwe_require_list_item (GtkComboBox *cbwe);
|
||||
|
||||
gboolean gnc_is_dark_theme (GdkRGBA *fg_color);
|
||||
void gnc_style_context_get_background_color (GtkStyleContext *context,
|
||||
GtkStateFlags state,
|
||||
GdkRGBA *color);
|
||||
void gnc_style_context_get_border_color (GtkStyleContext *context,
|
||||
GtkStateFlags state,
|
||||
GdkRGBA *color);
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* GNC_GTK_UTILS_H */
|
||||
|
@ -671,24 +671,6 @@ gboolean gnc_gen_trans_list_run (GNCImportMainMatcher *info)
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_style_context_get_background_color (GtkStyleContext *context,
|
||||
GtkStateFlags state,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
GdkRGBA *c;
|
||||
|
||||
g_return_if_fail (color != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_style_context_get (context,
|
||||
state,
|
||||
GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,
|
||||
NULL);
|
||||
*color = *c;
|
||||
gdk_rgba_free (c);
|
||||
}
|
||||
|
||||
static gchar*
|
||||
get_required_color (const gchar *class_name)
|
||||
{
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "gnucash-sheetP.h"
|
||||
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-gtk-utils.h"
|
||||
#include "gnc-prefs.h"
|
||||
#include "gnucash-color.h"
|
||||
#include "gnucash-cursor.h"
|
||||
@ -2330,25 +2331,6 @@ gnucash_sheet_realize_entry (GnucashSheet *sheet, GtkWidget *entry)
|
||||
* the register is rewritten.
|
||||
*/
|
||||
|
||||
static void
|
||||
gnc_style_context_get_background_color (GtkStyleContext *context,
|
||||
GtkStateFlags state,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
GdkRGBA *c;
|
||||
|
||||
g_return_if_fail (color != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_style_context_get (context,
|
||||
state,
|
||||
GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,
|
||||
NULL);
|
||||
*color = *c;
|
||||
gdk_rgba_free (c);
|
||||
}
|
||||
|
||||
|
||||
/** Map a cell type to a gtkrc specified color. */
|
||||
GdkRGBA *
|
||||
get_gtkrc_color (GnucashSheet *sheet,
|
||||
|
Loading…
Reference in New Issue
Block a user