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());
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) {
@ -363,7 +363,7 @@ int main(int argc, char** argv) {
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();
Fl_Tabs* tabs = new Fl_Tabs(10, 10, 530, 230);
tabs->begin();
@ -472,8 +472,6 @@ int main(int argc, char** argv) {
Fl_Button* cancel = new Fl_Button(450, 250, 90, 25, _("&Cancel"));
cancel->callback(close_cb, win);
win->end();
win->init(edelib::WIN_INIT_IMAGES);
load_settings();
win->show(argc, argv);
return Fl::run();

View File

@ -17,13 +17,13 @@
#include <FL/x.H>
#include <edelib/Debug.h>
#include <edelib/IconTheme.h>
#include <edelib/IconLoader.h>
#include <edelib/MessageBox.h>
#include <edelib/Nls.h>
#include <edelib/Run.h>
#ifdef USE_SHAPE
#include <X11/extensions/shape.h>
#include <X11/extensions/shape.h>
#endif
#include "ede-desktop.h"
@ -157,37 +157,25 @@ void DesktopIcon::load_icon(int face) {
if(!ic)
return;
edelib::String ipath = edelib::IconTheme::get(ic, edelib::ICON_SIZE_HUGE);
if(ipath.empty()) {
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());
if(!edelib::IconLoader::set(this, ic, edelib::ICON_SIZE_HUGE)) {
E_DEBUG(E_STRLOC ": Unable to load %s icon\n", ic);
return;
}
}
/* fetch image object for sizes */
Fl_Image* img = image();
int img_w = img->w();
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)
size(img_w + OFFSET_W, img_h + OFFSET_H);
image(img);
// darker icon version for selection
/* darker icon version for selection */
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);
}

View File

@ -26,7 +26,7 @@
#include <edelib/Nls.h>
#include <edelib/Window.h>
#include <edelib/IconTheme.h>
#include <edelib/IconLoader.h>
#include <edelib/MimeType.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);
prog_browse->tooltip(_("Browse location"));
// find icon for browse button
edelib::String ii = edelib::IconTheme::get("document-open", edelib::ICON_SIZE_TINY);
if(ii.empty())
// set icon for browse button
if(!edelib::IconLoader::set(prog_browse, "document-open", edelib::ICON_SIZE_TINY))
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();
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"));
cancel_button->callback(close_cb, win);
win->end();
win->init(edelib::WIN_INIT_ALL);
win->show();
while(win->shown())

View File

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