mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Correct the druid colors and watermarks for gnome2.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gnucash-gnome2-dev@9159 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -26,26 +26,125 @@
|
||||
|
||||
#include "dialog-utils.h"
|
||||
#include "druid-utils.h"
|
||||
#include "gnc-dir.h"
|
||||
#include "gnc-engine-util.h"
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_get_imlib_image *
|
||||
* returns a GdkImlibImage object given a pixmap filename *
|
||||
* *
|
||||
* Args: none *
|
||||
* Returns: GnomePixmap widget or NULL if there was a problem *
|
||||
\*******************************************************************/
|
||||
static GdkPixbuf *
|
||||
gnc_druid_get_pixmap (const char *name)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GError *error = NULL;
|
||||
char *fullname;
|
||||
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
fullname = g_strconcat (GNC_PIXMAP_DIR, "/", name, NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_file (fullname, &error);
|
||||
if (error != NULL) {
|
||||
g_assert (pixbuf == NULL);
|
||||
fprintf (stderr, "Pixbuf is NULL: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_free (fullname);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gnc_druid_set_watermark_images (GnomeDruid *druid,
|
||||
const char *top_path,
|
||||
const char *side_path)
|
||||
{
|
||||
GdkPixbuf *top_pixbuf, *side_pixbuf;
|
||||
GList *page_list, *item;
|
||||
GtkWidget *page;
|
||||
|
||||
page_list = gtk_container_get_children(GTK_CONTAINER(druid));
|
||||
top_pixbuf = gnc_druid_get_pixmap(top_path);
|
||||
side_pixbuf = gnc_druid_get_pixmap(side_path);
|
||||
|
||||
for (item = page_list; item; item = g_list_next(item)) {
|
||||
page = item->data;
|
||||
if (GNOME_IS_DRUID_PAGE_EDGE (page)) {
|
||||
GnomeDruidPageEdge *page_edge;
|
||||
|
||||
page_edge = GNOME_DRUID_PAGE_EDGE (page);
|
||||
gnome_druid_page_edge_set_top_watermark (page_edge, top_pixbuf);
|
||||
gnome_druid_page_edge_set_watermark (page_edge, side_pixbuf);
|
||||
} else {
|
||||
GnomeDruidPageStandard *page_standard;
|
||||
|
||||
page_standard = GNOME_DRUID_PAGE_STANDARD (page);
|
||||
gnome_druid_page_standard_set_top_watermark (page_standard, top_pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (G_OBJECT(side_pixbuf));
|
||||
g_object_unref (G_OBJECT(top_pixbuf));
|
||||
g_list_free(page_list);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_druid_set_logo_image (GnomeDruid *druid, char *image_path)
|
||||
{
|
||||
GdkPixbuf *logo_pixbuf;
|
||||
GList *page_list, *item;
|
||||
GtkWidget *page;
|
||||
|
||||
page_list = gtk_container_get_children(GTK_CONTAINER(druid));
|
||||
logo_pixbuf = gnc_druid_get_pixmap(image_path);
|
||||
|
||||
for (item = page_list; item; item = g_list_next(item)) {
|
||||
page = item->data;
|
||||
if (GNOME_IS_DRUID_PAGE_EDGE (page))
|
||||
{
|
||||
GnomeDruidPageEdge *page_edge;
|
||||
|
||||
page_edge = GNOME_DRUID_PAGE_EDGE (page);
|
||||
gnome_druid_page_edge_set_logo (page_edge, logo_pixbuf);
|
||||
} else {
|
||||
GnomeDruidPageStandard *page_standard;
|
||||
|
||||
page_standard = GNOME_DRUID_PAGE_STANDARD (page);
|
||||
gnome_druid_page_standard_set_logo (page_standard, logo_pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (G_OBJECT(logo_pixbuf));
|
||||
g_list_free(page_list);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_druid_set_colors (GnomeDruid *druid)
|
||||
{
|
||||
GList *pages = gtk_container_get_children (GTK_CONTAINER (druid));
|
||||
GdkColor color;
|
||||
GdkColor bluish;
|
||||
GdkColor white;
|
||||
GdkColormap *cm;
|
||||
|
||||
if (!druid) return;
|
||||
if (!GNOME_IS_DRUID (druid)) return;
|
||||
|
||||
color.red = (gushort) (.60 * 65535);
|
||||
color.green = (gushort) (.75 * 65535);
|
||||
color.blue = (gushort) (.60 * 65535);
|
||||
bluish.red = (gushort) (.40 * 65535);
|
||||
bluish.green = (gushort) (.40 * 65535);
|
||||
bluish.blue = (gushort) (.60 * 65535);
|
||||
|
||||
white.red = 65535;
|
||||
white.green = 65535;
|
||||
white.blue = 65535;
|
||||
|
||||
cm = gtk_widget_get_colormap (GTK_WIDGET (druid));
|
||||
|
||||
gdk_colormap_alloc_color(cm, &color, FALSE, TRUE);
|
||||
gdk_colormap_alloc_color(cm, &bluish, FALSE, TRUE);
|
||||
gdk_colormap_alloc_color(cm, &white, FALSE, TRUE);
|
||||
|
||||
while (pages != NULL)
|
||||
{
|
||||
@@ -56,18 +155,18 @@ gnc_druid_set_colors (GnomeDruid *druid)
|
||||
GnomeDruidPageEdge *page_edge;
|
||||
|
||||
page_edge = GNOME_DRUID_PAGE_EDGE (page);
|
||||
gnome_druid_page_edge_set_bg_color (page_edge, &color);
|
||||
gnome_druid_page_edge_set_logo_bg_color (page_edge, &color);
|
||||
gnome_druid_page_edge_set_bg_color (page_edge, &bluish);
|
||||
gnome_druid_page_edge_set_logo_bg_color (page_edge, &bluish);
|
||||
}
|
||||
else
|
||||
{
|
||||
GnomeDruidPageStandard *page_standard;
|
||||
|
||||
page_standard = GNOME_DRUID_PAGE_STANDARD (page);
|
||||
gnome_druid_page_standard_set_background (page_standard, &color);
|
||||
gnome_druid_page_standard_set_logo_background (page_standard, &color);
|
||||
}
|
||||
|
||||
gnome_druid_page_standard_set_background (page_standard, &bluish);
|
||||
gnome_druid_page_standard_set_logo_background (page_standard, &bluish);
|
||||
gnome_druid_page_standard_set_title_foreground (page_standard, &white);
|
||||
}
|
||||
pages = g_list_next (pages);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
|
||||
#include <libgnomeui/gnome-druid.h>
|
||||
|
||||
void gnc_druid_set_watermark_images (GnomeDruid *druid,
|
||||
const char *top_path,
|
||||
const char *side_path);
|
||||
void gnc_druid_set_logo_image (GnomeDruid *druid, char *image_path);
|
||||
void gnc_druid_set_colors (GnomeDruid *druid);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user