eiconman:

Implemented dialog for icon properties.
EDEBUG, EWARNING, EASSERT replaced with E_DEBUG, E_WARNING, E_ASSERT

ehelp:
Imported ehelp. It is meant for displaying ede help or some of
documented programs in the browser, no matter where help is installed.

Remanining thing is to be added in configure script so it can set correct
paths, when configure be written.

Documented ehelp.
This commit is contained in:
Sanel Zukan 2008-08-07 14:22:05 +00:00
parent 8cfff8f370
commit 530a815246
14 changed files with 536 additions and 104 deletions

View File

@ -22,6 +22,7 @@ SubInclude TOP ecrasher ;
SubInclude TOP edesktopconf ;
#SubInclude TOP edewm ;
SubInclude TOP efiler ;
SubInclude TOP ehelp ;
SubInclude TOP eiconman ;
SubInclude TOP eimage ;
SubInclude TOP elma ;

View File

@ -24,6 +24,7 @@
*Programs*
- link:ecalc.html[Ecalc]
- link:ehelp.html[Ehelp]
- link:etip.html[Etip]
- link:evoke.html[Evoke]
- link:emountd.html[Emountd]

13
ehelp/Jamfile Normal file
View File

@ -0,0 +1,13 @@
#
# $Id$
#
# Part of Equinox Desktop Environment (EDE).
# Copyright (c) 2008 EDE Authors.
#
# This program is licensed under the terms of the
# GNU General Public License version 2 or later.
# See COPYING for the details.
SubDir TOP ehelp ;
EdeManual ehelp.txt ;

79
ehelp/ehelp.in Normal file
View File

@ -0,0 +1,79 @@
#!/bin/sh
#help_dir="/home/sanel/programs/EDE/ede2/docs/manual"
help_dir="@docdir@/ede/manual"
browser_list="firefox mozilla konqueror opera navigator dillo"
url=""
if [ "$1" = "--help" ]; then
echo "Usage: ehelp [OPTIONS] [TITLE]"
echo "Display EDE Manual in the web browser"
echo "Options:"
echo " --help Show this help"
echo " --titles Show known titles"
echo ""
echo "Example:"
echo " ehelp evoke - display evoke help"
exit 1
fi
if [ "$1" = "--titles" ]; then
echo "Known titles:"
content=`ls $help_dir/ | sort`
for c in $content; do
echo " " $c | sed 's/\.html//g'
done
exit 0
fi
if [ -z "$1" ]; then
url="$help_dir/index.html"
else
url="$help_dir/$1.html"
if [ ! -f "$url" ]; then
echo "Unable to find $1. Going to start page..."
url="$help_dir/index.html"
fi
fi
# let browser knows it is file
url="file://$url"
# try to find browser
if [ -z "$BROWSER" ]; then
for i in $browser_list; do
if which $i > /dev/null 2>&1; then
BROWSER="$i"
break;
fi
done
fi
if [ -z $BROWSER ]; then
xmessage -title "Error" -center -file - <<EOF
Failed to find any of known browsers ($browser_list).
If you thing that I made mistake, please try to set
BROWSER environment variable with full path pointing
to the browser binary
EOF
exit 1
fi
# run browser
$BROWSER $url
if [ $? -ne 0 ]; then
xmessage -title "Error" -center -file - <<EOF
Unable to run '$BROWSER'.
Please check if program path is correct or
adjust BROWSER environment variable pointing
to the correct binary
EOF
exit 1
fi
exit 0

48
ehelp/ehelp.txt Normal file
View File

@ -0,0 +1,48 @@
Ehelp documentation
===================
Ehelp is program that will display EDE help in web browser. It will use
a list of predefined browsers and if find one of them, it will run it.
Running 'ehelp' without options will open help's starting page. On other
hand, if you want to display a help of some program or documentation about
some services, running 'ehelp [program-name-or-service]' will do that.
.Displaying evoke help
------------------------------
ehelp evoke
------------------------------
In case you are not sure for what programs help exists, using '--titles'
option will show it.
.Using '--titles' option
------------------------------
$ehelp --titles
Known titles:
HACKING
contact
dbus-usage
ecalc
emountd
etip
evoke
images
index
introduction
jambuild
------------------------------
If you don't like browser ehelp chooses, you can change it pointing
$BROWSER environment variable to desired program.
Options
-------
--help::
Display help
--titles::
Display a list of known titles

View File

@ -10,10 +10,6 @@
* See COPYING for details.
*/
#include "DesktopIcon.h"
#include "eiconman.h"
#include "Utils.h"
#include <FL/Fl.h>
#include <FL/fl_draw.h>
#include <FL/Fl_Shared_Image.h>
@ -29,6 +25,11 @@
#include <X11/extensions/shape.h>
#endif
#include "DesktopIcon.h"
#include "IconProperties.h"
#include "eiconman.h"
#include "Utils.h"
// minimal icon size
#define ICONSIZE 48
@ -40,13 +41,14 @@
#define LABEL_OFFSET 2
void rename_cb(Fl_Widget*, void* d);
static void rename_cb(Fl_Widget*, void* d);
static void props_cb(Fl_Widget*, void* d);
Fl_Menu_Item icon_menu[] = {
{_(" &Open "), 0, 0},
{_(" &Rename "), 0, rename_cb, 0},
{_(" &Delete "), 0, 0, 0, FL_MENU_DIVIDER},
{_(" &Properties "), 0, 0},
{_(" &Properties "), 0, props_cb, 0},
{0}
};
@ -57,9 +59,9 @@ Fl_Menu_Item icon_trash_menu[] = {
{0}
};
void rename_cb(Fl_Widget*, void* d) {
static void rename_cb(Fl_Widget*, void* d) {
DesktopIcon* di = (DesktopIcon*)d;
EASSERT(di != NULL);
E_ASSERT(di != NULL);
const char* new_name = edelib::input(_("New name"), di->label());
if(!new_name)
@ -69,10 +71,16 @@ void rename_cb(Fl_Widget*, void* d) {
di->rename(new_name);
}
static void props_cb(Fl_Widget*, void* d) {
DesktopIcon* di = (DesktopIcon*)d;
E_ASSERT(di != NULL);
show_icon_properties_dialog(di);
}
DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) :
Fl_Widget(is->x, is->y, ICONSIZE, ICONSIZE) {
EASSERT(gs != NULL);
E_ASSERT(gs != NULL);
lwidth = lheight = 0;
focus = false;
@ -130,9 +138,9 @@ DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) :
image(img);
} else
EDEBUG(ESTRLOC ": Unable to load %s\n", ipath.c_str());
E_DEBUG(E_STRLOC ": Unable to load %s\n", ipath.c_str());
} else
EDEBUG(ESTRLOC ": Got empty icon name ?!?\n");
E_DEBUG(E_STRLOC ": Got empty icon name ?!?\n");
}
#endif
@ -146,7 +154,7 @@ DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) :
}
DesktopIcon::~DesktopIcon() {
EDEBUG("DesktopIcon::~DesktopIcon()\n");
E_DEBUG("DesktopIcon::~DesktopIcon()\n");
if(settings)
delete settings;
@ -172,13 +180,20 @@ void DesktopIcon::load_icon(int face) {
edelib::String ipath = edelib::IconTheme::get(ic, edelib::ICON_SIZE_HUGE);
if(ipath.empty()) {
EDEBUG(ESTRLOC ": Got empty icon name ?!?\n");
return;
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) {
EDEBUG(ESTRLOC ": Unable to load %s\n", ipath.c_str());
E_DEBUG(E_STRLOC ": Unable to load %s\n", ipath.c_str());
return;
}
@ -251,7 +266,7 @@ void DesktopIcon::drag(int x, int y, bool apply) {
#endif
micon->show();
} else {
EASSERT(micon != NULL);
E_ASSERT(micon != NULL);
micon->position(x, y);
}
@ -320,7 +335,7 @@ void DesktopIcon::icon2(void) {
}
void DesktopIcon::fast_redraw(void) {
EASSERT(parent() != NULL && "Impossible !");
E_ASSERT(parent() != NULL && "Impossible !");
int wsz = w();
int xpos = x();
@ -348,7 +363,7 @@ void DesktopIcon::draw(void) {
im->draw(ix, iy);
EDEBUG(ESTRLOC ": DesktopIcon icon redraw\n");
E_DEBUG(E_STRLOC ": DesktopIcon icon redraw\n");
}
if(globals->label_draw && (damage() & (FL_DAMAGE_ALL | EDAMAGE_CHILD_LABEL))) {
@ -403,7 +418,7 @@ void DesktopIcon::draw(void) {
// revert to old color whatever that be
fl_color(old);
EDEBUG(ESTRLOC ": DesktopIcon label redraw\n");
E_DEBUG(E_STRLOC ": DesktopIcon label redraw\n");
}
}
@ -430,7 +445,7 @@ int DesktopIcon::handle(int event) {
return 1;
case FL_RELEASE:
if(Fl::event_clicks() > 0)
EDEBUG(ESTRLOC ": EXECUTE: %s\n", settings->cmd.c_str());
E_DEBUG(E_STRLOC ": EXECUTE: %s\n", settings->cmd.c_str());
return 1;
case FL_DND_ENTER:
@ -439,10 +454,10 @@ int DesktopIcon::handle(int event) {
return 1;
case FL_DND_RELEASE:
EDEBUG(ESTRLOC ": FL_DND_RELEASE on icon\n");
E_DEBUG(E_STRLOC ": FL_DND_RELEASE on icon\n");
return 1;
case FL_PASTE:
EDEBUG(ESTRLOC ": FL_PASTE on icon with %s\n", Fl::event_text());
E_DEBUG(E_STRLOC ": FL_PASTE on icon with %s\n", Fl::event_text());
return 1;
default:
break;
@ -452,7 +467,7 @@ int DesktopIcon::handle(int event) {
}
MovableIcon::MovableIcon(DesktopIcon* ic) : Fl_Window(ic->x(), ic->y(), ic->w(), ic->h()), icon(ic), mask(0) {
EASSERT(icon != NULL);
E_ASSERT(icon != NULL);
set_override();
color(ic->color());

View File

@ -13,8 +13,6 @@
#ifndef __DESKTOPICON_H__
#define __DESKTOPICON_H__
#include <edelib/String.h>
#include <FL/Fl_Widget.h>
#include <FL/Fl_Window.h>
#include <FL/Fl_Box.h>
@ -23,6 +21,8 @@
#include <X11/Xlib.h> // Pixmap
#include <edelib/String.h>
class GlobalIconSettings;
class IconSettings;
class MovableIcon;

196
eiconman/IconProperties.cpp Normal file
View File

@ -0,0 +1,196 @@
/*
* $Id$
*
* Eiconman, desktop and icon manager
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2008 EDE Authors.
*
* This program is licensed under terms of the
* GNU General Public License version 2 or newer.
* See COPYING for details.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include <FL/Fl.h>
#include <FL/Fl_Tabs.h>
#include <FL/Fl_Group.h>
#include <FL/Fl_Button.h>
#include <FL/Fl_Input.h>
#include <FL/Fl_Output.h>
#include <FL/Fl_Shared_Image.h>
#include <edelib/Nls.h>
#include <edelib/Window.h>
#include <edelib/IconTheme.h>
#include <edelib/MimeType.h>
#include <edelib/IconChooser.h>
#include "IconProperties.h"
#include "DesktopIcon.h"
struct DesktopIconData {
Fl_Image* image;
const char* label;
const char* location;
edelib::String time_access;
edelib::String time_mod;
edelib::String type;
edelib::String size;
};
static void close_cb(Fl_Widget*, void* w) {
Fl_Window* win = (Fl_Window*)w;
win->hide();
}
static void ok_cb(Fl_Widget*, void* w) {
close_cb(0, w);
}
static void icon_change_cb(Fl_Button* b, void* d) {
DesktopIconData* data = (DesktopIconData*)d;
edelib::String ret = edelib::icon_chooser(edelib::ICON_SIZE_HUGE);
if(ret.empty())
return;
Fl_Image* img = Fl_Shared_Image::get(ret.c_str());
if(!img)
return;
b->image(img);
b->redraw();
}
static void study_and_fill(DesktopIcon* dicon, DesktopIconData* data) {
// get image and scale it if needed
if(dicon->image()) {
int iw = dicon->w();
int ih = dicon->h();
if(iw > 64 || ih > 64) {
data->image = dicon->image()->copy((iw > 64) ? 64 : iw,
(ih > 64) ? 64 : ih);
} else {
data->image = dicon->image();
}
}
data->label = dicon->label();
const char* prog_path = dicon->path().c_str();
edelib::MimeType mt;
if(mt.set(prog_path))
data->type = mt.comment();
else
data->type = "(unknown)";
data->location = prog_path;
// now get size, access and modification times
struct stat st;
if(stat(prog_path, &st) == -1) {
data->size = "(unknown)";
data->time_access = "(unknown)";
data->time_mod = "(unknown)";
} else {
char buff[128];
snprintf(buff, sizeof(buff), "%lu Bytes", st.st_size);
data->size = buff;
strftime(buff, sizeof(buff), "%F %H:%S", localtime(&st.st_atime));
data->time_access = buff;
strftime(buff, sizeof(buff), "%F %H:%S", localtime(&st.st_mtime));
data->time_mod = buff;
}
}
void show_icon_properties_dialog(DesktopIcon* dicon) {
// fetch usefull data
DesktopIconData data;
study_and_fill(dicon, &data);
// now construct dialog and fill it
edelib::Window* win = new edelib::Window(315, 395, _("Icon properties"));
win->begin();
Fl_Tabs* tabs = new Fl_Tabs(10, 10, 295, 340);
tabs->begin();
Fl_Group* g1 = new Fl_Group(15, 35, 285, 310, _("General"));
g1->begin();
Fl_Button* icon_button = new Fl_Button(20, 50, 75, 75);
icon_button->image(data.image);
icon_button->callback((Fl_Callback*)icon_change_cb, &data);
icon_button->tooltip(_("Click to change icon"));
Fl_Input* prog_name = new Fl_Input(100, 75, 195, 25);
prog_name->value(data.label);
Fl_Output* prog_mime = new Fl_Output(100, 150, 195, 25, _("Type:"));
prog_mime->box(FL_FLAT_BOX);
prog_mime->color(FL_BACKGROUND_COLOR);
prog_mime->value(data.type.c_str());
Fl_Output* prog_location = new Fl_Output(100, 180, 195, 25, _("Location:"));
prog_location->box(FL_FLAT_BOX);
prog_location->color(FL_BACKGROUND_COLOR);
prog_location->value(data.location);
Fl_Output* prog_size = new Fl_Output(100, 210, 195, 25, _("Size:"));
prog_size->box(FL_FLAT_BOX);
prog_size->color(FL_BACKGROUND_COLOR);
prog_size->value(data.size.c_str());
Fl_Output* prog_date_mod = new Fl_Output(100, 240, 195, 25, _("Modified:"));
prog_date_mod->box(FL_FLAT_BOX);
prog_date_mod->color(FL_BACKGROUND_COLOR);
prog_date_mod->value(data.time_mod.c_str());
Fl_Output* prog_date_acessed = new Fl_Output(100, 270, 195, 25, "Accessed:");
prog_date_acessed->box(FL_FLAT_BOX);
prog_date_acessed->color(FL_BACKGROUND_COLOR);
prog_date_acessed->value(data.time_access.c_str());
g1->end();
Fl_Group* g2 = new Fl_Group(15, 35, 285, 310, _("URL"));
g2->hide();
g2->begin();
Fl_Input* prog_url = new Fl_Input(20, 65, 245, 25, _("URL:"));
prog_url->align(FL_ALIGN_TOP_LEFT);
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())
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();
Fl_Button* ok_button = new Fl_Button(120, 360, 90, 25, _("&OK"));
ok_button->callback(ok_cb, win);
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())
Fl::wait();
}

20
eiconman/IconProperties.h Normal file
View File

@ -0,0 +1,20 @@
/*
* $Id$
*
* Eiconman, desktop and icon manager
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2008 EDE Authors.
*
* This program is licensed under terms of the
* GNU General Public License version 2 or newer.
* See COPYING for details.
*/
#ifndef __ICONPROPERTIES_H__
#define __ICONPROPERTIES_H__
class DesktopIcon;
void show_icon_properties_dialog(DesktopIcon* d);
#endif

View File

@ -13,7 +13,7 @@ SubDir TOP eiconman ;
ObjectC++Flags DesktopIcon.cpp : -DUSE_SHAPE ;
ObjectC++Flags eiconman.cpp : -DUSE_EDELIB_WINDOW ;
SOURCE = eiconman.cpp Utils.cpp Wallpaper.cpp DesktopIcon.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 ;
LinkAgainst eiconman : -L/opt/ede/lib -ledelib -ledelib_dbus -ldbus-1 ;

View File

@ -173,7 +173,7 @@ int net_get_workspace_names(char** names) {
const char* p = (const char*)prop;
for(int i = 0, s = 0; i < n && alloc < MAX_DESKTOPS; i++, alloc++) {
if(p[i] == '\0') {
EDEBUG("%c ", p[i]);
E_DEBUG("%c ", p[i]);
names[alloc] = strndup((p + s), i - s + 1);
s = i + 1;
}

View File

@ -45,8 +45,8 @@
#include <time.h> // time
#define EICONMAN_UID 0x10
#define CONFIG_NAME "eiconman.conf"
#define ICONS_CONFIG_NAME "eiconman-icons.conf"
#define CONFIG_NAME "ede/eiconman"
#define ICONS_CONFIG_NAME "ede/eiconman-icons"
#define EICONMAN_INTERFACE "org.equinoxproject.Eiconman"
#define EICONMAN_OBJECT "/org/equinoxproject/Eiconman"
@ -59,7 +59,6 @@
#undef MAX
#define MAX(x,y) ((x) > (y) ? (x) : (y))
/*
* Which widgets Fl::belowmouse() should skip. This should be updated
* when new non-icon child is added to Desktop window.
@ -88,7 +87,7 @@ Fl_Menu_Item desktop_menu[] = {
};
Desktop* Desktop::pinstance = NULL;
bool running = false;
static bool running = false;
inline unsigned int random_pos(int max) {
return (rand() % max);
@ -106,12 +105,12 @@ inline void dpy_sizes(int& width, int& height) {
}
void exit_signal(int signum) {
EDEBUG(ESTRLOC ": Exiting (got signal %d)\n", signum);
E_DEBUG(E_STRLOC ": Exiting (got signal %d)\n", signum);
running = false;
}
void restart_signal(int signum) {
EDEBUG(ESTRLOC ": Restarting (got signal %d)\n", signum);
E_DEBUG(E_STRLOC ": Restarting (got signal %d)\n", signum);
}
void dir_watch_cb(const char* dir, const char* changed, int flags, void* data) {
@ -169,7 +168,7 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") {
}
Desktop::~Desktop() {
EDEBUG("Desktop::~Desktop()\n");
E_DEBUG("Desktop::~Desktop()\n");
save_icons();
@ -213,7 +212,7 @@ void Desktop::init_internals(void) {
*/
edelib::String desktop_path = edelib::dir_home();
if(desktop_path.empty()) {
EWARNING(ESTRLOC ": can't read home directory; icons will not be loaded\n");
E_WARNING(E_STRLOC ": can't read home directory; icons will not be loaded\n");
return;
}
desktop_path += "/Desktop";
@ -227,7 +226,7 @@ void Desktop::init_internals(void) {
if(!edelib::DirWatch::add(desktop_path.c_str(),
edelib::DW_CREATE | edelib::DW_MODIFY | edelib::DW_RENAME | edelib::DW_DELETE)) {
EWARNING(ESTRLOC ": Unable to watch %s\n", desktop_path.c_str());
E_WARNING(E_STRLOC ": Unable to watch %s\n", desktop_path.c_str());
}
}
@ -242,11 +241,10 @@ void Desktop::init_internals(void) {
if(edelib::dir_exists(trash_path.c_str())) {
if(!edelib::DirWatch::add(trash_path.c_str(), edelib::DW_CREATE | edelib::DW_DELETE))
EWARNING(ESTRLOC ": Unable to watch %s\n", trash_path.c_str());
E_WARNING(E_STRLOC ": Unable to watch %s\n", trash_path.c_str());
}
edelib::DirWatch::callback(dir_watch_cb);
running = true;
}
@ -267,7 +265,7 @@ void Desktop::shutdown(void) {
}
Desktop* Desktop::instance(void) {
EASSERT(Desktop::pinstance != NULL && "Desktop::init() should be run first");
E_ASSERT(Desktop::pinstance != NULL && "Desktop::init() should be run first");
return Desktop::pinstance;
}
@ -294,7 +292,7 @@ void Desktop::hide(void) {
void Desktop::update_workarea(void) {
int X, Y, W, H;
if(!net_get_workarea(X, Y, W, H)) {
EWARNING(ESTRLOC ": wm does not support _NET_WM_WORKAREA; using screen sizes...\n");
E_WARNING(E_STRLOC ": wm does not support _NET_WM_WORKAREA; using screen sizes...\n");
X = Y = 0;
dpy_sizes(W, H);
}
@ -313,9 +311,9 @@ void Desktop::set_bg_color(int c, bool do_redraw) {
}
void Desktop::read_config(void) {
edelib::Config conf;
edelib::Resource conf;
if(!conf.load(CONFIG_NAME)) {
EWARNING(ESTRLOC ": Can't load %s, using default...\n", CONFIG_NAME);
E_WARNING(E_STRLOC ": Can't load %s, using default...\n", CONFIG_NAME);
return;
}
@ -329,27 +327,21 @@ void Desktop::read_config(void) {
char wpath[256];
conf.get("Desktop", "Color", dsett->color, default_bg_color);
conf.get("Desktop", "WallpaperUse", dsett->wp_use, default_wp_use);
conf.get("Desktop", "Wallpaper", wpath, sizeof(wpath));
if(conf.error() != edelib::CONF_ERR_SECTION) {
conf.get("Desktop", "WallpaperUse", dsett->wp_use, default_wp_use);
conf.get("Desktop", "Wallpaper", wpath, sizeof(wpath));
// keep path but disable wallpaper if file does not exists
if(!edelib::file_exists(wpath)) {
EDEBUG(ESTRLOC ": %s as wallpaper does not exists\n", wpath);
dsett->wp_use = false;
}
} else {
// color is already filled
dsett->wp_use = default_wp_use;
// keep path but disable wallpaper if file does not exists
if(!edelib::file_exists(wpath)) {
E_DEBUG(E_STRLOC ": %s as wallpaper does not exists\n", wpath);
dsett->wp_use = false;
}
conf.get("Icons", "Label Background", gisett.label_background, FL_BLUE);
conf.get("Icons", "Label Foreground", gisett.label_foreground, FL_WHITE);
conf.get("Icons", "Label Fontsize", gisett.label_fontsize, 12);
conf.get("Icons", "Label Maxwidth", gisett.label_maxwidth, 75);
conf.get("Icons", "Label Transparent",gisett.label_transparent, false);
conf.get("Icons", "Label Visible", gisett.label_draw, true);
conf.get("Icons", "LabelBackground", gisett.label_background, FL_BLUE);
conf.get("Icons", "LabelForeground", gisett.label_foreground, FL_WHITE);
conf.get("Icons", "LabelFontsize", gisett.label_fontsize, 12);
conf.get("Icons", "LabelMaxwidth", gisett.label_maxwidth, 75);
conf.get("Icons", "LabelTransparent",gisett.label_transparent, false);
conf.get("Icons", "LabelVisible", gisett.label_draw, true);
conf.get("Icons", "OneClickExec", gisett.one_click_exec, false);
conf.get("Icons", "AutoArrange", gisett.auto_arrange, true);
@ -358,11 +350,11 @@ void Desktop::read_config(void) {
}
void Desktop::load_icons(const char* path) {
EASSERT(path != NULL);
edelib::Config conf, *conf_ptr = NULL;
E_ASSERT(path != NULL);
edelib::Resource conf, *conf_ptr = NULL;
if(!conf.load(ICONS_CONFIG_NAME))
EWARNING(ESTRLOC ": Can't load icons positions from %s, randomizing them...\n", ICONS_CONFIG_NAME);
E_WARNING(E_STRLOC ": Can't load icons positions from %s, randomizing them...\n", ICONS_CONFIG_NAME);
else
conf_ptr = &conf;
@ -370,7 +362,7 @@ void Desktop::load_icons(const char* path) {
// list with full path; icon basename is extracted in add_icon_pathed()
if(!dir_list(path, lst, true)) {
EDEBUG(ESTRLOC ": Can't read %s\n", path);
E_DEBUG(E_STRLOC ": Can't read %s\n", path);
return;
}
@ -379,8 +371,8 @@ void Desktop::load_icons(const char* path) {
add_icon_pathed((*it).c_str(), conf_ptr);
}
bool Desktop::add_icon_pathed(const char* path, edelib::Config* conf) {
EASSERT(path != NULL);
bool Desktop::add_icon_pathed(const char* path, edelib::Resource* conf) {
E_ASSERT(path != NULL);
IconSettings is;
bool can_add = false;
@ -401,7 +393,7 @@ bool Desktop::add_icon_pathed(const char* path, edelib::Config* conf) {
// then try to figure out it's mime; if fails, ignore it
if(mt.set(path)) {
EDEBUG(ESTRLOC ": Loading icon as mime-type %s\n", mt.icon_name().c_str());
E_DEBUG(E_STRLOC ": Loading icon as mime-type %s\n", mt.icon_name().c_str());
is.icon = mt.icon_name();
// icon label path's basename
is.name = base;
@ -409,7 +401,7 @@ bool Desktop::add_icon_pathed(const char* path, edelib::Config* conf) {
can_add = true;
} else {
EDEBUG(ESTRLOC ": Failed mime-type for %s, ignoring...\n", path);
E_DEBUG(E_STRLOC ": Failed mime-type for %s, ignoring...\n", path);
can_add = false;
}
}
@ -426,11 +418,12 @@ bool Desktop::add_icon_pathed(const char* path, edelib::Config* conf) {
int icon_y = random_pos(w() - 10);
if(conf) {
conf->get(base, "X", icon_x, icon_x);
conf->get(base, "Y", icon_y, icon_y);
// we load positions from used eiconman-icos.conf only
conf->get(base, "X", icon_x, icon_x, edelib::RES_USER_ONLY);
conf->get(base, "Y", icon_y, icon_y, edelib::RES_USER_ONLY);
}
EDEBUG(ESTRLOC ": %s found with: %i %i\n", base, icon_x, icon_y);
E_DEBUG(E_STRLOC ": %s found with: %i %i\n", base, icon_x, icon_y);
is.x = icon_x;
is.y = icon_y;
is.full_path = path;
@ -443,7 +436,7 @@ bool Desktop::add_icon_pathed(const char* path, edelib::Config* conf) {
}
void Desktop::save_icons(void) {
edelib::Config conf;
edelib::Resource conf;
char* icon_base;
DesktopIconListIter it = icons.begin(), it_end = icons.end();
@ -457,11 +450,11 @@ void Desktop::save_icons(void) {
}
if(!conf.save(ICONS_CONFIG_NAME))
EWARNING(ESTRLOC ": Unable to store icons positions\n");
E_WARNING(E_STRLOC ": Unable to store icons positions\n");
}
DesktopIcon* Desktop::find_icon_pathed(const char* path) {
EASSERT(path != NULL);
E_ASSERT(path != NULL);
if(icons.empty())
return NULL;
@ -476,7 +469,7 @@ DesktopIcon* Desktop::find_icon_pathed(const char* path) {
}
bool Desktop::remove_icon_pathed(const char* path) {
EASSERT(path != NULL);
E_ASSERT(path != NULL);
if(icons.empty())
return false;
@ -504,16 +497,16 @@ bool Desktop::remove_icon_pathed(const char* path) {
// read .desktop files
bool Desktop::read_desktop_file(const char* path, IconSettings& is) {
EASSERT(path != NULL);
E_ASSERT(path != NULL);
if(!edelib::file_exists(path)) {
EDEBUG(ESTRLOC ": %s don't exists\n");
E_DEBUG(E_STRLOC ": %s don't exists\n");
return false;
}
edelib::DesktopFile dconf;
if(!dconf.load(path)) {
EWARNING(ESTRLOC ": Can't read %s (%s)\n", path, dconf.strerror());
E_WARNING(E_STRLOC ": Can't read %s (%s)\n", path, dconf.strerror());
return false;
}
@ -532,7 +525,7 @@ bool Desktop::read_desktop_file(const char* path, IconSettings& is) {
is.type = ICON_NORMAL;
if(!dconf.icon(buff, buffsz)) {
EWARNING(ESTRLOC ": No Icon key, balling out\n");
E_WARNING(E_STRLOC ": No Icon key, balling out\n");
return false;
}
@ -554,7 +547,7 @@ bool Desktop::read_desktop_file(const char* path, IconSettings& is) {
is.cmd = buff;
if(!dconf.name(buff, buffsz)) {
EDEBUG(ESTRLOC ": No Name key\n");
E_DEBUG(E_STRLOC ": No Name key\n");
is.name = "(none)";
} else
is.name = buff;
@ -563,7 +556,7 @@ bool Desktop::read_desktop_file(const char* path, IconSettings& is) {
}
void Desktop::add_icon(DesktopIcon* ic) {
EASSERT(ic != NULL);
E_ASSERT(ic != NULL);
icons.push_back(ic);
add((Fl_Widget*)ic);
@ -584,7 +577,7 @@ void Desktop::unfocus_all(void) {
}
void Desktop::select(DesktopIcon* ic, bool do_redraw) {
EASSERT(ic != NULL);
E_ASSERT(ic != NULL);
if(in_selection(ic))
return;
@ -600,7 +593,7 @@ void Desktop::select(DesktopIcon* ic, bool do_redraw) {
}
void Desktop::select_only(DesktopIcon* ic) {
EASSERT(ic != NULL);
E_ASSERT(ic != NULL);
unfocus_all();
selectionbuff.clear();
@ -611,7 +604,7 @@ void Desktop::select_only(DesktopIcon* ic) {
}
bool Desktop::in_selection(const DesktopIcon* ic) {
EASSERT(ic != NULL);
E_ASSERT(ic != NULL);
if(selectionbuff.empty())
return false;
@ -712,7 +705,7 @@ void Desktop::select_in_area(void) {
for(it = icons.begin(), it_end = icons.end(); it != it_end; ++it) {
ic = (*it);
EASSERT(ic != NULL && "Impossible to happen");
E_ASSERT(ic != NULL && "Impossible to happen");
if(intersects(ax, ay, ax+aw, ay+ah, ic->x(), ic->y(), ic->w()+ic->x(), ic->h()+ic->y())) {
if(!ic->is_focused()) {
@ -783,7 +776,7 @@ void Desktop::drop_source(const char* src, int src_len, int x, int y) {
return;
}
EDEBUG(ESTRLOC ": DND on Desktop, got: %s\n", src_copy);
E_DEBUG(E_STRLOC ": DND on Desktop, got: %s\n", src_copy);
// valid url's (if got) ends with \r\n, clean that
char* pp = strstr(src_copy, "\r\n");
@ -848,7 +841,7 @@ void Desktop::drop_source(const char* src, int src_len, int x, int y) {
edelib::MimeType mt;
if(!mt.set(sptr)) {
EWARNING(ESTRLOC ": MimeType for %s (%s) failed, not dropping icon\n", sptr, src_copy);
E_WARNING(E_STRLOC ": MimeType for %s (%s) failed, not dropping icon\n", sptr, src_copy);
delete [] src_copy;
return;
}
@ -878,7 +871,7 @@ void Desktop::draw(void) {
clear_xoverlay();
DESKTOP_WINDOW::draw();
EDEBUG(ESTRLOC ": REDRAW ALL\n");
E_DEBUG(E_STRLOC ": REDRAW ALL\n");
}
if(damage() & EDAMAGE_OVERLAY) {
@ -895,7 +888,7 @@ void Desktop::draw(void) {
if(child(i)->damage() == EDAMAGE_CHILD_LABEL) {
update_child(*child(i));
child(i)->clear_damage();
EDEBUG(ESTRLOC ": ICON REDRAW \n");
E_DEBUG(E_STRLOC ": ICON REDRAW \n");
}
}
}
@ -920,7 +913,7 @@ void Desktop::dir_watch(const char* dir, const char* changed, int flags) {
}
}
EDEBUG(ESTRLOC ": event on trash dir %s\n", dir);
E_DEBUG(E_STRLOC ": event on trash dir %s\n", dir);
return;
}
@ -939,10 +932,10 @@ void Desktop::dir_watch(const char* dir, const char* changed, int flags) {
sleep(1);
if(flags == edelib::DW_REPORT_CREATE) {
EDEBUG(ESTRLOC ": adding %s\n", changed);
E_DEBUG(E_STRLOC ": adding %s\n", changed);
if(find_icon_pathed(changed)) {
EDEBUG(ESTRLOC ": %s already registered; skipping...\n", changed);
E_DEBUG(E_STRLOC ": %s already registered; skipping...\n", changed);
return;
}
@ -959,17 +952,17 @@ void Desktop::dir_watch(const char* dir, const char* changed, int flags) {
redraw();
} else if(flags == edelib::DW_REPORT_MODIFY) {
EDEBUG(ESTRLOC ": modified %s\n", changed);
E_DEBUG(E_STRLOC ": modified %s\n", changed);
} else if(flags == edelib::DW_REPORT_DELETE) {
EDEBUG(ESTRLOC ": deleted %s\n", changed);
E_DEBUG(E_STRLOC ": deleted %s\n", changed);
if(remove_icon_pathed(changed))
redraw();
} else
EDEBUG(ESTRLOC ": %s changed with %i\n", changed, flags);
E_DEBUG(E_STRLOC ": %s changed with %i\n", changed, flags);
}
void Desktop::execute(const char* cmd) {
EASSERT(cmd != NULL);
E_ASSERT(cmd != NULL);
edelib::run_program(cmd, false);
}
@ -989,7 +982,7 @@ int Desktop::handle(int event) {
Fl_Widget* clicked = Fl::belowmouse();
if(NOT_SELECTABLE(clicked)) {
EDEBUG(ESTRLOC ": DESKTOP CLICK !!!\n");
E_DEBUG(E_STRLOC ": DESKTOP CLICK !!!\n");
if(!selectionbuff.empty()) {
/*
* Only focused are in selectionbuff, so this is
@ -1048,7 +1041,7 @@ int Desktop::handle(int event) {
if(!moving)
tmp_icon->handle(FL_PUSH);
EDEBUG(ESTRLOC ": FL_PUSH from desktop\n");
E_DEBUG(E_STRLOC ": FL_PUSH from desktop\n");
selection_x = Fl::event_x_root();
selection_y = Fl::event_y_root();
@ -1058,10 +1051,10 @@ int Desktop::handle(int event) {
case FL_DRAG:
moving = true;
if(!selectionbuff.empty()) {
EDEBUG(ESTRLOC ": DRAG icon from desktop\n");
E_DEBUG(E_STRLOC ": DRAG icon from desktop\n");
move_selection(Fl::event_x_root(), Fl::event_y_root(), false);
} else {
EDEBUG(ESTRLOC ": DRAG from desktop\n");
E_DEBUG(E_STRLOC ": DRAG from desktop\n");
/*
* Moving is started with pushed button.
* From this point selection box is created and is rolled until release
@ -1083,8 +1076,8 @@ int Desktop::handle(int event) {
return 1;
case FL_RELEASE:
EDEBUG(ESTRLOC ": RELEASE from desktop\n");
EDEBUG(ESTRLOC ": clicks: %i\n", Fl::event_is_click());
E_DEBUG(E_STRLOC ": RELEASE from desktop\n");
E_DEBUG(E_STRLOC ": clicks: %i\n", Fl::event_is_click());
if(selbox->show) {
selbox->x = selbox->y = selbox->w = selbox->h = 0;

View File

@ -23,7 +23,7 @@
#include <FL/Fl_Image.h>
#include <edelib/String.h>
#include <edelib/Config.h>
#include <edelib/Resource.h>
#include <edelib/List.h>
#include <edelib/EdbusConnection.h>
@ -126,7 +126,7 @@ class Desktop : public DESKTOP_WINDOW {
bool read_desktop_file(const char* path, IconSettings& is);
void add_icon(DesktopIcon* ic);
bool add_icon_pathed(const char* path, edelib::Config* conf);
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);

View File

@ -0,0 +1,66 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0108
header_name {.h}
code_name {.cxx}
Function {} {open
} {
Fl_Window {} {open
xywh {661 66 315 395} type Double visible
} {
Fl_Tabs {} {open
xywh {10 10 295 340} labelsize 14
} {
Fl_Group {} {
label General open selected
xywh {15 35 285 310}
} {
Fl_Button {} {
image {/home/sanel/.icons/edeneu/64x64/apps/gaim.png} xywh {20 50 75 75} labelsize 14
}
Fl_Input {} {
xywh {100 75 195 25}
}
Fl_Output {} {
label {Type:}
xywh {100 150 195 25} box FLAT_BOX color 49
}
Fl_Output {} {
label {Location:}
xywh {100 180 195 25} box FLAT_BOX color 49
}
Fl_Output {} {
label {Size:}
xywh {100 210 195 25} box FLAT_BOX color 49
}
Fl_Output {} {
label {Modified:}
xywh {100 240 195 25} box FLAT_BOX color 49
}
Fl_Output {} {
label {Accessed:}
xywh {100 270 195 25} box FLAT_BOX color 49
}
}
Fl_Group {} {
label URL open
xywh {15 35 285 310} hide
} {
Fl_Input {} {
label {URL:}
xywh {20 65 245 25} align 5
}
Fl_Button {} {
image {/home/sanel/.icons/edeneu/16x16/actions/document-open.png} xywh {270 65 25 25} labelsize 14
}
}
}
Fl_Button {} {
label {&OK}
xywh {120 360 90 25}
}
Fl_Button {} {
label {&Cancel}
xywh {215 360 90 25}
}
}
}