comparison gtk/dw.c @ 1223:1255ba41adad

Added taskbar support for GTK... This will only work for desktops running Gnome... It will do nothing for Unity/KDE desktops. GTK3 support is tested.... will test GTK2 after committing.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 10 Oct 2011 04:38:45 +0000
parents c46c9894a8cf
children db21c0081387
comparison
equal deleted inserted replaced
1222:aac69b11e821 1223:1255ba41adad
7559 gtk_clist_set_column_width(GTK_CLIST(clist), z, width); 7559 gtk_clist_set_column_width(GTK_CLIST(clist), z, width);
7560 } 7560 }
7561 DW_MUTEX_UNLOCK; 7561 DW_MUTEX_UNLOCK;
7562 } 7562 }
7563 7563
7564 #if GTK_CHECK_VERSION(2,10,0)
7565 /* Translate the status message into a message on our buddy window */
7566 static void _status_translate(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data)
7567 {
7568 GdkEventButton event = { 0 };
7569 long x, y;
7570 gboolean retval;
7571
7572 dw_pointer_query_pos(&x, &y);
7573
7574 event.button = button;
7575 event.x = x;
7576 event.y = y;
7577
7578 g_signal_emit_by_name(G_OBJECT(user_data), "button_press_event", &event, &retval);
7579 }
7580 #endif
7581
7564 /* 7582 /*
7565 * Inserts an icon into the taskbar. 7583 * Inserts an icon into the taskbar.
7566 * Parameters: 7584 * Parameters:
7567 * handle: Window handle that will handle taskbar icon messages. 7585 * handle: Window handle that will handle taskbar icon messages.
7568 * icon: Icon handle to display in the taskbar. 7586 * icon: Icon handle to display in the taskbar.
7569 * bubbletext: Text to show when the mouse is above the icon. 7587 * bubbletext: Text to show when the mouse is above the icon.
7570 */ 7588 */
7571 void dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext) 7589 void dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext)
7572 { 7590 {
7573 /* TODO */ 7591 #if GTK_CHECK_VERSION(2,10,0)
7592 GtkStatusIcon *status;
7593 GdkPixbuf *pixbuf;
7594 int _locked_by_me = FALSE;
7595
7596 DW_MUTEX_LOCK;
7597 pixbuf = _find_pixbuf(icon);
7598 status = gtk_status_icon_new_from_pixbuf(pixbuf);
7599 if(bubbletext)
7600 gtk_status_icon_set_tooltip_text(status, bubbletext);
7601 g_object_set_data(G_OBJECT(handle), "_dw_taskbar", status);
7602 g_signal_connect(G_OBJECT (status), "popup-menu", G_CALLBACK (_status_translate), handle);
7603 gtk_status_icon_set_visible(status, TRUE);
7604 DW_MUTEX_UNLOCK;
7605 #endif
7574 } 7606 }
7575 7607
7576 /* 7608 /*
7577 * Deletes an icon from the taskbar. 7609 * Deletes an icon from the taskbar.
7578 * Parameters: 7610 * Parameters:
7579 * handle: Window handle that was used with dw_taskbar_insert(). 7611 * handle: Window handle that was used with dw_taskbar_insert().
7580 * icon: Icon handle that was used with dw_taskbar_insert(). 7612 * icon: Icon handle that was used with dw_taskbar_insert().
7581 */ 7613 */
7582 void dw_taskbar_delete(HWND handle, HICN icon) 7614 void dw_taskbar_delete(HWND handle, HICN icon)
7583 { 7615 {
7584 /* TODO */ 7616 #if GTK_CHECK_VERSION(2,10,0)
7617 GtkStatusIcon *status;
7618 int _locked_by_me = FALSE;
7619
7620 DW_MUTEX_LOCK;
7621 status = g_object_get_data(G_OBJECT(handle), "_dw_taskbar");
7622 g_object_unref(G_OBJECT(status));
7623 DW_MUTEX_UNLOCK;
7624 #endif
7585 } 7625 }
7586 7626
7587 /* 7627 /*
7588 * Creates a rendering context widget (window) to be packed. 7628 * Creates a rendering context widget (window) to be packed.
7589 * Parameters: 7629 * Parameters: