[Pkg-mozext-commits] [firetray] 04/399: first working version (firefox tray icon)

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:03 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 e0e0cc81a55caf72c05a96c6d7e7f4e154a8279d
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Mon Jul 4 14:31:56 2011 +0200

    first working version (firefox tray icon)
---
 src/chrome/content/overlay.js   |   12 +++---------
 src/chrome/skin/firefox32.png   |  Bin 0 -> 2912 bytes
 src/modules/LibGtkStatusIcon.js |   15 ++++-----------
 testing/firefox32.png           |  Bin 0 -> 2912 bytes
 testing/gkt_icon_example.c      |    9 ++++++---
 testing/gtk_icon_example        |  Bin 67281 -> 66933 bytes
 6 files changed, 13 insertions(+), 23 deletions(-)

diff --git a/src/chrome/content/overlay.js b/src/chrome/content/overlay.js
index a767eb1..770e755 100644
--- a/src/chrome/content/overlay.js
+++ b/src/chrome/content/overlay.js
@@ -21,17 +21,11 @@ mozt.Main = {
       return false;
     }
 
-
     LibGtkStatusIcon.init();
-/*
-    GtkStatusIcon *tray_icon = gtk_status_icon_new();
-    GdkPixbuf *default_icon = gdk_pixbuf_new_from_xpm_data(firefox_xpm);
-    gtk_status_icon_set_from_pixbuf(GTK_STATUS_ICON(tray_icon),
-                                    GDK_PIXBUF(default_icon));
-*/
     this.tray_icon  = LibGtkStatusIcon.gtk_status_icon_new();
-    // var pixmap = "hi";          // TODO: read pixmap from file
-    // LibGtkStatusIcon.gdk_pixbuf_new_from_xpm_data(pixmap);
+    var icon_filename = "chrome/skin/firefox32.png";
+    LibGtkStatusIcon.gtk_status_icon_set_from_file(this.tray_icon,
+                                                   icon_filename);
 
     mozt.Debug.dump('Moztray LOADED !');
     this.initialized = true;
diff --git a/src/chrome/skin/firefox32.png b/src/chrome/skin/firefox32.png
new file mode 100644
index 0000000..0c4f681
Binary files /dev/null and b/src/chrome/skin/firefox32.png differ
diff --git a/src/modules/LibGtkStatusIcon.js b/src/modules/LibGtkStatusIcon.js
index cd30195..af27979 100644
--- a/src/modules/LibGtkStatusIcon.js
+++ b/src/modules/LibGtkStatusIcon.js
@@ -49,7 +49,6 @@ var LibGtkStatusIcon = {
     this.GtkStatusIconRef = ctypes.PointerType(this.GtkStatusIcon);
     this.GdkPixbuf = ctypes.StructType("GdkPixbuf");
     this.GdkPixbufRef = ctypes.PointerType(this.GdkPixbuf);
-    this.Pixbuf = ctypes.PointerType(ctypes.char.ptr);
 
     // Consts
     this.INDICATOR_MESSAGES_SERVER_TYPE = "message";
@@ -62,18 +61,12 @@ var LibGtkStatusIcon = {
       this.GtkStatusIconRef
     );
 
-    this.gdk_pixbuf_new_from_xpm_data = this._lib.declare(
-      "gdk_pixbuf_new_from_xpm_data",
-      ctypes.default_abi,
-      this.GdkPixbufRef,
-      this.Pixbuf
-    );
-
-    this.gtk_status_icon_set_from_pixbuf = this._lib.declare(
-      "gtk_status_icon_set_from_pixbuf",
+    this.gtk_status_icon_set_from_file = this._lib.declare(
+      "gtk_status_icon_set_from_file",
       ctypes.default_abi,
+      ctypes.void_t,
       this.GtkStatusIconRef,
-      this.GdkPixbufRef
+      ctypes.char.ptr
     );
 
   }
diff --git a/testing/firefox32.png b/testing/firefox32.png
new file mode 100644
index 0000000..0c4f681
Binary files /dev/null and b/testing/firefox32.png differ
diff --git a/testing/gkt_icon_example.c b/testing/gkt_icon_example.c
index 0e0e1ef..b9e3d18 100644
--- a/testing/gkt_icon_example.c
+++ b/testing/gkt_icon_example.c
@@ -23,10 +23,13 @@ static GtkStatusIcon *create_tray_icon() {
                          "popup-menu",
                          G_CALLBACK(tray_icon_on_menu), NULL);
 
-        GdkPixbuf *default_icon = gdk_pixbuf_new_from_xpm_data(firefox_xpm);
+        /* GdkPixbuf *default_icon = gdk_pixbuf_new_from_xpm_data(firefox_xpm); */
 
-        gtk_status_icon_set_from_pixbuf(GTK_STATUS_ICON(tray_icon),
-                                        GDK_PIXBUF(default_icon));
+        /* gtk_status_icon_set_from_pixbuf(GTK_STATUS_ICON(tray_icon), */
+        /*                                 GDK_PIXBUF(default_icon)); */
+        const gchar *default_icon_filename = "firefox32.png";
+        gtk_status_icon_set_from_file(tray_icon,
+                                      default_icon_filename);
         gtk_status_icon_set_tooltip(tray_icon, 
                                     "Example Tray Icon");
         gtk_status_icon_set_visible(tray_icon, TRUE);
diff --git a/testing/gtk_icon_example b/testing/gtk_icon_example
index 6c75538..a57224f 100755
Binary files a/testing/gtk_icon_example and b/testing/gtk_icon_example differ

-- 
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