Renamings to clarify some actions

Commented building of test/notify; previous code that was tested
was removed long time ago
This commit is contained in:
Sanel Zukan 2008-08-10 17:49:38 +00:00
parent 5e1ed7064d
commit ef7c53d33d
6 changed files with 50 additions and 50 deletions

View File

@ -30,8 +30,9 @@
#include "eiconman.h" #include "eiconman.h"
#include "Utils.h" #include "Utils.h"
// minimal icon size // minimal icon sizes
#define ICONSIZE 48 #define ICON_SIZE_MIN_W 48
#define ICON_SIZE_MIN_H 48
// spaces around box in case of large/small icons // spaces around box in case of large/small icons
#define OFFSET_W 16 #define OFFSET_W 16
@ -44,7 +45,7 @@
static void rename_cb(Fl_Widget*, void* d); static void rename_cb(Fl_Widget*, void* d);
static void props_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}, {_(" &Open "), 0, 0},
{_(" &Rename "), 0, rename_cb, 0}, {_(" &Rename "), 0, rename_cb, 0},
{_(" &Delete "), 0, 0, 0, FL_MENU_DIVIDER}, {_(" &Delete "), 0, 0, 0, FL_MENU_DIVIDER},
@ -52,7 +53,7 @@ Fl_Menu_Item icon_menu[] = {
{0} {0}
}; };
Fl_Menu_Item icon_trash_menu[] = { static Fl_Menu_Item icon_trash_menu[] = {
{_(" &Open "), 0, 0}, {_(" &Open "), 0, 0},
{_(" &Properties "), 0, 0, 0, FL_MENU_DIVIDER}, {_(" &Properties "), 0, 0, 0, FL_MENU_DIVIDER},
{_(" &Empty "), 0, 0}, {_(" &Empty "), 0, 0},
@ -78,7 +79,7 @@ static void props_cb(Fl_Widget*, void* d) {
} }
DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) : 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); E_ASSERT(gs != NULL);
@ -133,7 +134,7 @@ DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) :
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 > 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); size(img_w + OFFSET_W, img_h + OFFSET_H);
image(img); image(img);
@ -180,9 +181,9 @@ void DesktopIcon::load_icon(int face) {
edelib::String ipath = edelib::IconTheme::get(ic, edelib::ICON_SIZE_HUGE); edelib::String ipath = edelib::IconTheme::get(ic, edelib::ICON_SIZE_HUGE);
if(ipath.empty()) { if(ipath.empty()) {
ipath = edelib::IconTheme::get("empty", edelib::ICON_SIZE_HUGE); ipath = edelib::IconTheme::get("empty", edelib::ICON_SIZE_HUGE);
E_DEBUG(E_STRLOC ": Didn't find '%s' icon, ", ic); E_DEBUG(E_STRLOC ": Didn't find '%s' icon, ", ic);
if(!ipath.empty()) { if(!ipath.empty()) {
E_DEBUG("loaded 'empty' instead\n"); E_DEBUG("loaded 'empty' instead\n");
} else { } else {
@ -201,7 +202,7 @@ void DesktopIcon::load_icon(int face) {
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 > 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); size(img_w + OFFSET_W, img_h + OFFSET_H);
image(img); image(img);

View File

@ -16,10 +16,9 @@ ObjectC++Flags eiconman.cpp : -DUSE_EDELIB_WINDOW ;
SOURCE = eiconman.cpp Utils.cpp Wallpaper.cpp DesktopIcon.cpp IconProperties.cpp ; 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 ; 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) ; EdeProgram eiconman : $(SOURCE) ;
TranslationStrings locale : $(SOURCE) ; TranslationStrings locale : $(SOURCE) ;
#FltkProgramBare test/notify : test/notify.cpp : noinstall ;
FltkProgramBare test/notify : test/notify.cpp : noinstall ;

View File

@ -25,14 +25,14 @@ Atom _XA_NET_CURRENT_DESKTOP = 0;
Atom _XA_NET_DESKTOP_NAMES = 0; Atom _XA_NET_DESKTOP_NAMES = 0;
Atom _XA_XROOTPMAP_ID = 0; Atom _XA_XROOTPMAP_ID = 0;
int overlay_x = 0; static int overlay_x = 0;
int overlay_y = 0; static int overlay_y = 0;
int overlay_w = 0; static int overlay_w = 0;
int overlay_h = 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) { void init_atoms(void) {
_XA_NET_WORKAREA = XInternAtom(fl_display, "_NET_WORKAREA", False); _XA_NET_WORKAREA = XInternAtom(fl_display, "_NET_WORKAREA", False);

View File

@ -1,15 +1,16 @@
[Desktop] [Desktop]
Color = 458855680 Color=1866896640
WallpaperUse = 1 WallpaperUse=1
WallpaperMode = 1 WallpaperMode=1
Wallpaper = /home/sanelz/walls/Something_Beautiful_by_mirrorkills.jpg Wallpaper=/home/sanel/wallpapers/kate-beckinsale8.jpg
[Icons] [Icons]
Label Background = 827223040 LabelBackground=827223040
Label Foreground = 7 LabelForeground=7
Label Fontsize = 12 LabelFont=1
Label Maxwidth = 55 LabelFontsize=12
Label Transparent = 1 LabelMaxwidth=55
Label Visible = 1 LabelTransparent=1
OneClickExec = 0 LabelVisible=1
OneClickExec=0

View File

@ -170,7 +170,7 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") {
Desktop::~Desktop() { Desktop::~Desktop() {
E_DEBUG("Desktop::~Desktop()\n"); E_DEBUG("Desktop::~Desktop()\n");
save_icons(); save_icons_positions();
delete dsett; delete dsett;
delete selbox; delete selbox;
@ -360,7 +360,7 @@ void Desktop::load_icons(const char* path) {
StringList lst; 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)) { if(!dir_list(path, lst, true)) {
E_DEBUG(E_STRLOC ": Can't read %s\n", path); E_DEBUG(E_STRLOC ": Can't read %s\n", path);
return; return;
@ -368,10 +368,10 @@ void Desktop::load_icons(const char* path) {
StringListIter it, it_end; StringListIter it, it_end;
for(it = lst.begin(), it_end = lst.end(); it != it_end; ++it) 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); E_ASSERT(path != NULL);
IconSettings is; IconSettings is;
@ -435,7 +435,7 @@ bool Desktop::add_icon_pathed(const char* path, edelib::Resource* conf) {
return can_add; return can_add;
} }
void Desktop::save_icons(void) { void Desktop::save_icons_positions(void) {
edelib::Resource conf; edelib::Resource conf;
char* icon_base; char* icon_base;
DesktopIconListIter it = icons.begin(), it_end = icons.end(); 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"); 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); E_ASSERT(path != NULL);
if(icons.empty()) if(icons.empty())
@ -468,7 +468,7 @@ DesktopIcon* Desktop::find_icon_pathed(const char* path) {
return NULL; return NULL;
} }
bool Desktop::remove_icon_pathed(const char* path) { bool Desktop::remove_icon_by_path(const char* path) {
E_ASSERT(path != NULL); E_ASSERT(path != NULL);
if(icons.empty()) if(icons.empty())
@ -752,7 +752,7 @@ void Desktop::notify_desktop_changed(void) {
XFreeStringList(names); 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) if(!src)
return; 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]; char* src_copy = new char[src_len + 1];
int real_len = 0; 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++) { for(int i = 0, j = 0; i < src_len; i++) {
if(src[i] != 0) { if(src[i] != 0) {
src_copy[j++] = src[i]; src_copy[j++] = src[i];
@ -901,12 +901,12 @@ void Desktop::dir_watch(const char* dir, const char* changed, int flags) {
return; return;
if(trash_path == dir) { 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; DesktopIconListIter it, it_end;
for(it = icons.begin(), it_end = icons.end(); it != it_end; ++it) { for(it = icons.begin(), it_end = icons.end(); it != it_end; ++it) {
if((*it)->icon_type() == ICON_TRASH) { if((*it)->icon_type() == ICON_TRASH) {
if(trash_dir_empty) if(is_empty)
(*it)->icon1(); (*it)->icon1();
else else
(*it)->icon2(); (*it)->icon2();
@ -934,7 +934,7 @@ void Desktop::dir_watch(const char* dir, const char* changed, int flags) {
if(flags == edelib::DW_REPORT_CREATE) { if(flags == edelib::DW_REPORT_CREATE) {
E_DEBUG(E_STRLOC ": adding %s\n", changed); 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); E_DEBUG(E_STRLOC ": %s already registered; skipping...\n", changed);
return; return;
} }
@ -948,14 +948,14 @@ void Desktop::dir_watch(const char* dir, const char* changed, int flags) {
*/ */
//sleep(1); //sleep(1);
if(add_icon_pathed(changed, 0)) if(add_icon_by_path(changed, 0))
redraw(); redraw();
} else if(flags == edelib::DW_REPORT_MODIFY) { } else if(flags == edelib::DW_REPORT_MODIFY) {
E_DEBUG(E_STRLOC ": modified %s\n", changed); E_DEBUG(E_STRLOC ": modified %s\n", changed);
} else if(flags == edelib::DW_REPORT_DELETE) { } else if(flags == edelib::DW_REPORT_DELETE) {
E_DEBUG(E_STRLOC ": deleted %s\n", changed); E_DEBUG(E_STRLOC ": deleted %s\n", changed);
if(remove_icon_pathed(changed)) if(remove_icon_by_path(changed))
redraw(); redraw();
} else } else
E_DEBUG(E_STRLOC ": %s changed with %i\n", changed, flags); E_DEBUG(E_STRLOC ": %s changed with %i\n", changed, flags);
@ -1135,7 +1135,7 @@ int Desktop::handle(int event) {
if(di) if(di)
return di->handle(event); 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; return 1;
} }

View File

@ -83,7 +83,6 @@ struct SelectionOverlay {
class Wallpaper; class Wallpaper;
class DesktopIcon; class DesktopIcon;
class Fl_Menu_Button; class Fl_Menu_Button;
typedef edelib::list<DesktopIcon*> DesktopIconList; typedef edelib::list<DesktopIcon*> DesktopIconList;
@ -122,14 +121,14 @@ class Desktop : public DESKTOP_WINDOW {
void init_internals(void); void init_internals(void);
void load_icons(const char* path); void load_icons(const char* path);
void save_icons(void); void save_icons_positions(void);
bool read_desktop_file(const char* path, IconSettings& is); bool read_desktop_file(const char* path, IconSettings& is);
void add_icon(DesktopIcon* ic); void add_icon(DesktopIcon* ic);
bool add_icon_pathed(const char* path, edelib::Resource* conf); bool add_icon_by_path(const char* path, edelib::Resource* conf);
DesktopIcon* find_icon_pathed(const char* path); DesktopIcon* find_icon_by_path(const char* path);
bool remove_icon_pathed(const char* path); bool remove_icon_by_path(const char* path);
bool update_icon_pathed(const char* path); bool update_icon_by_path(const char* path);
void unfocus_all(void); void unfocus_all(void);
@ -140,7 +139,7 @@ class Desktop : public DESKTOP_WINDOW {
void select_in_area(void); 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); DesktopIcon* below_mouse(int px, int py);