Re: [PATCH 3/9] wmaker: moved the list of Application Attributes into an array, for the Window Inspector

2015-06-28 Thread Christophe

- Rodolfo García Peñas (kix) k...@kix.es a écrit :
 
 Christophe CURIS christophe.cu...@free.fr escribió:
 
  The Window Inspector is used to let user change a list of advanced options
  for all the windows of an application. This list was defined through many
  hard-coded things; by defining an array with everything at the beginning of
  the file it is easier to maintain (the code is simpler because it is more
  generic) and to make it evolve.
 
  Signed-off-by: Christophe CURIS christophe.cu...@free.fr
  ---
   src/winspector.c | 116  
  +++
   1 file changed, 57 insertions(+), 59 deletions(-)
 
 Hi Christophe,
 
 these patches about move the hard coded things to an array are a great idea.
 
 Thanks a lot.
 Cheers,
 kix
 
 Rodolfo García Peñas (kix)
 http://www.kix.es/

You're welcome!
Everything that make everybody's life easier is generally a good idea...


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 3/9] wmaker: moved the list of Application Attributes into an array, for the Window Inspector

2015-06-27 Thread Rodolfo García Peñas (kix)


Christophe CURIS christophe.cu...@free.fr escribió:


The Window Inspector is used to let user change a list of advanced options
for all the windows of an application. This list was defined through many
hard-coded things; by defining an array with everything at the beginning of
the file it is easier to maintain (the code is simpler because it is more
generic) and to make it evolve.

Signed-off-by: Christophe CURIS christophe.cu...@free.fr
---
 src/winspector.c | 116  
+++

 1 file changed, 57 insertions(+), 59 deletions(-)


Hi Christophe,

these patches about move the hard coded things to an array are a great idea.

Thanks a lot.
Cheers,
kix

Rodolfo García Peñas (kix)
http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH 3/9] wmaker: moved the list of Application Attributes into an array, for the Window Inspector

2015-05-10 Thread Christophe CURIS
The Window Inspector is used to let user change a list of advanced options
for all the windows of an application. This list was defined through many
hard-coded things; by defining an array with everything at the beginning of
the file it is easier to maintain (the code is simpler because it is more
generic) and to make it evolve.

Signed-off-by: Christophe CURIS christophe.cu...@free.fr
---
 src/winspector.c | 116 +++
 1 file changed, 57 insertions(+), 59 deletions(-)

diff --git a/src/winspector.c b/src/winspector.c
index 16ab168..edfa8d0 100644
--- a/src/winspector.c
+++ b/src/winspector.c
@@ -162,6 +162,20 @@ static const struct {
,{ NoLanguageButton, { .no_language_button = 1 }, M_(Disable 
language button),
   M_(Remove the `toggle language' button of the window.) }
 #endif
+
+}, application_attr[] = {
+   { StartHidden, { .start_hidden = 1 }, M_(Start hidden),
+ M_(Automatically hide application when it's started.) },
+
+   { NoAppIcon, { .no_appicon = 1 }, M_(No application icon),
+ M_(Disable the application icon for the application.\n
+Note that you won't be able to dock it anymore,\n
+and any icons that are already docked will stop\n
+working correctly.) },
+
+   { SharedAppIcon, { .shared_appicon = 1 }, M_(Shared application 
icon),
+ M_(Use a single shared application icon for all of\n
+the instances of this application.\n) }
 };
 
 typedef struct InspectorPanel {
@@ -207,7 +221,7 @@ typedef struct InspectorPanel {
 
/* 5th page. application wide attributes */
WMFrame *appFrm;
-   WMButton *appChk[3];
+   WMButton *appChk[sizeof(application_attr) / 
sizeof(application_attr[0])];
 
unsigned int done:1;
unsigned int destroyed:1;
@@ -225,15 +239,13 @@ static InspectorPanel *panelList = NULL;
  */
 static WMPropList *pl_attribute[sizeof(window_attribute) / 
sizeof(window_attribute[0])] = { [0] = NULL };
 static WMPropList *pl_advoptions[sizeof(advanced_option) / 
sizeof(advanced_option[0])];
+static WMPropList *pl_appattrib[sizeof(application_attr) / 
sizeof(application_attr[0])];
 
-static WMPropList *ANoAppIcon;
 static WMPropList *AAlwaysUserIcon;
-static WMPropList *ASharedAppIcon;
 static WMPropList *AStartWorkspace;
 static WMPropList *AIcon;
 
 /* application wide options */
-static WMPropList *AStartHidden;
 static WMPropList *AnyWindow;
 static WMPropList *EmptyString;
 static WMPropList *Yes, *No;
@@ -311,11 +323,11 @@ static void make_keys(void)
for (i = 0; i  wlengthof(advanced_option); i++)
pl_advoptions[i] = 
WMCreatePLString(advanced_option[i].key_name);
 
+   for (i = 0; i  wlengthof(application_attr); i++)
+   pl_appattrib[i] = 
WMCreatePLString(application_attr[i].key_name);
+
AIcon = WMCreatePLString(Icon);
-   ANoAppIcon = WMCreatePLString(NoAppIcon);
AAlwaysUserIcon = WMCreatePLString(AlwaysUserIcon);
-   AStartHidden = WMCreatePLString(StartHidden);
-   ASharedAppIcon = WMCreatePLString(SharedAppIcon);
 
AStartWorkspace = WMCreatePLString(StartWorkspace);
 
@@ -640,15 +652,12 @@ static void saveSettings(WMWidget *button, void 
*client_data)
different |= insertAttribute(dict, winDic, pl_advoptions[i], 
value, flags);
}
 
+   /* Attributes... -- Application Specific */
if (wwin-main_window != None  wApplicationOf(wwin-main_window) != 
NULL) {
-   value = (WMGetButtonSelected(panel-appChk[0]) != 0) ? Yes : No;
-   different2 |= insertAttribute(dict, appDic, AStartHidden, 
value, flags);
-
-   value = (WMGetButtonSelected(panel-appChk[1]) != 0) ? Yes : No;
-   different2 |= insertAttribute(dict, appDic, ANoAppIcon, value, 
flags);
-
-   value = (WMGetButtonSelected(panel-appChk[2]) != 0) ? Yes : No;
-   different2 |= insertAttribute(dict, appDic, ASharedAppIcon, 
value, flags);
+   for (i = 0; i  wlengthof(application_attr); i++) {
+   value = (WMGetButtonSelected(panel-appChk[i]) != 0) ? 
Yes : No;
+   different2 |= insertAttribute(dict, appDic, 
pl_appattrib[i], value, flags);
+   }
}
 
if (wwin-fake_group) {
@@ -780,9 +789,14 @@ static void applySettings(WMWidget *button, void 
*client_data)
/* Can't apply emulate_appicon because it will probably cause problems. 
*/
if (wapp) {
/* do application wide stuff */
-   WSETUFLAG(wapp-main_window_desc, start_hidden, 
WMGetButtonSelected(panel-appChk[0]));
-   WSETUFLAG(wapp-main_window_desc, no_appicon, 
WMGetButtonSelected(panel-appChk[1]));
-   WSETUFLAG(wapp-main_window_desc, shared_appicon, 
WMGetButtonSelected(panel-appChk[2]));
+   for (i = 0; i  wlengthof(application_attr); i++) {
+