--- tasklist-widget-ORIG.c 2014-02-16 03:38:19.000000000 +0100 +++ tasklist-widget.c 2014-04-24 18:02:11.789569888 +0200 @@ -1102,7 +1102,10 @@ } else /* buttons without labels */ { - w = h; + /* reserve some space for the number of windows in a group: */ + w = h + tasklist->size / tasklist->nrows / 4; + if (xfce_tasklist_deskbar (tasklist)) + w = MAX (w + 4, 36); /* some little adjustments if in deskbar mode */ } area_width -= w; @@ -2070,8 +2073,11 @@ gtk_button_set_relief (GTK_BUTTON (child->button), tasklist->button_relief); - child->box = xfce_hvbox_new (!xfce_tasklist_vertical (tasklist) ? - GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, FALSE, 6); + child->box = xfce_hvbox_new ( + (xfce_tasklist_horizontal (tasklist) || (xfce_tasklist_deskbar (tasklist) && tasklist->show_labels)) ? + GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, FALSE, + (!(tasklist->show_labels) && tasklist->grouping == XFCE_TASKLIST_GROUPING_ALWAYS) ? 0 : 6 + ); gtk_container_add (GTK_CONTAINER (child->button), child->box); gtk_widget_show (child->box); @@ -2088,7 +2094,10 @@ if (!xfce_tasklist_vertical (tasklist)) { /* gtk_box_reorder_child (GTK_BOX (child->box), child->icon, 0); */ - gtk_misc_set_alignment (GTK_MISC (child->label), 0.0, 0.5); + if (!tasklist->show_labels) + gtk_misc_set_alignment (GTK_MISC (child->label), xfce_tasklist_deskbar (tasklist)? 0.5 : 0.0, 0.95); + else + gtk_misc_set_alignment (GTK_MISC (child->label), 0.0, 0.5); gtk_label_set_ellipsize (GTK_LABEL (child->label), tasklist->ellipsize_mode); } else @@ -2432,7 +2441,7 @@ return; /* get the window icon */ - if (tasklist->show_labels) + if (tasklist->show_labels || tasklist->size / tasklist->nrows < 38) pixbuf = wnck_window_get_mini_icon (window); else pixbuf = wnck_window_get_icon (window); @@ -3446,13 +3455,24 @@ } /* create the button label */ - name = wnck_class_group_get_name (group_child->class_group); - if (!exo_str_is_empty (name)) - label = g_strdup_printf ("%s (%d)", name, n_windows); + if (group_child->tasklist->show_labels == FALSE) + { /* prepare the label to display the number of windows in the group: */ + label = g_strdup_printf ("%d", n_windows); + gtk_label_set_markup (GTK_LABEL (group_child->label), label); + } else - label = g_strdup_printf ("(%d)", n_windows); - gtk_label_set_text (GTK_LABEL (group_child->label), label); + { + name = wnck_class_group_get_name (group_child->class_group); + if (!exo_str_is_empty (name)) + label = g_strdup_printf ("%s (%d)", name, n_windows); + else + label = g_strdup_printf ("(%d)", n_windows); + gtk_label_set_text (GTK_LABEL (group_child->label), label); + } g_free (label); + + /* display the label with the number of windows in the group: */ + gtk_widget_show (group_child->label); /* don't sort if there is no need to update the sorting (ie. only number * of windows is changed or button is not inserted in the tasklist yet */ @@ -3467,6 +3487,7 @@ XfceTasklistChild *group_child) { GdkPixbuf *pixbuf; + gboolean expand, fill; panel_return_if_fail (XFCE_IS_TASKLIST (group_child->tasklist)); panel_return_if_fail (WNCK_IS_CLASS_GROUP (class_group)); @@ -3479,10 +3500,25 @@ return; /* get the class group icon */ - if (group_child->tasklist->show_labels) - pixbuf = wnck_class_group_get_mini_icon (class_group); + if (group_child->tasklist->show_labels || + group_child->tasklist->size / group_child->tasklist->nrows < 38) + { + pixbuf = wnck_class_group_get_mini_icon (class_group); + if (group_child->tasklist->grouping != XFCE_TASKLIST_GROUPING_ALWAYS) + expand = fill = TRUE; + else + expand = fill = FALSE; + } else - pixbuf = wnck_class_group_get_icon (class_group); + { + pixbuf = wnck_class_group_get_icon (class_group); + expand = fill = FALSE; + } + /* let's set the fill mode of the icon inside its box: */ + gtk_box_set_child_packing (GTK_BOX (group_child->box), + group_child->icon, + expand, fill, 0, + GTK_PACK_START); if (G_LIKELY (pixbuf != NULL)) xfce_panel_image_set_from_pixbuf (XFCE_PANEL_IMAGE (group_child->icon), pixbuf); @@ -3800,7 +3836,7 @@ child = li->data; /* show or hide the label */ - if (show_labels) + if (show_labels || child->type == CHILD_TYPE_GROUP) { gtk_widget_show (child->label); gtk_box_set_child_packing (GTK_BOX (child->box), @@ -3819,7 +3855,18 @@ /* update the icon (we use another size for * icon box mode) */ - xfce_tasklist_button_icon_changed (child->window, child); + if (child->type == CHILD_TYPE_GROUP) { + xfce_tasklist_group_button_icon_changed (child->class_group, child); + xfce_tasklist_group_button_name_changed (NULL, child); + } + else + xfce_tasklist_button_icon_changed (child->window, child); + } + + if (tasklist->screen != NULL) + { + xfce_tasklist_disconnect_screen (tasklist); + xfce_tasklist_connect_screen (tasklist); } } } @@ -3867,6 +3914,9 @@ xfce_tasklist_set_grouping (XfceTasklist *tasklist, XfceTasklistGrouping grouping) { + GList *li; + XfceTasklistChild *child; + panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); /* TODO avoid overflow, because we allows + 1 in the object */ @@ -3882,6 +3932,13 @@ xfce_tasklist_disconnect_screen (tasklist); xfce_tasklist_connect_screen (tasklist); } + + for (li = tasklist->windows; li != NULL; li = li->next) + { + child = li->data; + if (child->type == CHILD_TYPE_GROUP) + xfce_tasklist_group_button_icon_changed (child->class_group, child); + } } } @@ -3889,12 +3946,13 @@ static void xfce_tasklist_update_orientation (XfceTasklist *tasklist) { - gboolean horizontal; + gboolean horizontal, deskbar; GList *li; XfceTasklistChild *child; - horizontal = !xfce_tasklist_vertical (tasklist); - + horizontal = xfce_tasklist_horizontal (tasklist); + deskbar = xfce_tasklist_deskbar (tasklist); + /* update the tasklist */ for (li = tasklist->windows; li != NULL; li = li->next) { @@ -3905,10 +3963,13 @@ horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); /* update the label */ - if (horizontal) + if (horizontal || deskbar) { /* gtk_box_reorder_child (GTK_BOX (child->box), child->icon, 0); */ - gtk_misc_set_alignment (GTK_MISC (child->label), 0.0, 0.5); + if (tasklist->show_labels) + gtk_misc_set_alignment (GTK_MISC (child->label), 0.0, 0.5); + else + gtk_misc_set_alignment (GTK_MISC (child->label), deskbar ? 0.5 : 0.0, 0.95); gtk_label_set_angle (GTK_LABEL (child->label), 0); gtk_label_set_ellipsize (GTK_LABEL (child->label), child->tasklist->ellipsize_mode); @@ -3962,6 +4023,9 @@ xfce_tasklist_set_size (XfceTasklist *tasklist, gint size) { + GList *li; + XfceTasklistChild *child; + panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); if (tasklist->size != size) @@ -3969,6 +4033,18 @@ tasklist->size = size; gtk_widget_queue_resize (GTK_WIDGET (tasklist)); } + + for (li = tasklist->windows; li != NULL; li = li->next) + { + child = li->data; + if (child->type == CHILD_TYPE_GROUP) + { + xfce_tasklist_group_button_icon_changed (child->class_group, child); + xfce_tasklist_group_button_name_changed (NULL, child); + } + else + xfce_tasklist_button_icon_changed (child->window, child); + } }