Update to the latest IconLoader changes.

This commit is contained in:
Sanel Zukan 2009-03-25 11:13:12 +00:00
parent a978576701
commit 59e0be678f
4 changed files with 22 additions and 47 deletions

View File

@ -269,7 +269,7 @@ void apply_cb(Fl_Widget*, void* w) {
conf.set("Icons", "one_click_exec", engage_with_one_click->value()); conf.set("Icons", "one_click_exec", engage_with_one_click->value());
if(conf.save(EDE_DESKTOP_CONFIG)) if(conf.save(EDE_DESKTOP_CONFIG))
edelib::Window::update_settings(EDE_DESKTOP_UID); edelib::Window::do_foreign_callback(EDE_DESKTOP_UID);
} }
void ok_cb(Fl_Widget*, void* w) { void ok_cb(Fl_Widget*, void* w) {
@ -363,7 +363,7 @@ int main(int argc, char** argv) {
show_group = 3; show_group = 3;
} }
edelib::Window* win = new edelib::Window(550, 285, _("Desktop options")); edelib::Window* win = new edelib::Window(550, 285, _("Desktop options"), edelib::WIN_INIT_IMAGES);
win->begin(); win->begin();
Fl_Tabs* tabs = new Fl_Tabs(10, 10, 530, 230); Fl_Tabs* tabs = new Fl_Tabs(10, 10, 530, 230);
tabs->begin(); tabs->begin();
@ -472,8 +472,6 @@ int main(int argc, char** argv) {
Fl_Button* cancel = new Fl_Button(450, 250, 90, 25, _("&Cancel")); Fl_Button* cancel = new Fl_Button(450, 250, 90, 25, _("&Cancel"));
cancel->callback(close_cb, win); cancel->callback(close_cb, win);
win->end(); win->end();
win->init(edelib::WIN_INIT_IMAGES);
load_settings(); load_settings();
win->show(argc, argv); win->show(argc, argv);
return Fl::run(); return Fl::run();

View File

@ -17,13 +17,13 @@
#include <FL/x.H> #include <FL/x.H>
#include <edelib/Debug.h> #include <edelib/Debug.h>
#include <edelib/IconTheme.h> #include <edelib/IconLoader.h>
#include <edelib/MessageBox.h> #include <edelib/MessageBox.h>
#include <edelib/Nls.h> #include <edelib/Nls.h>
#include <edelib/Run.h> #include <edelib/Run.h>
#ifdef USE_SHAPE #ifdef USE_SHAPE
#include <X11/extensions/shape.h> #include <X11/extensions/shape.h>
#endif #endif
#include "ede-desktop.h" #include "ede-desktop.h"
@ -157,37 +157,25 @@ void DesktopIcon::load_icon(int face) {
if(!ic) if(!ic)
return; return;
edelib::String ipath = edelib::IconTheme::get(ic, edelib::ICON_SIZE_HUGE); if(!edelib::IconLoader::set(this, ic, edelib::ICON_SIZE_HUGE)) {
if(ipath.empty()) { E_DEBUG(E_STRLOC ": Unable to load %s icon\n", ic);
ipath = edelib::IconTheme::get("empty", edelib::ICON_SIZE_HUGE);
E_DEBUG(E_STRLOC ": Didn't find '%s' icon, ", ic);
if(!ipath.empty()) {
E_DEBUG("loaded 'empty' instead\n");
} else {
E_DEBUG("balling out\n");
return;
}
}
Fl_Image* img = Fl_Shared_Image::get(ipath.c_str());
if(!img) {
E_DEBUG(E_STRLOC ": Unable to load %s\n", ipath.c_str());
return; return;
} }
/* fetch image object for sizes */
Fl_Image* img = image();
int img_w = img->w(); int img_w = img->w();
int img_h = img->h(); int img_h = img->h();
// resize box if icon is larger /* resize box if icon is larger */
if(img_w > ICON_SIZE_MIN_W || img_h > ICON_SIZE_MIN_H) if(img_w > ICON_SIZE_MIN_W || img_h > ICON_SIZE_MIN_H)
size(img_w + OFFSET_W, img_h + OFFSET_H); size(img_w + OFFSET_W, img_h + OFFSET_H);
image(img); /* darker icon version for selection */
// darker icon version for selection
delete darker_img; delete darker_img;
darker_img = image()->copy(image()->w(), image()->h());
darker_img = img->copy(img->w(), img->h());
darker_img->color_average(FL_BLUE, 0.6); darker_img->color_average(FL_BLUE, 0.6);
} }

View File

@ -26,7 +26,7 @@
#include <edelib/Nls.h> #include <edelib/Nls.h>
#include <edelib/Window.h> #include <edelib/Window.h>
#include <edelib/IconTheme.h> #include <edelib/IconLoader.h>
#include <edelib/MimeType.h> #include <edelib/MimeType.h>
#include <edelib/IconChooser.h> #include <edelib/IconChooser.h>
@ -165,17 +165,9 @@ void show_icon_properties_dialog(DesktopIcon* dicon) {
Fl_Button* prog_browse = new Fl_Button(270, 65, 25, 25); Fl_Button* prog_browse = new Fl_Button(270, 65, 25, 25);
prog_browse->tooltip(_("Browse location")); prog_browse->tooltip(_("Browse location"));
// find icon for browse button // set icon for browse button
edelib::String ii = edelib::IconTheme::get("document-open", edelib::ICON_SIZE_TINY); if(!edelib::IconLoader::set(prog_browse, "document-open", edelib::ICON_SIZE_TINY))
if(ii.empty())
prog_browse->label("..."); prog_browse->label("...");
else {
Fl_Image* ii_img = Fl_Shared_Image::get(ii.c_str());
if(ii_img)
prog_browse->image(ii_img);
else
prog_browse->label("...");
}
g2->end(); g2->end();
tabs->end(); tabs->end();
@ -185,8 +177,6 @@ void show_icon_properties_dialog(DesktopIcon* dicon) {
Fl_Button* cancel_button = new Fl_Button(215, 360, 90, 25, _("&Cancel")); Fl_Button* cancel_button = new Fl_Button(215, 360, 90, 25, _("&Cancel"));
cancel_button->callback(close_cb, win); cancel_button->callback(close_cb, win);
win->end(); win->end();
win->init(edelib::WIN_INIT_ALL);
win->show(); win->show();
while(win->shown()) while(win->shown())

View File

@ -34,7 +34,7 @@
#include <edelib/DirWatch.h> #include <edelib/DirWatch.h>
#include <edelib/MimeType.h> #include <edelib/MimeType.h>
#include <edelib/StrUtil.h> #include <edelib/StrUtil.h>
#include <edelib/IconTheme.h> #include <edelib/IconLoader.h>
#include <edelib/Run.h> #include <edelib/Run.h>
#include <edelib/Util.h> #include <edelib/Util.h>
#include <edelib/Nls.h> #include <edelib/Nls.h>
@ -152,9 +152,8 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") {
do_dirwatch = true; do_dirwatch = true;
#ifdef USE_EDELIB_WINDOW #ifdef USE_EDELIB_WINDOW
DESKTOP_WINDOW::init(); window_id(EDE_DESKTOP_UID);
settings_uid(EDE_DESKTOP_UID); foreign_callback(settings_changed_cb);
settings_callback(settings_changed_cb);
//DESKTOP_WINDOW::single_buffer(true); //DESKTOP_WINDOW::single_buffer(true);
#endif #endif
@ -1157,7 +1156,7 @@ int main() {
#ifndef USE_EDELIB_WINDOW #ifndef USE_EDELIB_WINDOW
fl_register_images(); fl_register_images();
edelib::IconTheme::init("edeneu"); edelib::IconLoader::init();
#endif #endif
Desktop::init(); Desktop::init();
@ -1177,7 +1176,7 @@ int main() {
Desktop::shutdown(); Desktop::shutdown();
#ifndef USE_EDELIB_WINDOW #ifndef USE_EDELIB_WINDOW
edelib::IconTheme::shutdown(); edelib::IconLoader::shutdown();
#endif #endif
return 0; return 0;
} }