pixlist.h File Reference

#include <glib.h>
Include dependency graph for pixlist.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define PATH_IMG   "/usr/share/icons/"

Functions

GdkPixbuf * pixlist_icon_state (const char *icon, const char *state)
GdkPixbuf * pixlist_toolbar_icon (const char *name, const char *state)

Define Documentation

#define PATH_IMG   "/usr/share/icons/"

File Name : pixlist.h

Description: Maintains a referenced list of all pixbuf objects as cache Copyright (C) 2008 iRex Technologies B.V. All rights reserved.

Definition at line 36 of file pixlist.h.

Referenced by pixlist_icon_state(), pixlist_toolbar_icon(), and statusbar_create().


Function Documentation

GdkPixbuf* pixlist_icon_state ( const char *  icon,
const char *  state 
)

Definition at line 70 of file pixlist.c.

References load_icon(), LOGPRINTF, and PATH_IMG.

Referenced by add_popup_submenu(), get_pixbuf(), menustore_add_group(), menustore_add_item(), statusbar_add_item(), and statusbar_add_item_state().

00071 {
00072     LOGPRINTF("entry %s, %s", icon, state);
00073     
00074     if ((icon == NULL) || (icon[0] == '\0'))
00075     {
00076         // no icon name so don't bother to load/ref image
00077         return NULL;
00078     }
00079 
00080     gchar *iconfile = NULL;
00081     gchar *fileext = g_utf8_strrchr(icon, strlen(icon), '.');
00082     if (fileext == NULL)
00083     {
00084         // name is not a filename or path 
00085         // prefix with path and postfix with state and file extension
00086         if (state && (strcmp(state, "normal") == 0))
00087         {
00088             iconfile = g_strdup_printf("%s%s.png", PATH_IMG, icon);
00089         }
00090         else
00091         {
00092             iconfile = g_strdup_printf("%s%s_%s.png", PATH_IMG, icon, state);
00093         }
00094     }
00095     else
00096     {
00097         gchar *strcopy = g_strdup(icon);
00098         gchar *filepath = g_utf8_strrchr(strcopy, strlen(strcopy), '.');
00099         *filepath = '\0';
00100         
00101         // icon is a full path
00102         // postfix with state only
00103         if (strcmp(state, "normal") ==0)
00104         {
00105             iconfile = g_strdup_printf("%s%s", strcopy, fileext);
00106         }
00107         else
00108         {
00109             iconfile = g_strdup_printf("%s_%s%s", strcopy, state, fileext);
00110         }
00111         g_free(strcopy);
00112     }
00113         
00114     GdkPixbuf* pixbuf = load_icon(iconfile);
00115     g_free(iconfile);
00116     return pixbuf;
00117 }

Here is the call graph for this function:

Here is the caller graph for this function:

GdkPixbuf* pixlist_toolbar_icon ( const char *  name,
const char *  state 
)

Definition at line 120 of file pixlist.c.

References filename, load_icon(), PATH_IMG, and WARNPRINTF.

00121 {
00122     GdkPixbuf* icon = NULL;
00123     if (name != NULL && name[0] != 0) {
00124         static char filename[256];
00125         snprintf(filename, sizeof(filename), "%stoolbar_%s_%s.png", PATH_IMG, name, state);
00126         icon = load_icon(filename);
00127         if (icon == NULL) {
00128             WARNPRINTF("cannot find icon %s", filename);
00129         }
00130     }
00131     if (icon == NULL) {
00132         icon = load_icon(PATH_IMG"toolbar_blank.png");
00133     }
00134     return icon;
00135 }

Here is the call graph for this function:

Generated by  doxygen 1.6.2-20100208