Codebase list gnome-shell-extension-appindicator / b7bff60
appIndicator: Do not log critical errors on null GIcon's if there are no errors It may be legit to have null icons, but this is an issue only if due to an actual error, so filter them more. Marco Trevisan (TreviƱo) 1 year, 7 months ago
1 changed file(s) with 27 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
902902 this.set_icon_size(iconSize);
903903 } else {
904904 this.gicon = null;
905 Util.Logger.debug(`unable to update icon for ${this._indicator.id}`);
906905 }
907906 } else if (gicon) {
908907 this._emblem = new Gio.Emblem({ icon: gicon });
911910 gicon.inUse = true;
912911 } else {
913912 this._emblem = null;
914 Util.Logger.debug(`unable to update icon emblem for ${this._indicator.id}`);
915913 }
916914
917915 if (this.gicon) {
938936 }
939937
940938 const [name, pixmap, theme] = icon;
941 let gicon = null;
942939 const commonArgs = [theme, iconType, iconSize];
943940
944941 if (this._customIcons.size) {
945942 let customIcon = this._customIcons.get(iconType);
946 if (customIcon)
947 gicon = await this._createIcon(customIcon, null, ...commonArgs);
948 else if (iconType === SNIconType.OVERLAY)
949 return;
950
951 if (!gicon && iconType !== SNIconType.NORMAL) {
952 customIcon = this._customIcons.get(SNIconType.NORMAL);
953 gicon = await this._createIcon(customIcon, null, ...commonArgs);
943 if (!await this._createAndSetIcon(customIcon, null, ...commonArgs)) {
944 if (iconType !== SNIconType.OVERLAY) {
945 customIcon = this._customIcons.get(SNIconType.NORMAL);
946 this._createAndSetIcon(customIcon, null, ...commonArgs);
947 }
954948 }
955949 } else {
956 gicon = await this._createIcon(name, pixmap, ...commonArgs);
950 this._createAndSetIcon(name, pixmap, ...commonArgs);
951 }
952 }
953
954 async _createAndSetIcon(name, pixmap, theme, iconType, iconSize) {
955 let gicon = null;
956
957 try {
958 gicon = await this._createIcon(name, pixmap, theme, iconType, iconSize);
959 } catch (e) {
960 if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED) ||
961 e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.PENDING)) {
962 Util.Logger.debug(`${this._indicator.id}, Impossible to load icon: ${e}`);
963 return null;
964 }
965
966 if (iconType === SNIconType.OVERLAY)
967 logError(e, `unable to update icon emblem for ${this._indicator.id}`);
968 else
969 logError(e, `unable to update icon for ${this._indicator.id}`);
957970 }
958971
959972 try {
960973 this._setGicon(iconType, gicon, iconSize);
974 return gicon;
961975 } catch (e) {
962976 logError(e, 'Setting GIcon failed');
977 return null;
963978 }
964979 }
965980