1
0
mirror of https://github.com/moparisthebest/FireTray synced 2024-12-21 21:48:47 -05:00

first working version (firefox tray icon)

This commit is contained in:
foudfou 2011-07-04 14:31:56 +02:00
parent c842690051
commit e0e0cc81a5
6 changed files with 13 additions and 23 deletions

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -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
);
}

BIN
testing/firefox32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -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);

Binary file not shown.