mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-07 22:34:18 +01:00
- Finished moving to the new proplist handling code in WINGs.
- Also tested the backward compatibility ability of the WINGs proplist code which seems to work quite well. Starting with this moment, Window Maker no longer needs libPropList and is now using the better and much more robust proplist code from WINGs. Also the WINGs based proplist code is actively maintained while the old libPropList code is practically dead and flawed by the fact that it borrowed concepts from the UserDefaults which conflicted with the retain/release mechanism, making some problems that libPropList had, practically unsolvable without a complete redesign (which can be found in the more robust WINGs code).
This commit is contained in:
@@ -122,7 +122,7 @@ typedef struct _Panel {
|
||||
typedef struct {
|
||||
char *title;
|
||||
char *texture;
|
||||
proplist_t prop;
|
||||
WMPropList *prop;
|
||||
Pixmap preview;
|
||||
|
||||
char *path;
|
||||
@@ -437,13 +437,13 @@ dumpRImage(char *path, RImage *image)
|
||||
|
||||
|
||||
static int
|
||||
isPixmap(proplist_t prop)
|
||||
isPixmap(WMPropList *prop)
|
||||
{
|
||||
proplist_t p;
|
||||
WMPropList *p;
|
||||
char *s;
|
||||
|
||||
p = PLGetArrayElement(prop, 0);
|
||||
s = PLGetString(p);
|
||||
p = WMGetFromPLArray(prop, 0);
|
||||
s = WMGetFromPLString(p);
|
||||
if (strcasecmp(&s[1], "pixmap")==0)
|
||||
return 1;
|
||||
else
|
||||
@@ -518,7 +518,7 @@ drawMenuBevel(RImage *img)
|
||||
|
||||
|
||||
static Pixmap
|
||||
renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||
renderTexture(WMScreen *scr, WMPropList *texture, int width, int height,
|
||||
char *path, int border)
|
||||
{
|
||||
char *type;
|
||||
@@ -529,11 +529,11 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||
RColor rcolor;
|
||||
|
||||
|
||||
type = PLGetString(PLGetArrayElement(texture, 0));
|
||||
type = WMGetFromPLString(WMGetFromPLArray(texture, 0));
|
||||
|
||||
if (strcasecmp(type, "solid")==0) {
|
||||
|
||||
str = PLGetString(PLGetArrayElement(texture, 1));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
|
||||
|
||||
str2rcolor(rc, str, &rcolor);
|
||||
|
||||
@@ -543,18 +543,18 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||
int t1, t2;
|
||||
RColor c1[2], c2[2];
|
||||
|
||||
str = PLGetString(PLGetArrayElement(texture, 1));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
|
||||
str2rcolor(rc, str, &c1[0]);
|
||||
str = PLGetString(PLGetArrayElement(texture, 2));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 2));
|
||||
str2rcolor(rc, str, &c1[1]);
|
||||
str = PLGetString(PLGetArrayElement(texture, 3));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 3));
|
||||
t1 = atoi(str);
|
||||
|
||||
str = PLGetString(PLGetArrayElement(texture, 4));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 4));
|
||||
str2rcolor(rc, str, &c2[0]);
|
||||
str = PLGetString(PLGetArrayElement(texture, 5));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 5));
|
||||
str2rcolor(rc, str, &c2[1]);
|
||||
str = PLGetString(PLGetArrayElement(texture, 6));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 6));
|
||||
t2 = atoi(str);
|
||||
|
||||
image = RRenderInterwovenGradient(width, height, c1, t1, c2, t2);
|
||||
@@ -575,9 +575,9 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||
break;
|
||||
}
|
||||
|
||||
str = PLGetString(PLGetArrayElement(texture, 1));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
|
||||
str2rcolor(rc, str, &rcolor);
|
||||
str = PLGetString(PLGetArrayElement(texture, 2));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 2));
|
||||
str2rcolor(rc, str, &rcolor2);
|
||||
|
||||
image = RRenderGradient(width, height, &rcolor, &rcolor2, style);
|
||||
@@ -601,12 +601,12 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||
break;
|
||||
}
|
||||
|
||||
str = PLGetString(PLGetArrayElement(texture, 3));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 3));
|
||||
str2rcolor(rc, str, &rcolor);
|
||||
str = PLGetString(PLGetArrayElement(texture, 4));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 4));
|
||||
str2rcolor(rc, str, &rcolor2);
|
||||
|
||||
str = PLGetString(PLGetArrayElement(texture, 1));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
|
||||
|
||||
if ((path=wfindfileinarray(GetObjectForKey("PixmapPath"), str))!=NULL)
|
||||
timage = RLoadImage(rc, path, 0);
|
||||
@@ -620,7 +620,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||
image = RMakeTiledImage(timage, width, height);
|
||||
RReleaseImage(timage);
|
||||
|
||||
i = atoi(PLGetString(PLGetArrayElement(texture, 2)));
|
||||
i = atoi(WMGetFromPLString(WMGetFromPLArray(texture, 2)));
|
||||
|
||||
RCombineImagesWithOpaqueness(image, grad, i);
|
||||
RReleaseImage(grad);
|
||||
@@ -643,13 +643,13 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||
break;
|
||||
}
|
||||
|
||||
j = PLGetNumberOfElements(texture);
|
||||
j = WMGetPropListItemCount(texture);
|
||||
|
||||
if (j > 0) {
|
||||
colors = wmalloc(j * sizeof(RColor*));
|
||||
|
||||
for (i = 2; i < j; i++) {
|
||||
str = PLGetString(PLGetArrayElement(texture, i));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, i));
|
||||
colors[i-2] = wmalloc(sizeof(RColor));
|
||||
str2rcolor(rc, str, colors[i-2]);
|
||||
}
|
||||
@@ -666,7 +666,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||
char *path;
|
||||
RColor color;
|
||||
|
||||
str = PLGetString(PLGetArrayElement(texture, 1));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
|
||||
|
||||
if ((path=wfindfileinarray(GetObjectForKey("PixmapPath"), str))!=NULL)
|
||||
timage = RLoadImage(rc, path, 0);
|
||||
@@ -675,7 +675,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||
wwarning("could not load file '%s': %s", path ? path : str,
|
||||
RMessageForError(RErrorCode));
|
||||
} else {
|
||||
str = PLGetString(PLGetArrayElement(texture, 2));
|
||||
str = WMGetFromPLString(WMGetFromPLArray(texture, 2));
|
||||
str2rcolor(rc, str, &color);
|
||||
|
||||
switch (toupper(type[0])) {
|
||||
@@ -727,7 +727,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||
|
||||
|
||||
static Pixmap
|
||||
renderMenu(_Panel *panel, proplist_t texture, int width, int iheight)
|
||||
renderMenu(_Panel *panel, WMPropList *texture, int width, int iheight)
|
||||
{
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
Display *dpy = WMScreenDisplay(scr);
|
||||
@@ -949,7 +949,7 @@ okNewTexture(void *data)
|
||||
WMListItem *item;
|
||||
char *name;
|
||||
char *str;
|
||||
proplist_t prop;
|
||||
WMPropList *prop;
|
||||
TextureListItem *titem;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
|
||||
@@ -962,7 +962,7 @@ okNewTexture(void *data)
|
||||
|
||||
prop = GetTexturePanelTexture(panel->texturePanel);
|
||||
|
||||
str = PLGetDescription(prop);
|
||||
str = WMGetPropListDescription(prop, False);
|
||||
|
||||
titem->title = name;
|
||||
titem->prop = prop;
|
||||
@@ -989,7 +989,7 @@ okEditTexture(void *data)
|
||||
WMListItem *item;
|
||||
char *name;
|
||||
char *str;
|
||||
proplist_t prop;
|
||||
WMPropList *prop;
|
||||
TextureListItem *titem;
|
||||
|
||||
item = WMGetListItem(panel->texLs, WMGetListSelectedItemRow(panel->texLs));
|
||||
@@ -1006,9 +1006,9 @@ okEditTexture(void *data)
|
||||
|
||||
prop = GetTexturePanelTexture(panel->texturePanel);
|
||||
|
||||
str = PLGetDescription(prop);
|
||||
str = WMGetPropListDescription(prop, False);
|
||||
|
||||
PLRelease(titem->prop);
|
||||
WMReleasePropList(titem->prop);
|
||||
titem->prop = prop;
|
||||
|
||||
titem->ispixmap = isPixmap(prop);
|
||||
@@ -1098,7 +1098,7 @@ deleteTexture(WMWidget *w, void *data)
|
||||
|
||||
wfree(titem->title);
|
||||
wfree(titem->texture);
|
||||
PLRelease(titem->prop);
|
||||
WMReleasePropList(titem->prop);
|
||||
if (titem->path) {
|
||||
if (remove(titem->path) < 0 && errno != ENOENT) {
|
||||
wsyserror("could not remove file %s", titem->path);
|
||||
@@ -1373,8 +1373,8 @@ loadRImage(WMScreen *scr, char *path)
|
||||
static void
|
||||
fillTextureList(WMList *lPtr)
|
||||
{
|
||||
proplist_t textureList;
|
||||
proplist_t texture;
|
||||
WMPropList *textureList;
|
||||
WMPropList *texture;
|
||||
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
||||
TextureListItem *titem;
|
||||
WMScreen *scr = WMWidgetScreen(lPtr);
|
||||
@@ -1384,19 +1384,19 @@ fillTextureList(WMList *lPtr)
|
||||
if (!textureList)
|
||||
return;
|
||||
|
||||
for (i = 0; i < PLGetNumberOfElements(textureList); i++) {
|
||||
for (i = 0; i < WMGetPropListItemCount(textureList); i++) {
|
||||
WMListItem *item;
|
||||
|
||||
texture = PLGetArrayElement(textureList, i);
|
||||
texture = WMGetFromPLArray(textureList, i);
|
||||
|
||||
titem = wmalloc(sizeof(TextureListItem));
|
||||
memset(titem, 0, sizeof(TextureListItem));
|
||||
|
||||
titem->title = wstrdup(PLGetString(PLGetArrayElement(texture, 0)));
|
||||
titem->prop = PLRetain(PLGetArrayElement(texture, 1));
|
||||
titem->texture = PLGetDescription(titem->prop);
|
||||
titem->title = wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 0)));
|
||||
titem->prop = WMRetainPropList(WMGetFromPLArray(texture, 1));
|
||||
titem->texture = WMGetPropListDescription(titem->prop, False);
|
||||
titem->selectedFor = 0;
|
||||
titem->path = wstrdup(PLGetString(PLGetArrayElement(texture, 2)));
|
||||
titem->path = wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 2)));
|
||||
|
||||
titem->preview = loadRImage(scr, titem->path);
|
||||
if (!titem->preview) {
|
||||
@@ -1413,7 +1413,7 @@ static void
|
||||
fillColorList(_Panel *panel)
|
||||
{
|
||||
WMColor *color;
|
||||
proplist_t list;
|
||||
WMPropList *list;
|
||||
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
||||
WMScreen *scr = WMWidgetScreen(panel->box);
|
||||
int i;
|
||||
@@ -1428,13 +1428,13 @@ fillColorList(_Panel *panel)
|
||||
WMReleaseColor(color);
|
||||
}
|
||||
} else {
|
||||
proplist_t c;
|
||||
WMPropList *c;
|
||||
|
||||
for (i = 0; i < WMIN(24, PLGetNumberOfElements(list)); i++) {
|
||||
c = PLGetArrayElement(list, i);
|
||||
if (!c || !PLIsString(c))
|
||||
for (i = 0; i < WMIN(24, WMGetPropListItemCount(list)); i++) {
|
||||
c = WMGetFromPLArray(list, i);
|
||||
if (!c || !WMIsPLString(c))
|
||||
continue;
|
||||
color = WMCreateNamedColor(scr, PLGetString(c), False);
|
||||
color = WMCreateNamedColor(scr, WMGetFromPLString(c), False);
|
||||
if (!color)
|
||||
continue;
|
||||
WMSetColorWellColor(panel->sampW[i], color);
|
||||
@@ -2034,13 +2034,13 @@ setupTextureFor(WMList *list, char *key, char *defValue, char *title,
|
||||
|
||||
titem->title = wstrdup(title);
|
||||
titem->prop = GetObjectForKey(key);
|
||||
if (!titem->prop || !PLIsArray(titem->prop)) {
|
||||
if (!titem->prop || !WMIsPLArray(titem->prop)) {
|
||||
/* Maybe also give a error message to stderr that the entry is bad? */
|
||||
titem->prop = PLGetProplistWithDescription(defValue);
|
||||
titem->prop = WMCreatePropListFromDescription(defValue);
|
||||
} else {
|
||||
PLRetain(titem->prop);
|
||||
WMRetainPropList(titem->prop);
|
||||
}
|
||||
titem->texture = PLGetDescription((proplist_t)titem->prop);
|
||||
titem->texture = WMGetPropListDescription((WMPropList*)titem->prop, False);
|
||||
titem->current = 1;
|
||||
titem->selectedFor = 1<<index;
|
||||
|
||||
@@ -2160,33 +2160,33 @@ storeData(_Panel *panel)
|
||||
static void
|
||||
prepareForClose(_Panel *panel)
|
||||
{
|
||||
proplist_t textureList;
|
||||
proplist_t texture;
|
||||
WMPropList *textureList;
|
||||
WMPropList *texture;
|
||||
TextureListItem *titem;
|
||||
WMListItem *item;
|
||||
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
||||
int i;
|
||||
|
||||
textureList = PLMakeArrayFromElements(NULL, NULL);
|
||||
textureList = WMCreatePLArray(NULL, NULL);
|
||||
|
||||
/* store list of textures */
|
||||
for (i = 7; i < WMGetListNumberOfRows(panel->texLs); i++) {
|
||||
item = WMGetListItem(panel->texLs, i);
|
||||
titem = (TextureListItem*)item->clientData;
|
||||
|
||||
texture = PLMakeArrayFromElements(PLMakeString(titem->title),
|
||||
PLRetain(titem->prop),
|
||||
PLMakeString(titem->path),
|
||||
texture = WMCreatePLArray(WMCreatePLString(titem->title),
|
||||
WMRetainPropList(titem->prop),
|
||||
WMCreatePLString(titem->path),
|
||||
NULL);
|
||||
|
||||
PLAppendArrayElement(textureList, texture);
|
||||
WMAddToPLArray(textureList, texture);
|
||||
}
|
||||
|
||||
WMSetUDObjectForKey(udb, textureList, "TextureList");
|
||||
PLRelease(textureList);
|
||||
WMReleasePropList(textureList);
|
||||
|
||||
/* store list of colors */
|
||||
textureList = PLMakeArrayFromElements(NULL, NULL);
|
||||
textureList = WMCreatePLArray(NULL, NULL);
|
||||
for (i = 0; i < 24; i++) {
|
||||
WMColor *color;
|
||||
char *str;
|
||||
@@ -2194,11 +2194,11 @@ prepareForClose(_Panel *panel)
|
||||
color = WMGetColorWellColor(panel->sampW[i]);
|
||||
|
||||
str = WMGetColorRGBDescription(color);
|
||||
PLAppendArrayElement(textureList, PLMakeString(str));
|
||||
WMAddToPLArray(textureList, WMCreatePLString(str));
|
||||
wfree(str);
|
||||
}
|
||||
WMSetUDObjectForKey(udb, textureList, "ColorList");
|
||||
PLRelease(textureList);
|
||||
WMReleasePropList(textureList);
|
||||
|
||||
WMSynchronizeUserDefaults(udb);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,6 @@ typedef struct _Panel {
|
||||
#define DELAY_ICON "timer%i"
|
||||
#define DELAY_ICON_S "timer%is"
|
||||
|
||||
static void changeFocusMode(WMWidget *w, void *data);
|
||||
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "WPrefs.h"
|
||||
|
||||
#include <proplist.h>
|
||||
|
||||
typedef struct _Panel {
|
||||
WMBox *box;
|
||||
@@ -76,12 +75,12 @@ typedef struct _Panel {
|
||||
|
||||
|
||||
|
||||
static proplist_t DefaultWindowTitleFont = NULL;
|
||||
static proplist_t DefaultMenuTitleFont = NULL;
|
||||
static proplist_t DefaultMenuTextFont = NULL;
|
||||
static proplist_t DefaultIconTitleFont = NULL;
|
||||
static proplist_t DefaultClipTitleFont = NULL;
|
||||
static proplist_t DefaultDisplayFont = NULL;
|
||||
static WMPropList *DefaultWindowTitleFont = NULL;
|
||||
static WMPropList *DefaultMenuTitleFont = NULL;
|
||||
static WMPropList *DefaultMenuTextFont = NULL;
|
||||
static WMPropList *DefaultIconTitleFont = NULL;
|
||||
static WMPropList *DefaultClipTitleFont = NULL;
|
||||
static WMPropList *DefaultDisplayFont = NULL;
|
||||
|
||||
|
||||
|
||||
@@ -268,7 +267,7 @@ setLanguageType(Panel *p, Bool multiByte)
|
||||
static void
|
||||
readFontEncodings(Panel *panel)
|
||||
{
|
||||
proplist_t pl = NULL;
|
||||
WMPropList *pl = NULL;
|
||||
char *path;
|
||||
char *msg;
|
||||
|
||||
@@ -278,19 +277,19 @@ readFontEncodings(Panel *panel)
|
||||
goto error;
|
||||
}
|
||||
|
||||
pl = PLGetProplistWithPath(path);
|
||||
pl = WMReadPropListFromFile(path);
|
||||
if (!pl) {
|
||||
msg = _("Could not read font information file WPrefs.app/font.data");
|
||||
goto error;
|
||||
} else {
|
||||
int i;
|
||||
proplist_t key = PLMakeString("Encodings");
|
||||
proplist_t array;
|
||||
WMPropList *key = WMCreatePLString("Encodings");
|
||||
WMPropList *array;
|
||||
WMMenuItem *mi;
|
||||
|
||||
array = PLGetDictionaryEntry(pl, key);
|
||||
PLRelease(key);
|
||||
if (!array || !PLIsArray(array)) {
|
||||
array = WMGetFromPLDictionary(pl, key);
|
||||
WMReleasePropList(key);
|
||||
if (!array || !WMIsPLArray(array)) {
|
||||
msg = _("Invalid data in font information file WPrefs.app/font.data.\n"
|
||||
"Encodings data not found.");
|
||||
goto error;
|
||||
@@ -298,46 +297,46 @@ readFontEncodings(Panel *panel)
|
||||
|
||||
WMAddPopUpButtonItem(panel->langP, _("- Custom -"));
|
||||
|
||||
for (i = 0; i < PLGetNumberOfElements(array); i++) {
|
||||
proplist_t item, str;
|
||||
for (i = 0; i < WMGetPropListItemCount(array); i++) {
|
||||
WMPropList *item, *str;
|
||||
|
||||
item = PLGetArrayElement(array, i);
|
||||
str = PLGetArrayElement(item, 0);
|
||||
mi = WMAddPopUpButtonItem(panel->langP, PLGetString(str));
|
||||
WMSetMenuItemRepresentedObject(mi, PLRetain(item));
|
||||
item = WMGetFromPLArray(array, i);
|
||||
str = WMGetFromPLArray(item, 0);
|
||||
mi = WMAddPopUpButtonItem(panel->langP, WMGetFromPLString(str));
|
||||
WMSetMenuItemRepresentedObject(mi, WMRetainPropList(item));
|
||||
}
|
||||
|
||||
key = PLMakeString("WindowTitleFont");
|
||||
DefaultWindowTitleFont = PLGetDictionaryEntry(pl, key);
|
||||
PLRelease(key);
|
||||
key = WMCreatePLString("WindowTitleFont");
|
||||
DefaultWindowTitleFont = WMGetFromPLDictionary(pl, key);
|
||||
WMReleasePropList(key);
|
||||
|
||||
key = PLMakeString("MenuTitleFont");
|
||||
DefaultMenuTitleFont = PLGetDictionaryEntry(pl, key);
|
||||
PLRelease(key);
|
||||
key = WMCreatePLString("MenuTitleFont");
|
||||
DefaultMenuTitleFont = WMGetFromPLDictionary(pl, key);
|
||||
WMReleasePropList(key);
|
||||
|
||||
key = PLMakeString("MenuTextFont");
|
||||
DefaultMenuTextFont = PLGetDictionaryEntry(pl, key);
|
||||
PLRelease(key);
|
||||
key = WMCreatePLString("MenuTextFont");
|
||||
DefaultMenuTextFont = WMGetFromPLDictionary(pl, key);
|
||||
WMReleasePropList(key);
|
||||
}
|
||||
|
||||
PLRelease(pl);
|
||||
WMReleasePropList(pl);
|
||||
return;
|
||||
error:
|
||||
if (pl)
|
||||
PLRelease(pl);
|
||||
WMReleasePropList(pl);
|
||||
|
||||
WMRunAlertPanel(WMWidgetScreen(panel->parent), panel->parent,
|
||||
_("Error"), msg, _("OK"), NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
static void
|
||||
changeLanguageAction(WMWidget *w, void *data)
|
||||
{
|
||||
/*Panel *panel = (Panel*)data;*/
|
||||
WMMenuItem *mi;
|
||||
proplist_t pl;
|
||||
WMPropList *pl;
|
||||
|
||||
mi = WMGetPopUpButtonMenuItem(w, WMGetPopUpButtonSelectedItem(w));
|
||||
pl = WMGetMenuItemRepresentedObject(mi);
|
||||
@@ -348,6 +347,7 @@ changeLanguageAction(WMWidget *w, void *data)
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
|
||||
@@ -51,6 +51,5 @@ WPrefs_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
|
||||
WPrefs_LDADD = \
|
||||
$(top_builddir)/WINGs/libWINGs.a\
|
||||
$(top_builddir)/wrlib/libwraster.la \
|
||||
@LIBPL@ \
|
||||
@INTLIBS@
|
||||
|
||||
|
||||
@@ -947,27 +947,27 @@ freeItemData(ItemData *data)
|
||||
|
||||
|
||||
static ItemData*
|
||||
parseCommand(proplist_t item)
|
||||
parseCommand(WMPropList *item)
|
||||
{
|
||||
ItemData *data = NEW(ItemData);
|
||||
proplist_t p;
|
||||
WMPropList *p;
|
||||
char *command = NULL;
|
||||
char *parameter = NULL;
|
||||
char *shortcut = NULL;
|
||||
int i = 1;
|
||||
|
||||
|
||||
p = PLGetArrayElement(item, i++);
|
||||
command = PLGetString(p);
|
||||
p = WMGetFromPLArray(item, i++);
|
||||
command = WMGetFromPLString(p);
|
||||
if (strcmp(command, "SHORTCUT") == 0) {
|
||||
p = PLGetArrayElement(item, i++);
|
||||
shortcut = PLGetString(p);
|
||||
p = PLGetArrayElement(item, i++);
|
||||
command = PLGetString(p);
|
||||
p = WMGetFromPLArray(item, i++);
|
||||
shortcut = WMGetFromPLString(p);
|
||||
p = WMGetFromPLArray(item, i++);
|
||||
command = WMGetFromPLString(p);
|
||||
}
|
||||
p = PLGetArrayElement(item, i++);
|
||||
p = WMGetFromPLArray(item, i++);
|
||||
if (p)
|
||||
parameter = PLGetString(p);
|
||||
parameter = WMGetFromPLString(p);
|
||||
|
||||
if (strcmp(command, "EXEC") == 0 || strcmp(command, "SHEXEC") == 0) {
|
||||
|
||||
@@ -1438,31 +1438,31 @@ menuItemSelected(WEditMenuDelegate *delegate, WEditMenu *menu,
|
||||
|
||||
|
||||
static WEditMenu*
|
||||
buildSubmenu(_Panel *panel, proplist_t pl)
|
||||
buildSubmenu(_Panel *panel, WMPropList *pl)
|
||||
{
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
WEditMenu *menu;
|
||||
WEditMenuItem *item;
|
||||
char *title;
|
||||
proplist_t tp, bp;
|
||||
WMPropList *tp, *bp;
|
||||
int i;
|
||||
|
||||
tp = PLGetArrayElement(pl, 0);
|
||||
title = PLGetString(tp);
|
||||
tp = WMGetFromPLArray(pl, 0);
|
||||
title = WMGetFromPLString(tp);
|
||||
|
||||
menu = WCreateEditMenu(scr, title);
|
||||
|
||||
for (i = 1; i < PLGetNumberOfElements(pl); i++) {
|
||||
proplist_t pi;
|
||||
for (i = 1; i < WMGetPropListItemCount(pl); i++) {
|
||||
WMPropList *pi;
|
||||
|
||||
pi = PLGetArrayElement(pl, i);
|
||||
pi = WMGetFromPLArray(pl, i);
|
||||
|
||||
tp = PLGetArrayElement(pi, 0);
|
||||
bp = PLGetArrayElement(pi, 1);
|
||||
tp = WMGetFromPLArray(pi, 0);
|
||||
bp = WMGetFromPLArray(pi, 1);
|
||||
|
||||
title = PLGetString(tp);
|
||||
title = WMGetFromPLString(tp);
|
||||
|
||||
if (!bp || PLIsArray(bp)) { /* it's a submenu */
|
||||
if (!bp || WMIsPLArray(bp)) { /* it's a submenu */
|
||||
WEditMenu *submenu;
|
||||
|
||||
submenu = buildSubmenu(panel, pi);
|
||||
@@ -1494,17 +1494,17 @@ buildSubmenu(_Panel *panel, proplist_t pl)
|
||||
|
||||
|
||||
static void
|
||||
buildMenuFromPL(_Panel *panel, proplist_t pl)
|
||||
buildMenuFromPL(_Panel *panel, WMPropList *pl)
|
||||
{
|
||||
panel->menu = buildSubmenu(panel, pl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static proplist_t
|
||||
static WMPropList*
|
||||
getDefaultMenu(_Panel *panel)
|
||||
{
|
||||
proplist_t menu, pmenu;
|
||||
WMPropList *menu, *pmenu;
|
||||
char *menuPath, *gspath;
|
||||
|
||||
gspath = wusergnusteppath();
|
||||
@@ -1513,7 +1513,7 @@ getDefaultMenu(_Panel *panel)
|
||||
/* if there is a localized plmenu for the tongue put it's filename here */
|
||||
sprintf(menuPath, _("%s/Library/WindowMaker/plmenu"), gspath);
|
||||
|
||||
menu = PLGetProplistWithPath(menuPath);
|
||||
menu = WMReadPropListFromFile(menuPath);
|
||||
if (!menu) {
|
||||
wwarning("%s:could not read property list menu", menuPath);
|
||||
|
||||
@@ -1521,7 +1521,7 @@ getDefaultMenu(_Panel *panel)
|
||||
_("%s/Library/WindowMaker/plmenu"))!=0) {
|
||||
|
||||
sprintf(menuPath, "%s/Library/WindowMaker/plmenu", gspath);
|
||||
menu = PLGetProplistWithPath(menuPath);
|
||||
menu = WMReadPropListFromFile(menuPath);
|
||||
wwarning("%s:could not read property list menu", menuPath);
|
||||
}
|
||||
if (!menu) {
|
||||
@@ -1551,7 +1551,7 @@ showData(_Panel *panel)
|
||||
{
|
||||
char *gspath;
|
||||
char *menuPath;
|
||||
proplist_t pmenu;
|
||||
WMPropList *pmenu;
|
||||
|
||||
gspath = wusergnusteppath();
|
||||
|
||||
@@ -1559,9 +1559,9 @@ showData(_Panel *panel)
|
||||
strcpy(menuPath, gspath);
|
||||
strcat(menuPath, "/Defaults/WMRootMenu");
|
||||
|
||||
pmenu = PLGetProplistWithPath(menuPath);
|
||||
pmenu = WMReadPropListFromFile(menuPath);
|
||||
|
||||
if (!pmenu || !PLIsArray(pmenu)) {
|
||||
if (!pmenu || !WMIsPLArray(pmenu)) {
|
||||
int res;
|
||||
|
||||
res = WMRunAlertPanel(WMWidgetScreen(panel->parent), panel->parent,
|
||||
@@ -1576,7 +1576,7 @@ showData(_Panel *panel)
|
||||
pmenu = getDefaultMenu(panel);
|
||||
|
||||
if (!pmenu) {
|
||||
pmenu = PLMakeArrayFromElements(PLMakeString("Applications"),
|
||||
pmenu = WMCreatePLArray(WMCreatePLString("Applications"),
|
||||
NULL);
|
||||
}
|
||||
} else {
|
||||
@@ -1589,7 +1589,7 @@ showData(_Panel *panel)
|
||||
|
||||
buildMenuFromPL(panel, pmenu);
|
||||
|
||||
PLRelease(pmenu);
|
||||
WMReleasePropList(pmenu);
|
||||
}
|
||||
|
||||
|
||||
@@ -1606,21 +1606,21 @@ notblank(char *s)
|
||||
}
|
||||
|
||||
|
||||
static proplist_t
|
||||
static WMPropList*
|
||||
processData(char *title, ItemData *data)
|
||||
{
|
||||
proplist_t item;
|
||||
WMPropList *item;
|
||||
char *s1;
|
||||
static char *pscut = NULL;
|
||||
static char *pomenu = NULL;
|
||||
static WMPropList *pscut = NULL;
|
||||
static WMPropList *pomenu = NULL;
|
||||
int i;
|
||||
|
||||
if (!pscut) {
|
||||
pscut = PLMakeString("SHORTCUT");
|
||||
pomenu = PLMakeString("OPEN_MENU");
|
||||
pscut = WMCreatePLString("SHORTCUT");
|
||||
pomenu = WMCreatePLString("OPEN_MENU");
|
||||
}
|
||||
|
||||
item = PLMakeArrayFromElements(PLMakeString(title), NULL);
|
||||
item = WMCreatePLArray(WMCreatePLString(title), NULL);
|
||||
|
||||
|
||||
switch (data->type) {
|
||||
@@ -1638,39 +1638,39 @@ processData(char *title, ItemData *data)
|
||||
#endif
|
||||
|
||||
if (notblank(data->param.exec.shortcut)) {
|
||||
PLAppendArrayElement(item, pscut);
|
||||
PLAppendArrayElement(item,
|
||||
PLMakeString(data->param.exec.shortcut));
|
||||
WMAddToPLArray(item, pscut);
|
||||
WMAddToPLArray(item,
|
||||
WMCreatePLString(data->param.exec.shortcut));
|
||||
}
|
||||
|
||||
PLAppendArrayElement(item, PLMakeString(s1));
|
||||
PLAppendArrayElement(item, PLMakeString(data->param.exec.command));
|
||||
WMAddToPLArray(item, WMCreatePLString(s1));
|
||||
WMAddToPLArray(item, WMCreatePLString(data->param.exec.command));
|
||||
break;
|
||||
|
||||
case CommandInfo:
|
||||
if (notblank(data->param.command.shortcut)) {
|
||||
PLAppendArrayElement(item, pscut);
|
||||
PLAppendArrayElement(item,
|
||||
PLMakeString(data->param.command.shortcut));
|
||||
WMAddToPLArray(item, pscut);
|
||||
WMAddToPLArray(item,
|
||||
WMCreatePLString(data->param.command.shortcut));
|
||||
}
|
||||
|
||||
i = data->param.command.command;
|
||||
|
||||
PLAppendArrayElement(item, PLMakeString(commandNames[i]));
|
||||
WMAddToPLArray(item, WMCreatePLString(commandNames[i]));
|
||||
|
||||
switch (i) {
|
||||
case 3:
|
||||
case 4:
|
||||
if (data->param.command.parameter) {
|
||||
PLAppendArrayElement(item,
|
||||
PLMakeString(data->param.command.parameter));
|
||||
WMAddToPLArray(item,
|
||||
WMCreatePLString(data->param.command.parameter));
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: /* restart */
|
||||
if (data->param.command.parameter) {
|
||||
PLAppendArrayElement(item,
|
||||
PLMakeString(data->param.command.parameter));
|
||||
WMAddToPLArray(item,
|
||||
WMCreatePLString(data->param.command.parameter));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1680,17 +1680,17 @@ processData(char *title, ItemData *data)
|
||||
case PipeInfo:
|
||||
if (!data->param.pipe.command)
|
||||
return NULL;
|
||||
PLAppendArrayElement(item, pomenu);
|
||||
WMAddToPLArray(item, pomenu);
|
||||
s1 = wstrconcat("| ", data->param.pipe.command);
|
||||
PLAppendArrayElement(item, PLMakeString(s1));
|
||||
WMAddToPLArray(item, WMCreatePLString(s1));
|
||||
wfree(s1);
|
||||
break;
|
||||
|
||||
case ExternalInfo:
|
||||
if (!data->param.external.path)
|
||||
return NULL;
|
||||
PLAppendArrayElement(item, pomenu);
|
||||
PLAppendArrayElement(item, PLMakeString(data->param.external.path));
|
||||
WMAddToPLArray(item, pomenu);
|
||||
WMAddToPLArray(item, WMCreatePLString(data->param.external.path));
|
||||
break;
|
||||
|
||||
case DirectoryInfo:
|
||||
@@ -1705,7 +1705,7 @@ processData(char *title, ItemData *data)
|
||||
l += strlen(data->param.directory.command);
|
||||
l += 32;
|
||||
|
||||
PLAppendArrayElement(item, pomenu);
|
||||
WMAddToPLArray(item, pomenu);
|
||||
|
||||
tmp = wmalloc(l);
|
||||
sprintf(tmp, "%s%s WITH %s",
|
||||
@@ -1713,17 +1713,17 @@ processData(char *title, ItemData *data)
|
||||
data->param.directory.directory,
|
||||
data->param.directory.command);
|
||||
|
||||
PLAppendArrayElement(item, PLMakeString(tmp));
|
||||
WMAddToPLArray(item, WMCreatePLString(tmp));
|
||||
wfree(tmp);
|
||||
}
|
||||
break;
|
||||
|
||||
case WSMenuInfo:
|
||||
PLAppendArrayElement(item, PLMakeString("WORKSPACE_MENU"));
|
||||
WMAddToPLArray(item, WMCreatePLString("WORKSPACE_MENU"));
|
||||
break;
|
||||
|
||||
case WWindowListInfo:
|
||||
PLAppendArrayElement(item, PLMakeString("WINDOWS_MENU"));
|
||||
WMAddToPLArray(item, WMCreatePLString("WINDOWS_MENU"));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1735,20 +1735,20 @@ processData(char *title, ItemData *data)
|
||||
}
|
||||
|
||||
|
||||
static proplist_t
|
||||
static WMPropList*
|
||||
processSubmenu(WEditMenu *menu)
|
||||
{
|
||||
WEditMenuItem *item;
|
||||
proplist_t pmenu;
|
||||
proplist_t pl;
|
||||
WMPropList *pmenu;
|
||||
WMPropList *pl;
|
||||
char *s;
|
||||
int i;
|
||||
|
||||
|
||||
s = WGetEditMenuTitle(menu);
|
||||
pl = PLMakeString(s);
|
||||
pl = WMCreatePLString(s);
|
||||
|
||||
pmenu = PLMakeArrayFromElements(pl, NULL);
|
||||
pmenu = WMCreatePLArray(pl, NULL);
|
||||
|
||||
i = 0;
|
||||
while ((item = WGetEditMenuItem(menu, i++))) {
|
||||
@@ -1766,7 +1766,7 @@ processSubmenu(WEditMenu *menu)
|
||||
if (!pl)
|
||||
continue;
|
||||
|
||||
PLAppendArrayElement(pmenu, pl);
|
||||
WMAddToPLArray(pmenu, pl);
|
||||
}
|
||||
|
||||
return pmenu;
|
||||
@@ -1774,10 +1774,10 @@ processSubmenu(WEditMenu *menu)
|
||||
|
||||
|
||||
|
||||
static proplist_t
|
||||
static WMPropList*
|
||||
buildPLFromMenu(_Panel *panel)
|
||||
{
|
||||
proplist_t menu;
|
||||
WMPropList *menu;
|
||||
|
||||
menu = processSubmenu(panel->menu);
|
||||
|
||||
@@ -1790,18 +1790,16 @@ buildPLFromMenu(_Panel *panel)
|
||||
static void
|
||||
storeData(_Panel *panel)
|
||||
{
|
||||
proplist_t menu;
|
||||
WMPropList *menu;
|
||||
|
||||
if (panel->dontSave)
|
||||
return;
|
||||
|
||||
|
||||
menu = buildPLFromMenu(panel);
|
||||
|
||||
PLSetFilename(menu, PLMakeString(panel->menuPath));
|
||||
|
||||
PLSave(menu, YES);
|
||||
WMWritePropListToFile(menu, panel->menuPath, True);
|
||||
|
||||
PLRelease(menu);
|
||||
WMReleasePropList(menu);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -96,7 +96,6 @@ createPanel(Panel *p)
|
||||
{
|
||||
_Panel *panel = (_Panel*)p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
WMBox *hbox, *vbox;
|
||||
WMPixmap *icon;
|
||||
int i;
|
||||
char *buf1, *buf2;
|
||||
|
||||
@@ -196,8 +196,7 @@ doubleClick(WMWidget *w, void *data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
getButtonAction(char *str)
|
||||
{
|
||||
if (!str)
|
||||
@@ -217,6 +216,7 @@ getButtonAction(char *str)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
getWheelAction(char *str)
|
||||
{
|
||||
if (!str)
|
||||
|
||||
@@ -75,11 +75,11 @@ addPathToList(WMList *list, int index, char *path)
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
{
|
||||
proplist_t array, val;
|
||||
WMPropList *array, *val;
|
||||
int i;
|
||||
|
||||
array = GetObjectForKey("IconPath");
|
||||
if (!array || !PLIsArray(array)) {
|
||||
if (!array || !WMIsPLArray(array)) {
|
||||
if (array)
|
||||
wwarning(_("bad value in option IconPath. Using default path list"));
|
||||
addPathToList(panel->icoL, -1, "~/pixmaps");
|
||||
@@ -89,23 +89,23 @@ showData(_Panel *panel)
|
||||
addPathToList(panel->icoL, -1, "/usr/local/share/WindowMaker/Pixmaps");
|
||||
addPathToList(panel->icoL, -1, "/usr/share/WindowMaker/Icons");
|
||||
} else {
|
||||
for (i=0; i<PLGetNumberOfElements(array); i++) {
|
||||
val = PLGetArrayElement(array, i);
|
||||
addPathToList(panel->icoL, -1, PLGetString(val));
|
||||
for (i=0; i<WMGetPropListItemCount(array); i++) {
|
||||
val = WMGetFromPLArray(array, i);
|
||||
addPathToList(panel->icoL, -1, WMGetFromPLString(val));
|
||||
}
|
||||
}
|
||||
|
||||
array = GetObjectForKey("PixmapPath");
|
||||
if (!array || !PLIsArray(array)) {
|
||||
if (!array || !WMIsPLArray(array)) {
|
||||
if (array)
|
||||
wwarning(_("bad value in option PixmapPath. Using default path list"));
|
||||
addPathToList(panel->pixL, -1, "~/pixmaps");
|
||||
addPathToList(panel->pixL, -1, "~/GNUstep/Library/WindowMaker/Pixmaps");
|
||||
addPathToList(panel->pixL, -1, "/usr/local/share/WindowMaker/Pixmaps");
|
||||
} else {
|
||||
for (i=0; i<PLGetNumberOfElements(array); i++) {
|
||||
val = PLGetArrayElement(array, i);
|
||||
addPathToList(panel->pixL, -1, PLGetString(val));
|
||||
for (i=0; i<WMGetPropListItemCount(array); i++) {
|
||||
val = WMGetFromPLArray(array, i);
|
||||
addPathToList(panel->pixL, -1, WMGetFromPLString(val));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,24 +213,24 @@ paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
|
||||
static void
|
||||
storeData(_Panel *panel)
|
||||
{
|
||||
proplist_t list;
|
||||
proplist_t tmp;
|
||||
WMPropList *list;
|
||||
WMPropList *tmp;
|
||||
int i;
|
||||
char *p;
|
||||
|
||||
list = PLMakeArrayFromElements(NULL, NULL);
|
||||
list = WMCreatePLArray(NULL, NULL);
|
||||
for (i=0; i<WMGetListNumberOfRows(panel->icoL); i++) {
|
||||
p = WMGetListItem(panel->icoL, i)->text;
|
||||
tmp = PLMakeString(p);
|
||||
PLAppendArrayElement(list, tmp);
|
||||
tmp = WMCreatePLString(p);
|
||||
WMAddToPLArray(list, tmp);
|
||||
}
|
||||
SetObjectForKey(list, "IconPath");
|
||||
|
||||
list = PLMakeArrayFromElements(NULL, NULL);
|
||||
list = WMCreatePLArray(NULL, NULL);
|
||||
for (i=0; i<WMGetListNumberOfRows(panel->pixL); i++) {
|
||||
p = WMGetListItem(panel->pixL, i)->text;
|
||||
tmp = PLMakeString(p);
|
||||
PLAppendArrayElement(list, tmp);
|
||||
tmp = WMCreatePLString(p);
|
||||
WMAddToPLArray(list, tmp);
|
||||
}
|
||||
SetObjectForKey(list, "PixmapPath");
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ typedef struct _TexturePanel {
|
||||
int currentType;
|
||||
|
||||
|
||||
proplist_t pathList;
|
||||
WMPropList *pathList;
|
||||
|
||||
} _TexturePanel;
|
||||
|
||||
@@ -816,11 +816,11 @@ SetTexturePanelCancelAction(TexturePanel *panel, WMCallback *action, void *clien
|
||||
|
||||
|
||||
void
|
||||
SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
SetTexturePanelTexture(TexturePanel *panel, char *name, WMPropList *texture)
|
||||
{
|
||||
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||
char *str, *type;
|
||||
proplist_t p;
|
||||
WMPropList *p;
|
||||
WMColor *color;
|
||||
int i;
|
||||
char buffer[64];
|
||||
@@ -831,22 +831,22 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
if (!texture)
|
||||
return;
|
||||
|
||||
p = PLGetArrayElement(texture, 0);
|
||||
p = WMGetFromPLArray(texture, 0);
|
||||
if (!p) {
|
||||
goto bad_texture;
|
||||
}
|
||||
type = PLGetString(p);
|
||||
type = WMGetFromPLString(p);
|
||||
|
||||
/*...............................................*/
|
||||
if (strcasecmp(type, "solid")==0) {
|
||||
|
||||
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SOLID);
|
||||
|
||||
p = PLGetArrayElement(texture, 1);
|
||||
p = WMGetFromPLArray(texture, 1);
|
||||
if (!p) {
|
||||
str = "black";
|
||||
} else {
|
||||
str = PLGetString(p);
|
||||
str = WMGetFromPLString(p);
|
||||
}
|
||||
color = WMCreateNamedColor(scr, str, False);
|
||||
|
||||
@@ -860,11 +860,11 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
|
||||
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SGRADIENT);
|
||||
|
||||
p = PLGetArrayElement(texture, 1);
|
||||
p = WMGetFromPLArray(texture, 1);
|
||||
if (!p) {
|
||||
str = "black";
|
||||
} else {
|
||||
str = PLGetString(p);
|
||||
str = WMGetFromPLString(p);
|
||||
}
|
||||
color = WMCreateNamedColor(scr, str, False);
|
||||
|
||||
@@ -872,11 +872,11 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
|
||||
WMReleaseColor(color);
|
||||
|
||||
p = PLGetArrayElement(texture, 2);
|
||||
p = WMGetFromPLArray(texture, 2);
|
||||
if (!p) {
|
||||
str = "black";
|
||||
} else {
|
||||
str = PLGetString(p);
|
||||
str = WMGetFromPLString(p);
|
||||
}
|
||||
color = WMCreateNamedColor(scr, str, False);
|
||||
|
||||
@@ -896,21 +896,21 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
gradient = type[1];
|
||||
|
||||
WMSetTextFieldText(panel->imageT,
|
||||
PLGetString(PLGetArrayElement(texture, 1)));
|
||||
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
|
||||
if (panel->imageFile)
|
||||
wfree(panel->imageFile);
|
||||
panel->imageFile = wstrdup(PLGetString(PLGetArrayElement(texture, 1)));
|
||||
panel->imageFile = wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 1)));
|
||||
|
||||
|
||||
i = 180;
|
||||
sscanf(PLGetString(PLGetArrayElement(texture, 2)), "%i", &i);
|
||||
sscanf(WMGetFromPLString(WMGetFromPLArray(texture, 2)), "%i", &i);
|
||||
WMSetSliderValue(panel->topaS, i);
|
||||
|
||||
p = PLGetArrayElement(texture, 3);
|
||||
p = WMGetFromPLArray(texture, 3);
|
||||
if (!p) {
|
||||
str = "black";
|
||||
} else {
|
||||
str = PLGetString(p);
|
||||
str = WMGetFromPLString(p);
|
||||
}
|
||||
color = WMCreateNamedColor(scr, str, False);
|
||||
|
||||
@@ -918,11 +918,11 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
|
||||
WMReleaseColor(color);
|
||||
|
||||
p = PLGetArrayElement(texture, 4);
|
||||
p = WMGetFromPLArray(texture, 4);
|
||||
if (!p) {
|
||||
str = "black";
|
||||
} else {
|
||||
str = PLGetString(p);
|
||||
str = WMGetFromPLString(p);
|
||||
}
|
||||
color = WMCreateNamedColor(scr, str, False);
|
||||
|
||||
@@ -931,12 +931,12 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
WMReleaseColor(color);
|
||||
|
||||
WMSetTextFieldText(panel->imageT,
|
||||
PLGetString(PLGetArrayElement(texture, 1)));
|
||||
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
|
||||
|
||||
if (panel->imageFile)
|
||||
wfree(panel->imageFile);
|
||||
if ((panel->imageFile = wfindfileinarray(panel->pathList,
|
||||
PLGetString(PLGetArrayElement(texture, 1)))) != NULL) {
|
||||
WMGetFromPLString(WMGetFromPLArray(texture, 1)))) != NULL) {
|
||||
|
||||
panel->image = RLoadImage(WMScreenRContext(scr), panel->imageFile, 0);
|
||||
updateTGradImage(panel);
|
||||
@@ -959,11 +959,11 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
|
||||
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_GRADIENT);
|
||||
|
||||
p = PLGetArrayElement(texture, 1);
|
||||
p = WMGetFromPLArray(texture, 1);
|
||||
if (!p) {
|
||||
str = "black";
|
||||
} else {
|
||||
str = PLGetString(p);
|
||||
str = WMGetFromPLString(p);
|
||||
}
|
||||
color = WMCreateNamedColor(scr, str, False);
|
||||
|
||||
@@ -971,15 +971,15 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
|
||||
WMReleaseColor(color);
|
||||
|
||||
for (i = 2; i < PLGetNumberOfElements(texture); i++) {
|
||||
for (i = 2; i < WMGetPropListItemCount(texture); i++) {
|
||||
RColor *rgb;
|
||||
XColor xcolor;
|
||||
|
||||
p = PLGetArrayElement(texture, i);
|
||||
p = WMGetFromPLArray(texture, i);
|
||||
if (!p) {
|
||||
str = "black";
|
||||
} else {
|
||||
str = PLGetString(p);
|
||||
str = WMGetFromPLString(p);
|
||||
}
|
||||
|
||||
XParseColor(WMScreenDisplay(scr), WMScreenRContext(scr)->cmap,
|
||||
@@ -1023,15 +1023,15 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
}
|
||||
|
||||
WMSetTextFieldText(panel->imageT,
|
||||
PLGetString(PLGetArrayElement(texture, 1)));
|
||||
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
|
||||
|
||||
if (panel->imageFile)
|
||||
wfree(panel->imageFile);
|
||||
panel->imageFile = wfindfileinarray(panel->pathList,
|
||||
PLGetString(PLGetArrayElement(texture, 1)));
|
||||
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
|
||||
|
||||
color = WMCreateNamedColor(scr,
|
||||
PLGetString(PLGetArrayElement(texture, 2)), False);
|
||||
WMGetFromPLString(WMGetFromPLArray(texture, 2)), False);
|
||||
WMSetColorWellColor(panel->defcW, color);
|
||||
WMReleaseColor(color);
|
||||
|
||||
@@ -1060,7 +1060,7 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
||||
return;
|
||||
|
||||
bad_texture:
|
||||
str = PLGetDescription(texture);
|
||||
str = WMGetPropListDescription(texture, False);
|
||||
wwarning(_("error creating texture %s"), str);
|
||||
wfree(str);
|
||||
|
||||
@@ -1076,11 +1076,10 @@ GetTexturePanelTextureName(TexturePanel *panel)
|
||||
}
|
||||
|
||||
|
||||
|
||||
proplist_t
|
||||
WMPropList*
|
||||
GetTexturePanelTexture(TexturePanel *panel)
|
||||
{
|
||||
proplist_t prop = NULL;
|
||||
WMPropList *prop = NULL;
|
||||
WMColor *color;
|
||||
char *str, *str2;
|
||||
char buff[32];
|
||||
@@ -1092,8 +1091,8 @@ GetTexturePanelTexture(TexturePanel *panel)
|
||||
case TYPE_SOLID:
|
||||
color = WMGetColorWellColor(panel->defcW);
|
||||
str = WMGetColorRGBDescription(color);
|
||||
prop = PLMakeArrayFromElements(PLMakeString("solid"),
|
||||
PLMakeString(str), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("solid"),
|
||||
WMCreatePLString(str), NULL);
|
||||
wfree(str);
|
||||
|
||||
break;
|
||||
@@ -1104,24 +1103,24 @@ GetTexturePanelTexture(TexturePanel *panel)
|
||||
|
||||
switch (WMGetPopUpButtonSelectedItem(panel->arrP)) {
|
||||
case PTYPE_SCALE:
|
||||
prop = PLMakeArrayFromElements(PLMakeString("spixmap"),
|
||||
PLMakeString(panel->imageFile),
|
||||
PLMakeString(str), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("spixmap"),
|
||||
WMCreatePLString(panel->imageFile),
|
||||
WMCreatePLString(str), NULL);
|
||||
break;
|
||||
case PTYPE_MAXIMIZE:
|
||||
prop = PLMakeArrayFromElements(PLMakeString("mpixmap"),
|
||||
PLMakeString(panel->imageFile),
|
||||
PLMakeString(str), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("mpixmap"),
|
||||
WMCreatePLString(panel->imageFile),
|
||||
WMCreatePLString(str), NULL);
|
||||
break;
|
||||
case PTYPE_CENTER:
|
||||
prop = PLMakeArrayFromElements(PLMakeString("cpixmap"),
|
||||
PLMakeString(panel->imageFile),
|
||||
PLMakeString(str), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("cpixmap"),
|
||||
WMCreatePLString(panel->imageFile),
|
||||
WMCreatePLString(str), NULL);
|
||||
break;
|
||||
case PTYPE_TILE:
|
||||
prop = PLMakeArrayFromElements(PLMakeString("tpixmap"),
|
||||
PLMakeString(panel->imageFile),
|
||||
PLMakeString(str), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("tpixmap"),
|
||||
WMCreatePLString(panel->imageFile),
|
||||
WMCreatePLString(str), NULL);
|
||||
break;
|
||||
}
|
||||
wfree(str);
|
||||
@@ -1137,23 +1136,23 @@ GetTexturePanelTexture(TexturePanel *panel)
|
||||
sprintf(buff, "%i", WMGetSliderValue(panel->topaS));
|
||||
|
||||
if (WMGetButtonSelected(panel->dirdB)) {
|
||||
prop = PLMakeArrayFromElements(PLMakeString("tdgradient"),
|
||||
PLMakeString(panel->imageFile),
|
||||
PLMakeString(buff),
|
||||
PLMakeString(str),
|
||||
PLMakeString(str2), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("tdgradient"),
|
||||
WMCreatePLString(panel->imageFile),
|
||||
WMCreatePLString(buff),
|
||||
WMCreatePLString(str),
|
||||
WMCreatePLString(str2), NULL);
|
||||
} else if (WMGetButtonSelected(panel->dirvB)) {
|
||||
prop = PLMakeArrayFromElements(PLMakeString("tvgradient"),
|
||||
PLMakeString(panel->imageFile),
|
||||
PLMakeString(buff),
|
||||
PLMakeString(str),
|
||||
PLMakeString(str2), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("tvgradient"),
|
||||
WMCreatePLString(panel->imageFile),
|
||||
WMCreatePLString(buff),
|
||||
WMCreatePLString(str),
|
||||
WMCreatePLString(str2), NULL);
|
||||
} else {
|
||||
prop = PLMakeArrayFromElements(PLMakeString("thgradient"),
|
||||
PLMakeString(panel->imageFile),
|
||||
PLMakeString(buff),
|
||||
PLMakeString(str),
|
||||
PLMakeString(str2), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("thgradient"),
|
||||
WMCreatePLString(panel->imageFile),
|
||||
WMCreatePLString(buff),
|
||||
WMCreatePLString(str),
|
||||
WMCreatePLString(str2), NULL);
|
||||
}
|
||||
wfree(str);
|
||||
wfree(str2);
|
||||
@@ -1168,17 +1167,17 @@ GetTexturePanelTexture(TexturePanel *panel)
|
||||
str2 = WMGetColorRGBDescription(color);
|
||||
|
||||
if (WMGetButtonSelected(panel->dirdB)) {
|
||||
prop = PLMakeArrayFromElements(PLMakeString("dgradient"),
|
||||
PLMakeString(str),
|
||||
PLMakeString(str2), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("dgradient"),
|
||||
WMCreatePLString(str),
|
||||
WMCreatePLString(str2), NULL);
|
||||
} else if (WMGetButtonSelected(panel->dirvB)) {
|
||||
prop = PLMakeArrayFromElements(PLMakeString("vgradient"),
|
||||
PLMakeString(str),
|
||||
PLMakeString(str2), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("vgradient"),
|
||||
WMCreatePLString(str),
|
||||
WMCreatePLString(str2), NULL);
|
||||
} else {
|
||||
prop = PLMakeArrayFromElements(PLMakeString("hgradient"),
|
||||
PLMakeString(str),
|
||||
PLMakeString(str2), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("hgradient"),
|
||||
WMCreatePLString(str),
|
||||
WMCreatePLString(str2), NULL);
|
||||
}
|
||||
wfree(str);
|
||||
wfree(str2);
|
||||
@@ -1189,14 +1188,14 @@ GetTexturePanelTexture(TexturePanel *panel)
|
||||
str = WMGetColorRGBDescription(color);
|
||||
|
||||
if (WMGetButtonSelected(panel->dirdB)) {
|
||||
prop = PLMakeArrayFromElements(PLMakeString("mdgradient"),
|
||||
PLMakeString(str), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("mdgradient"),
|
||||
WMCreatePLString(str), NULL);
|
||||
} else if (WMGetButtonSelected(panel->dirvB)) {
|
||||
prop = PLMakeArrayFromElements(PLMakeString("mvgradient"),
|
||||
PLMakeString(str), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("mvgradient"),
|
||||
WMCreatePLString(str), NULL);
|
||||
} else {
|
||||
prop = PLMakeArrayFromElements(PLMakeString("mhgradient"),
|
||||
PLMakeString(str), NULL);
|
||||
prop = WMCreatePLArray(WMCreatePLString("mhgradient"),
|
||||
WMCreatePLString(str), NULL);
|
||||
}
|
||||
wfree(str);
|
||||
|
||||
@@ -1210,7 +1209,7 @@ GetTexturePanelTexture(TexturePanel *panel)
|
||||
|
||||
sprintf(buff, "#%02x%02x%02x", rgb->red, rgb->green, rgb->blue);
|
||||
|
||||
PLAppendArrayElement(prop, PLMakeString(buff));
|
||||
WMAddToPLArray(prop, WMCreatePLString(buff));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1222,7 +1221,7 @@ GetTexturePanelTexture(TexturePanel *panel)
|
||||
|
||||
|
||||
void
|
||||
SetTexturePanelPixmapPath(TexturePanel *panel, proplist_t array)
|
||||
SetTexturePanelPixmapPath(TexturePanel *panel, WMPropList *array)
|
||||
{
|
||||
panel->pathList = array;
|
||||
}
|
||||
@@ -1653,7 +1652,7 @@ int main(int argc, char **argv)
|
||||
SetTexturePanelCancelAction(panel,(WMAction*)testCancelButton,panel);
|
||||
|
||||
SetTexturePanelTexture(panel, "pinky",
|
||||
PLGetProplistWithDescription("(mdgradient, pink, red, blue, yellow)"));
|
||||
WMCreatePropListFromDescription("(mdgradient, pink, red, blue, yellow)"));
|
||||
|
||||
ShowTexturePanel(panel);
|
||||
|
||||
|
||||
@@ -37,12 +37,12 @@ void ShowTexturePanel(TexturePanel *panel);
|
||||
void HideTexturePanel(TexturePanel *panel);
|
||||
|
||||
void SetTexturePanelTexture(TexturePanel *panel, char *name,
|
||||
proplist_t texture);
|
||||
WMPropList *texture);
|
||||
|
||||
|
||||
char *GetTexturePanelTextureName(TexturePanel *panel);
|
||||
|
||||
proplist_t GetTexturePanelTexture(TexturePanel *panel);
|
||||
WMPropList *GetTexturePanelTexture(TexturePanel *panel);
|
||||
|
||||
RImage *RenderTexturePanelTexture(TexturePanel *panel, unsigned width,
|
||||
unsigned height);
|
||||
@@ -53,7 +53,7 @@ void SetTexturePanelOkAction(TexturePanel *panel, WMCallback *action,
|
||||
void SetTexturePanelCancelAction(TexturePanel *panel, WMCallback *action,
|
||||
void *clientData);
|
||||
|
||||
void SetTexturePanelPixmapPath(TexturePanel *panel, proplist_t array);
|
||||
void SetTexturePanelPixmapPath(TexturePanel *panel, WMPropList *array);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -96,9 +96,10 @@ typedef struct _WPrefs {
|
||||
static _WPrefs WPrefs;
|
||||
|
||||
/* system wide defaults dictionary. Read-only */
|
||||
static proplist_t GlobalDB = NULL;
|
||||
static WMPropList *GlobalDB = NULL;
|
||||
/* user defaults dictionary */
|
||||
static proplist_t WindowMakerDB = NULL;
|
||||
static WMPropList *WindowMakerDB = NULL;
|
||||
static char *WindowMakerDBPath = NULL;
|
||||
|
||||
|
||||
static Bool TIFFOK = False;
|
||||
@@ -128,9 +129,9 @@ static void
|
||||
save(WMWidget *w, void *data)
|
||||
{
|
||||
int i;
|
||||
proplist_t p1, p2;
|
||||
proplist_t keyList;
|
||||
proplist_t key;
|
||||
WMPropList *p1, *p2;
|
||||
WMPropList *keyList;
|
||||
WMPropList *key;
|
||||
char *msg = "Reconfigure";
|
||||
XEvent ev;
|
||||
|
||||
@@ -143,30 +144,30 @@ save(WMWidget *w, void *data)
|
||||
}
|
||||
/* puts("compressing data");*/
|
||||
/* compare the user dictionary with the global and remove redundant data */
|
||||
keyList = PLGetAllDictionaryKeys(GlobalDB);
|
||||
/* puts(PLGetDescription(WindowMakerDB));*/
|
||||
for (i=0; i<PLGetNumberOfElements(keyList); i++) {
|
||||
key = PLGetArrayElement(keyList, i);
|
||||
keyList = WMGetPLDictionaryKeys(GlobalDB);
|
||||
/* puts(WMGetPropListDescription(WindowMakerDB, False));*/
|
||||
for (i=0; i<WMGetPropListItemCount(keyList); i++) {
|
||||
key = WMGetFromPLArray(keyList, i);
|
||||
|
||||
/* We don't have this value anyway, so no problem.
|
||||
* Probably a new option */
|
||||
p1 = PLGetDictionaryEntry(WindowMakerDB, key);
|
||||
p1 = WMGetFromPLDictionary(WindowMakerDB, key);
|
||||
if (!p1)
|
||||
continue;
|
||||
/* The global doesn't have it, so no problem either. */
|
||||
p2 = PLGetDictionaryEntry(GlobalDB, key);
|
||||
p2 = WMGetFromPLDictionary(GlobalDB, key);
|
||||
if (!p2)
|
||||
continue;
|
||||
/* If both values are the same, don't save. */
|
||||
if (PLIsEqual(p1, p2))
|
||||
PLRemoveDictionaryEntry(WindowMakerDB, key);
|
||||
if (WMIsPropListEqualTo(p1, p2))
|
||||
WMRemoveFromPLDictionary(WindowMakerDB, key);
|
||||
}
|
||||
/* puts(PLGetDescription(WindowMakerDB));*/
|
||||
PLRelease(keyList);
|
||||
/* puts(WMGetPropListDescription(WindowMakerDB, False));*/
|
||||
WMReleasePropList(keyList);
|
||||
/* puts("storing data");*/
|
||||
|
||||
PLSave(WindowMakerDB, YES);
|
||||
|
||||
WMWritePropListToFile(WindowMakerDB, WindowMakerDBPath, True);
|
||||
|
||||
|
||||
memset(&ev, 0, sizeof(XEvent));
|
||||
|
||||
@@ -738,7 +739,7 @@ GetWindow(Panel *panel)
|
||||
static void
|
||||
loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
||||
{
|
||||
proplist_t db, gdb;
|
||||
WMPropList *db, *gdb;
|
||||
char *path;
|
||||
FILE *file;
|
||||
char buffer[1024];
|
||||
@@ -746,11 +747,12 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
||||
int v1, v2, v3;
|
||||
|
||||
path = wdefaultspathfordomain("WindowMaker");
|
||||
WindowMakerDBPath = path;
|
||||
|
||||
db = PLGetProplistWithPath(path);
|
||||
db = WMReadPropListFromFile(path);
|
||||
if (db) {
|
||||
if (!PLIsDictionary(db)) {
|
||||
PLRelease(db);
|
||||
if (!WMIsPLDictionary(db)) {
|
||||
WMReleasePropList(db);
|
||||
db = NULL;
|
||||
sprintf(mbuf, _("Window Maker domain (%s) is corrupted!"), path);
|
||||
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
|
||||
@@ -760,7 +762,6 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
||||
path);
|
||||
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
|
||||
}
|
||||
wfree(path);
|
||||
|
||||
path = getenv("WMAKER_BIN_NAME");
|
||||
if (!path)
|
||||
@@ -827,10 +828,11 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
||||
if (file)
|
||||
pclose(file);
|
||||
|
||||
gdb = PLGetProplistWithPath(buffer);
|
||||
gdb = WMReadPropListFromFile(buffer);
|
||||
|
||||
if (gdb) {
|
||||
if (!PLIsDictionary(gdb)) {
|
||||
PLRelease(gdb);
|
||||
if (!WMIsPLDictionary(gdb)) {
|
||||
WMReleasePropList(gdb);
|
||||
gdb = NULL;
|
||||
sprintf(mbuf, _("Window Maker domain (%s) is corrupted!"), buffer);
|
||||
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
|
||||
@@ -842,10 +844,10 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
||||
}
|
||||
|
||||
if (!db) {
|
||||
db = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||
db = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||
}
|
||||
if (!gdb) {
|
||||
gdb = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||
gdb = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
GlobalDB = gdb;
|
||||
@@ -854,89 +856,89 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
||||
}
|
||||
|
||||
|
||||
proplist_t
|
||||
WMPropList*
|
||||
GetObjectForKey(char *defaultName)
|
||||
{
|
||||
proplist_t object = NULL;
|
||||
proplist_t key = PLMakeString(defaultName);
|
||||
WMPropList *object = NULL;
|
||||
WMPropList *key = WMCreatePLString(defaultName);
|
||||
|
||||
object = PLGetDictionaryEntry(WindowMakerDB, key);
|
||||
object = WMGetFromPLDictionary(WindowMakerDB, key);
|
||||
if (!object)
|
||||
object = PLGetDictionaryEntry(GlobalDB, key);
|
||||
object = WMGetFromPLDictionary(GlobalDB, key);
|
||||
|
||||
PLRelease(key);
|
||||
WMReleasePropList(key);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SetObjectForKey(proplist_t object, char *defaultName)
|
||||
SetObjectForKey(WMPropList *object, char *defaultName)
|
||||
{
|
||||
proplist_t key = PLMakeString(defaultName);
|
||||
WMPropList *key = WMCreatePLString(defaultName);
|
||||
|
||||
PLInsertDictionaryEntry(WindowMakerDB, key, object);
|
||||
PLRelease(key);
|
||||
WMPutInPLDictionary(WindowMakerDB, key, object);
|
||||
WMReleasePropList(key);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RemoveObjectForKey(char *defaultName)
|
||||
{
|
||||
proplist_t key = PLMakeString(defaultName);
|
||||
WMPropList *key = WMCreatePLString(defaultName);
|
||||
|
||||
PLRemoveDictionaryEntry(WindowMakerDB, key);
|
||||
WMRemoveFromPLDictionary(WindowMakerDB, key);
|
||||
|
||||
PLRelease(key);
|
||||
WMReleasePropList(key);
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
GetStringForKey(char *defaultName)
|
||||
{
|
||||
proplist_t val;
|
||||
WMPropList *val;
|
||||
|
||||
val = GetObjectForKey(defaultName);
|
||||
|
||||
if (!val)
|
||||
return NULL;
|
||||
|
||||
if (!PLIsString(val))
|
||||
if (!WMIsPLString(val))
|
||||
return NULL;
|
||||
|
||||
return PLGetString(val);
|
||||
return WMGetFromPLString(val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
proplist_t
|
||||
WMPropList*
|
||||
GetArrayForKey(char *defaultName)
|
||||
{
|
||||
proplist_t val;
|
||||
WMPropList *val;
|
||||
|
||||
val = GetObjectForKey(defaultName);
|
||||
|
||||
if (!val)
|
||||
return NULL;
|
||||
|
||||
if (!PLIsArray(val))
|
||||
if (!WMIsPLArray(val))
|
||||
return NULL;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
proplist_t
|
||||
WMPropList*
|
||||
GetDictionaryForKey(char *defaultName)
|
||||
{
|
||||
proplist_t val;
|
||||
WMPropList *val;
|
||||
|
||||
val = GetObjectForKey(defaultName);
|
||||
|
||||
if (!val)
|
||||
return NULL;
|
||||
|
||||
if (!PLIsDictionary(val))
|
||||
if (!WMIsPLDictionary(val))
|
||||
return NULL;
|
||||
|
||||
return val;
|
||||
@@ -946,7 +948,7 @@ GetDictionaryForKey(char *defaultName)
|
||||
int
|
||||
GetIntegerForKey(char *defaultName)
|
||||
{
|
||||
proplist_t val;
|
||||
WMPropList *val;
|
||||
char *str;
|
||||
int value;
|
||||
|
||||
@@ -955,10 +957,10 @@ GetIntegerForKey(char *defaultName)
|
||||
if (!val)
|
||||
return 0;
|
||||
|
||||
if (!PLIsString(val))
|
||||
if (!WMIsPLString(val))
|
||||
return 0;
|
||||
|
||||
str = PLGetString(val);
|
||||
str = WMGetFromPLString(val);
|
||||
if (!str)
|
||||
return 0;
|
||||
|
||||
@@ -996,14 +998,14 @@ GetBoolForKey(char *defaultName)
|
||||
void
|
||||
SetIntegerForKey(int value, char *defaultName)
|
||||
{
|
||||
proplist_t object;
|
||||
WMPropList *object;
|
||||
char buffer[128];
|
||||
|
||||
sprintf(buffer, "%i", value);
|
||||
object = PLMakeString(buffer);
|
||||
object = WMCreatePLString(buffer);
|
||||
|
||||
SetObjectForKey(object, defaultName);
|
||||
PLRelease(object);
|
||||
WMReleasePropList(object);
|
||||
}
|
||||
|
||||
|
||||
@@ -1011,23 +1013,23 @@ SetIntegerForKey(int value, char *defaultName)
|
||||
void
|
||||
SetStringForKey(char *value, char *defaultName)
|
||||
{
|
||||
proplist_t object;
|
||||
WMPropList *object;
|
||||
|
||||
object = PLMakeString(value);
|
||||
object = WMCreatePLString(value);
|
||||
|
||||
SetObjectForKey(object, defaultName);
|
||||
PLRelease(object);
|
||||
WMReleasePropList(object);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SetBoolForKey(Bool value, char *defaultName)
|
||||
{
|
||||
static proplist_t yes = NULL, no = NULL;
|
||||
static WMPropList *yes = NULL, *no = NULL;
|
||||
|
||||
if (!yes) {
|
||||
yes = PLMakeString("YES");
|
||||
no = PLMakeString("NO");
|
||||
yes = WMCreatePLString("YES");
|
||||
no = WMCreatePLString("NO");
|
||||
}
|
||||
|
||||
SetObjectForKey(value ? yes : no, defaultName);
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include <proplist.h>
|
||||
|
||||
#include <wraster.h>
|
||||
|
||||
#include <WINGs/WINGs.h>
|
||||
@@ -85,9 +83,9 @@ WMWindow *GetWindow(Panel *panel);
|
||||
|
||||
/* manipulate the dictionary for the WindowMaker domain */
|
||||
|
||||
proplist_t GetObjectForKey(char *defaultName);
|
||||
WMPropList *GetObjectForKey(char *defaultName);
|
||||
|
||||
void SetObjectForKey(proplist_t object, char *defaultName);
|
||||
void SetObjectForKey(WMPropList *object, char *defaultName);
|
||||
|
||||
void RemoveObjectForKey(char *defaultName);
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ static void
|
||||
showData(_Panel *panel)
|
||||
{
|
||||
char *str;
|
||||
proplist_t arr;
|
||||
WMPropList *arr;
|
||||
int x, y;
|
||||
|
||||
str = GetStringForKey("WindowPlacement");
|
||||
@@ -159,12 +159,12 @@ showData(_Panel *panel)
|
||||
|
||||
x = 0;
|
||||
y = 0;
|
||||
if (arr && (!PLIsArray(arr) || PLGetNumberOfElements(arr)!=2)) {
|
||||
if (arr && (!WMIsPLArray(arr) || WMGetPropListItemCount(arr)!=2)) {
|
||||
wwarning(_("invalid data in option WindowPlaceOrigin. Using default (0,0)"));
|
||||
} else {
|
||||
if (arr) {
|
||||
x = atoi(PLGetString(PLGetArrayElement(arr, 0)));
|
||||
y = atoi(PLGetString(PLGetArrayElement(arr, 1)));
|
||||
x = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 0)));
|
||||
y = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ showData(_Panel *panel)
|
||||
static void
|
||||
storeData(_Panel *panel)
|
||||
{
|
||||
proplist_t arr;
|
||||
WMPropList *arr;
|
||||
char x[16], y[16];
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->miconB), "NoWindowOverIcons");
|
||||
@@ -206,11 +206,11 @@ storeData(_Panel *panel)
|
||||
"WindowPlacement");
|
||||
sprintf(x, "%i", WMGetSliderValue(panel->hsli));
|
||||
sprintf(y, "%i", WMGetSliderValue(panel->vsli));
|
||||
arr = PLMakeArrayFromElements(PLMakeString(x), PLMakeString(y), NULL);
|
||||
arr = WMCreatePLArray(WMCreatePLString(x), WMCreatePLString(y), NULL);
|
||||
SetObjectForKey(arr, "WindowPlaceOrigin");
|
||||
SetIntegerForKey(WMGetSliderValue(panel->resS), "EdgeResistance");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->resrB), "Attraction");
|
||||
PLRelease(arr);
|
||||
WMReleasePropList(arr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,21 +53,6 @@ wAbort(Bool foo)
|
||||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
stringCompareHook(proplist_t pl1, proplist_t pl2)
|
||||
{
|
||||
char *str1, *str2;
|
||||
|
||||
str1 = PLGetString(pl1);
|
||||
str2 = PLGetString(pl2);
|
||||
|
||||
if (strcasecmp(str1, str2)==0)
|
||||
return YES;
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_help(char *progname)
|
||||
{
|
||||
@@ -177,7 +162,7 @@ main(int argc, char **argv)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
PLSetStringCmpHook(stringCompareHook);
|
||||
WMPLSetCaseSensitive(False);
|
||||
|
||||
Initialize(scr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user