From: Rodolfo García Peñas (kix) Date: Tue, 17 Jul 2012 20:55:37 +0000 (+0200) Subject: noDefault changed to default_icon X-Git-Tag: wmaker-0.95.4~130 X-Git-Url: https://repo.or.cz/w/wmaker-crm.git/commitdiff_plain/bef6555b6a96fa81a393e26188fcee978218643d 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(). --- diff --git a/src/appicon.c b/src/appicon.c index 795b020d..e3672ff3 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -127,10 +127,12 @@ WAppIcon *wAppIconCreateForDock(WScreen * scr, char *command, char *wm_instance, if (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) { 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) diff --git a/src/defaults.c b/src/defaults.c index c6fc2c35..4bf9affe 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -1125,7 +1125,8 @@ void wDefaultUpdateIcons(WScreen * scr) char *file; 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) || (file && !aicon->icon->file)) { wIconChangeImageFile(aicon->icon, file); @@ -1139,7 +1140,8 @@ void wDefaultUpdateIcons(WScreen * scr) while (wwin) { 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) || (file && !wwin->icon->file)) { wIconChangeImageFile(wwin->icon, file); diff --git a/src/defaults.h b/src/defaults.h index e96128ab..87ea8fb5 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -41,7 +41,7 @@ void wDefaultFillAttributes(char *instance, char *class, WWindowAttributes *attr, WWindowAttributes *mask, 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); @@ -49,6 +49,6 @@ RImage * wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int max_s int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class); void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file); 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); #endif /* WMDEFAULTS_H_ */ diff --git a/src/dialog.c b/src/dialog.c index 3f9e5368..5ec3ec6b 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -1466,7 +1466,8 @@ static WMPixmap *getWindowMakerIconImage(WMScreen *scr) WMPixmap *pix = 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) { RColor gray; diff --git a/src/dockedapp.c b/src/dockedapp.c index cd059c22..6bfc2168 100644 --- a/src/dockedapp.c +++ b/src/dockedapp.c @@ -320,7 +320,7 @@ void ShowDockAppSettingsPanel(WAppIcon * aicon) panel->iconField = WMCreateTextField(panel->iconFrame); WMResizeWidget(panel->iconField, 176, 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); WMResizeWidget(panel->browseBtn, 70, 24); diff --git a/src/icon.c b/src/icon.c index 812301e7..c4798909 100644 --- a/src/icon.c +++ b/src/icon.c @@ -128,7 +128,8 @@ WIcon *wIconCreate(WWindow * wwin) #endif 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) icon->file = wstrdup(file); @@ -615,7 +616,8 @@ void get_pixmap_icon_from_user_icon(WScreen *scr, WIcon * icon) } else { /* make default icons */ if (!scr->def_icon_pixmap) { - file = wDefaultGetIconFile(NULL, NULL, False); + /* Get the default icon */ + file = wDefaultGetIconFile(NULL, NULL, True); if (file) { path = FindImage(wPreferences.icon_path, file); if (path) { diff --git a/src/wdefaults.c b/src/wdefaults.c index 497cb48e..c4cd8197 100644 --- a/src/wdefaults.c +++ b/src/wdefaults.c @@ -315,7 +315,7 @@ void wDefaultFillAttributes(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; @@ -361,8 +361,8 @@ static WMPropList *get_generic_value(char *instance, char *class, value = WMGetFromPLDictionary(dict, option); } - /* Search the default icon name - See noDefault argument! */ - if (!value && !noDefault) { + /* Search the default icon name - See default_icon argument! */ + if (!value && default_icon) { /* AnyWindow is "*" - see wdefaults.c */ 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 */ char *get_default_icon_filename(WScreen *scr, char *winstance, char *wclass, char *command, - Bool noDefault) + Bool default_icon) { char *file_name = NULL; char *file_path = NULL; /* 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 * and re-do the search, but now always including the default icon * so the icon is found always. The .app is selected before default */ if (!file_name && scr && command) { 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 */ @@ -442,7 +442,7 @@ RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int max_s char *file_name = NULL; /* 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) return NULL; @@ -461,7 +461,7 @@ int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class) if (!WDWindowAttributes->dictionary) return -1; - value = get_generic_value(instance, class, AStartWorkspace, False); + value = get_generic_value(instance, class, AStartWorkspace, True); if (!value) return -1; @@ -477,8 +477,8 @@ int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class) return w; } -/* Get the name of the Icon File. If noDefault is False, then, default value included */ -char *wDefaultGetIconFile(char *instance, char *class, Bool noDefault) +/* Get the name of the Icon File. If default_icon is True, then, default value included */ +char *wDefaultGetIconFile(char *instance, char *class, Bool default_icon) { WMPropList *value; char *tmp; @@ -489,7 +489,7 @@ char *wDefaultGetIconFile(char *instance, char *class, Bool noDefault) if (!WDWindowAttributes || !WDWindowAttributes->dictionary) return NULL; - value = get_generic_value(instance, class, AIcon, noDefault); + value = get_generic_value(instance, class, AIcon, default_icon); if (!value) return NULL; diff --git a/src/winspector.c b/src/winspector.c index b671087c..65b21fa5 100644 --- a/src/winspector.c +++ b/src/winspector.c @@ -323,7 +323,8 @@ static int showIconFor(WMScreen *scrPtr, InspectorPanel *panel, char *wm_instanc file = NULL; } } 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) file = wstrdup(db_icon); }