Names over the code updating.

Small code reordering.
Interface where ede-desktop listens is now org.equinoxproject.Desktop.
New config format.
This commit is contained in:
Sanel Zukan 2008-10-02 09:42:19 +00:00
parent cb0ee372b8
commit f5ca9cd65a
12 changed files with 112 additions and 100 deletions

View File

@ -1,9 +1,9 @@
/* /*
* $Id$ * $Id$
* *
* Eiconman, desktop and icon manager * ede-desktop, desktop and icon manager
* Part of Equinox Desktop Environment (EDE). * Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2007 EDE Authors. * Copyright (c) 2006-2008 EDE Authors.
* *
* This program is licensed under terms of the * This program is licensed under terms of the
* GNU General Public License version 2 or newer. * GNU General Public License version 2 or newer.
@ -25,9 +25,9 @@
#include <X11/extensions/shape.h> #include <X11/extensions/shape.h>
#endif #endif
#include "ede-desktop.h"
#include "DesktopIcon.h" #include "DesktopIcon.h"
#include "IconProperties.h" #include "IconProperties.h"
#include "eiconman.h"
#include "Utils.h" #include "Utils.h"
// minimal icon sizes // minimal icon sizes

View File

@ -1,9 +1,9 @@
/* /*
* $Id$ * $Id$
* *
* Eiconman, desktop and icon manager * ede-desktop, desktop and icon manager
* Part of Equinox Desktop Environment (EDE). * Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2007 EDE Authors. * Copyright (c) 2006-2008 EDE Authors.
* *
* This program is licensed under terms of the * This program is licensed under terms of the
* GNU General Public License version 2 or newer. * GNU General Public License version 2 or newer.
@ -13,14 +13,14 @@
#ifndef __DESKTOPICON_H__ #ifndef __DESKTOPICON_H__
#define __DESKTOPICON_H__ #define __DESKTOPICON_H__
#include <X11/Xlib.h> // Pixmap
#include <FL/Fl_Widget.H> #include <FL/Fl_Widget.H>
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>
#include <FL/Fl_Box.H> #include <FL/Fl_Box.H>
#include <FL/Fl_Button.H> #include <FL/Fl_Button.H>
#include <FL/Fl_Image.H> #include <FL/Fl_Image.H>
#include <X11/Xlib.h> // Pixmap
#include <edelib/String.h> #include <edelib/String.h>
class GlobalIconSettings; class GlobalIconSettings;

View File

@ -1,9 +1,9 @@
/* /*
* $Id$ * $Id$
* *
* Eiconman, desktop and icon manager * ede-desktop, desktop and icon manager
* Part of Equinox Desktop Environment (EDE). * Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2008 EDE Authors. * Copyright (c) 2006-2008 EDE Authors.
* *
* This program is licensed under terms of the * This program is licensed under terms of the
* GNU General Public License version 2 or newer. * GNU General Public License version 2 or newer.

View File

@ -1,9 +1,9 @@
/* /*
* $Id$ * $Id$
* *
* Eiconman, desktop and icon manager * ede-desktop, desktop and icon manager
* Part of Equinox Desktop Environment (EDE). * Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2008 EDE Authors. * Copyright (c) 2006-2008 EDE Authors.
* *
* This program is licensed under terms of the * This program is licensed under terms of the
* GNU General Public License version 2 or newer. * GNU General Public License version 2 or newer.

View File

@ -8,15 +8,15 @@
# GNU General Public License version 2 or newer. # GNU General Public License version 2 or newer.
# See COPYING for details. # See COPYING for details.
SubDir TOP eiconman ; SubDir TOP ede-desktop ;
ObjectC++Flags DesktopIcon.cpp : -DUSE_SHAPE ; ObjectC++Flags DesktopIcon.cpp : -DUSE_SHAPE ;
ObjectC++Flags eiconman.cpp : -DUSE_EDELIB_WINDOW ; ObjectC++Flags ede-desktop.cpp : -DUSE_EDELIB_WINDOW ;
SOURCE = eiconman.cpp Utils.cpp Wallpaper.cpp DesktopIcon.cpp IconProperties.cpp ; SOURCE = ede-desktop.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 ;
EdeProgram eiconman : $(SOURCE) ; EdeProgram ede-desktop : $(SOURCE) ;
LinkAgainst eiconman : -L/opt/ede/lib -ledelib_dbus -ldbus-1 ; LinkAgainst ede-desktop : -L/opt/ede/lib -ledelib_dbus -ldbus-1 ;
TranslationStrings locale : $(SOURCE) ; TranslationStrings locale : $(SOURCE) ;

View File

@ -1,21 +1,21 @@
/* /*
* $Id$ * $Id$
* *
* Eiconman, desktop and icon manager * ede-desktop, desktop and icon manager
* Part of Equinox Desktop Environment (EDE). * Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2007 EDE Authors. * Copyright (c) 2006-2008 EDE Authors.
* *
* This program is licensed under terms of the * This program is licensed under terms of the
* GNU General Public License version 2 or newer. * GNU General Public License version 2 or newer.
* See COPYING for details. * See COPYING for details.
*/ */
#include "Utils.h" #include <string.h> // strrchr, strncpy, strlen
#include <X11/Xproto.h> // CARD32 #include <X11/Xproto.h> // CARD32
#include <FL/x.H> #include <FL/x.H>
#include <edelib/Debug.h> #include <edelib/Debug.h>
#include <string.h> // strrchr, strncpy, strlen #include "Utils.h"
Atom _XA_NET_WORKAREA = 0; Atom _XA_NET_WORKAREA = 0;
Atom _XA_NET_WM_WINDOW_TYPE = 0; Atom _XA_NET_WM_WINDOW_TYPE = 0;

View File

@ -1,9 +1,9 @@
/* /*
* $Id$ * $Id$
* *
* Eiconman, desktop and icon manager * ede-desktop, desktop and icon manager
* Part of Equinox Desktop Environment (EDE). * Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2007 EDE Authors. * Copyright (c) 2006-2008 EDE Authors.
* *
* This program is licensed under terms of the * This program is licensed under terms of the
* GNU General Public License version 2 or newer. * GNU General Public License version 2 or newer.
@ -13,11 +13,11 @@
#ifndef __UTILS_H__ #ifndef __UTILS_H__
#define __UTILS_H__ #define __UTILS_H__
#include <X11/Xlib.h> // Pixmap
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>
#include <FL/Fl_Image.H> #include <FL/Fl_Image.H>
#include <X11/Xlib.h> // Pixmap
extern Atom _XA_NET_WORKAREA; extern Atom _XA_NET_WORKAREA;
extern Atom _XA_NET_WM_WINDOW_TYPE; extern Atom _XA_NET_WM_WINDOW_TYPE;
extern Atom _XA_NET_WM_WINDOW_TYPE_DESKTOP; extern Atom _XA_NET_WM_WINDOW_TYPE_DESKTOP;

View File

@ -1,27 +1,27 @@
/* /*
* $Id$ * $Id$
* *
* Eiconman, desktop and icon manager * ede-desktop, desktop and icon manager
* Part of Equinox Desktop Environment (EDE). * Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2007 EDE Authors. * Copyright (c) 2006-2008 EDE Authors.
* *
* This program is licensed under terms of the * This program is licensed under terms of the
* GNU General Public License version 2 or newer. * GNU General Public License version 2 or newer.
* See COPYING for details. * See COPYING for details.
*/ */
#include "Wallpaper.h" #include <string.h> // memcpy
#include "Utils.h" #include <stdlib.h> // malloc
#include <edelib/Debug.h>
#include <FL/Fl_Shared_Image.H> #include <FL/Fl_Shared_Image.H>
#include <FL/Fl_RGB_Image.H> #include <FL/Fl_RGB_Image.H>
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include <FL/x.H> #include <FL/x.H>
#include <string.h> // memcpy #include <edelib/Debug.h>
#include <stdlib.h> // malloc
#include "Wallpaper.h"
#include "Utils.h"
#define CALC_PIXEL(tmp, rshift, rmask, gshift, gmask, bshift, bmask) \ #define CALC_PIXEL(tmp, rshift, rmask, gshift, gmask, bshift, bmask) \
tmp = 0; \ tmp = 0; \
@ -41,7 +41,7 @@
tmp |= (((int)b >> (-bshift)) & bmask); tmp |= (((int)b >> (-bshift)) & bmask);
Pixmap create_xpixmap(Fl_Image* img, XImage*& xim, Pixmap pix, int wp_w, int wp_h) { static Pixmap create_xpixmap(Fl_Image* img, XImage*& xim, Pixmap pix, int wp_w, int wp_h) {
if(!img) if(!img)
return 0; return 0;

View File

@ -1,9 +1,9 @@
/* /*
* $Id$ * $Id$
* *
* Eiconman, desktop and icon manager * ede-desktop, desktop and icon manager
* Part of Equinox Desktop Environment (EDE). * Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2007 EDE Authors. * Copyright (c) 2006-2008 EDE Authors.
* *
* This program is licensed under terms of the * This program is licensed under terms of the
* GNU General Public License version 2 or newer. * GNU General Public License version 2 or newer.
@ -13,9 +13,8 @@
#ifndef __WALLPAPER_H__ #ifndef __WALLPAPER_H__
#define __WALLPAPER_H__ #define __WALLPAPER_H__
#include <FL/Fl_Box.H>
#include <X11/Xlib.h> // XImage, Pixmap #include <X11/Xlib.h> // XImage, Pixmap
#include <FL/Fl_Box.H>
/* /*
* Class responsible for displaying images at background * Class responsible for displaying images at background

View File

@ -1,16 +1,15 @@
[Desktop] [Desktop]
Color=1866896640 color=1866896640
WallpaperUse=1 wallpaper_use=1
WallpaperMode=1 wallpaper_mode=1
Wallpaper=/home/sanel/wallpapers/kate-beckinsale8.jpg wallpaper=/home/sanel/wallpapers/kate-beckinsale8.jpg
[Icons] [Icons]
LabelBackground=827223040 label_background=827223040
LabelForeground=7 label_foreground=7
LabelFont=1 label_font=1
LabelFontsize=12 label_fontsize=12
LabelMaxwidth=55 label_maxwidth=55
LabelTransparent=1 label_transparent=1
LabelVisible=1 label_visible=1
OneClickExec=0 one_click_exec=0

View File

@ -1,12 +1,12 @@
/* /*
* $Id$ * $Id$
* *
* Eiconman, desktop and icon manager * ede-desktop, desktop and icon manager
* Part of Equinox Desktop Environment (EDE). * Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2007 EDE Authors. * Copyright (c) 2006-2008 EDE Authors.
* *
* This program is licensed under the terms of * This program is licensed under terms of the
* the GNU General Public License version 2 or later. * GNU General Public License version 2 or newer.
* See COPYING for details. * See COPYING for details.
*/ */
@ -14,10 +14,18 @@
#include <config.h> #include <config.h>
#endif #endif
#include "eiconman.h" #include <unistd.h> // sleep
#include "DesktopIcon.h" #include <signal.h>
#include "Utils.h" #include <stdlib.h> // rand, srand
#include "Wallpaper.h" #include <time.h> // time
#include <FL/Fl.H>
#include <FL/x.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Menu_Button.H>
#include <FL/fl_ask.H>
#include <edelib/Debug.h> #include <edelib/Debug.h>
#include <edelib/File.h> #include <edelib/File.h>
@ -31,25 +39,17 @@
#include <edelib/Util.h> #include <edelib/Util.h>
#include <edelib/Nls.h> #include <edelib/Nls.h>
#include <FL/Fl.H> #include "ede-desktop.h"
#include <FL/x.H> #include "DesktopIcon.h"
#include <FL/fl_draw.H> #include "Utils.h"
#include <FL/Fl_Box.H> #include "Wallpaper.h"
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Menu_Button.H>
#include <FL/fl_ask.H>
#include <unistd.h> // sleep #define EDE_DESKTOP_UID 0x10
#include <signal.h> #define CONFIG_NAME "ede/ede-desktop"
#include <stdlib.h> // rand, srand #define ICONS_CONFIG_NAME "ede/ede-desktop-icons"
#include <time.h> // time
#define EICONMAN_UID 0x10 #define EDE_DESKTOP_INTERFACE "org.equinoxproject.Desktop"
#define CONFIG_NAME "ede/eiconman" #define EDE_DESKTOP_OBJECT "/org/equinoxproject/Desktop"
#define ICONS_CONFIG_NAME "ede/eiconman-icons"
#define EICONMAN_INTERFACE "org.equinoxproject.Eiconman"
#define EICONMAN_OBJECT "/org/equinoxproject/Eiconman"
#define SELECTION_SINGLE (Fl::event_button() == 1) #define SELECTION_SINGLE (Fl::event_button() == 1)
#define SELECTION_MULTI (Fl::event_button() == 1 && (Fl::event_key(FL_Shift_L) || Fl::event_key(FL_Shift_R))) #define SELECTION_MULTI (Fl::event_button() == 1 && (Fl::event_key(FL_Shift_L) || Fl::event_key(FL_Shift_R)))
@ -123,11 +123,11 @@ void settings_changed_cb(void* data) {
} }
void background_conf_cb(Fl_Widget*, void*) { void background_conf_cb(Fl_Widget*, void*) {
Desktop::instance()->execute("../edesktopconf/edesktopconf"); Desktop::instance()->execute("../ede-desktop-conf/ede-desktop-conf");
} }
void icons_conf_cb(Fl_Widget*, void*) { void icons_conf_cb(Fl_Widget*, void*) {
Desktop::instance()->execute("../edesktopconf/edesktopconf --icons"); Desktop::instance()->execute("../ede-desktop-conf/ede-desktop-conf --icons");
} }
int desktop_xmessage_handler(int event) { int desktop_xmessage_handler(int event) {
@ -153,7 +153,7 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") {
#ifdef USE_EDELIB_WINDOW #ifdef USE_EDELIB_WINDOW
DESKTOP_WINDOW::init(); DESKTOP_WINDOW::init();
settings_uid(EICONMAN_UID); settings_uid(EDE_DESKTOP_UID);
settings_callback(settings_changed_cb); settings_callback(settings_changed_cb);
//DESKTOP_WINDOW::single_buffer(true); //DESKTOP_WINDOW::single_buffer(true);
#endif #endif
@ -162,6 +162,17 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") {
selbox->x = selbox->y = selbox->w = selbox->h = 0; selbox->x = selbox->y = selbox->w = selbox->h = 0;
selbox->show = false; selbox->show = false;
gisett = new GlobalIconSettings;
// gnome light blue
gisett->label_background = 138;
gisett->label_foreground = FL_WHITE;
gisett->label_fontsize = 12;
gisett->label_maxwidth = 75;
gisett->label_transparent = false;
gisett->label_draw = true;
gisett->one_click_exec = false;
gisett->auto_arrange = true;
dsett = new DesktopSettings; dsett = new DesktopSettings;
dsett->color = FL_GRAY; dsett->color = FL_GRAY;
dsett->wp_use = false; dsett->wp_use = false;
@ -172,6 +183,7 @@ Desktop::~Desktop() {
save_icons_positions(); save_icons_positions();
delete gisett;
delete dsett; delete dsett;
delete selbox; delete selbox;
delete dbus; delete dbus;
@ -326,9 +338,9 @@ void Desktop::read_config(void) {
int default_wp_use = false; int default_wp_use = false;
char wpath[256]; char wpath[256];
conf.get("Desktop", "Color", dsett->color, default_bg_color); conf.get("Desktop", "color", dsett->color, default_bg_color);
conf.get("Desktop", "WallpaperUse", dsett->wp_use, default_wp_use); conf.get("Desktop", "wallpaper_use", dsett->wp_use, default_wp_use);
conf.get("Desktop", "Wallpaper", wpath, sizeof(wpath)); conf.get("Desktop", "wallpaper", wpath, sizeof(wpath));
// keep path but disable wallpaper if file does not exists // keep path but disable wallpaper if file does not exists
if(!edelib::file_exists(wpath)) { if(!edelib::file_exists(wpath)) {
@ -336,14 +348,16 @@ void Desktop::read_config(void) {
dsett->wp_use = false; dsett->wp_use = false;
} }
conf.get("Icons", "LabelBackground", gisett.label_background, FL_BLUE); // '138' is gnome light blue
conf.get("Icons", "LabelForeground", gisett.label_foreground, FL_WHITE); conf.get("Icons", "label_background", gisett->label_background, 138);
conf.get("Icons", "LabelFontsize", gisett.label_fontsize, 12);
conf.get("Icons", "LabelMaxwidth", gisett.label_maxwidth, 75); conf.get("Icons", "label_foreground", gisett->label_foreground, FL_WHITE);
conf.get("Icons", "LabelTransparent",gisett.label_transparent, false); conf.get("Icons", "label_fontsize", gisett->label_fontsize, 12);
conf.get("Icons", "LabelVisible", gisett.label_draw, true); conf.get("Icons", "label_maxwidth", gisett->label_maxwidth, 75);
conf.get("Icons", "OneClickExec", gisett.one_click_exec, false); conf.get("Icons", "label_transparent",gisett->label_transparent, false);
conf.get("Icons", "AutoArrange", gisett.auto_arrange, true); conf.get("Icons", "label_visible", gisett->label_draw, true);
conf.get("Icons", "one_click_exec", gisett->one_click_exec, false);
conf.get("Icons", "auto_arrange", gisett->auto_arrange, true);
if(dsett->wp_use) if(dsett->wp_use)
wallpaper->set(wpath); wallpaper->set(wpath);
@ -418,7 +432,7 @@ bool Desktop::add_icon_by_path(const char* path, edelib::Resource* conf) {
int icon_y = random_pos(w() - 10); int icon_y = random_pos(w() - 10);
if(conf) { if(conf) {
// we load positions from used eiconman-icos.conf only // we load positions from used ede-desktop-icos.conf only
conf->get(base, "X", icon_x, icon_x, edelib::RES_USER_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); conf->get(base, "Y", icon_y, icon_y, edelib::RES_USER_ONLY);
} }
@ -428,7 +442,7 @@ bool Desktop::add_icon_by_path(const char* path, edelib::Resource* conf) {
is.y = icon_y; is.y = icon_y;
is.full_path = path; is.full_path = path;
DesktopIcon* dic = new DesktopIcon(&gisett, &is, dsett->color); DesktopIcon* dic = new DesktopIcon(gisett, &is, dsett->color);
add_icon(dic); add_icon(dic);
} }
@ -743,8 +757,8 @@ void Desktop::notify_desktop_changed(void) {
if(dbus) { if(dbus) {
edelib::EdbusMessage msg; edelib::EdbusMessage msg;
// send org.equinoxproject.Eiconman.DesktopChanged(int32, string) signal // send org.equinoxproject.Desktop.DesktopChanged(int32, string) signal
msg.create_signal(EICONMAN_OBJECT, EICONMAN_INTERFACE, "DesktopChanged"); msg.create_signal(EDE_DESKTOP_OBJECT, EDE_DESKTOP_INTERFACE, "DesktopChanged");
msg << num << names[num]; msg << num << names[num];
dbus->send(msg); dbus->send(msg);
} }
@ -850,7 +864,7 @@ void Desktop::dnd_drop_source(const char* src, int src_len, int x, int y) {
is.icon = mt.icon_name(); is.icon = mt.icon_name();
} }
DesktopIcon* dic = new DesktopIcon(&gisett, &is, color()); DesktopIcon* dic = new DesktopIcon(gisett, &is, color());
add_icon(dic); add_icon(dic);
delete [] src_copy; delete [] src_copy;

View File

@ -1,17 +1,17 @@
/* /*
* $Id$ * $Id$
* *
* Eiconman, desktop and icon manager * ede-desktop, desktop and icon manager
* Part of Equinox Desktop Environment (EDE). * Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2007 EDE Authors. * Copyright (c) 2006-2008 EDE Authors.
* *
* This program is licensed under terms of the * This program is licensed under terms of the
* GNU General Public License version 2 or newer. * GNU General Public License version 2 or newer.
* See COPYING for details. * See COPYING for details.
*/ */
#ifndef __EICONMAN_H__ #ifndef __EDE_DESKTOP_H__
#define __EICONMAN_H__ #define __EDE_DESKTOP_H__
#ifdef USE_EDELIB_WINDOW #ifdef USE_EDELIB_WINDOW
#include <edelib/Window.h> #include <edelib/Window.h>
@ -106,7 +106,7 @@ class Desktop : public DESKTOP_WINDOW {
SelectionOverlay* selbox; SelectionOverlay* selbox;
GlobalIconSettings gisett; GlobalIconSettings* gisett;
DesktopSettings* dsett; DesktopSettings* dsett;
Fl_Menu_Button* dmenu; Fl_Menu_Button* dmenu;