From f5ca9cd65ad9f74c105b40e6a67538787cb3a4de Mon Sep 17 00:00:00 2001 From: Sanel Zukan Date: Thu, 2 Oct 2008 09:42:19 +0000 Subject: [PATCH] Names over the code updating. Small code reordering. Interface where ede-desktop listens is now org.equinoxproject.Desktop. New config format. --- ede-desktop/DesktopIcon.cpp | 6 +- ede-desktop/DesktopIcon.h | 8 +-- ede-desktop/IconProperties.cpp | 4 +- ede-desktop/IconProperties.h | 4 +- ede-desktop/Jamfile | 10 ++-- ede-desktop/Utils.cpp | 8 +-- ede-desktop/Utils.h | 8 +-- ede-desktop/Wallpaper.cpp | 18 +++--- ede-desktop/Wallpaper.h | 7 +-- ede-desktop/ede-desktop.conf | 25 ++++---- ede-desktop/ede-desktop.cpp | 102 +++++++++++++++++++-------------- ede-desktop/ede-desktop.h | 12 ++-- 12 files changed, 112 insertions(+), 100 deletions(-) diff --git a/ede-desktop/DesktopIcon.cpp b/ede-desktop/DesktopIcon.cpp index a640a5d..02f56eb 100644 --- a/ede-desktop/DesktopIcon.cpp +++ b/ede-desktop/DesktopIcon.cpp @@ -1,9 +1,9 @@ /* * $Id$ * - * Eiconman, desktop and icon manager + * ede-desktop, desktop and icon manager * 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 * GNU General Public License version 2 or newer. @@ -25,9 +25,9 @@ #include #endif +#include "ede-desktop.h" #include "DesktopIcon.h" #include "IconProperties.h" -#include "eiconman.h" #include "Utils.h" // minimal icon sizes diff --git a/ede-desktop/DesktopIcon.h b/ede-desktop/DesktopIcon.h index df345e6..19aa430 100644 --- a/ede-desktop/DesktopIcon.h +++ b/ede-desktop/DesktopIcon.h @@ -1,9 +1,9 @@ /* * $Id$ * - * Eiconman, desktop and icon manager + * ede-desktop, desktop and icon manager * 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 * GNU General Public License version 2 or newer. @@ -13,14 +13,14 @@ #ifndef __DESKTOPICON_H__ #define __DESKTOPICON_H__ +#include // Pixmap + #include #include #include #include #include -#include // Pixmap - #include class GlobalIconSettings; diff --git a/ede-desktop/IconProperties.cpp b/ede-desktop/IconProperties.cpp index 136865d..781798d 100644 --- a/ede-desktop/IconProperties.cpp +++ b/ede-desktop/IconProperties.cpp @@ -1,9 +1,9 @@ /* * $Id$ * - * Eiconman, desktop and icon manager + * ede-desktop, desktop and icon manager * 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 * GNU General Public License version 2 or newer. diff --git a/ede-desktop/IconProperties.h b/ede-desktop/IconProperties.h index 3d4ba60..d338cfd 100644 --- a/ede-desktop/IconProperties.h +++ b/ede-desktop/IconProperties.h @@ -1,9 +1,9 @@ /* * $Id$ * - * Eiconman, desktop and icon manager + * ede-desktop, desktop and icon manager * 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 * GNU General Public License version 2 or newer. diff --git a/ede-desktop/Jamfile b/ede-desktop/Jamfile index a2f8163..22ffd33 100644 --- a/ede-desktop/Jamfile +++ b/ede-desktop/Jamfile @@ -8,15 +8,15 @@ # GNU General Public License version 2 or newer. # See COPYING for details. -SubDir TOP eiconman ; +SubDir TOP ede-desktop ; 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 ; -EdeProgram eiconman : $(SOURCE) ; -LinkAgainst eiconman : -L/opt/ede/lib -ledelib_dbus -ldbus-1 ; +EdeProgram ede-desktop : $(SOURCE) ; +LinkAgainst ede-desktop : -L/opt/ede/lib -ledelib_dbus -ldbus-1 ; TranslationStrings locale : $(SOURCE) ; diff --git a/ede-desktop/Utils.cpp b/ede-desktop/Utils.cpp index cfbbde4..e13b74e 100644 --- a/ede-desktop/Utils.cpp +++ b/ede-desktop/Utils.cpp @@ -1,21 +1,21 @@ /* * $Id$ * - * Eiconman, desktop and icon manager + * ede-desktop, desktop and icon manager * 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 * GNU General Public License version 2 or newer. * See COPYING for details. */ -#include "Utils.h" +#include // strrchr, strncpy, strlen #include // CARD32 #include #include -#include // strrchr, strncpy, strlen +#include "Utils.h" Atom _XA_NET_WORKAREA = 0; Atom _XA_NET_WM_WINDOW_TYPE = 0; diff --git a/ede-desktop/Utils.h b/ede-desktop/Utils.h index 0e9b051..f3c39ba 100644 --- a/ede-desktop/Utils.h +++ b/ede-desktop/Utils.h @@ -1,9 +1,9 @@ /* * $Id$ * - * Eiconman, desktop and icon manager + * ede-desktop, desktop and icon manager * 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 * GNU General Public License version 2 or newer. @@ -13,11 +13,11 @@ #ifndef __UTILS_H__ #define __UTILS_H__ +#include // Pixmap + #include #include -#include // Pixmap - extern Atom _XA_NET_WORKAREA; extern Atom _XA_NET_WM_WINDOW_TYPE; extern Atom _XA_NET_WM_WINDOW_TYPE_DESKTOP; diff --git a/ede-desktop/Wallpaper.cpp b/ede-desktop/Wallpaper.cpp index 466a06f..148a15d 100644 --- a/ede-desktop/Wallpaper.cpp +++ b/ede-desktop/Wallpaper.cpp @@ -1,27 +1,27 @@ /* * $Id$ * - * Eiconman, desktop and icon manager + * ede-desktop, desktop and icon manager * 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 * GNU General Public License version 2 or newer. * See COPYING for details. */ -#include "Wallpaper.h" -#include "Utils.h" - -#include +#include // memcpy +#include // malloc #include #include #include #include -#include // memcpy -#include // malloc +#include + +#include "Wallpaper.h" +#include "Utils.h" #define CALC_PIXEL(tmp, rshift, rmask, gshift, gmask, bshift, bmask) \ tmp = 0; \ @@ -41,7 +41,7 @@ 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) return 0; diff --git a/ede-desktop/Wallpaper.h b/ede-desktop/Wallpaper.h index 4f62b14..ad54508 100644 --- a/ede-desktop/Wallpaper.h +++ b/ede-desktop/Wallpaper.h @@ -1,9 +1,9 @@ /* * $Id$ * - * Eiconman, desktop and icon manager + * ede-desktop, desktop and icon manager * 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 * GNU General Public License version 2 or newer. @@ -13,9 +13,8 @@ #ifndef __WALLPAPER_H__ #define __WALLPAPER_H__ -#include - #include // XImage, Pixmap +#include /* * Class responsible for displaying images at background diff --git a/ede-desktop/ede-desktop.conf b/ede-desktop/ede-desktop.conf index 5f142f9..9e5d0a7 100644 --- a/ede-desktop/ede-desktop.conf +++ b/ede-desktop/ede-desktop.conf @@ -1,16 +1,15 @@ [Desktop] -Color=1866896640 -WallpaperUse=1 -WallpaperMode=1 -Wallpaper=/home/sanel/wallpapers/kate-beckinsale8.jpg +color=1866896640 +wallpaper_use=1 +wallpaper_mode=1 +wallpaper=/home/sanel/wallpapers/kate-beckinsale8.jpg [Icons] -LabelBackground=827223040 -LabelForeground=7 -LabelFont=1 -LabelFontsize=12 -LabelMaxwidth=55 -LabelTransparent=1 -LabelVisible=1 -OneClickExec=0 - +label_background=827223040 +label_foreground=7 +label_font=1 +label_fontsize=12 +label_maxwidth=55 +label_transparent=1 +label_visible=1 +one_click_exec=0 diff --git a/ede-desktop/ede-desktop.cpp b/ede-desktop/ede-desktop.cpp index a8fd403..15eae04 100644 --- a/ede-desktop/ede-desktop.cpp +++ b/ede-desktop/ede-desktop.cpp @@ -1,12 +1,12 @@ /* * $Id$ * - * Eiconman, desktop and icon manager + * ede-desktop, desktop and icon manager * 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 - * the GNU General Public License version 2 or later. + * This program is licensed under terms of the + * GNU General Public License version 2 or newer. * See COPYING for details. */ @@ -14,10 +14,18 @@ #include #endif -#include "eiconman.h" -#include "DesktopIcon.h" -#include "Utils.h" -#include "Wallpaper.h" +#include // sleep +#include +#include // rand, srand +#include // time + +#include +#include +#include +#include +#include +#include +#include #include #include @@ -31,25 +39,17 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include "ede-desktop.h" +#include "DesktopIcon.h" +#include "Utils.h" +#include "Wallpaper.h" -#include // sleep -#include -#include // rand, srand -#include // time +#define EDE_DESKTOP_UID 0x10 +#define CONFIG_NAME "ede/ede-desktop" +#define ICONS_CONFIG_NAME "ede/ede-desktop-icons" -#define EICONMAN_UID 0x10 -#define CONFIG_NAME "ede/eiconman" -#define ICONS_CONFIG_NAME "ede/eiconman-icons" - -#define EICONMAN_INTERFACE "org.equinoxproject.Eiconman" -#define EICONMAN_OBJECT "/org/equinoxproject/Eiconman" +#define EDE_DESKTOP_INTERFACE "org.equinoxproject.Desktop" +#define EDE_DESKTOP_OBJECT "/org/equinoxproject/Desktop" #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))) @@ -123,11 +123,11 @@ void settings_changed_cb(void* data) { } 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*) { - Desktop::instance()->execute("../edesktopconf/edesktopconf --icons"); + Desktop::instance()->execute("../ede-desktop-conf/ede-desktop-conf --icons"); } int desktop_xmessage_handler(int event) { @@ -153,7 +153,7 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") { #ifdef USE_EDELIB_WINDOW DESKTOP_WINDOW::init(); - settings_uid(EICONMAN_UID); + settings_uid(EDE_DESKTOP_UID); settings_callback(settings_changed_cb); //DESKTOP_WINDOW::single_buffer(true); #endif @@ -162,6 +162,17 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") { selbox->x = selbox->y = selbox->w = selbox->h = 0; 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->color = FL_GRAY; dsett->wp_use = false; @@ -172,6 +183,7 @@ Desktop::~Desktop() { save_icons_positions(); + delete gisett; delete dsett; delete selbox; delete dbus; @@ -326,9 +338,9 @@ void Desktop::read_config(void) { int default_wp_use = false; 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)); + conf.get("Desktop", "color", dsett->color, default_bg_color); + conf.get("Desktop", "wallpaper_use", 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)) { @@ -336,14 +348,16 @@ void Desktop::read_config(void) { dsett->wp_use = false; } - 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); + // '138' is gnome light blue + conf.get("Icons", "label_background", gisett->label_background, 138); + + 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", "one_click_exec", gisett->one_click_exec, false); + conf.get("Icons", "auto_arrange", gisett->auto_arrange, true); if(dsett->wp_use) 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); 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, "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.full_path = path; - DesktopIcon* dic = new DesktopIcon(&gisett, &is, dsett->color); + DesktopIcon* dic = new DesktopIcon(gisett, &is, dsett->color); add_icon(dic); } @@ -743,8 +757,8 @@ void Desktop::notify_desktop_changed(void) { if(dbus) { edelib::EdbusMessage msg; - // send org.equinoxproject.Eiconman.DesktopChanged(int32, string) signal - msg.create_signal(EICONMAN_OBJECT, EICONMAN_INTERFACE, "DesktopChanged"); + // send org.equinoxproject.Desktop.DesktopChanged(int32, string) signal + msg.create_signal(EDE_DESKTOP_OBJECT, EDE_DESKTOP_INTERFACE, "DesktopChanged"); msg << num << names[num]; 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(); } - DesktopIcon* dic = new DesktopIcon(&gisett, &is, color()); + DesktopIcon* dic = new DesktopIcon(gisett, &is, color()); add_icon(dic); delete [] src_copy; diff --git a/ede-desktop/ede-desktop.h b/ede-desktop/ede-desktop.h index ce0dcea..9c5a68e 100644 --- a/ede-desktop/ede-desktop.h +++ b/ede-desktop/ede-desktop.h @@ -1,17 +1,17 @@ /* * $Id$ * - * Eiconman, desktop and icon manager + * ede-desktop, desktop and icon manager * 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 * GNU General Public License version 2 or newer. * See COPYING for details. */ -#ifndef __EICONMAN_H__ -#define __EICONMAN_H__ +#ifndef __EDE_DESKTOP_H__ +#define __EDE_DESKTOP_H__ #ifdef USE_EDELIB_WINDOW #include @@ -106,8 +106,8 @@ class Desktop : public DESKTOP_WINDOW { SelectionOverlay* selbox; - GlobalIconSettings gisett; - DesktopSettings* dsett; + GlobalIconSettings* gisett; + DesktopSettings* dsett; Fl_Menu_Button* dmenu; Wallpaper* wallpaper;