Generalise theme extension handling
[claws.git] / src / stock_pixmap.c
index 702b45c624b8bf91b919b3c2cf5358e59079f09b..70ff84e1e7454fd8d15699435cf8b1295cdf5ae2 100644 (file)
 #include "pixmaps/mime_message.xpm"
 #include "pixmaps/address_search.xpm"
 #include "pixmaps/check_spelling.xpm"
-
 #include "pixmaps/dir_close.xpm"
 #include "pixmaps/dir_close_hrm.xpm"
 #include "pixmaps/dir_open.xpm"
 #include "pixmaps/trash_open.xpm"
 #include "pixmaps/trash_close.xpm"
 #include "pixmaps/delete_btn.xpm"
+#include "pixmaps/delete_dup_btn.xpm"
 #include "pixmaps/cancel.xpm"
 #include "pixmaps/trash_btn.xpm"
 #include "pixmaps/trash_open_hrm.xpm"
@@ -402,6 +402,7 @@ static StockPixmapData pixmaps[] =
     {claws_mail_icon_64_xpm           , NULL, NULL, "claws_mail_icon_64", NULL, NULL},
     {read_xpm                         , NULL, NULL, "read", NULL, NULL},
     {delete_btn_xpm                   , NULL, NULL, "delete_btn", NULL, NULL},
+    {delete_dup_btn_xpm               , NULL, NULL, "delete_dup_btn", NULL, NULL},
     {cancel_xpm                       , NULL, NULL, "cancel", NULL, NULL},
     {trash_btn_xpm                    , NULL, NULL, "trash_btn", NULL, NULL},
     {claws_mail_compose_logo_xpm      , NULL, NULL, "claws_mail_compose_logo", NULL, NULL},
@@ -459,12 +460,25 @@ static StockPixmapData pixmaps[] =
     {empty_xpm                        , NULL, NULL, "empty", NULL, NULL}
 };
 
+/* Supported theme extensions */
+static const char *extension[] = {
+       ".png",
+       ".xpm",
+       NULL
+};
+
+/* return current supported extensions */
+const char **stock_pixmap_theme_extensions(void)
+{
+       return extension;
+}
+
 /* return newly constructed GtkPixmap from GdkPixmap */
 GtkWidget *stock_pixmap_widget(StockPixmap icon)
 {
        GdkPixbuf *pixbuf;
 
-       cm_return_val_if_fail(icon >= 0 && icon < N_STOCK_PIXMAPS, NULL);
+       cm_return_val_if_fail(icon < N_STOCK_PIXMAPS, NULL);
 
        if (stock_pixbuf_gdk(icon, &pixbuf) != -1)
                return gtk_image_new_from_pixbuf(pixbuf);
@@ -478,14 +492,13 @@ GtkWidget *stock_pixmap_widget(StockPixmap icon)
 gint stock_pixbuf_gdk(StockPixmap icon, GdkPixbuf **pixbuf)
 {
        StockPixmapData *pix_d;
-       static const char *extension[]={".png", ".xpm", NULL};
        int i = 0;
        gboolean theme_changed = FALSE;
 
        if (pixbuf)
                *pixbuf = NULL;
 
-       cm_return_val_if_fail(icon >= 0 && icon < N_STOCK_PIXMAPS, -1);
+       cm_return_val_if_fail(icon < N_STOCK_PIXMAPS, -1);
 
        pix_d = &pixmaps[icon];
 
@@ -555,7 +568,6 @@ static void stock_pixmap_find_themes_in_dir(GList **list, const gchar *dirname)
        gchar *fullentry;
        GDir *dp;
        GError *error = NULL;
-       static const char *extension[]={".png", ".xpm", NULL};
 
        if ((dp = g_dir_open(dirname, 0, &error)) == NULL) {
                debug_print("skipping theme scan, dir %s could not be opened: %s (%d)\n",
@@ -635,7 +647,7 @@ void stock_pixmap_themes_list_free(GList *list)
 
 gchar *stock_pixmap_get_name (StockPixmap icon)
 {
-       if (icon < 0 || icon >= N_STOCK_PIXMAPS)
+       if (icon >= N_STOCK_PIXMAPS)
                return NULL;
 
        return pixmaps[icon].file;