forked from e16/e16
1
0
Fork 0

A bit more consistent naming and minor tweaks (groups).

SVN revision: 36787
This commit is contained in:
Kim Woelders 2008-10-18 16:13:54 +00:00
parent 05b1f91c04
commit 28c4a83441
3 changed files with 24 additions and 29 deletions

View File

@ -196,7 +196,14 @@ GroupsGetList(int *pnum)
return (Group **) ecore_list_items_get(group_list, pnum);
}
Group **
Group *const *
EwinGetGroups(const EWin * ewin, int *num)
{
*num = ewin->num_groups;
return ewin->groups;
}
static Group **
ListWinGroups(const EWin * ewin, char group_select, int *num)
{
Group **groups = NULL;
@ -361,7 +368,7 @@ RemoveEwinFromGroup(EWin * ewin, Group * g)
ewin->groups =
EREALLOC(Group *, ewin->groups, ewin->num_groups);
SaveGroups();
GroupsSave();
return;
}
}
@ -487,7 +494,7 @@ ShowHideWinGroups(EWin * ewin, int group_index, char onoff)
}
if (group_index < 0)
Efree(gwins);
SaveGroups();
GroupsSave();
}
#else
@ -496,7 +503,7 @@ ShowHideWinGroups(EWin * ewin, int group_index, char onoff)
#endif /* USE_GROUP_SHOWHIDE */
void
SaveGroups(void)
GroupsSave(void)
{
Group *g;
FILE *f;
@ -538,7 +545,7 @@ SaveGroups(void)
fclose(f);
}
static void
void
GroupsLoad(void)
{
FILE *f;
@ -647,7 +654,7 @@ ChooseGroup(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
Efree(tmp_groups);
tmp_groups = NULL;
SaveGroups();
GroupsSave();
}
}
@ -1080,17 +1087,6 @@ GroupsConfigure(const char *params)
}
}
static void
GroupsSighan(int sig, void *prm __UNUSED__)
{
switch (sig)
{
case ESIGNAL_INIT:
GroupsLoad();
break;
}
}
static void
GroupShow(Group * g)
{
@ -1197,7 +1193,7 @@ IPC_GroupOps(const char *params)
IpcPrintf("Error: no such operation: %s", operation);
return;
}
SaveGroups();
GroupsSave();
}
static void
@ -1408,7 +1404,7 @@ static const CfgItem GroupsCfgItems[] = {
extern const EModule ModGroups;
const EModule ModGroups = {
"groups", "grp",
GroupsSighan,
NULL,
{N_IPC_FUNCS, GroupsIpcArray},
{N_CFG_ITEMS, GroupsCfgItems}
};

View File

@ -63,13 +63,13 @@ EWin **ListWinGroupMembersForEwin(const EWin * ewin, int action,
char nogroup, int *num);
/* groups.c */
Group *const *EwinGetGroups(const EWin * ewin, int *num);
Group *EwinsInGroup(const EWin * ewin1, const EWin * ewin2);
void GroupsEwinAdd(EWin * ewin, int gid);
void GroupsEwinRemove(EWin * ewin);
void SaveGroups(void);
void GroupsLoad(void);
void GroupsSave(void);
Group **GroupsGetList(int *pnum);
Group **ListWinGroups(const EWin * ewin, char group_select,
int *num);
int GroupsGetSwapmove(void);
#endif /* _GROUPS_H_ */

View File

@ -389,7 +389,7 @@ static void
_SnapUpdateEwinGroups(Snapshot * sn, const EWin * ewin, char onoff)
{
EWin **gwins = NULL;
Group **groups;
Group *const *groups;
int i, j, num, num_groups;
if (!ewin)
@ -409,8 +409,7 @@ _SnapUpdateEwinGroups(Snapshot * sn, const EWin * ewin, char onoff)
{
if (onoff)
{
groups =
ListWinGroups(gwins[i], GROUP_SELECT_EWIN_ONLY, &num_groups);
groups = EwinGetGroups(gwins[i], &num_groups);
if (groups)
{
sn = gwins[i]->snap;
@ -418,15 +417,13 @@ _SnapUpdateEwinGroups(Snapshot * sn, const EWin * ewin, char onoff)
sn = _SnapEwinGet(gwins[i], SNAP_MATCH_DEFAULT);
if (sn)
{
sn->num_groups = num_groups;
Efree(sn->groups);
sn->groups = EMALLOC(int, num_groups);
sn->num_groups = num_groups;
for (j = 0; j < num_groups; j++)
sn->groups[j] = groups[j]->index;
}
Efree(groups);
}
}
else
@ -1167,7 +1164,7 @@ SnapshotsSaveReal(void *data __UNUSED__)
if (!isfile(buf))
Alert(_("Error saving snaps file\n"));
SaveGroups();
GroupsSave();
done:
TIMER_DEL(ss_timer);
@ -1199,6 +1196,8 @@ SnapshotsLoad(void)
FILE *f;
int res_w, res_h, a, b, c, d;
GroupsLoad();
Esnprintf(buf, sizeof(buf), "%s.snapshots", EGetSavePrefix());
f = fopen(buf, "r");
if (!f)