mirror of
https://github.com/moparisthebest/FireTray
synced 2024-12-23 06:18:48 -05:00
* refactoring
* fix consistence in preference UI (filepickers' disabling) We still need to find out why the order in g_themed_icon_new_from_names is not respected.
This commit is contained in:
parent
2e65e07029
commit
e19930b654
@ -31,6 +31,7 @@ var firetrayUIOptions = {
|
|||||||
this.updateScrollOptions();
|
this.updateScrollOptions();
|
||||||
this.initAppIconType();
|
this.initAppIconType();
|
||||||
this.initAppIconNames();
|
this.initAppIconNames();
|
||||||
|
if (firetray.Handler.inMailApp)
|
||||||
this.initNewMailIconNames();
|
this.initNewMailIconNames();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -85,17 +86,20 @@ var firetrayUIOptions = {
|
|||||||
FIRETRAY_APPLICATION_ICON_TYPE_THEMED;
|
FIRETRAY_APPLICATION_ICON_TYPE_THEMED;
|
||||||
document.getElementById("ui_app_icon_type_custom").value =
|
document.getElementById("ui_app_icon_type_custom").value =
|
||||||
FIRETRAY_APPLICATION_ICON_TYPE_CUSTOM;
|
FIRETRAY_APPLICATION_ICON_TYPE_CUSTOM;
|
||||||
document.getElementById("ui_app_icon_type").selectedIndex =
|
|
||||||
firetray.Utils.prefService.getIntPref("app_icon_type");
|
let prefAppIconType = firetray.Utils.prefService.getIntPref("app_icon_type");
|
||||||
|
document.getElementById("ui_app_icon_type").selectedIndex = prefAppIconType;
|
||||||
|
|
||||||
|
this.disableIconTypeMaybe(prefAppIconType);
|
||||||
},
|
},
|
||||||
|
|
||||||
initAppIconNames: function() {
|
initAppIconNames: function() {
|
||||||
this.initIconNames(firetray.StatusIcon.prefAppIconNames,
|
this.initIconNames(firetray.StatusIcon.prefAppIconNames,
|
||||||
"app_icon_type_themed_name", firetray.Handler.appNameOriginal.toLowerCase());
|
"app_icon_type_themed_name", firetray.StatusIcon.defaultAppIconName);
|
||||||
},
|
},
|
||||||
initNewMailIconNames: function() {
|
initNewMailIconNames: function() {
|
||||||
this.initIconNames("new_mail_icon_names",
|
this.initIconNames("new_mail_icon_names",
|
||||||
"radio_mail_notification_newmail_icon_name", "mail-unread");
|
"radio_mail_notification_newmail_icon_name", firetray.StatusIcon.defaultNewMailIconName);
|
||||||
},
|
},
|
||||||
|
|
||||||
initIconNames: function(prefIconNames, uiIconNameId, defaultIconName) {
|
initIconNames: function(prefIconNames, uiIconNameId, defaultIconName) {
|
||||||
@ -125,13 +129,18 @@ var firetrayUIOptions = {
|
|||||||
let textbox = document.getElementById(uiIconNameId+i);
|
let textbox = document.getElementById(uiIconNameId+i);
|
||||||
let val = textbox.value.trim();
|
let val = textbox.value.trim();
|
||||||
LOG("val="+val);
|
LOG("val="+val);
|
||||||
if (val)
|
if (val) iconNames.push(val);
|
||||||
iconNames.push(val);
|
|
||||||
}
|
}
|
||||||
LOG("iconNames="+iconNames);
|
LOG("iconNames="+iconNames);
|
||||||
firetray.Utils.setArrayPref(prefIconNames, iconNames);
|
firetray.Utils.setArrayPref(prefIconNames, iconNames);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
disableIconTypeMaybe: function(appIconType) {
|
||||||
|
let customIconGroup = document.getElementById("custom_app_icon");
|
||||||
|
this.disableGroup(customIconGroup,
|
||||||
|
(appIconType !== FIRETRAY_APPLICATION_ICON_TYPE_CUSTOM));
|
||||||
|
},
|
||||||
|
|
||||||
initMailControls: function() {
|
initMailControls: function() {
|
||||||
this.populateExcludedFoldersList();
|
this.populateExcludedFoldersList();
|
||||||
this.populateTreeAccountsOrServerTypes();
|
this.populateTreeAccountsOrServerTypes();
|
||||||
|
@ -74,13 +74,14 @@
|
|||||||
<tabpanel id="icon_tabpanel" flex="1">
|
<tabpanel id="icon_tabpanel" flex="1">
|
||||||
<vbox pack="start" align="left" flex="1">
|
<vbox pack="start" align="left" flex="1">
|
||||||
|
|
||||||
<radiogroup id="ui_app_icon_type" preference="pref_app_icon_type">
|
<radiogroup id="ui_app_icon_type" preference="pref_app_icon_type"
|
||||||
|
oncommand="firetrayUIOptions.disableIconTypeMaybe(this.selectedIndex);">
|
||||||
<vbox align="left" flex="1">
|
<vbox align="left" flex="1">
|
||||||
<label class="header">&app_icon_type;</label>
|
<label class="header">&app_icon_type;</label>
|
||||||
|
|
||||||
<hbox>
|
<hbox>
|
||||||
<radio id="ui_app_icon_type_themed" label="&app_icon_themed.label;"
|
<radio id="ui_app_icon_type_themed" label="&app_icon_themed.label;"
|
||||||
accesskey="&app_icon_themed.accesskey;" tooltiptext="&app_icon_themed.tooltip;" />
|
accesskey="&app_icon_themed.accesskey;" tooltiptext="&icon_themed.tooltip;" />
|
||||||
<textbox id="app_icon_type_themed_name1" size="12" placeholder="&app_icon_themed_name;"
|
<textbox id="app_icon_type_themed_name1" size="12" placeholder="&app_icon_themed_name;"
|
||||||
onchange="firetrayUIOptions.updateAppIconNames(this);" flex="1" />
|
onchange="firetrayUIOptions.updateAppIconNames(this);" flex="1" />
|
||||||
<textbox id="app_icon_type_themed_name2" size="12" placeholder="&app_icon_themed_name;"
|
<textbox id="app_icon_type_themed_name2" size="12" placeholder="&app_icon_themed_name;"
|
||||||
@ -89,14 +90,16 @@
|
|||||||
onchange="firetrayUIOptions.updateAppIconNames(this);" flex="1"
|
onchange="firetrayUIOptions.updateAppIconNames(this);" flex="1"
|
||||||
disabled="true"/>
|
disabled="true"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
<hbox>
|
<hbox id="ui_app_icon_type_custom_group">
|
||||||
<radio id="ui_app_icon_type_custom" label="&app_icon_custom.label;"
|
<radio id="ui_app_icon_type_custom" label="&app_icon_custom.label;"
|
||||||
accesskey="&app_icon_custom.accesskey;" />
|
accesskey="&app_icon_custom.accesskey;" />
|
||||||
|
<hbox id="custom_app_icon" align="center" flex="1" >
|
||||||
<textbox id="app_icon_custom_filename" preference="pref_app_icon_filename" flex="1" />
|
<textbox id="app_icon_custom_filename" preference="pref_app_icon_filename" flex="1" />
|
||||||
<button id="app_icon_custom_select" label="&choose;"
|
<button id="app_icon_custom_select" label="&choose;"
|
||||||
accesskey="&choose.accesskey;"
|
accesskey="&choose.accesskey;"
|
||||||
oncommand="firetrayUIOptions.chooseAppIconFile()" />
|
oncommand="firetrayUIOptions.chooseAppIconFile()" />
|
||||||
</hbox>
|
</hbox>
|
||||||
|
</hbox>
|
||||||
|
|
||||||
</vbox>
|
</vbox>
|
||||||
</radiogroup>
|
</radiogroup>
|
||||||
@ -166,7 +169,8 @@
|
|||||||
<radio id="ui_radio_mail_notification_newmail_icon" label="&mail_notification_newmail_icon.label;"
|
<radio id="ui_radio_mail_notification_newmail_icon" label="&mail_notification_newmail_icon.label;"
|
||||||
accesskey="&mail_notification_newmail_icon.accesskey;"
|
accesskey="&mail_notification_newmail_icon.accesskey;"
|
||||||
oncommand="firetrayUIOptions.updateNotificationSettings()"
|
oncommand="firetrayUIOptions.updateNotificationSettings()"
|
||||||
observes="broadcaster-notification-disabled" />
|
observes="broadcaster-notification-disabled"
|
||||||
|
tooltiptext="&icon_themed.tooltip;" />
|
||||||
<textbox id="radio_mail_notification_newmail_icon_name1" size="12"
|
<textbox id="radio_mail_notification_newmail_icon_name1" size="12"
|
||||||
placeholder="&app_icon_themed_name;" flex="1"
|
placeholder="&app_icon_themed_name;" flex="1"
|
||||||
observes="broadcaster-notification-disabled"
|
observes="broadcaster-notification-disabled"
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<!ENTITY app_icon_themed.label "Default themed">
|
<!ENTITY app_icon_themed.label "Default themed">
|
||||||
<!ENTITY app_icon_themed.accesskey "D">
|
<!ENTITY app_icon_themed.accesskey "D">
|
||||||
<!ENTITY app_icon_themed_name "icon-name">
|
<!ENTITY app_icon_themed_name "icon-name">
|
||||||
<!ENTITY app_icon_themed.tooltip "Icon names provided by graphical environment">
|
<!ENTITY icon_themed.tooltip "Icon names provided by graphical environment">
|
||||||
<!ENTITY app_icon_custom.label "Custom">
|
<!ENTITY app_icon_custom.label "Custom">
|
||||||
<!ENTITY app_icon_custom.accesskey "u">
|
<!ENTITY app_icon_custom.accesskey "u">
|
||||||
|
|
||||||
|
@ -140,6 +140,7 @@ function gobject_defines(lib) {
|
|||||||
return this.g_signal_connect_data(instance, detailed_signal, handler, data, null, this.G_CONNECT_AFTER);
|
return this.g_signal_connect_data(instance, detailed_signal, handler, data, null, this.G_CONNECT_AFTER);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lib.lazy_bind("g_free", ctypes.void_t, this.gpointer);
|
||||||
lib.lazy_bind("g_object_unref", ctypes.void_t, this.gpointer);
|
lib.lazy_bind("g_object_unref", ctypes.void_t, this.gpointer);
|
||||||
lib.lazy_bind("g_list_free", ctypes.void_t, this.GList.ptr);
|
lib.lazy_bind("g_list_free", ctypes.void_t, this.GList.ptr);
|
||||||
lib.lazy_bind("g_list_length", this.guint, this.GList.ptr);
|
lib.lazy_bind("g_list_length", this.guint, this.GList.ptr);
|
||||||
|
@ -31,8 +31,13 @@ firetray.StatusIcon = {
|
|||||||
themedIconApp: null,
|
themedIconApp: null,
|
||||||
themedIconNewMail: null,
|
themedIconNewMail: null,
|
||||||
prefAppIconNames: null,
|
prefAppIconNames: null,
|
||||||
|
prefNewMailIconNames: null,
|
||||||
|
defaultAppIconName: null,
|
||||||
|
defaultNewMailIconName: null,
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
|
this.defineIconNames();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.GTK_THEME_ICON_PATH = firetray.Utils.chromeToPath("chrome://firetray/skin/linux/icons");
|
this.GTK_THEME_ICON_PATH = firetray.Utils.chromeToPath("chrome://firetray/skin/linux/icons");
|
||||||
LOG(this.GTK_THEME_ICON_PATH);
|
LOG(this.GTK_THEME_ICON_PATH);
|
||||||
@ -68,23 +73,44 @@ firetray.StatusIcon = {
|
|||||||
this.initialized = false;
|
this.initialized = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
defineIconNames: function() {
|
||||||
|
this.prefAppIconNames = (function() {
|
||||||
|
if (firetray.Handler.inMailApp) {
|
||||||
|
return "app_mail_icon_names";
|
||||||
|
} else if (firetray.Handler.inBrowserApp) {
|
||||||
|
return "app_browser_icon_names";
|
||||||
|
} else {
|
||||||
|
return "app_default_icon_names";
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
this.defaultAppIconName = firetray.Handler.appNameOriginal.toLowerCase();
|
||||||
|
|
||||||
|
this.prefNewMailIconNames = "new_mail_icon_names";
|
||||||
|
this.defaultNewMailIconName = "mail-unread";
|
||||||
|
},
|
||||||
|
|
||||||
loadThemedIcons: function() {
|
loadThemedIcons: function() {
|
||||||
if (firetray.Handler.inMailApp) {
|
if (firetray.Handler.inMailApp) {
|
||||||
let newMailIconNames = firetray.Utils.getArrayPref("new_mail_icon_names");
|
let newMailIconNames = this.getNewMailIconNames();
|
||||||
newMailIconNames.push("mail-unread"); // SMELL
|
if (this.themedIconNewMail) gobject.g_object_unref(this.themedIconNewMail);
|
||||||
this.themedIconNewMail = this.initThemedIcon(newMailIconNames);
|
this.themedIconNewMail = this.initThemedIcon(newMailIconNames);
|
||||||
|
|
||||||
this.prefAppIconNames = "app_mail_icon_names";
|
|
||||||
} else if (firetray.Handler.inBrowserApp) {
|
|
||||||
this.prefAppIconNames = "app_browser_icon_names";
|
|
||||||
} else {
|
|
||||||
this.prefAppIconNames = "app_default_icon_names";
|
|
||||||
}
|
}
|
||||||
let appIconNames = firetray.Utils.getArrayPref(this.prefAppIconNames);
|
let appIconNames = this.getAppIconNames();
|
||||||
appIconNames.push(firetray.Handler.appNameOriginal.toLowerCase());
|
if (this.themedIconApp) gobject.g_object_unref(this.themedIconApp);
|
||||||
this.themedIconApp = this.initThemedIcon(appIconNames);
|
this.themedIconApp = this.initThemedIcon(appIconNames);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getAppIconNames: function() {
|
||||||
|
let appIconNames = firetray.Utils.getArrayPref(this.prefAppIconNames);
|
||||||
|
appIconNames.push(this.defaultAppIconName);
|
||||||
|
return appIconNames;
|
||||||
|
},
|
||||||
|
getNewMailIconNames: function() {
|
||||||
|
let newMailIconNames = firetray.Utils.getArrayPref(this.prefNewMailIconNames);
|
||||||
|
newMailIconNames.push(this.defaultNewMailIconName);
|
||||||
|
return newMailIconNames;
|
||||||
|
},
|
||||||
|
|
||||||
initThemedIcon: function(names) {
|
initThemedIcon: function(names) {
|
||||||
if (!isArray(names)) throw new TypeError();
|
if (!isArray(names)) throw new TypeError();
|
||||||
LOG("themedIconNames="+names);
|
LOG("themedIconNames="+names);
|
||||||
|
Loading…
Reference in New Issue
Block a user