~ubuntu-branches/ubuntu/karmic/fsviewer/karmic

« back to all changes in this revision

Viewing changes to src/attribsInspector.c

  • Committer: Bazaar Package Importer
  • Author(s): Francois Gurin
  • Date: 2004-08-12 16:13:27 UTC
  • mfrom: (1.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040812161327-4b2uq9v4gmxpgp9t
Tags: 0.2.5-6
* Fix ICONDIR problem  (closes: #261880)
* Fix FTBFS problems with patched api changes and dependency on libwraster-dev (closes: #280283)
* Implemented work around for BadWindow error (re: #288605)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* attribsInspector.c */
 
2
 
1
3
#include <time.h>
2
4
#include <WINGs/WINGsP.h>
3
5
#include <grp.h>
10
12
#include "FSViewer.h"
11
13
#include "FSUtils.h"
12
14
#include "timestampWidget.h"
13
 
#include "config.h"
14
15
 
 
16
/* dimensions of Panel */
15
17
#define WIDTH               272
16
18
#define HEIGHT              272
 
19
/* dimensions of PermissionsFrame */
17
20
#define PERM_WIDTH          180
18
21
#define PERM_HEIGHT          92
19
22
#define LABEL_HEIGHT         16
73
76
    WMButton     *okBtn;
74
77
    WMButton     *revertBtn;
75
78
 
 
79
    WMLabel      *linkToLabel; /*Color changes grey/black if file is link*/
76
80
    WMLabel      *linkLabel;
77
81
    WMLabel      *sizeLabel;
78
82
    WMLabel      *ownerLabel;
86
90
 
87
91
} _Panel;
88
92
 
89
 
 
 
93
/* transfer permission data from memory to panel buttons */
90
94
static void
91
 
setPermissions(_Panel *panel)
 
95
showPermissions(_Panel *panel)
92
96
{
93
97
    
94
 
    if(panel->currentPerm & S_IRUSR)
 
98
    if (panel->currentPerm & S_IRUSR)
95
99
        WMSetButtonSelected(panel->permBtn[0][0], 1);
96
100
    else
97
101
        WMSetButtonSelected(panel->permBtn[0][0], 0);
98
102
 
99
 
    if(panel->currentPerm & S_IWUSR)
 
103
    if (panel->currentPerm & S_IWUSR)
100
104
        WMSetButtonSelected(panel->permBtn[1][0], 1);
101
105
    else
102
106
        WMSetButtonSelected(panel->permBtn[1][0], 0);
103
 
    if(panel->currentPerm & S_IXUSR)
 
107
    if (panel->currentPerm & S_IXUSR)
104
108
        WMSetButtonSelected(panel->permBtn[2][0], 1);
105
109
    else
106
110
        WMSetButtonSelected(panel->permBtn[2][0], 0);
107
 
    if(panel->currentPerm & S_IRGRP)
 
111
    if (panel->currentPerm & S_IRGRP)
108
112
        WMSetButtonSelected(panel->permBtn[0][1], 1);
109
113
    else
110
114
        WMSetButtonSelected(panel->permBtn[0][1], 0);
111
 
    if(panel->currentPerm & S_IWGRP)
 
115
    if (panel->currentPerm & S_IWGRP)
112
116
        WMSetButtonSelected(panel->permBtn[1][1], 1);
113
117
    else
114
118
        WMSetButtonSelected(panel->permBtn[1][1], 0);
115
 
    if(panel->currentPerm & S_IXGRP)
 
119
    if (panel->currentPerm & S_IXGRP)
116
120
        WMSetButtonSelected(panel->permBtn[2][1], 1);
117
121
    else
118
122
        WMSetButtonSelected(panel->permBtn[2][1], 0);
119
 
    if(panel->currentPerm & S_IROTH)
 
123
    if (panel->currentPerm & S_IROTH)
120
124
        WMSetButtonSelected(panel->permBtn[0][2], 1);
121
125
    else
122
126
        WMSetButtonSelected(panel->permBtn[0][2], 0);
123
 
    if(panel->currentPerm & S_IWOTH)
 
127
    if (panel->currentPerm & S_IWOTH)
124
128
        WMSetButtonSelected(panel->permBtn[1][2], 1);
125
129
    else
126
130
        WMSetButtonSelected(panel->permBtn[1][2], 0);
127
 
    if(panel->currentPerm & S_IXOTH)
 
131
    if (panel->currentPerm & S_IXOTH)
128
132
        WMSetButtonSelected(panel->permBtn[2][2], 1);
129
133
    else
130
134
        WMSetButtonSelected(panel->permBtn[2][2], 0);
131
135
 
132
136
}
133
137
 
 
138
/* store permission data from file to memory */
134
139
static void
135
 
initPermissions(_Panel *panel, struct stat *st)
 
140
setPermissions(_Panel *panel, struct stat *st)
136
141
{
137
 
 
138
142
    panel->currentPerm &= 0;
139
143
 
140
 
    if(st->st_mode & S_IRUSR)
 
144
    if (st->st_mode & S_IRUSR)
141
145
         panel->currentPerm |= S_IRUSR;
142
 
    if(st->st_mode & S_IWUSR)
 
146
    if (st->st_mode & S_IWUSR)
143
147
         panel->currentPerm |= S_IWUSR;
144
 
    if(st->st_mode & S_IXUSR)
 
148
    if (st->st_mode & S_IXUSR)
145
149
         panel->currentPerm |= S_IXUSR;
146
 
    if(st->st_mode & S_IRGRP)
 
150
    if (st->st_mode & S_IRGRP)
147
151
         panel->currentPerm |= S_IRGRP;
148
 
    if(st->st_mode & S_IWGRP)
 
152
    if (st->st_mode & S_IWGRP)
149
153
         panel->currentPerm |= S_IWGRP;
150
 
    if(st->st_mode & S_IXGRP)
 
154
    if (st->st_mode & S_IXGRP)
151
155
         panel->currentPerm |= S_IXGRP;
152
 
    if(st->st_mode & S_IROTH)
 
156
    if (st->st_mode & S_IROTH)
153
157
         panel->currentPerm |= S_IROTH;
154
 
    if(st->st_mode & S_IWOTH)
 
158
    if (st->st_mode & S_IWOTH)
155
159
         panel->currentPerm |= S_IWOTH;
156
 
    if(st->st_mode & S_IXOTH)
 
160
    if (st->st_mode & S_IXOTH)
157
161
         panel->currentPerm |= S_IXOTH;
158
162
 
159
 
    setPermissions(panel);
 
163
    showPermissions(panel);
160
164
}
161
165
 
 
166
/* read permissions */
162
167
static void
163
168
showData(_Panel *panel)
164
169
{
167
172
    struct stat   *st;
168
173
    struct passwd *psswd;
169
174
    struct group  *grp;
 
175
    int count;
170
176
 
171
177
    st = (struct stat *) wmalloc(sizeof(struct stat));
172
178
    
173
179
    pathname = (char *) wmalloc(strlen(panel->fileInfo->path)+
174
180
                                strlen(panel->fileInfo->name)+1);
175
181
    strcpy(pathname, panel->fileInfo->path);
176
 
    if(panel->fileInfo->fileType != ROOT)
 
182
    if (panel->fileInfo->fileType != ROOT)
177
183
        strcat(pathname, panel->fileInfo->name);
178
184
 
179
185
    /* get  information of a file represented by pathname */
180
 
    if (stat(pathname, st) == -1)
181
 
        wwarning("%s %d: Stat Error", __FILE__, __LINE__);
 
186
    /* lstat shows the link information (was: stat)*/
 
187
    if (lstat(pathname, st) == -1)
 
188
        wwarning(_("%s %d: lstat Error"), __FILE__, __LINE__);
182
189
 
183
 
    if(CLK)
 
190
    if (CLK)
184
191
        SetTimeStampWithTimeT(panel->stamp, (int) st->st_mtime);
185
 
    
186
 
    initPermissions(panel, st);
 
192
    /* should only be called first time, not with revert button */  
 
193
    setPermissions(panel, st);
187
194
    
188
195
    grp = getgrgid(st->st_gid);
189
 
    if(grp)
 
196
    if (grp)
190
197
        WMSetLabelText(panel->groupLabel, grp->gr_name);
191
198
 
192
199
    psswd = getpwuid(st->st_uid);
193
 
    if(psswd)
 
200
    if (psswd)
194
201
        WMSetLabelText(panel->ownerLabel, psswd->pw_name);    
195
202
 
196
 
    sprintf(buf, "%d Bytes\n", (int)st->st_size);
 
203
    /* Directory sizes have to be calculated
 
204
    if (S_ISLNK(st->st_mode))
 
205
      WMSetLabelText(panel->sizeLabel, "");
 
206
    else {
 
207
    */
 
208
    if (st->st_size >= 10240) {           /* 10240 Bytes -> 10.0 KB */
 
209
      if (st->st_size > (1024*1024)) {
 
210
        double fsize = st->st_size/(1024.0*1024.0);
 
211
        sprintf(buf, _("%'.1lf MB\n"), fsize);
 
212
      }
 
213
      else {
 
214
        double fsize = st->st_size/1024.0;
 
215
        sprintf(buf, _("%'.1lf KB\n"), fsize);
 
216
      }
 
217
    }
 
218
    else
 
219
      sprintf(buf, _("%d Bytes\n"), (int)st->st_size);
197
220
    WMSetLabelText(panel->sizeLabel, buf);
 
221
    /* } */
198
222
 
199
 
    if(S_ISLNK(st->st_mode))
200
 
    {
201
 
        readlink(pathname, buf, sizeof(buf));
 
223
    if (S_ISLNK(st->st_mode)) {
 
224
      count = readlink(pathname, buf, sizeof(buf));
 
225
      if (count != -1) {
 
226
        if (count >= 100) 
 
227
          count = 100-1;
 
228
        /* terminate pathname string */
 
229
        buf[count] = 0;
202
230
        WMSetLabelText(panel->linkLabel, buf);
203
 
    }
204
 
    
 
231
        /* Set text color to black */
 
232
        WMSetLabelTextColor(panel->linkToLabel,
 
233
          WMBlackColor(WMWidgetScreen(panel->win)));
 
234
        /* what to do with very long pathnames (wrap?) */
 
235
      }
 
236
    }
 
237
    else {
 
238
      /* linkLabel keeps text when inspector rereads with Alt-i */
 
239
      WMSetLabelText(panel->linkLabel, "");
 
240
      /* Set text color to darkgrey */
 
241
      WMSetLabelTextColor(panel->linkToLabel,
 
242
        WMDarkGrayColor(WMWidgetScreen(panel->win)));
 
243
    }
205
244
    if (st)
206
245
    {
207
246
        free(st);
208
247
        st = NULL;
209
248
    }
210
249
 
211
 
    if(pathname)
 
250
    if (pathname)
212
251
        free(pathname);
213
252
 
214
253
}
215
254
 
216
 
 
 
255
/* transfer permission data from panel to memory */
217
256
static void
218
257
storeData(_Panel *panel)
219
258
{
228
267
                                strlen(panel->fileInfo->name)+1);
229
268
    
230
269
    strcpy(pathname, panel->fileInfo->path);
231
 
    if(panel->fileInfo->fileType != ROOT)
 
270
    if (panel->fileInfo->fileType != ROOT)
232
271
        strcat(pathname, panel->fileInfo->name);
233
272
    permissions = 0; 
234
273
    
260
299
    free(pathname);     
261
300
}
262
301
 
 
302
/* Panel-Design - Label section
 
303
 
 
304
Layout:     | | Label    | | Label                 | |
 
305
Size [px]:  |4| adjusted |4| WIDTH - 12 - adjusted |4|
 
306
          ->| |          | |                       | |<- = WIDTH
 
307
 
 
308
Labels on the left side fit to the text width of the largest text,
 
309
to make translations easier.
 
310
*/
 
311
 
263
312
static void
264
 
createLinkLabels(_Panel *panel)
 
313
createLabels(_Panel *panel)
265
314
{
266
 
    WMLabel *l;
267
 
 
268
 
    l = WMCreateLabel(panel->frame);
269
 
    WMResizeWidget(l, 50, 16);
270
 
    WMMoveWidget(l, 4, 16);
271
 
    WMSetLabelText(l, "Link To:");
272
 
    WMSetLabelTextAlignment(l, WARight);
273
 
    WMSetLabelRelief(l, WRFlat);
274
 
    WMSetLabelTextColor(l, WMDarkGrayColor(WMWidgetScreen(panel->win)));
275
 
 
 
315
    WMLabel *sl, *ol, *gl;
 
316
    WMScreen *scr;
 
317
    int tw, maxLW = 0;
 
318
 
 
319
    /* LinkToLabel */
 
320
    panel->linkToLabel = WMCreateLabel(panel->frame);
 
321
    WMMoveWidget(panel->linkToLabel, 6, 18);
 
322
    WMSetLabelText(panel->linkToLabel, _("Link To:"));
 
323
    WMSetLabelTextAlignment(panel->linkToLabel, WARight);
 
324
    WMSetLabelRelief(panel->linkToLabel, WRFlat);
 
325
    WMSetLabelTextColor(panel->linkToLabel,
 
326
      WMDarkGrayColor(WMWidgetScreen(panel->win)));
 
327
 
 
328
    scr = WMWidgetScreen(panel->win);
 
329
    if (scr->normalFont) { 
 
330
      tw = WMWidthOfString(scr->normalFont,
 
331
        WMGetLabelText(panel->linkToLabel),
 
332
        strlen(WMGetLabelText(panel->linkToLabel)));
 
333
    }
 
334
    else {
 
335
      tw = LABEL_WIDTH;
 
336
    }
 
337
    maxLW = tw;
 
338
 
 
339
    /* SizeLabel */
 
340
    sl = WMCreateLabel(panel->frame);
 
341
    WMMoveWidget(sl, 6, 56);
 
342
    WMSetLabelText(sl, _("Size:"));
 
343
    WMSetLabelTextAlignment(sl, WARight);
 
344
    WMSetLabelRelief(sl, WRFlat);
 
345
    if (scr->normalFont) { 
 
346
      tw = WMWidthOfString(scr->normalFont, WMGetLabelText(sl),
 
347
        strlen(WMGetLabelText(sl)));
 
348
    }
 
349
    else {
 
350
      tw = LABEL_WIDTH;
 
351
    }
 
352
    if (tw > maxLW) { maxLW =tw; }
 
353
 
 
354
    /* OwnerLabel */
 
355
    ol = WMCreateLabel(panel->frame);
 
356
    WMMoveWidget(ol, 6, 86);
 
357
    WMSetLabelText(ol, _("Owner:"));
 
358
    WMSetLabelTextAlignment(ol, WARight);
 
359
    WMSetLabelRelief(ol, WRFlat);
 
360
    if (scr->normalFont) { 
 
361
      tw = WMWidthOfString(scr->normalFont, WMGetLabelText(ol),
 
362
        strlen(WMGetLabelText(ol)));
 
363
    }
 
364
    else {
 
365
      tw = LABEL_WIDTH;
 
366
    }
 
367
    if (tw > maxLW) { maxLW = tw; }
 
368
 
 
369
    /* GroupLabel */
 
370
    gl = WMCreateLabel(panel->frame);
 
371
    WMMoveWidget(gl, 6, 116);
 
372
    WMSetLabelText(gl, _("Group:"));
 
373
    WMSetLabelTextAlignment(gl, WARight);
 
374
    WMSetLabelRelief(gl, WRFlat);
 
375
    if (scr->normalFont) { 
 
376
      tw = WMWidthOfString(scr->normalFont, WMGetLabelText(gl),
 
377
        strlen(WMGetLabelText(gl)));
 
378
    }
 
379
    else {
 
380
      tw = LABEL_WIDTH;
 
381
    }
 
382
    if (tw > maxLW) { maxLW = tw; }
 
383
    /* now we have the real maxLW */
 
384
    maxLW+=4;
 
385
    WMResizeWidget(panel->linkToLabel, maxLW, LABEL_HEIGHT);
 
386
    WMResizeWidget(sl, maxLW, LABEL_HEIGHT);
 
387
    WMResizeWidget(ol, maxLW, LABEL_HEIGHT);
 
388
    WMResizeWidget(gl, maxLW, LABEL_HEIGHT);
 
389
 
 
390
    /* the text of this label is set in "showData()" */
276
391
    panel->linkLabel = WMCreateLabel(panel->frame);
277
 
    WMResizeWidget(panel->linkLabel, PERM_WIDTH-LABEL_WIDTH-10, 16);
278
 
    WMMoveWidget(panel->linkLabel, LABEL_WIDTH+2, 16);
279
 
/*     WMSetLabelText(panel->linkLabel, "Link:"); */
 
392
    WMSetLabelWraps(panel->linkLabel, 1);
 
393
    /* this label needs space for wraping long pathnames */
 
394
    WMResizeWidget(panel->linkLabel, WIDTH-maxLW-12, LABEL_HEIGHT*3);
 
395
    WMMoveWidget(panel->linkLabel, maxLW+4, 2);
280
396
    WMSetLabelRelief(panel->linkLabel, WRFlat);
281
397
 
282
 
}    
283
 
 
284
 
static void 
285
 
createSizeLabels(_Panel *panel)
286
 
{
287
 
    WMLabel *l;
288
 
 
289
 
    l = WMCreateLabel(panel->frame);
290
 
    WMResizeWidget(l, 48, 16);
291
 
    WMMoveWidget(l, 4, 56);
292
 
    WMSetLabelText(l, "Size:");
293
 
    WMSetLabelTextAlignment(l, WARight);
294
 
    WMSetLabelRelief(l, WRFlat);
295
 
 
296
398
    panel->sizeLabel = WMCreateLabel(panel->frame);
297
 
    WMResizeWidget(panel->sizeLabel, PERM_WIDTH-LABEL_WIDTH-10, 16);
298
 
    WMMoveWidget(panel->sizeLabel, LABEL_WIDTH+2, 56);
299
 
/*     WMSetLabelText(panel->sizeLabel, "Size"); */
 
399
    WMResizeWidget(panel->sizeLabel, PERM_WIDTH-maxLW, LABEL_HEIGHT);
 
400
    WMMoveWidget(panel->sizeLabel, maxLW+4, 56);
300
401
    WMSetLabelRelief(panel->sizeLabel, WRFlat);
301
402
 
302
 
}
303
 
 
304
 
static void
305
 
createOwnerLabels(_Panel *panel)
306
 
{
307
 
    WMLabel *l;
308
 
 
309
 
    l = WMCreateLabel(panel->frame);
310
 
    WMResizeWidget(l, LABEL_WIDTH, LABEL_HEIGHT);
311
 
    WMMoveWidget(l, 4, 86);
312
 
    WMSetLabelText(l, "Owner:");
313
 
    WMSetLabelTextAlignment(l, WARight);
314
 
    WMSetLabelRelief(l, WRFlat);
315
 
 
316
403
    panel->ownerLabel = WMCreateLabel(panel->frame);
317
 
    WMResizeWidget(panel->ownerLabel, PERM_WIDTH-LABEL_WIDTH-10, LABEL_HEIGHT);
318
 
    WMMoveWidget(panel->ownerLabel, LABEL_WIDTH+2, 86);
319
 
/*     WMSetLabelText(panel->ownerLabel, "Owner"); */
 
404
    WMResizeWidget(panel->ownerLabel, PERM_WIDTH-maxLW, LABEL_HEIGHT);
 
405
    WMMoveWidget(panel->ownerLabel, maxLW+4, 86);
320
406
    WMSetLabelRelief(panel->ownerLabel, WRFlat);
321
407
 
322
 
}
323
 
 
324
 
static void 
325
 
createGroupLabels(_Panel *panel)
326
 
{
327
 
    WMLabel *l;
328
 
 
329
 
    l = WMCreateLabel(panel->frame);
330
 
    WMResizeWidget(l, LABEL_WIDTH, LABEL_HEIGHT);
331
 
    WMMoveWidget(l, 4, 116);
332
 
    WMSetLabelText(l, "Group:");
333
 
    WMSetLabelTextAlignment(l, WARight);
334
 
    WMSetLabelRelief(l, WRFlat);
335
 
 
336
408
    panel->groupLabel = WMCreateLabel(panel->frame);
337
 
    WMResizeWidget(panel->groupLabel, PERM_WIDTH-LABEL_WIDTH-10, LABEL_HEIGHT);
338
 
    WMMoveWidget(panel->groupLabel, LABEL_WIDTH+2, 116);
 
409
    WMResizeWidget(panel->groupLabel, PERM_WIDTH-maxLW, LABEL_HEIGHT);
 
410
    WMMoveWidget(panel->groupLabel, maxLW+4, 116);
339
411
    WMSetLabelRelief(panel->groupLabel, WRFlat);
340
412
    
341
413
}
342
414
 
343
415
static void
 
416
buttonClick(WMWidget *self, void *data)
 
417
{
 
418
    _Panel *panel = (_Panel *)data;
 
419
 
 
420
    /*  okButton sets the new file attributes */
 
421
    if ((WMButton *)self == panel->okBtn)
 
422
    {
 
423
        storeData(panel);
 
424
        WMSetButtonEnabled(panel->okBtn, False); 
 
425
        WMSetButtonEnabled(panel->revertBtn, True);
 
426
    }   
 
427
    /*  revertButton resets the old file attributes */
 
428
    else {    /* revert button clicked */
 
429
      if ((WMButton *)self == panel->revertBtn) {
 
430
        showPermissions(panel);
 
431
        storeData(panel);
 
432
        WMSetButtonEnabled(panel->okBtn, False); 
 
433
        WMSetButtonEnabled(panel->revertBtn, False); 
 
434
      }
 
435
    /*  permission buttons only aktivate the okButton */
 
436
      else {  /* permission button clicked */
 
437
        WMSetButtonEnabled(panel->okBtn, True); 
 
438
      }
 
439
    }
 
440
}
 
441
 
 
442
static void
344
443
fillPermissionsFrame(WMScreen *scr, _Panel *panel, int x, int y, 
345
444
                     int row, int col)
346
445
{
349
448
    int i;
350
449
    int j;
351
450
 
352
 
    char *label[] = { "Read", "Write", "Exec", 
353
 
                      "Owner", "Group", "Other" };
 
451
    char *label[] = { _("Read"), _("Write"), _("Exec"), 
 
452
                      _("Owner"), _("Group"), _("Other") };
354
453
 
355
454
    for(i=0; i < row; i++)
356
455
        for(j=0; j < col; j++)
362
461
            WMSetButtonImagePosition(btn, WIPImageOnly);
363
462
            WMSetButtonBordered(btn, False);
364
463
            WMSetButtonEnabled(btn, True);
 
464
            WMSetButtonAction(btn, buttonClick, panel);   
365
465
            WMResizeWidget(btn, 43, LABEL_HEIGHT);
366
466
            WMMoveWidget(btn, 0+43+(j*(43-1)), 
367
467
                         y+(i*(LABEL_HEIGHT-1)));
398
498
    panel->permF = WMCreateFrame(panel->frame);
399
499
    WMResizeWidget(panel->permF, PERM_WIDTH, PERM_HEIGHT);
400
500
    WMMoveWidget(panel->permF, 8, HEIGHT-33-PERM_HEIGHT);
401
 
    WMSetFrameTitle(panel->permF, " Permissions ");
 
501
    WMSetFrameTitle(panel->permF, _(" Permissions "));
402
502
    fillPermissionsFrame(WMWidgetScreen(panel->win), panel, 6, 20, 3, 3);
403
503
 
404
504
}
409
509
    panel->timeF = WMCreateFrame(panel->frame);
410
510
    WMResizeWidget(panel->timeF, 68, PERM_HEIGHT);
411
511
    WMMoveWidget(panel->timeF, WIDTH-76, HEIGHT-33-PERM_HEIGHT);
412
 
    WMSetFrameTitle(panel->timeF, " Changed ");
 
512
    WMSetFrameTitle(panel->timeF, _(" Changed "));
413
513
 
414
 
    if(CLK)
 
514
    if (CLK)
415
515
    {
416
516
        InitTimeStamp(WMWidgetScreen(panel->win));
417
517
        panel->stamp = CreateTimeStamp(panel->timeF);
423
523
}
424
524
 
425
525
static void
426
 
buttonClick(WMWidget *self, void *data)
427
 
{
428
 
    _Panel *panel = (_Panel *)data;
429
 
 
430
 
    if ((WMButton *)self == panel->okBtn) 
431
 
    {
432
 
        storeData(panel);
433
 
        showData(panel);
434
 
/*      WMSetButtonEnabled(panel->okBtn, False); */
435
 
/*      WMSetButtonEnabled(panel->revertBtn, True); */
436
 
    }   
437
 
    else
438
 
    {
439
 
        setPermissions(panel);
440
 
/*      WMSetButtonEnabled(panel->okBtn, True); */
441
 
/*      WMSetButtonEnabled(panel->revertBtn, False); */
442
 
    }
443
 
}
444
 
 
445
 
static void
446
526
createButtons(_Panel *panel)
447
527
{
448
 
 
449
528
    panel->revertBtn = WMCreateCommandButton(panel->frame);
450
529
    WMMoveWidget(panel->revertBtn, 16, HEIGHT-24);
451
530
    WMResizeWidget(panel->revertBtn, 115, 24);
452
 
    WMSetButtonText(panel->revertBtn, "Revert");
453
 
    WMSetButtonEnabled(panel->revertBtn, True);
 
531
    WMSetButtonText(panel->revertBtn, _("Revert"));
 
532
    WMSetButtonEnabled(panel->revertBtn, False);
454
533
    WMSetButtonAction(panel->revertBtn, buttonClick, panel);
455
534
   
456
535
    panel->okBtn = WMCreateCommandButton(panel->frame);
457
536
    WMMoveWidget(panel->okBtn, 140, HEIGHT-24);
458
537
    WMResizeWidget(panel->okBtn, 115, 24);
459
 
    WMSetButtonText(panel->okBtn, "OK");
 
538
    WMSetButtonText(panel->okBtn, _("OK"));
460
539
    WMSetButtonImage(panel->okBtn, 
461
540
                     WMGetSystemPixmap(WMWidgetScreen(panel->win), 
462
541
                                       WSIReturnArrow));
464
543
                        WMGetSystemPixmap(WMWidgetScreen(panel->win), 
465
544
                                          WSIHighlightedReturnArrow));
466
545
    WMSetButtonImagePosition(panel->okBtn, WIPRight);
467
 
    WMSetButtonEnabled(panel->okBtn, True);
 
546
    WMSetButtonEnabled(panel->okBtn, False);
468
547
    WMSetButtonAction(panel->okBtn, buttonClick, panel);   
469
548
}
470
549
 
480
559
 
481
560
    createChangedFrame(panel);
482
561
    createPermissionsFrame(panel);
483
 
    createLinkLabels(panel);
484
 
    createSizeLabels(panel);
485
 
    createOwnerLabels(panel);
486
 
    createGroupLabels(panel);
 
562
    createLabels(panel);
487
563
    createButtons(panel);
488
564
 
489
565
    WMRealizeWidget(panel->frame);
503
579
    panel = wmalloc(sizeof(_Panel));
504
580
    memset(panel, 0, sizeof(_Panel));
505
581
 
506
 
    panel->sectionName = (char *) wmalloc(strlen("Attributes Inspector")+1);
507
 
    strcpy(panel->sectionName, "Attributes Inspector");
 
582
    panel->sectionName = (char *) wmalloc(strlen(_("Attributes Inspector"))+1);
 
583
    strcpy(panel->sectionName, _("Attributes Inspector"));
508
584
 
509
585
    panel->win = win;
510
586