Changeset 5e4f71dcc0a6c1d008fd8d95df86fbd05299e55b

Show
Ignore:
Timestamp:
01/07/07 00:04:51 (6 years ago)
Author:
Philipp Kern <phil@…>
Parents:
dfc8e830fe2821fcb4775fb6d78b5654e733a8ff
Children:
960ea8f1a0fe6c93f64551b52589fe8585e7fd5e
git-committer:
Philipp Kern <phil@0x539.de> / 2007-01-06T23:04:51Z+0000
Message:

[project @ Load pixmaps from pixmaps/ if not found in PIXMAPS_DIR]

Original author: Armin Burgmeier <armin@…>
Date: 2006-08-21 20:41:33+00:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/icon.cpp

    r813a0b5 r5e4f71d  
    1 /* GdkPixbuf RGBA C-Source image dump */ 
     1/* IconZZzzzzzzzzz */ 
    22 
    33#include <glib/gtypes.h> 
     
    66#include "icon.hpp" 
    77 
     8#ifdef _WIN32 
     9# include <windows.h> 
     10#endif 
     11 
     12namespace 
     13{ 
     14        Glib::RefPtr<Gdk::Pixbuf> load_pixbuf(const char* dir, const char* file) 
     15        { 
     16                try 
     17                { 
     18                        return Gdk::Pixbuf::create_from_file( 
     19                                Glib::build_filename(dir, file) 
     20                        ); 
     21                } 
     22                catch(Glib::FileError& e) 
     23                { 
     24                        /* Not installed */ 
     25#ifdef _WIN32 
     26                        TCHAR path[MAX_PATH]; 
     27                        if(!GetModuleFileName(NULL, path, MAX_PATH)) 
     28                                throw e; 
     29 
     30                        return Gdk::Pixbuf::create_from_file( 
     31                                Glib::build_filename( 
     32                                        Glib::build_filename( 
     33                                                Glib::path_get_dirname(path), 
     34                                                "pixmaps" 
     35                                        ), 
     36                                        file 
     37                                ) 
     38                        ); 
     39#else 
     40                        return Gdk::Pixbuf::create_from_file( 
     41                                Glib::build_filename("pixmaps", file) 
     42                        ); 
     43#endif 
     44                } 
     45        } 
     46} 
     47 
    848Gtk::StockID Gobby::IconManager::STOCK_USERLIST("gobby-userlist"); 
    949Gtk::StockID Gobby::IconManager::STOCK_DOCLIST("gobby-doclist"); 
     
    1151 
    1252Gobby::IconManager::IconManager(): 
    13         gobby(Gdk::Pixbuf::create_from_file(APPICON_DIR"/gobby.png") ), 
    14         userlist(Gdk::Pixbuf::create_from_file(PIXMAPS_DIR"/userlist.png") ), 
    15         doclist(Gdk::Pixbuf::create_from_file(PIXMAPS_DIR"/doclist.png") ), 
    16         chat(Gdk::Pixbuf::create_from_file(PIXMAPS_DIR"/chat.png") ), 
     53        gobby(load_pixbuf(APPICON_DIR, "gobby.png") ), 
     54        userlist(load_pixbuf(PIXMAPS_DIR, "userlist.png") ), 
     55        doclist(load_pixbuf(PIXMAPS_DIR, "doclist.png") ), 
     56        chat(load_pixbuf(PIXMAPS_DIR, "chat.png") ), 
    1757        m_is_userlist(userlist), 
    1858        m_is_doclist(doclist),