This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project wmaker-crm.git.
The branch, next has been updated via fd7b1173461c0764db1cedc3c6602d68cb7a627e (commit) from ada7161d8d3ab0250eb766b51f42247c0dc75999 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://repo.or.cz/w/wmaker-crm.git/commit/fd7b1173461c0764db1cedc3c6602d68cb7a627e commit fd7b1173461c0764db1cedc3c6602d68cb7a627e Author: Rodolfo GarcÃa Peñas (kix) <k...@kix.es> Date: Fri Jan 25 00:59:08 2013 +0100 Sanitize 'Ignore client supplied icon' logic There can be these 4 situations: 1. ignore flag + file set 2. no ignore flag + file set 3. ignore flag + no file set 4. no ignore flag + no file set If the "ignore client supplied icon flag" is not set it means the user wants to use the client-provided icon, so the eventual file name which might be in the entry field is ignored. If the user sets the ignore flag and sets the icon name all is fine and Option 1 is done. If the user tries to set an icon (ignore flag is set) but the file textbox is not set we show the warning: "Ignore client supplied icon is set, but icon filename textbox is empty. Using client supplied icon" and use the client-supplied icon instead. diff --git a/src/winspector.c b/src/winspector.c index 7335030..8d5923a 100644 --- a/src/winspector.c +++ b/src/winspector.c @@ -475,29 +475,23 @@ static void saveSettings(WMButton *button, InspectorPanel *panel) winDic = WMCreatePLDictionary(NULL, NULL); appDic = WMCreatePLDictionary(NULL, NULL); - /* If the "Ignore client suplied icon is not selected" flag was not set, - * then, don't save the icon filename. If saved, the application will use - * that icon, even the flag is not set. */ - if (WMGetButtonSelected(panel->alwChk) != 0) { - /* Update icon for window */ - icon_file = WMGetTextFieldText(panel->fileText); - if (icon_file) { - if (icon_file[0] != 0) { - value = WMCreatePLString(icon_file); - different |= insertAttribute(dict, winDic, AIcon, value, flags); - different2 |= insertAttribute(dict, appDic, AIcon, value, flags); - WMReleasePropList(value); - - /* Set the ckeck for AAlwaysUserIcon only if icon_file exists */ - buf1 = wmalloc(4); - snprintf(buf1, 4, "%s", (WMGetButtonSelected(panel->alwChk) != 0) ? "Yes" : "No"); - value1 = WMCreatePLString(buf1); - different |= insertAttribute(dict, winDic, AAlwaysUserIcon, value1, flags); - WMReleasePropList(value1); - wfree(buf1); - } - wfree(icon_file); - } + /* Save the icon info */ + /* The flag "Ignore client suplied icon is not selected" */ + buf1 = wmalloc(4); + snprintf(buf1, 4, "%s", (WMGetButtonSelected(panel->alwChk) != 0) ? "Yes" : "No"); + value1 = WMCreatePLString(buf1); + different |= insertAttribute(dict, winDic, AAlwaysUserIcon, value1, flags); + WMReleasePropList(value1); + wfree(buf1); + + /* The icon filename (if exists) */ + icon_file = WMGetTextFieldText(panel->fileText); + if ((icon_file) && (icon_file[0] != 0)) { + value = WMCreatePLString(icon_file); + different |= insertAttribute(dict, winDic, AIcon, value, flags); + different2 |= insertAttribute(dict, appDic, AIcon, value, flags); + WMReleasePropList(value); + wfree(icon_file); } i = WMGetPopUpButtonSelectedItem(panel->wsP) - 1; @@ -746,24 +740,45 @@ static void applySettings(WMButton *button, InspectorPanel *panel) file = NULL; } - /* If file is NULL, the always_user_icon doesn't matter, - * because we need to read the icon from the window */ - if (file && WFLAGP(wwin, always_user_icon)) { - /* Change icon image if the app is minimized */ - if (wwin->icon) - wIconChangeImageFile(wwin->icon, file); + /* If always_user_icon flag is set, but the user icon is not set + * we use client supplied icon and we unset the flag */ + if ((WFLAGP(wwin, always_user_icon) && (!file))) { + /* Show the warning */ + char *buf; + int len = 100; - /* Change App Icon image */ + buf = wmalloc(len); + snprintf(buf, len, _("Ignore client supplied icon is set, but icon filename textbox is empty. Using client supplied icon")); + wMessageDialog(panel->frame->screen_ptr, _("Warning"), buf, _("OK"), NULL, NULL); + wfree(buf); + wfree(file); + + /* Change the flags */ + WSETUFLAG(wwin, always_user_icon, 0); + WMSetButtonSelected(panel->alwChk, 0); + } + + /* After test the always_user_icon flag value before, + * the "else" block is used only if the flag is set and + * the icon text box has an icon path */ + if (!WFLAGP(wwin, always_user_icon)) { + /* Change App Icon image, using the icon provided by the client */ if (wapp->app_icon) - wIconChangeImageFile(wapp->app_icon->icon, file); + wIconUpdate(wapp->app_icon->icon, + get_rimage_icon_from_wm_hints(wapp->app_icon->icon)); + + /* Change icon image if the app is minimized, + * using the icon provided by the client */ + if (wwin->icon) + wIconUpdate(wwin->icon, get_rimage_icon_from_wm_hints(wwin->icon)); } else { /* Change App Icon image */ if (wapp->app_icon) - wIconUpdate(wapp->app_icon->icon, get_rimage_icon_from_wm_hints(wapp->app_icon->icon)); + wIconChangeImageFile(wapp->app_icon->icon, file); /* Change icon image if the app is minimized */ if (wwin->icon) - wIconUpdate(wwin->icon, get_rimage_icon_from_wm_hints(wwin->icon)); + wIconChangeImageFile(wwin->icon, file); } if (file) ----------------------------------------------------------------------- Summary of changes: src/winspector.c | 81 ++++++++++++++++++++++++++++++++---------------------- 1 files changed, 48 insertions(+), 33 deletions(-) repo.or.cz automatic notification. Contact project admin crma...@gmail.com if you want to unsubscribe, or site admin ad...@repo.or.cz if you receive no reply. -- wmaker-crm.git ("The Window Maker window manager") -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.