From 59e0be678fa83650710f904f9fb32a0b5c353251 Mon Sep 17 00:00:00 2001 From: Sanel Zukan Date: Wed, 25 Mar 2009 11:13:12 +0000 Subject: [PATCH] Update to the latest IconLoader changes. --- ede-desktop-conf/ede-desktop-conf.cpp | 6 ++--- ede-desktop/DesktopIcon.cpp | 36 +++++++++------------------ ede-desktop/IconProperties.cpp | 16 +++--------- ede-desktop/ede-desktop.cpp | 11 ++++---- 4 files changed, 22 insertions(+), 47 deletions(-) diff --git a/ede-desktop-conf/ede-desktop-conf.cpp b/ede-desktop-conf/ede-desktop-conf.cpp index 5cb0a9b..1c1ac79 100644 --- a/ede-desktop-conf/ede-desktop-conf.cpp +++ b/ede-desktop-conf/ede-desktop-conf.cpp @@ -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(); diff --git a/ede-desktop/DesktopIcon.cpp b/ede-desktop/DesktopIcon.cpp index 57941bb..7bb51f4 100644 --- a/ede-desktop/DesktopIcon.cpp +++ b/ede-desktop/DesktopIcon.cpp @@ -17,13 +17,13 @@ #include #include -#include +#include #include #include #include #ifdef USE_SHAPE - #include +#include #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); } diff --git a/ede-desktop/IconProperties.cpp b/ede-desktop/IconProperties.cpp index 3ba2a65..635f99d 100644 --- a/ede-desktop/IconProperties.cpp +++ b/ede-desktop/IconProperties.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -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()) diff --git a/ede-desktop/ede-desktop.cpp b/ede-desktop/ede-desktop.cpp index ac8017f..726e933 100644 --- a/ede-desktop/ede-desktop.cpp +++ b/ede-desktop/ede-desktop.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include @@ -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; }