Skip to content

Commit

Permalink
Update to use new prefsclass functions
Browse files Browse the repository at this point in the history
  • Loading branch information
KeithDHedger committed Jan 28, 2025
1 parent d628a93 commit f2f3698
Show file tree
Hide file tree
Showing 10 changed files with 175 additions and 321 deletions.
1 change: 1 addition & 0 deletions LFSApplications/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
0.2.0
Update to use new prefsclass functions.
Added killall docks to lfsappearance 'Apply'.
Added prelight colour to lfsdockprefs.
File dialog now goes to last valid folder selected.
Expand Down
47 changes: 13 additions & 34 deletions LFSApplications/LFSApplications/src/lfsbackdropprefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
* along with LFSApplications. If not, see <http://www.gnu.org/licenses/>.
*/

#include <getopt.h>

#include "config.h"
#include <lfstk/LFSTKGlobals.h>

Expand Down Expand Up @@ -252,43 +250,24 @@ void loadMonitorInfo(void)

int main(int argc, char **argv)
{
XEvent event;
int sy=0;
int c=0;
int option_index=0;
const char *shortOpts="h?w:";
std::string bffr;

option longOptions[]=
{
{"window",1,0,'w'},
{"help",0,0,'h'},
{0, 0, 0, 0}
};

while(1)
{
option_index=0;
c=getopt_long_only(argc,argv,shortOpts,longOptions,&option_index);
if (c==-1)
break;
switch (c)
{
case 'h':
case '?':
printf("-?,-h,--help\t\tPrint this help\n");
printf("-w,--window\t\tSet transient for window\n");
exit(0);
case 'w':
parentWindow=atoi(optarg);
break;
}
}
XEvent event;
int sy=0;
std::string bffr;
LFSTK_prefsClass cliprefs("lfsbackdropprefs",VERSION);
option longOptions[]={{"window",1,0,'w'},{0, 0, 0, 0}};

apc=new LFSTK_applicationClass();
apc->LFSTK_addWindow(NULL,BOXLABEL,"LFSTKPrefs");
wc=apc->mainWindow;

cliprefs.prefsMap=
{
{LFSTK_UtilityClass::LFSTK_hashFromKey("window"),{TYPEINT,"window","Set transient for window ARG","",false,0}}
};
if(cliprefs.LFSTK_argsToPrefs(argc,argv,longOptions,true)==false)
return(1);
parentWindow=cliprefs.LFSTK_getInt("window");

asprintf(&wd,"%s",apc->userHome);
asprintf(&mainPrefs,"%s/lfssetwallpaper.rc",apc->configDir.c_str());
asprintf(&monitorPrefs,"%s/lfsmonitors.rc",apc->configDir.c_str());
Expand Down
45 changes: 12 additions & 33 deletions LFSApplications/LFSApplications/src/lfscolourchooser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

#include "config.h"
#include <getopt.h>
#include <sstream>
#include <string>
#include <iomanip>
Expand Down Expand Up @@ -137,42 +136,22 @@ bool doAlpha(void *p,void *ud)

int main(int argc, char **argv)
{
XEvent event;
int sy=BORDER;

int c=0;
int option_index=0;
const char *shortOpts="h?w:";
option longOptions[]=
{
{"window",1,0,'w'},
{"help",0,0,'h'},
{0, 0, 0, 0}
};

while(1)
{
option_index=0;
c=getopt_long_only(argc,argv,shortOpts,longOptions,&option_index);
if (c==-1)
break;
switch (c)
{
case 'h':
case '?':
printf("Usage:\nlfscolourchooser [ARG] - Where ARG is a colour definition either e.g. \"#ff0080\" or \"darkgreen\"\n");
printf("-?,-h,--help\t\tPrint this help\n");
printf("-w,--window\t\tSet transient for window\n");
exit(0);
case 'w':
parentWindow=atoi(optarg);
break;
}
}
XEvent event;
int sy=BORDER;
LFSTK_prefsClass cliprefs("lfspanelprefs",VERSION);
option longOptions[]={{"window",1,0,'w'},{0, 0, 0, 0}};

apc=new LFSTK_applicationClass();
apc->LFSTK_addWindow(NULL,BOXLABEL);
wc=apc->mainWindow;

cliprefs.prefsMap=
{
{LFSTK_UtilityClass::LFSTK_hashFromKey("window"),{TYPEINT,"window","Set transient for window ARG","",false,0}}
};
if(cliprefs.LFSTK_argsToPrefs(argc,argv,longOptions,true)==false)
return(1);
parentWindow=cliprefs.LFSTK_getInt("window");

label=new LFSTK_labelClass(wc,BOXLABEL,BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE);
label->LFSTK_setCairoFontDataParts("sB",20);
Expand Down
42 changes: 11 additions & 31 deletions LFSApplications/LFSApplications/src/lfsdesktopprefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
* along with LFSApplications. If not, see <http://www.gnu.org/licenses/>.
*/

#include <getopt.h>

#include "config.h"
#include "lfstk/LFSTKGlobals.h"
#include <lfstk/LFSTKGlobals.h>

#include <libgen.h>

Expand Down Expand Up @@ -197,39 +195,21 @@ int main(int argc, char **argv)
XEvent event;
int sy=0;
std::string bffr;
int c=0;
int option_index=0;
const char *shortOpts="h?w:";
option longOptions[]=
{
{"window",1,0,'w'},
{"help",0,0,'h'},
{0, 0, 0, 0}
};
while(1)
{
option_index=0;
c=getopt_long_only(argc,argv,shortOpts,longOptions,&option_index);
if (c==-1)
break;
switch (c)
{
case 'h':
case '?':
printf("-?,-h,--help\t\tPrint this help\n");
printf("-w,--window\t\tSet transient for window\n");
printf("Right click in a colour edit box for a colour chooser.\n");
exit(0);
case 'w':
parentWindow=atoi(optarg);
break;
}
}
LFSTK_prefsClass cliprefs("lfsdesktopprefs",VERSION);
option longOptions[]={{"window",1,0,'w'},{0, 0, 0, 0}};

apc=new LFSTK_applicationClass();
apc->LFSTK_addWindow(NULL,BOXLABEL,"LFSTKPrefs");
wc=apc->mainWindow;

cliprefs.prefsMap=
{
{LFSTK_UtilityClass::LFSTK_hashFromKey("window"),{TYPEINT,"window","Set transient for window ARG","",false,0}}
};
if(cliprefs.LFSTK_argsToPrefs(argc,argv,longOptions,true)==false)
return(1);
parentWindow=cliprefs.LFSTK_getInt("window");

prefs.prefsMap=
{
{LFSTK_UtilityClass::LFSTK_hashFromKey("icontheme"),{TYPESTRING,"icontheme","","gnome",false,0}},
Expand Down
44 changes: 15 additions & 29 deletions LFSApplications/LFSApplications/src/lfsdockprefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
*/

#include <string>
#include <getopt.h>

#include "lfstk/LFSTKGlobals.h"
#include "config.h"
#include <lfstk/LFSTKGlobals.h>

#undef GADGETWIDTH
#define GADGETWIDTH 128
Expand Down Expand Up @@ -289,43 +289,29 @@ int main(int argc, char **argv)
{
int sy=0;
int parentWindow=-1;
int c=0;
int option_index=0;
const char *shortOpts="h?w:";
LFSTK_prefsClass cliprefs("lfsdockprefs",VERSION);

option longOptions[]=
{
{"window",1,0,'w'},
{"dock",1,0,'d'},
{"help",0,0,'h'},
{"dockname",1,0,'d'},
{0, 0, 0, 0}
};

while(1)
{
option_index=0;
c=getopt_long_only(argc,argv,shortOpts,longOptions,&option_index);
if (c==-1)
break;
switch (c)
{
case 'h':
case '?':
printf("-?,-h,--help\t\tPrint this help\n");
printf("-w,--window\t\tSet transient for window\n");
exit(0);
case 'w':
parentWindow=atoi(optarg);
break;
case 'd':
dockName=optarg;
break;
}
}

apc=new LFSTK_applicationClass();
apc->LFSTK_addWindow(NULL,BOXLABEL,"LFSTKPrefs");
wc=apc->mainWindow;

cliprefs.prefsMap=
{
{LFSTK_UtilityClass::LFSTK_hashFromKey("window"),{TYPEINT,"window","Set transient for window ARG","",false,0}},
{LFSTK_UtilityClass::LFSTK_hashFromKey("dockname"),{TYPESTRING,"dockname","Load prefs for dock ARG","",false,0}}
};
if(cliprefs.LFSTK_argsToPrefs(argc,argv,longOptions,true)==false)
return(1);
parentWindow=cliprefs.LFSTK_getInt("window");
dockName=cliprefs.LFSTK_getString("dockname");

copyrite=new LFSTK_labelClass(wc,COPYRITE,BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE);
sy+=HALFYSPACING;
personal=new LFSTK_labelClass(wc,PERSONAL,BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE);
Expand Down
54 changes: 19 additions & 35 deletions LFSApplications/LFSApplications/src/lfsfilechooser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,62 +18,46 @@
* along with LFSApplications. If not, see <http://www.gnu.org/licenses/>.
*/

#include <getopt.h>

#include "config.h"
#include <lfstk/LFSTKGlobals.h>

LFSTK_applicationClass *apc=NULL;
LFSTK_windowClass *wc=NULL;
LFSTK_fileDialogClass *filedialogfile;
LFSTK_fileDialogClass *filedialogdir;
LFSTK_prefsClass prefs("lfsfilechooser",VERSION);

bool showFolder=false;
Window parentWindow=None;
char *wd;

int main(int argc, char **argv)
void setPrefs(void)
{
int c=0;
int option_index=0;
const char *shortOpts="fh?w:";
int retval=1;

option longOptions[]=
prefs.prefsMap=
{
{"window",1,0,'w'},
{"folder",0,0,'f'},
{"help",0,0,'h'},
{0, 0, 0, 0}
{LFSTK_UtilityClass::LFSTK_hashFromKey("window"),{TYPEINT,"window","Parent Window ARG","",false,0}},
{LFSTK_UtilityClass::LFSTK_hashFromKey("folder"),{TYPEBOOL,"folder","Select folder","",false,0}},
};
}

while(1)
int main(int argc, char **argv)
{
int retval=1;
option longOptions[]=
{
option_index=0;
c=getopt_long_only(argc,argv,shortOpts,longOptions,&option_index);
if (c==-1)
break;
switch (c)
{
case 'f':
showFolder=true;
break;
case 'h':
case '?':
printf("-?,-h,--help\t\tPrint this help\n");
printf("-f,--folder\t\tSelect folder instead of file\n");
printf("-w,--window\t\tSet transient for window\n");
exit(0);
case 'w':
parentWindow=atoi(optarg);
break;
}
}
{"window",required_argument,0,'w'},
{"folder",no_argument,0,'f'},
{0, 0, 0, 0}
};

setPrefs();
if(prefs.LFSTK_argsToPrefs(argc,argv,longOptions,true)==false)
return(1);
parentWindow=prefs.LFSTK_getInt("window");
showFolder=prefs.LFSTK_getBool("folder");
apc=new LFSTK_applicationClass();
apc->LFSTK_addWindow(NULL,"");
wc=apc->mainWindow;
wc->LFSTK_showWindow();

asprintf(&wd,"%s",apc->userHome.c_str());
if(parentWindow!=None)
Expand Down
Loading

0 comments on commit f2f3698

Please sign in to comment.