[Pkg-mozext-commits] [firetray] 142/399: handle scroll-event on icon
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:23:30 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch dfsg-clean
in repository firetray.
commit f6549e42118e47edb758d9e9947a8464d6889098
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Mon Jan 16 23:53:27 2012 +0100
handle scroll-event on icon
---
src/chrome/content/options.js | 6 ++++++
src/chrome/content/options.xul | 13 ++++++++++---
src/chrome/locale/en-US/options.dtd | 13 ++++++++++---
src/defaults/preferences/prefs.js | 2 ++
src/modules/ctypes/gdk.jsm | 18 ++++++++++++++++++
src/modules/ctypes/gobject.jsm | 1 +
src/modules/gtk2/FiretrayStatusIcon.jsm | 25 +++++++++++++++++++++++--
7 files changed, 70 insertions(+), 8 deletions(-)
diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index 735ee24..612db61 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -20,6 +20,7 @@ var firetrayUIOptions = {
this.strings = document.getElementById("firetray-options-strings");
this.updateWindowAndIconOptions();
+ this.updateScrollOptions();
if(firetray.Handler.inMailApp) {
Cu.import("resource://firetray/FiretrayMessaging.jsm");
@@ -70,6 +71,11 @@ var firetrayUIOptions = {
!(hides_on_close || hides_on_minimize);
},
+ updateScrollOptions: function() {
+ let scroll_to_hide = document.getElementById("ui_scroll_to_hide").checked;
+ this.disableGroup(document.getElementById("ui_radiogroup_scroll"), !scroll_to_hide);
+ },
+
initMailControls: function() {
this.populateExcludedFoldersList();
this.populateTreeAccountsOrServerTypes();
diff --git a/src/chrome/content/options.xul b/src/chrome/content/options.xul
index f3e9b69..cfa95fa 100644
--- a/src/chrome/content/options.xul
+++ b/src/chrome/content/options.xul
@@ -24,6 +24,8 @@
<preference id="pref_bool_hides_single_window" name="extensions.firetray.hides_single_window" type="bool"/>
<preference id="pref_bool_start_hidden" name="extensions.firetray.start_hidden" type="bool"/>
<preference id="pref_bool_show_icon_on_hide" name="extensions.firetray.show_icon_on_hide" type="bool"/>
+ <preference id="pref_bool_scroll_to_hide" name="extensions.firetray.scroll_to_hide" type="bool" />
+ <preference id="pref_string_scroll_mode" name="extensions.firetray.scroll_mode" type="string" />
<preference id="pref_string_icon_text_color" name="extensions.firetray.icon_text_color" type="string" />
<preference id="pref_string_custom_mail_icon" name="extensions.firetray.custom_mail_icon" type="string" />
<preference id="pref_string_mail_accounts" name="extensions.firetray.mail_accounts" type="string"/>
@@ -32,7 +34,6 @@
<tabbox>
<tabs>
<tab label="&general_options;"/>
- <tab label="&input_options;" disabled="true" tooltiptext="&NOT_IMPLEMENTED_YET;"/>
<tab label="&mail_options;" id="mail_tab" />
</tabs>
<tabpanels flex="1">
@@ -64,13 +65,19 @@
<checkbox id="ui_show_icon_on_hide" preference="pref_bool_show_icon_on_hide"
label="&bool_show_icon_on_hide.label;"
accesskey="&bool_show_icon_on_hide.accesskey;"/>
+ <checkbox id="ui_scroll_to_hide" preference="pref_bool_scroll_to_hide"
+ label="&enable_mouse_scroll.label;"
+ accesskey="&enable_mouse_scroll.accesskey;"
+ oncommand="firetrayUIOptions.updateScrollOptions()" />
+ <radiogroup id="ui_radiogroup_scroll" preference="pref_string_scroll_mode">
+ <radio id="ui_radio_scroll_down_hides" label="&down;=&hide;, &up;=&restore;" value="down_hides" />
+ <radio id="ui_radio_scroll_up_hides" label="&up;=&hide;, &down;=&restore;" value="up_hides" />
+ </radiogroup>
</groupbox>
</vbox>
</tabpanel>
- <tabpanel id="input_tabpanel" flex="1" />
-
<tabpanel id="mail_tabpanel" flex="1">
<vbox align="left" flex="1">
diff --git a/src/chrome/locale/en-US/options.dtd b/src/chrome/locale/en-US/options.dtd
index 52894f0..f3aa08e 100644
--- a/src/chrome/locale/en-US/options.dtd
+++ b/src/chrome/locale/en-US/options.dtd
@@ -10,17 +10,24 @@
<!ENTITY windows_behaviour "Windows behaviour">
<!ENTITY bool_hides_on_close.label "Closing window hides to tray">
<!ENTITY bool_hides_on_close.accesskey "C">
-<!ENTITY bool_hides_single_window.tooltip "not all windows at once">
<!ENTITY bool_hides_on_minimize.label "Minimizing window hides to tray">
<!ENTITY bool_hides_on_minimize.accesskey "M">
-<!ENTITY bool_hides_single_window.label "Hide the current window only">
+<!ENTITY bool_hides_single_window.label "Hide windows individually">
+<!ENTITY bool_hides_single_window.tooltip "not all windows at once">
<!ENTITY bool_hides_single_window.accesskey "H">
<!ENTITY bool_start_hidden.label "Start application hidden to tray">
<!ENTITY bool_start_hidden.accesskey "S">
<!ENTITY icon_settings "Icon settings">
-<!ENTITY bool_show_icon_on_hide.label "Show only if at least a window is hidden">
+<!ENTITY bool_show_icon_on_hide.label "Show tray icon only if a window is hidden">
<!ENTITY bool_show_icon_on_hide.accesskey "w">
+<!ENTITY mouse_wheel_options "Mouse wheel options" >
+<!ENTITY enable_mouse_scroll.label "Handle mouse scroll on tray icon" >
+<!ENTITY enable_mouse_scroll.accesskey "l">
+<!ENTITY up "↑" >
+<!ENTITY down "↓" >
+<!ENTITY hide "hide" >
+<!ENTITY restore "restore" >
<!ENTITY mail_notification.label "Mail notification">
<!ENTITY mail_notification_disabled.label "disabled">
diff --git a/src/defaults/preferences/prefs.js b/src/defaults/preferences/prefs.js
index 935907e..495476b 100644
--- a/src/defaults/preferences/prefs.js
+++ b/src/defaults/preferences/prefs.js
@@ -11,6 +11,8 @@ pref("extensions.firetray.hides_on_minimize", true);
pref("extensions.firetray.hides_single_window", false);
pref("extensions.firetray.start_hidden", false);
pref("extensions.firetray.show_icon_on_hide", false);
+pref("extensions.firetray.scroll_to_hide", true);
+pref("extensions.firetray.scroll_mode", "down_hides");
pref("extensions.firetray.mail_notification", 1);
pref("extensions.firetray.icon_text_color", "#000000");
diff --git a/src/modules/ctypes/gdk.jsm b/src/modules/ctypes/gdk.jsm
index 940d9ba..84df88e 100644
--- a/src/modules/ctypes/gdk.jsm
+++ b/src/modules/ctypes/gdk.jsm
@@ -112,6 +112,11 @@ function gdk_defines(lib) {
this.GDK_PROP_MODE_REPLACE = 0;
this.GDK_PROP_MODE_PREPEN = 1;
this.GDK_PROP_MODE_APPEND = 2;
+ this.GdkScrollDirection = ctypes.int; // enum
+ this.GDK_SCROLL_UP = 0;
+ this.GDK_SCROLL_DOWN = 1;
+ this.GDK_SCROLL_LEFT = 2;
+ this.GDK_SCROLL_RIGHT = 3;
this.GdkWindow = ctypes.StructType("GdkWindow");
this.GdkByteOrder = ctypes.int; // enum
@@ -180,6 +185,19 @@ function gdk_defines(lib) {
{ "changed_mask": this.GdkWindowState },
{ "new_window_state": this.GdkWindowState },
]);
+ this.GdkDevice = ctypes.StructType("GdkDevice");
+ this.GdkEventScroll = ctypes.StructType("GdkEventScroll", [
+ { "type": this.GdkEventType },
+ { "window": this.GdkWindow.ptr },
+ { "send_event": gobject.gint8 },
+ { "time": gobject.guint32 },
+ { "x": gobject.gdouble },
+ { "y": gobject.gdouble },
+ { "state": gobject.guint },
+ { "direction": this.GdkScrollDirection },
+ { "device": this.GdkDevice.ptr },
+ { "x_root": gobject.gdouble }, { "y_root": gobject.gdouble }
+ ]);
this.GdkAtom = ctypes.StructType("GdkAtom");
this.GdkFilterFunc_t = ctypes.FunctionType(
diff --git a/src/modules/ctypes/gobject.jsm b/src/modules/ctypes/gobject.jsm
index 8d56d58..542e6ba 100644
--- a/src/modules/ctypes/gobject.jsm
+++ b/src/modules/ctypes/gobject.jsm
@@ -93,6 +93,7 @@ function gobject_defines(lib) {
this.guchar = ctypes.unsigned_char;
this.gboolean = this.gint;
this.gfloat = ctypes.float;
+ this.gdouble = ctypes.double;
this.gsize = ctypes.unsigned_long;
this.GCallback = ctypes.voidptr_t;
this.GClosureNotify = this.gpointer;
diff --git a/src/modules/gtk2/FiretrayStatusIcon.jsm b/src/modules/gtk2/FiretrayStatusIcon.jsm
index 4e59bd5..e1406b2 100644
--- a/src/modules/gtk2/FiretrayStatusIcon.jsm
+++ b/src/modules/gtk2/FiretrayStatusIcon.jsm
@@ -149,8 +149,29 @@ firetray.StatusIcon = {
},
onScroll: function(icon, event, data) {
- LOG("scroll-event");
- // TODO:
+ let iconGpointer = ctypes.cast(icon, gobject.gpointer);
+ let gdkEventScroll = ctypes.cast(event, gdk.GdkEventScroll.ptr);
+ let scroll_mode = firetray.Utils.prefService.getCharPref("scroll_mode");
+
+ let direction = gdkEventScroll.contents.direction;
+ switch(direction) {
+ case gdk.GDK_SCROLL_UP:
+ LOG("SCROLL UP");
+ if (scroll_mode === "down_hides")
+ firetray.Handler.showAllWindows();
+ else if (scroll_mode === "up_hides")
+ firetray.Handler.hideAllWindows();
+ break;
+ case gdk.GDK_SCROLL_DOWN:
+ LOG("SCROLL DOWN");
+ if (scroll_mode === "down_hides")
+ firetray.Handler.hideAllWindows();
+ else if (scroll_mode === "up_hides")
+ firetray.Handler.showAllWindows();
+ break;
+ default:
+ ERROR("SCROLL UNKNOWN");
+ }
}
}; // firetray.StatusIcon
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git
More information about the Pkg-mozext-commits
mailing list