diff --git a/eiconman/DesktopIcon.cpp b/eiconman/DesktopIcon.cpp index e0cacbe..4fb38e9 100644 --- a/eiconman/DesktopIcon.cpp +++ b/eiconman/DesktopIcon.cpp @@ -30,8 +30,9 @@ #include "eiconman.h" #include "Utils.h" -// minimal icon size -#define ICONSIZE 48 +// minimal icon sizes +#define ICON_SIZE_MIN_W 48 +#define ICON_SIZE_MIN_H 48 // spaces around box in case of large/small icons #define OFFSET_W 16 @@ -44,7 +45,7 @@ static void rename_cb(Fl_Widget*, void* d); static void props_cb(Fl_Widget*, void* d); -Fl_Menu_Item icon_menu[] = { +static Fl_Menu_Item icon_menu[] = { {_(" &Open "), 0, 0}, {_(" &Rename "), 0, rename_cb, 0}, {_(" &Delete "), 0, 0, 0, FL_MENU_DIVIDER}, @@ -52,7 +53,7 @@ Fl_Menu_Item icon_menu[] = { {0} }; -Fl_Menu_Item icon_trash_menu[] = { +static Fl_Menu_Item icon_trash_menu[] = { {_(" &Open "), 0, 0}, {_(" &Properties "), 0, 0, 0, FL_MENU_DIVIDER}, {_(" &Empty "), 0, 0}, @@ -78,7 +79,7 @@ static void props_cb(Fl_Widget*, void* d) { } DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) : - Fl_Widget(is->x, is->y, ICONSIZE, ICONSIZE) { + Fl_Widget(is->x, is->y, ICON_SIZE_MIN_W, ICON_SIZE_MIN_H) { E_ASSERT(gs != NULL); @@ -133,7 +134,7 @@ DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) : int img_h = img->h(); // resize box if icon is larger - if(img_w > ICONSIZE || img_h > ICONSIZE) + if(img_w > ICON_SIZE_MIN_W || img_h > ICON_SIZE_MIN_H) size(img_w + OFFSET_W, img_h + OFFSET_H); image(img); @@ -180,9 +181,9 @@ void DesktopIcon::load_icon(int face) { 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 { @@ -201,7 +202,7 @@ void DesktopIcon::load_icon(int face) { int img_h = img->h(); // resize box if icon is larger - if(img_w > ICONSIZE || img_h > ICONSIZE) + if(img_w > ICON_SIZE_MIN_W || img_h > ICON_SIZE_MIN_H) size(img_w + OFFSET_W, img_h + OFFSET_H); image(img); diff --git a/eiconman/Jamfile b/eiconman/Jamfile index f01eed7..56aa539 100644 --- a/eiconman/Jamfile +++ b/eiconman/Jamfile @@ -16,10 +16,9 @@ ObjectC++Flags eiconman.cpp : -DUSE_EDELIB_WINDOW ; SOURCE = eiconman.cpp Utils.cpp Wallpaper.cpp DesktopIcon.cpp IconProperties.cpp ; ObjectC++Flags $(SOURCE) : -Wno-long-long -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include ; -LinkAgainst eiconman : -L/opt/ede/lib -ledelib -ledelib_dbus -ldbus-1 ; +LinkAgainst eiconman : -L/opt/ede/lib -ledelib -ledelib_dbus -ldbus-1 ; EdeProgram eiconman : $(SOURCE) ; TranslationStrings locale : $(SOURCE) ; - -FltkProgramBare test/notify : test/notify.cpp : noinstall ; +#FltkProgramBare test/notify : test/notify.cpp : noinstall ; diff --git a/eiconman/Utils.cpp b/eiconman/Utils.cpp index 6e1ef0c..7707604 100644 --- a/eiconman/Utils.cpp +++ b/eiconman/Utils.cpp @@ -25,14 +25,14 @@ Atom _XA_NET_CURRENT_DESKTOP = 0; Atom _XA_NET_DESKTOP_NAMES = 0; Atom _XA_XROOTPMAP_ID = 0; -int overlay_x = 0; -int overlay_y = 0; -int overlay_w = 0; -int overlay_h = 0; +static int overlay_x = 0; +static int overlay_y = 0; +static int overlay_w = 0; +static int overlay_h = 0; -Fl_Window* overlay_drawable = NULL; +static Fl_Window* overlay_drawable = NULL; -char dash_list[] = {1}; +static char dash_list[] = {1}; void init_atoms(void) { _XA_NET_WORKAREA = XInternAtom(fl_display, "_NET_WORKAREA", False); diff --git a/eiconman/eiconman.conf b/eiconman/eiconman.conf index 1e19052..5f142f9 100644 --- a/eiconman/eiconman.conf +++ b/eiconman/eiconman.conf @@ -1,15 +1,16 @@ [Desktop] - Color = 458855680 - WallpaperUse = 1 - WallpaperMode = 1 - Wallpaper = /home/sanelz/walls/Something_Beautiful_by_mirrorkills.jpg +Color=1866896640 +WallpaperUse=1 +WallpaperMode=1 +Wallpaper=/home/sanel/wallpapers/kate-beckinsale8.jpg [Icons] - Label Background = 827223040 - Label Foreground = 7 - Label Fontsize = 12 - Label Maxwidth = 55 - Label Transparent = 1 - Label Visible = 1 - OneClickExec = 0 +LabelBackground=827223040 +LabelForeground=7 +LabelFont=1 +LabelFontsize=12 +LabelMaxwidth=55 +LabelTransparent=1 +LabelVisible=1 +OneClickExec=0 diff --git a/eiconman/eiconman.cpp b/eiconman/eiconman.cpp index 8453b0a..df8a8a6 100644 --- a/eiconman/eiconman.cpp +++ b/eiconman/eiconman.cpp @@ -170,7 +170,7 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") { Desktop::~Desktop() { E_DEBUG("Desktop::~Desktop()\n"); - save_icons(); + save_icons_positions(); delete dsett; delete selbox; @@ -360,7 +360,7 @@ void Desktop::load_icons(const char* path) { StringList lst; - // list with full path; icon basename is extracted in add_icon_pathed() + // list with full path; icon basename is extracted in add_icon_by_path() if(!dir_list(path, lst, true)) { E_DEBUG(E_STRLOC ": Can't read %s\n", path); return; @@ -368,10 +368,10 @@ void Desktop::load_icons(const char* path) { StringListIter it, it_end; for(it = lst.begin(), it_end = lst.end(); it != it_end; ++it) - add_icon_pathed((*it).c_str(), conf_ptr); + add_icon_by_path((*it).c_str(), conf_ptr); } -bool Desktop::add_icon_pathed(const char* path, edelib::Resource* conf) { +bool Desktop::add_icon_by_path(const char* path, edelib::Resource* conf) { E_ASSERT(path != NULL); IconSettings is; @@ -435,7 +435,7 @@ bool Desktop::add_icon_pathed(const char* path, edelib::Resource* conf) { return can_add; } -void Desktop::save_icons(void) { +void Desktop::save_icons_positions(void) { edelib::Resource conf; char* icon_base; DesktopIconListIter it = icons.begin(), it_end = icons.end(); @@ -453,7 +453,7 @@ void Desktop::save_icons(void) { E_WARNING(E_STRLOC ": Unable to store icons positions\n"); } -DesktopIcon* Desktop::find_icon_pathed(const char* path) { +DesktopIcon* Desktop::find_icon_by_path(const char* path) { E_ASSERT(path != NULL); if(icons.empty()) @@ -468,7 +468,7 @@ DesktopIcon* Desktop::find_icon_pathed(const char* path) { return NULL; } -bool Desktop::remove_icon_pathed(const char* path) { +bool Desktop::remove_icon_by_path(const char* path) { E_ASSERT(path != NULL); if(icons.empty()) @@ -752,7 +752,7 @@ void Desktop::notify_desktop_changed(void) { XFreeStringList(names); } -void Desktop::drop_source(const char* src, int src_len, int x, int y) { +void Desktop::dnd_drop_source(const char* src, int src_len, int x, int y) { if(!src) return; @@ -762,7 +762,7 @@ void Desktop::drop_source(const char* src, int src_len, int x, int y) { char* src_copy = new char[src_len + 1]; int real_len = 0; - // mozilla sends UTF-16 form; for now use this hack untill Utf8.cpp code is ready + // mozilla sends UTF-16 form; for now use this hack untill some utf8 code is ready for(int i = 0, j = 0; i < src_len; i++) { if(src[i] != 0) { src_copy[j++] = src[i]; @@ -901,12 +901,12 @@ void Desktop::dir_watch(const char* dir, const char* changed, int flags) { return; if(trash_path == dir) { - bool trash_dir_empty = edelib::dir_empty(trash_path.c_str()); + bool is_empty = edelib::dir_empty(trash_path.c_str()); DesktopIconListIter it, it_end; for(it = icons.begin(), it_end = icons.end(); it != it_end; ++it) { if((*it)->icon_type() == ICON_TRASH) { - if(trash_dir_empty) + if(is_empty) (*it)->icon1(); else (*it)->icon2(); @@ -934,7 +934,7 @@ void Desktop::dir_watch(const char* dir, const char* changed, int flags) { if(flags == edelib::DW_REPORT_CREATE) { E_DEBUG(E_STRLOC ": adding %s\n", changed); - if(find_icon_pathed(changed)) { + if(find_icon_by_path(changed)) { E_DEBUG(E_STRLOC ": %s already registered; skipping...\n", changed); return; } @@ -948,14 +948,14 @@ void Desktop::dir_watch(const char* dir, const char* changed, int flags) { */ //sleep(1); - if(add_icon_pathed(changed, 0)) + if(add_icon_by_path(changed, 0)) redraw(); } else if(flags == edelib::DW_REPORT_MODIFY) { E_DEBUG(E_STRLOC ": modified %s\n", changed); } else if(flags == edelib::DW_REPORT_DELETE) { E_DEBUG(E_STRLOC ": deleted %s\n", changed); - if(remove_icon_pathed(changed)) + if(remove_icon_by_path(changed)) redraw(); } else E_DEBUG(E_STRLOC ": %s changed with %i\n", changed, flags); @@ -1135,7 +1135,7 @@ int Desktop::handle(int event) { if(di) return di->handle(event); - drop_source(Fl::event_text(), Fl::event_length(), Fl::event_x(), Fl::event_y()); + dnd_drop_source(Fl::event_text(), Fl::event_length(), Fl::event_x(), Fl::event_y()); return 1; } diff --git a/eiconman/eiconman.h b/eiconman/eiconman.h index 8461c0c..c01aad6 100644 --- a/eiconman/eiconman.h +++ b/eiconman/eiconman.h @@ -83,7 +83,6 @@ struct SelectionOverlay { class Wallpaper; class DesktopIcon; - class Fl_Menu_Button; typedef edelib::list DesktopIconList; @@ -122,14 +121,14 @@ class Desktop : public DESKTOP_WINDOW { void init_internals(void); void load_icons(const char* path); - void save_icons(void); + void save_icons_positions(void); bool read_desktop_file(const char* path, IconSettings& is); void add_icon(DesktopIcon* ic); - bool add_icon_pathed(const char* path, edelib::Resource* conf); - DesktopIcon* find_icon_pathed(const char* path); - bool remove_icon_pathed(const char* path); - bool update_icon_pathed(const char* path); + bool add_icon_by_path(const char* path, edelib::Resource* conf); + DesktopIcon* find_icon_by_path(const char* path); + bool remove_icon_by_path(const char* path); + bool update_icon_by_path(const char* path); void unfocus_all(void); @@ -140,7 +139,7 @@ class Desktop : public DESKTOP_WINDOW { void select_in_area(void); - void drop_source(const char* src, int src_len, int x, int y); + void dnd_drop_source(const char* src, int src_len, int x, int y); DesktopIcon* below_mouse(int px, int py);