/* ====================================================================
 * FTD4Linux Software License, Version 1.0
 *
 * Copyright (c) 2000-2004 The FTD4Linux Development Team.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *        FTD4Linux Development Team (http://www.ftd4linux.2y.net/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "FTD" and "FTD4Linux" must
 *    not be used to endorse or promote products derived from this
 *    software without prior written permission. For written
 *    permission, please contact alguno@ftd4linux.2y.net.
 *
 * 5. Products derived from this software may not be called "FTD4Linux",
 *    nor may "FTD4Linux" appear in their name, without prior written
 *    permission of the FTD4Linux Development Team.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE FTD4LINUX DEVELOPMENT TEAM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <stdio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <images/icon.xpm>
#include <images/icon-updaten_on.xpm>
#include <images/icon-updaten_off.xpm>
#include <images/icon-config_on.xpm>
#include <images/icon-config_off.xpm>
#include <images/icon-toevoegen_on.xpm>
#include <images/icon-toevoegen_off.xpm>
#include <images/icon-mail_on.xpm>
#include <images/icon-mail_off.xpm>
//#include <images/icon-mail_active.xpm>
#include <images/icon-nieuw_on.xpm>
#include <images/icon-nieuw_off.xpm>
#include <images/icon-refresh_on.xpm>
#include <images/icon-refresh_off.xpm>
#include <images/icon-dayselector_on.xpm>
#include <images/icon-dayselector_off.xpm>
#include <images/icon-watchlist_on.xpm>
#include <images/icon-watchlist_off.xpm>
#include <images/icon-watchlist_active.xpm>
#include <images/icon-vrienden_on.xpm>
#include <images/icon-vrienden_off.xpm>
#include <images/icon-myftd_on.xpm>
#include <images/icon-myftd_off.xpm>
#include <images/icon-modje_on.xpm>
#include <images/icon-modje_off.xpm>
#include <images/icon-hulp_on.xpm>
#include <images/icon-hulp_off.xpm>
#include <images/upd-uploading.xpm>
#include <images/upd-ready.xpm>
#include <images/upd-unsupported.xpm>
#include <images/icon-mail-controleer.xpm>
#include <images/icon-mail-nieuw.xpm>
#include <images/icon-mail-reageer.xpm>
#include <images/icon-mail-deleten.xpm>
#include <images/icon-new.xpm>

#include "ftd_gui_main.h"
#include "ftd_gui_pixbuf.h"

typedef struct ftd_pixbuf_data {
    char *name;
    GdkPixbuf *pixbuf;
} FtdPixbufData;

FtdList *pixbufs;

static void
ftd_gui_pixbuf_new(const char *name, GdkPixbuf *pixbuf)
{
    FtdPixbufData *pixbuf_data;

    pixbuf_data = (FtdPixbufData *) g_malloc(sizeof(FtdPixbufData));
    pixbuf_data->name = g_strdup(name);
    pixbuf_data->pixbuf = pixbuf;
    pixbufs = ftd_list_append(pixbufs, pixbuf_data);
}

void
ftd_gui_pixbuf_destroy(void)
{
    FtdList *list = pixbufs;
    while (list) {
        FtdPixbufData *data = ftd_list_value(list);

        g_object_unref(data->pixbuf);
        g_free(data->name);
        g_free(data);

        list = ftd_list_next(list);
    }

    ftd_list_free(pixbufs);
    pixbufs = NULL;
}

void
ftd_gui_pixbuf_init_pixbufs(void)
{
    char *filename;

    pixbufs = NULL;

    /* ICON xpm *
     ************/
    ftd_gui_pixbuf_new("icon", gdk_pixbuf_new_from_xpm_data((const char **)icon_xpm));

    /* STATUS gif's *
     ****************/
    filename = ftd_file_parse_data_dir("/images/kill.gif");
    ftd_gui_pixbuf_new("deleted", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/spot.gif");
    ftd_gui_pixbuf_new("spot", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/red.gif");
    ftd_gui_pixbuf_new("unsupported", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/brown.gif");
    ftd_gui_pixbuf_new("announce", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/green.gif");
    ftd_gui_pixbuf_new("uploading", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/gray.gif");
    ftd_gui_pixbuf_new("ready", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    /* Category xpm's *
     ******************/

    filename = ftd_file_parse_data_dir("/images/ct00.gif");
    ftd_gui_pixbuf_new("ct00", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct01.gif");
    ftd_gui_pixbuf_new("ct01", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct02.gif");
    ftd_gui_pixbuf_new("ct02", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct03.gif");
    ftd_gui_pixbuf_new("ct03", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct04.gif");
    ftd_gui_pixbuf_new("ct04", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct05.gif");
    ftd_gui_pixbuf_new("ct05", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct10.gif");
    ftd_gui_pixbuf_new("ct10", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct11.gif");
    ftd_gui_pixbuf_new("ct11", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct12.gif");
    ftd_gui_pixbuf_new("ct12", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct13.gif");
    ftd_gui_pixbuf_new("ct13", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct14.gif");
    ftd_gui_pixbuf_new("ct14", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct20.gif");
    ftd_gui_pixbuf_new("ct20", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct21.gif");
    ftd_gui_pixbuf_new("ct21", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct22.gif");
    ftd_gui_pixbuf_new("ct22", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct23.gif");
    ftd_gui_pixbuf_new("ct23", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct24.gif");
    ftd_gui_pixbuf_new("ct24", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct25.gif");
    ftd_gui_pixbuf_new("ct25", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct26.gif");
    ftd_gui_pixbuf_new("ct26", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct27.gif");
    ftd_gui_pixbuf_new("ct27", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct28.gif");
    ftd_gui_pixbuf_new("ct28", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct29.gif");
    ftd_gui_pixbuf_new("ct29", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct30.gif");
    ftd_gui_pixbuf_new("ct30", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct31.gif");
    ftd_gui_pixbuf_new("ct31", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct32.gif");
    ftd_gui_pixbuf_new("ct32", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct33.gif");
    ftd_gui_pixbuf_new("ct33", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct34.gif");
    ftd_gui_pixbuf_new("ct34", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    filename = ftd_file_parse_data_dir("/images/ct35.gif");
    ftd_gui_pixbuf_new("ct35", gdk_pixbuf_new_from_file(filename, NULL));
    g_free(filename);

    /* ICON xpm's *
     **************/
    filename = ftd_file_parse_data_dir("/gui/icon-updaten_off.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-updaten_off", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-updaten_off",  gdk_pixbuf_new_from_xpm_data((const char **)icon_updaten_off_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-updaten_on.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-updaten_on", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-updaten_on",  gdk_pixbuf_new_from_xpm_data((const char **)icon_updaten_on_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-config_off.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-config_off", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-config_off",  gdk_pixbuf_new_from_xpm_data((const char **)icon_config_off_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-config_on.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-config_on", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-config_on",  gdk_pixbuf_new_from_xpm_data((const char **)icon_config_on_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-toevoegen_off.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-toevoegen_off", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-toevoegen_off",  gdk_pixbuf_new_from_xpm_data((const char **)icon_toevoegen_off_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-toevoegen_on.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-toevoegen_on", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-toevoegen_on",  gdk_pixbuf_new_from_xpm_data((const char **)icon_toevoegen_on_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-mail_off.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-mail_off", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-mail_off",  gdk_pixbuf_new_from_xpm_data((const char **)icon_mail_off_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-mail_on.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-mail_on", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-mail_on",  gdk_pixbuf_new_from_xpm_data((const char **)icon_mail_on_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-mail_active.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-mail_active", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-mail_active",  gdk_pixbuf_new_from_xpm_data((const char **)icon_mail_off_xpm));    // FIXME: nog apart XPM icoontje maken
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-nieuw_off.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-nieuw_off", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-nieuw_off",  gdk_pixbuf_new_from_xpm_data((const char **)icon_nieuw_off_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-nieuw_on.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-nieuw_on", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-nieuw_on",  gdk_pixbuf_new_from_xpm_data((const char **)icon_nieuw_on_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-refresh_off.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-refresh_off", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-refresh_off",  gdk_pixbuf_new_from_xpm_data((const char **)icon_refresh_off_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-refresh_on.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-refresh_on", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-refresh_on",  gdk_pixbuf_new_from_xpm_data((const char **)icon_refresh_on_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-dayselector_off.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-dayselector_off", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-dayselector_off",  gdk_pixbuf_new_from_xpm_data((const char **)icon_dayselector_off_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-dayselector_on.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-dayselector_on", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-dayselector_on",  gdk_pixbuf_new_from_xpm_data((const char **)icon_dayselector_on_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-vrienden_off.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-vrienden_off", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-vrienden_off",  gdk_pixbuf_new_from_xpm_data((const char **)icon_vrienden_off_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-vrienden_on.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-vrienden_on", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-vrienden_on",  gdk_pixbuf_new_from_xpm_data((const char **)icon_vrienden_on_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-watchlist_off.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-watchlist_off", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-watchlist_off",  gdk_pixbuf_new_from_xpm_data((const char **)icon_watchlist_off_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-watchlist_on.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-watchlist_on", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-watchlist_on",  gdk_pixbuf_new_from_xpm_data((const char **)icon_watchlist_on_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-watchlist_active.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-watchlist_active", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-watchlist_active",  gdk_pixbuf_new_from_xpm_data((const char **)icon_watchlist_active_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-myftd_off.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-myftd_off", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-myftd_off",  gdk_pixbuf_new_from_xpm_data((const char **)icon_myftd_off_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-myftd_on.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-myftd_on", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-myftd_on",  gdk_pixbuf_new_from_xpm_data((const char **)icon_myftd_on_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-modje_off.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-modje_off", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-modje_off",  gdk_pixbuf_new_from_xpm_data((const char **)icon_modje_off_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-modje_on.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-modje_on", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-modje_on",  gdk_pixbuf_new_from_xpm_data((const char **)icon_modje_on_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-hulp_off.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-hulp_off", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-hulp_off",  gdk_pixbuf_new_from_xpm_data((const char **)icon_hulp_off_xpm));
    }
    g_free(filename);

    filename = ftd_file_parse_data_dir("/gui/icon-hulp_on.png");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("icon-hulp_on", gdk_pixbuf_new_from_file(filename, NULL));
    } else {
        ftd_gui_pixbuf_new("icon-hulp_on",  gdk_pixbuf_new_from_xpm_data((const char **)icon_hulp_on_xpm));
    }
    g_free(filename);

    // TODO: Donate?

    ftd_gui_pixbuf_new("upd-unsupported",  gdk_pixbuf_new_from_xpm_data((const char **)upd_unsupported_xpm));
    ftd_gui_pixbuf_new("upd-ready",  gdk_pixbuf_new_from_xpm_data((const char **)upd_ready_xpm));
    ftd_gui_pixbuf_new("upd-uploading",  gdk_pixbuf_new_from_xpm_data((const char **)upd_uploading_xpm));

    /* FTD Mail xpm's *
     *****************/
    ftd_gui_pixbuf_new("icon-mail-controleer", gdk_pixbuf_new_from_xpm_data((const char **)icon_mail_controleer_xpm));
    ftd_gui_pixbuf_new("icon-mail-nieuw", gdk_pixbuf_new_from_xpm_data((const char **)icon_mail_nieuw_xpm));
    ftd_gui_pixbuf_new("icon-mail-reageer", gdk_pixbuf_new_from_xpm_data((const char **)icon_mail_reageer_xpm));
    ftd_gui_pixbuf_new("icon-mail-deleten", gdk_pixbuf_new_from_xpm_data((const char **)icon_mail_deleten_xpm));

    ftd_gui_pixbuf_new("new",  gdk_pixbuf_new_from_xpm_data((const char **)icon_new_xpm));

    filename = ftd_file_parse_data_dir("/images/u.gif");
    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
        ftd_gui_pixbuf_new("link", gdk_pixbuf_new_from_file(filename, NULL));
    }
    g_free(filename);

}

GdkPixbuf *
ftd_gui_main_get_pixbuf(const char *pixbufname)
{
    FtdList *list = pixbufs;

    g_assert(pixbufs);
    g_assert(pixbufname);

    while (list) {
        FtdPixbufData *pixbuf_data = (FtdPixbufData *) ftd_list_value(list);
        g_assert(pixbuf_data);

        if (!strcmp(pixbuf_data->name, pixbufname)) {
            return pixbuf_data->pixbuf;
        }
        list = ftd_list_next(list);
    }

    g_warning("ftd_gui_pixbuf_get(): No pixbuf associated with %s !\n", pixbufname);
    return NULL;
}
