comparison gtk3/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 70dca53cb071
children db21c0081387
comparison
equal deleted inserted replaced
1222:aac69b11e821 1223:1255ba41adad
6505 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) 6505 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
6506 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(cont)); 6506 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(cont));
6507 DW_MUTEX_UNLOCK; 6507 DW_MUTEX_UNLOCK;
6508 } 6508 }
6509 6509
6510 /* Translate the status message into a message on our buddy window */
6511 static void _status_translate(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data)
6512 {
6513 GdkEventButton event = { 0 };
6514 long x, y;
6515 gboolean retval;
6516
6517 dw_pointer_query_pos(&x, &y);
6518
6519 event.button = button;
6520 event.x = x;
6521 event.y = y;
6522
6523 g_signal_emit_by_name(G_OBJECT(user_data), "button_press_event", &event, &retval);
6524 }
6525
6510 /* 6526 /*
6511 * Inserts an icon into the taskbar. 6527 * Inserts an icon into the taskbar.
6512 * Parameters: 6528 * Parameters:
6513 * handle: Window handle that will handle taskbar icon messages. 6529 * handle: Window handle that will handle taskbar icon messages.
6514 * icon: Icon handle to display in the taskbar. 6530 * icon: Icon handle to display in the taskbar.
6515 * bubbletext: Text to show when the mouse is above the icon. 6531 * bubbletext: Text to show when the mouse is above the icon.
6516 */ 6532 */
6517 void dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext) 6533 void dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext)
6518 { 6534 {
6519 /* TODO */ 6535 GtkStatusIcon *status;
6536 GdkPixbuf *pixbuf;
6537 int _locked_by_me = FALSE;
6538
6539 DW_MUTEX_LOCK;
6540 pixbuf = _find_pixbuf(icon, NULL, NULL);
6541 status = gtk_status_icon_new_from_pixbuf(pixbuf);
6542 if(bubbletext)
6543 gtk_status_icon_set_tooltip_text(status, bubbletext);
6544 g_object_set_data(G_OBJECT(handle), "_dw_taskbar", status);
6545 g_signal_connect(G_OBJECT (status), "popup-menu", G_CALLBACK (_status_translate), handle);
6546 gtk_status_icon_set_visible(status, TRUE);
6547 DW_MUTEX_UNLOCK;
6520 } 6548 }
6521 6549
6522 /* 6550 /*
6523 * Deletes an icon from the taskbar. 6551 * Deletes an icon from the taskbar.
6524 * Parameters: 6552 * Parameters:
6525 * handle: Window handle that was used with dw_taskbar_insert(). 6553 * handle: Window handle that was used with dw_taskbar_insert().
6526 * icon: Icon handle that was used with dw_taskbar_insert(). 6554 * icon: Icon handle that was used with dw_taskbar_insert().
6527 */ 6555 */
6528 void dw_taskbar_delete(HWND handle, HICN icon) 6556 void dw_taskbar_delete(HWND handle, HICN icon)
6529 { 6557 {
6530 /* TODO */ 6558 GtkStatusIcon *status;
6559 int _locked_by_me = FALSE;
6560
6561 DW_MUTEX_LOCK;
6562 status = g_object_get_data(G_OBJECT(handle), "_dw_taskbar");
6563 g_object_unref(G_OBJECT(status));
6564 DW_MUTEX_UNLOCK;
6531 } 6565 }
6532 6566
6533 /* 6567 /*
6534 * Creates a rendering context widget (window) to be packed. 6568 * Creates a rendering context widget (window) to be packed.
6535 * Parameters: 6569 * Parameters: