mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
noDefault changed to default_icon
The functions wDefaultGetIconFile(), get_default_icon_filename() and
get_generic_value() use the argument noDefault in order to avoid searching the
default icon. This double negation is difficult to read though. This patch
changes it to be True if the default icon should be included or false if not.
This patch changes the noDefault argument to default_icon, then the
True is now False and False is True.
The main change is at get_generic_value():
- /* Search the default icon name - See noDefault argument! */
- if (!value && !noDefault) {
+ /* Search the default icon name - See default_icon argument! */
+ if (!value && default_icon) {
Because the functions wDefaultGetIconFile() and get_default_icon_filename()
mainly forwards the noDefault argument to get_generic_value().
This commit is contained in:
committed by
Carlos R. Mafra
parent
fae81bf518
commit
bef6555b6a
@@ -127,10 +127,12 @@ WAppIcon *wAppIconCreateForDock(WScreen * scr, char *command, char *wm_instance,
|
|||||||
if (wm_instance)
|
if (wm_instance)
|
||||||
dicon->wm_instance = wstrdup(wm_instance);
|
dicon->wm_instance = wstrdup(wm_instance);
|
||||||
|
|
||||||
path = wDefaultGetIconFile(wm_instance, wm_class, True);
|
/* Search the icon using instance and class, without default icon */
|
||||||
|
path = wDefaultGetIconFile(wm_instance, wm_class, False);
|
||||||
if (!path && command) {
|
if (!path && command) {
|
||||||
wApplicationExtractDirPackIcon(scr, command, wm_instance, wm_class);
|
wApplicationExtractDirPackIcon(scr, command, wm_instance, wm_class);
|
||||||
path = wDefaultGetIconFile(wm_instance, wm_class, False);
|
/* Search again, now with default icon */
|
||||||
|
path = wDefaultGetIconFile(wm_instance, wm_class, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path)
|
if (path)
|
||||||
|
|||||||
@@ -1125,7 +1125,8 @@ void wDefaultUpdateIcons(WScreen * scr)
|
|||||||
char *file;
|
char *file;
|
||||||
|
|
||||||
while (aicon) {
|
while (aicon) {
|
||||||
file = wDefaultGetIconFile(aicon->wm_instance, aicon->wm_class, False);
|
/* Get the application icon, default included */
|
||||||
|
file = wDefaultGetIconFile(aicon->wm_instance, aicon->wm_class, True);
|
||||||
if ((file && aicon->icon->file && strcmp(file, aicon->icon->file) != 0)
|
if ((file && aicon->icon->file && strcmp(file, aicon->icon->file) != 0)
|
||||||
|| (file && !aicon->icon->file)) {
|
|| (file && !aicon->icon->file)) {
|
||||||
wIconChangeImageFile(aicon->icon, file);
|
wIconChangeImageFile(aicon->icon, file);
|
||||||
@@ -1139,7 +1140,8 @@ void wDefaultUpdateIcons(WScreen * scr)
|
|||||||
|
|
||||||
while (wwin) {
|
while (wwin) {
|
||||||
if (wwin->icon && wwin->flags.miniaturized) {
|
if (wwin->icon && wwin->flags.miniaturized) {
|
||||||
file = wDefaultGetIconFile(wwin->wm_instance, wwin->wm_class, False);
|
/* Get the application icon, default included */
|
||||||
|
file = wDefaultGetIconFile(wwin->wm_instance, wwin->wm_class, True);
|
||||||
if ((file && wwin->icon->file && strcmp(file, wwin->icon->file) != 0)
|
if ((file && wwin->icon->file && strcmp(file, wwin->icon->file) != 0)
|
||||||
|| (file && !wwin->icon->file)) {
|
|| (file && !wwin->icon->file)) {
|
||||||
wIconChangeImageFile(wwin->icon, file);
|
wIconChangeImageFile(wwin->icon, file);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ void wDefaultFillAttributes(char *instance, char *class,
|
|||||||
WWindowAttributes *attr, WWindowAttributes *mask,
|
WWindowAttributes *attr, WWindowAttributes *mask,
|
||||||
Bool useGlobalDefault);
|
Bool useGlobalDefault);
|
||||||
|
|
||||||
char *wDefaultGetIconFile(char *instance, char *class, Bool noDefault);
|
char *wDefaultGetIconFile(char *instance, char *class, Bool default_icon);
|
||||||
|
|
||||||
RImage * wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int max_size);
|
RImage * wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int max_size);
|
||||||
|
|
||||||
@@ -49,6 +49,6 @@ RImage * wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int max_s
|
|||||||
int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class);
|
int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class);
|
||||||
void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
|
void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
|
||||||
char *get_default_icon_filename(WScreen *scr, char *winstance, char *wclass, char *command,
|
char *get_default_icon_filename(WScreen *scr, char *winstance, char *wclass, char *command,
|
||||||
Bool noDefault);
|
Bool default_icon);
|
||||||
RImage *get_default_icon_rimage(WScreen *scr, char *file_name, int max_size);
|
RImage *get_default_icon_rimage(WScreen *scr, char *file_name, int max_size);
|
||||||
#endif /* WMDEFAULTS_H_ */
|
#endif /* WMDEFAULTS_H_ */
|
||||||
|
|||||||
@@ -1466,7 +1466,8 @@ static WMPixmap *getWindowMakerIconImage(WMScreen *scr)
|
|||||||
WMPixmap *pix = NULL;
|
WMPixmap *pix = NULL;
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
|
|
||||||
path = get_default_icon_filename(NULL, "Logo", "WMPanel", NULL, True);
|
/* Get the Logo icon, without the default icon */
|
||||||
|
path = get_default_icon_filename(NULL, "Logo", "WMPanel", NULL, False);
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
RColor gray;
|
RColor gray;
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ void ShowDockAppSettingsPanel(WAppIcon * aicon)
|
|||||||
panel->iconField = WMCreateTextField(panel->iconFrame);
|
panel->iconField = WMCreateTextField(panel->iconFrame);
|
||||||
WMResizeWidget(panel->iconField, 176, 20);
|
WMResizeWidget(panel->iconField, 176, 20);
|
||||||
WMMoveWidget(panel->iconField, 10, 20);
|
WMMoveWidget(panel->iconField, 10, 20);
|
||||||
WMSetTextFieldText(panel->iconField, wDefaultGetIconFile(aicon->wm_instance, aicon->wm_class, True));
|
WMSetTextFieldText(panel->iconField, wDefaultGetIconFile(aicon->wm_instance, aicon->wm_class, False));
|
||||||
|
|
||||||
panel->browseBtn = WMCreateCommandButton(panel->iconFrame);
|
panel->browseBtn = WMCreateCommandButton(panel->iconFrame);
|
||||||
WMResizeWidget(panel->browseBtn, 70, 24);
|
WMResizeWidget(panel->browseBtn, 70, 24);
|
||||||
|
|||||||
@@ -128,7 +128,8 @@ WIcon *wIconCreate(WWindow * wwin)
|
|||||||
#endif
|
#endif
|
||||||
icon->file_image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class, wPreferences.icon_size);
|
icon->file_image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class, wPreferences.icon_size);
|
||||||
|
|
||||||
file = wDefaultGetIconFile(wwin->wm_instance, wwin->wm_class, False);
|
/* Get the application icon, default included */
|
||||||
|
file = wDefaultGetIconFile(wwin->wm_instance, wwin->wm_class, True);
|
||||||
if (file)
|
if (file)
|
||||||
icon->file = wstrdup(file);
|
icon->file = wstrdup(file);
|
||||||
|
|
||||||
@@ -615,7 +616,8 @@ void get_pixmap_icon_from_user_icon(WScreen *scr, WIcon * icon)
|
|||||||
} else {
|
} else {
|
||||||
/* make default icons */
|
/* make default icons */
|
||||||
if (!scr->def_icon_pixmap) {
|
if (!scr->def_icon_pixmap) {
|
||||||
file = wDefaultGetIconFile(NULL, NULL, False);
|
/* Get the default icon */
|
||||||
|
file = wDefaultGetIconFile(NULL, NULL, True);
|
||||||
if (file) {
|
if (file) {
|
||||||
path = FindImage(wPreferences.icon_path, file);
|
path = FindImage(wPreferences.icon_path, file);
|
||||||
if (path) {
|
if (path) {
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ void wDefaultFillAttributes(char *instance, char *class,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static WMPropList *get_generic_value(char *instance, char *class,
|
static WMPropList *get_generic_value(char *instance, char *class,
|
||||||
WMPropList *option, Bool noDefault)
|
WMPropList *option, Bool default_icon)
|
||||||
{
|
{
|
||||||
WMPropList *value, *key, *dict;
|
WMPropList *value, *key, *dict;
|
||||||
|
|
||||||
@@ -361,8 +361,8 @@ static WMPropList *get_generic_value(char *instance, char *class,
|
|||||||
value = WMGetFromPLDictionary(dict, option);
|
value = WMGetFromPLDictionary(dict, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search the default icon name - See noDefault argument! */
|
/* Search the default icon name - See default_icon argument! */
|
||||||
if (!value && !noDefault) {
|
if (!value && default_icon) {
|
||||||
/* AnyWindow is "*" - see wdefaults.c */
|
/* AnyWindow is "*" - see wdefaults.c */
|
||||||
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, AnyWindow);
|
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, AnyWindow);
|
||||||
|
|
||||||
@@ -377,21 +377,21 @@ static WMPropList *get_generic_value(char *instance, char *class,
|
|||||||
|
|
||||||
/* Get the file name of the image, using instance and class */
|
/* Get the file name of the image, using instance and class */
|
||||||
char *get_default_icon_filename(WScreen *scr, char *winstance, char *wclass, char *command,
|
char *get_default_icon_filename(WScreen *scr, char *winstance, char *wclass, char *command,
|
||||||
Bool noDefault)
|
Bool default_icon)
|
||||||
{
|
{
|
||||||
char *file_name = NULL;
|
char *file_name = NULL;
|
||||||
char *file_path = NULL;
|
char *file_path = NULL;
|
||||||
|
|
||||||
/* Get the file name of the image, using instance and class */
|
/* Get the file name of the image, using instance and class */
|
||||||
file_name = wDefaultGetIconFile(winstance, wclass, noDefault);
|
file_name = wDefaultGetIconFile(winstance, wclass, default_icon);
|
||||||
|
|
||||||
/* If the specific (or generic if noDefault is False) icon filename
|
/* If the specific (or generic if default_icon is True) icon filename
|
||||||
* is not found, and command is specified, then include the .app icons
|
* is not found, and command is specified, then include the .app icons
|
||||||
* and re-do the search, but now always including the default icon
|
* and re-do the search, but now always including the default icon
|
||||||
* so the icon is found always. The .app is selected before default */
|
* so the icon is found always. The .app is selected before default */
|
||||||
if (!file_name && scr && command) {
|
if (!file_name && scr && command) {
|
||||||
wApplicationExtractDirPackIcon(scr, command, winstance, wclass);
|
wApplicationExtractDirPackIcon(scr, command, winstance, wclass);
|
||||||
file_name = wDefaultGetIconFile(winstance, wclass, False);
|
file_name = wDefaultGetIconFile(winstance, wclass, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the full path for the image file */
|
/* Get the full path for the image file */
|
||||||
@@ -442,7 +442,7 @@ RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int max_s
|
|||||||
char *file_name = NULL;
|
char *file_name = NULL;
|
||||||
|
|
||||||
/* Get the file name of the image, using instance and class */
|
/* Get the file name of the image, using instance and class */
|
||||||
file_name = get_default_icon_filename(scr, winstance, wclass, NULL, False);
|
file_name = get_default_icon_filename(scr, winstance, wclass, NULL, True);
|
||||||
if (!file_name)
|
if (!file_name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -461,7 +461,7 @@ int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class)
|
|||||||
if (!WDWindowAttributes->dictionary)
|
if (!WDWindowAttributes->dictionary)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
value = get_generic_value(instance, class, AStartWorkspace, False);
|
value = get_generic_value(instance, class, AStartWorkspace, True);
|
||||||
|
|
||||||
if (!value)
|
if (!value)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -477,8 +477,8 @@ int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class)
|
|||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the name of the Icon File. If noDefault is False, then, default value included */
|
/* Get the name of the Icon File. If default_icon is True, then, default value included */
|
||||||
char *wDefaultGetIconFile(char *instance, char *class, Bool noDefault)
|
char *wDefaultGetIconFile(char *instance, char *class, Bool default_icon)
|
||||||
{
|
{
|
||||||
WMPropList *value;
|
WMPropList *value;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
@@ -489,7 +489,7 @@ char *wDefaultGetIconFile(char *instance, char *class, Bool noDefault)
|
|||||||
if (!WDWindowAttributes || !WDWindowAttributes->dictionary)
|
if (!WDWindowAttributes || !WDWindowAttributes->dictionary)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
value = get_generic_value(instance, class, AIcon, noDefault);
|
value = get_generic_value(instance, class, AIcon, default_icon);
|
||||||
|
|
||||||
if (!value)
|
if (!value)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -323,7 +323,8 @@ static int showIconFor(WMScreen *scrPtr, InspectorPanel *panel, char *wm_instanc
|
|||||||
file = NULL;
|
file = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
db_icon = wDefaultGetIconFile(wm_instance, wm_class, False);
|
/* Get the application icon, default included */
|
||||||
|
db_icon = wDefaultGetIconFile(wm_instance, wm_class, True);
|
||||||
if (db_icon != NULL)
|
if (db_icon != NULL)
|
||||||
file = wstrdup(db_icon);
|
file = wstrdup(db_icon);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user