222
163
GParamSpec *pspec)
224
165
SystrayBox *box = XFCE_SYSTRAY_BOX (object);
229
case PROP_NAMES_VISIBLE:
230
array = g_ptr_array_new ();
231
g_hash_table_foreach (box->names, systray_box_names_collect_visible, array);
232
g_value_set_boxed (value, array);
233
xfconf_array_free (array);
236
case PROP_NAMES_HIDDEN:
237
array = g_ptr_array_new ();
238
g_hash_table_foreach (box->names, systray_box_names_collect_hidden, array);
239
g_value_set_boxed (value, array);
240
xfconf_array_free (array);
244
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
252
systray_box_set_property (GObject *object,
257
SystrayBox *box = XFCE_SYSTRAY_BOX (object);
262
gboolean hidden = TRUE;
266
case PROP_NAMES_VISIBLE:
270
case PROP_NAMES_HIDDEN:
271
/* remove old names with this state */
272
g_hash_table_foreach_remove (box->names,
273
systray_box_names_remove,
274
GUINT_TO_POINTER (hidden));
277
array = g_value_get_boxed (value);
278
if (G_LIKELY (array != NULL))
280
for (i = 0; i < array->len; i++)
282
tmp = g_ptr_array_index (array, i);
283
panel_assert (G_VALUE_HOLDS_STRING (tmp));
284
name = g_value_dup_string (tmp);
285
g_hash_table_replace (box->names, name, GUINT_TO_POINTER (hidden));
289
/* update icons in the box */
290
systray_box_update_hidden (box);
169
case PROP_HAS_HIDDEN:
170
g_value_set_boolean (value, box->n_hidden_childeren > 0);
309
189
/* free the child list */
310
190
g_slist_free (box->childeren);
311
g_debug ("Leaking memory, not all children have been removed");
191
g_debug ("Not all icons has been removed from the systray.");
314
/* destroy the hash table */
315
g_hash_table_destroy (box->names);
317
194
G_OBJECT_CLASS (systray_box_parent_class)->finalize (object);
200
systray_box_size_get_max_child_size (SystrayBox *box,
206
GtkWidget *widget = GTK_WIDGET (box);
211
alloc_size -= 2 * GTK_CONTAINER (widget)->border_width;
213
/* count the number of rows that fit in the allocated space */
214
for (rows = 1;; rows++)
216
size = rows * box->size_max + (rows - 1) * SPACING;
217
if (size < alloc_size)
220
/* decrease rows if the new size doesn't fit */
221
if (rows > 1 && size > alloc_size)
227
row_size = (alloc_size - (rows - 1) * SPACING) / rows;
228
row_size = MIN (box->size_max, row_size);
230
if (rows_ret != NULL)
233
if (row_size_ret != NULL)
234
*row_size_ret = row_size;
236
if (offset_ret != NULL)
238
rows = MIN (rows, box->n_visible_children);
239
*offset_ret = (alloc_size - (rows * row_size + (rows - 1) * SPACING)) / 2;
323
248
systray_box_size_request (GtkWidget *widget,
324
249
GtkRequisition *requisition)
326
SystrayBox *box = XFCE_SYSTRAY_BOX (widget);
328
SystrayBoxChild *child_info;
330
gint child_size = -1;
331
GtkRequisition child_req;
332
gint n_visible_childeren = 0;
334
gint guess_size, icon_size;
336
panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (widget));
337
panel_return_if_fail (requisition != NULL);
339
/* get the guess size */
340
guess_size = box->guess_size - (SPACING * (box->rows - 1));
341
guess_size /= box->rows;
343
/* check if we need to hide or show any childeren */
344
for (li = box->childeren; li != NULL; li = li->next)
251
SystrayBox *box = XFCE_SYSTRAY_BOX (widget);
254
GtkRequisition child_req;
255
gint n_hidden_childeren = 0;
260
gint min_seq_cells = -1;
267
box->n_visible_children = 0;
269
/* get some info about the n_rows we're going to allocate */
270
systray_box_size_get_max_child_size (box, box->size_alloc, &rows, &row_size, NULL);
272
for (li = box->childeren, cells = 0.00; li != NULL; li = li->next)
346
child_info = li->data;
348
/* get the icons size request */
349
gtk_widget_size_request (child_info->widget, &child_req);
351
if (G_UNLIKELY (child_req.width == 1 || child_req.height == 1))
274
child = GTK_WIDGET (li->data);
275
panel_return_if_fail (XFCE_IS_SYSTRAY_SOCKET (child));
277
gtk_widget_size_request (child, &child_req);
279
/* skip invisible requisitions (see macro) or hidden widgets */
280
if (REQUISITION_IS_INVISIBLE (child_req)
281
|| !GTK_WIDGET_VISIBLE (child))
284
hidden = systray_socket_get_hidden (XFCE_SYSTRAY_SOCKET (child));
286
n_hidden_childeren++;
288
/* if we show hidden icons */
289
if (!hidden || box->show_hidden)
353
/* icons that return a 1 by 1 requisition supposed to be hidden */
354
if (!child_info->invalid)
291
/* special handling for non-squared icons. this only works if
292
* the icon size ratio is > 1.00, if this is lower then 1.00
293
* the icon implementation should respect the tray orientation */
294
if (G_UNLIKELY (child_req.width != child_req.height))
356
/* this icon should not be visible */
357
child_info->invalid = TRUE;
359
/* decrease the hidden counter if needed */
360
if (child_info->auto_hide)
361
box->n_hidden_childeren--;
296
ratio = (gdouble) child_req.width / (gdouble) child_req.height;
297
if (!box->horizontal)
302
if (G_UNLIKELY (rows > 1))
304
/* align to whole blocks if we have multiple rows */
305
ratio = ceil (ratio);
307
/* update the min sequential number of blocks */
308
min_seq_cells = MAX (min_seq_cells, ratio);
317
/* don't do anything with the actual size,
318
* just count the number of cells */
320
box->n_visible_children++;
326
cols = cells / (gdouble) rows;
329
if (cols * rows < cells)
332
/* make sure we have enough columns to fix the minimum amount of cells */
333
if (min_seq_cells != -1)
334
cols = MAX (min_seq_cells, cols);
336
col_px = row_size * cols + (cols - 1) * SPACING;
337
row_px = row_size * rows + (rows - 1) * SPACING;
341
requisition->width = col_px;
342
requisition->height = row_px;
366
/* restore icon if it was previously invisible */
367
if (G_UNLIKELY (child_info->invalid))
370
child_info->invalid = FALSE;
373
if (child_info->auto_hide)
374
box->n_hidden_childeren++;
377
/* count the number of visible childeren */
378
if (!child_info->auto_hide || box->show_hidden)
380
/* get the icon size */
381
icon_size = MIN (guess_size, MAX (child_req.width, child_req.height));
383
/* pick largest icon */
384
if (G_UNLIKELY (child_size == -1))
385
child_size = icon_size;
387
child_size = MAX (child_size, icon_size);
389
/* increase number of visible childeren */
390
n_visible_childeren++;
346
requisition->width = row_px;
347
requisition->height = col_px;
395
/* number of columns */
396
n_columns = n_visible_childeren / box->rows;
397
if (n_visible_childeren > (n_columns * box->rows))
400
/* set the width and height needed for the icons */
401
if (n_visible_childeren > 0)
403
requisition->width = ((child_size + SPACING) * n_columns) - SPACING;
404
requisition->height = ((child_size + SPACING) * box->rows) - SPACING;
408
requisition->width = requisition->height = 0;
411
/* add the button size if there are hidden icons */
412
if (box->n_hidden_childeren > 0)
414
/* add the button size */
415
requisition->width += BUTTON_SIZE;
418
if (n_visible_childeren > 0)
419
requisition->width += SPACING;
422
/* swap the sizes if the orientation is vertical */
423
if (!IS_HORIZONTAL (box))
425
swap = requisition->width;
426
requisition->width = requisition->height;
427
requisition->height = swap;
430
/* add container border */
431
requisition->width += GTK_CONTAINER (widget)->border_width * 2;
432
requisition->height += GTK_CONTAINER (widget)->border_width * 2;
352
requisition->width = 0;
353
requisition->height = 0;
356
/* emit property if changed */
357
if (box->n_hidden_childeren != n_hidden_childeren)
359
box->n_hidden_childeren = n_hidden_childeren;
360
g_object_notify (G_OBJECT (box), "has-hidden");
363
/* add border size */
364
border = GTK_CONTAINER (widget)->border_width * 2;
365
requisition->width += border;
366
requisition->height += border;
438
372
systray_box_size_allocate (GtkWidget *widget,
439
373
GtkAllocation *allocation)
441
SystrayBox *box = XFCE_SYSTRAY_BOX (widget);
442
SystrayBoxChild *child_info;
449
GtkAllocation child_allocation;
453
panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (widget));
454
panel_return_if_fail (allocation != NULL);
456
/* set widget allocation */
375
SystrayBox *box = XFCE_SYSTRAY_BOX (widget);
377
GtkAllocation child_alloc;
378
GtkRequisition child_req;
383
gint x, x_start, x_end;
384
gint y, y_start, y_end;
457
390
widget->allocation = *allocation;
459
n_children = g_slist_length (box->childeren);
463
/* get root coordinates */
464
x = allocation->x + GTK_CONTAINER (widget)->border_width;
465
y = allocation->y + GTK_CONTAINER (widget)->border_width;
468
width = allocation->width - 2 * GTK_CONTAINER (widget)->border_width;
469
height = allocation->height - 2 * GTK_CONTAINER (widget)->border_width;
474
child_size = IS_HORIZONTAL (box) ? width : height;
475
if (box->n_hidden_childeren > 0)
476
child_size -= BUTTON_SIZE + SPACING;
477
n = n_children - (box->show_hidden ? 0 : box->n_hidden_childeren);
478
child_size -= SPACING * MAX (n - 1, 0);
482
if (IS_HORIZONTAL (box))
483
y += MAX (height - child_size, 0) / 2;
485
x += MAX (width - child_size, 0) / 2;
392
border = GTK_CONTAINER (widget)->border_width;
394
alloc_size = box->horizontal ? widget->allocation.height : widget->allocation.width;
395
systray_box_size_get_max_child_size (box, alloc_size, &rows, &row_size, &offset);
397
/* get allocation bounds */
398
x_start = allocation->x + border;
399
x_end = allocation->x + allocation->width - border;
401
y_start = allocation->y + border;
402
y_end = allocation->y + allocation->height - border;
404
/* add offset to center the tray contents */
489
child_size = IS_HORIZONTAL (box) ? height : width;
490
child_size -= SPACING * (box->rows - 1);
491
child_size /= box->rows;
494
/* don't allocate zero width icon */
498
/* position arrow button */
499
if (box->n_hidden_childeren > 0)
501
/* initialize allocation */
502
child_allocation.x = allocation->x + GTK_CONTAINER (widget)->border_width;
503
child_allocation.y = allocation->y + GTK_CONTAINER (widget)->border_width;
505
/* set the width and height */
506
if (IS_HORIZONTAL (box))
508
child_allocation.width = BUTTON_SIZE;
509
child_allocation.height = height;
513
child_allocation.width = width;
514
child_allocation.height = BUTTON_SIZE;
517
/* position the button on the other side of the box */
518
if (box->arrow_type == GTK_ARROW_RIGHT)
519
child_allocation.x += width - child_allocation.width;
520
else if (box->arrow_type == GTK_ARROW_DOWN)
521
child_allocation.y += height - child_allocation.height;
523
/* set the offset for the icons */
524
offset = BUTTON_SIZE + SPACING;
526
/* position the arrow button */
527
gtk_widget_size_allocate (box->button, &child_allocation);
529
/* show button if not already visible */
530
if (!GTK_WIDGET_VISIBLE (box->button))
531
gtk_widget_show (box->button);
533
else if (GTK_WIDGET_VISIBLE (box->button))
535
/* hide the button */
536
gtk_widget_hide (box->button);
540
for (li = box->childeren, n = 0; li != NULL; li = li->next)
542
child_info = li->data;
544
if (child_info->invalid || (child_info->auto_hide && !box->show_hidden))
546
/* put icons offscreen */
547
child_allocation.x = child_allocation.y = OFFSCREEN;
551
/* set coordinates */
552
child_allocation.x = (child_size + SPACING) * (n / box->rows) + offset;
553
child_allocation.y = (child_size + SPACING) * (n % box->rows);
555
/* increase item counter */
558
/* swap coordinates on a vertical panel */
559
if (!IS_HORIZONTAL (box))
561
swap = child_allocation.x;
562
child_allocation.x = child_allocation.y;
563
child_allocation.y = swap;
566
/* invert the icon order if the arrow button position is right or down */
567
if (box->arrow_type == GTK_ARROW_RIGHT)
568
child_allocation.x = width - child_allocation.x - child_size;
569
else if (box->arrow_type == GTK_ARROW_DOWN)
570
child_allocation.y = height - child_allocation.y - child_size;
573
child_allocation.x += x;
574
child_allocation.y += y;
577
/* set child width and height */
578
child_allocation.width = child_size;
579
child_allocation.height = child_size;
581
/* allocate widget size */
582
gtk_widget_size_allocate (child_info->widget, &child_allocation);
589
systray_box_expose_event (GtkWidget *widget,
590
GdkEventExpose *event)
592
SystrayBox *box = XFCE_SYSTRAY_BOX (widget);
594
SystrayBoxChild *child_info;
598
result = GTK_WIDGET_CLASS (systray_box_parent_class)->expose_event (widget, event);
600
if (gtk_widget_is_composited (widget))
602
cr = gdk_cairo_create (widget->window);
603
gdk_cairo_region (cr, event->region);
606
for (li = box->childeren; li != NULL; li = li->next)
608
child_info = li->data;
610
/* skip invisible or not composited children */
611
if (child_info->invalid
612
|| (child_info->auto_hide && !box->show_hidden)
613
|| !systray_socket_is_composited (XFCE_SYSTRAY_SOCKET (child_info->widget)))
616
/* paint the child */
617
gdk_cairo_set_source_pixmap (cr, child_info->widget->window,
618
child_info->widget->allocation.x,
619
child_info->widget->allocation.y);
415
for (li = box->childeren; li != NULL; li = li->next)
417
child = GTK_WIDGET (li->data);
418
panel_return_if_fail (XFCE_IS_SYSTRAY_SOCKET (child));
420
if (!GTK_WIDGET_VISIBLE (child))
423
gtk_widget_get_child_requisition (child, &child_req);
425
if (REQUISITION_IS_INVISIBLE (child_req)
426
|| (!box->show_hidden
427
&& systray_socket_get_hidden (XFCE_SYSTRAY_SOCKET (child))))
429
/* position hidden icons offscreen if we don't show hidden icons
430
* or the requested size looks like an invisible icons (see macro) */
431
child_alloc.x = child_alloc.y = OFFSCREEN;
433
/* do nothing special with the requested size */
434
child_alloc.width = child_req.width;
435
child_alloc.height = child_req.height;
439
/* special case handling for non-squared icons */
440
if (G_UNLIKELY (child_req.width != child_req.height))
442
ratio = (gdouble) child_req.width / (gdouble) child_req.height;
446
child_alloc.height = row_size;
447
child_alloc.width = row_size * ratio;
448
child_alloc.y = child_alloc.x = 0;
452
ratio = ceil (ratio);
453
child_alloc.x = ((ratio * row_size) - child_alloc.width) / 2;
460
child_alloc.width = row_size;
461
child_alloc.height = row_size * ratio;
462
child_alloc.x = child_alloc.y = 0;
466
ratio = ceil (ratio);
467
child_alloc.y = ((ratio * row_size) - child_alloc.height) / 2;
473
/* fix icon to row size */
474
child_alloc.width = row_size;
475
child_alloc.height = row_size;
482
if ((box->horizontal && x + child_alloc.width > x_end)
483
|| (!box->horizontal && y + child_alloc.height > y_end))
488
/* child doesn't fit, but maybe we still have space for the
489
* next icon, so move the child 1 step forward in the list
490
* and restart allocating the box */
491
idx = g_slist_position (box->childeren, li);
492
box->childeren = g_slist_delete_link (box->childeren, li);
493
box->childeren = g_slist_insert (box->childeren, child, idx + 1);
495
goto restart_allocation;
498
/* TODO maybe restart allocating with row_size-- if new row
503
y += row_size + SPACING;
508
x += row_size + SPACING;
516
x += row_size * ratio + SPACING;
518
y += row_size * ratio + SPACING;
521
gtk_widget_size_allocate (child, &child_alloc);
646
548
systray_box_remove (GtkContainer *container,
647
549
GtkWidget *child)
649
SystrayBox *box = XFCE_SYSTRAY_BOX (container);
650
SystrayBoxChild *child_info;
651
gboolean need_resize;
551
SystrayBox *box = XFCE_SYSTRAY_BOX (container);
654
554
/* search the child */
655
for (li = box->childeren; li != NULL; li = li->next)
555
li = g_slist_find (box->childeren, child);
556
if (G_LIKELY (li != NULL))
657
child_info = li->data;
659
if (child_info->widget == child)
661
/* whether the need to redraw afterwards */
662
need_resize = !child_info->auto_hide;
664
/* update hidden counter */
665
if (child_info->auto_hide && !child_info->invalid)
666
box->n_hidden_childeren--;
668
/* remove from list */
669
box->childeren = g_slist_remove_link (box->childeren, li);
672
g_free (child_info->name);
674
/* free child info */
675
g_slice_free (SystrayBoxChild, child_info);
677
/* unparent the widget */
678
gtk_widget_unparent (child);
680
/* resize when the child was visible */
682
gtk_widget_queue_resize (GTK_WIDGET (container));
558
panel_assert (GTK_WIDGET (li->data) == child);
560
/* unparent widget */
561
box->childeren = g_slist_remove_link (box->childeren, li);
562
gtk_widget_unparent (child);
564
/* resize, so we update has-hidden */
565
gtk_widget_queue_resize (GTK_WIDGET (container));
725
systray_box_names_collect (GPtrArray *array,
730
tmp = g_new0 (GValue, 1);
731
g_value_init (tmp, G_TYPE_STRING);
732
g_value_set_string (tmp, name);
733
g_ptr_array_add (array, tmp);
739
systray_box_names_collect_visible (gpointer key,
743
/* add all the visible names */
744
if (!GPOINTER_TO_UINT (value))
745
systray_box_names_collect (user_data, key);
751
systray_box_names_collect_hidden (gpointer key,
755
/* add all the hidden names */
756
if (GPOINTER_TO_UINT (value))
757
systray_box_names_collect (user_data, key);
763
systray_box_names_remove (gpointer key,
767
return GPOINTER_TO_UINT (value) == GPOINTER_TO_UINT (user_data);
773
systray_box_button_set_arrow (SystrayBox *box)
775
GtkArrowType arrow_type;
778
arrow_type = box->arrow_type;
780
/* invert the arrow direction when the button is toggled */
781
if (box->show_hidden)
783
if (IS_HORIZONTAL (box))
784
arrow_type = (arrow_type == GTK_ARROW_LEFT ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT);
786
arrow_type = (arrow_type == GTK_ARROW_UP ? GTK_ARROW_DOWN : GTK_ARROW_UP);
789
/* set the arrow type */
790
xfce_arrow_button_set_arrow_type (XFCE_ARROW_BUTTON (box->button), arrow_type);
796
systray_box_button_press_event (GtkWidget *widget,
797
GdkEventButton *event,
800
/* send the event to the box for the panel menu */
801
gtk_widget_event (box, (GdkEvent *) event);
809
systray_box_button_clicked (GtkToggleButton *button,
812
/* whether to show hidden icons */
813
box->show_hidden = gtk_toggle_button_get_active (button);
815
/* update the arrow */
816
systray_box_button_set_arrow (box);
819
gtk_widget_queue_resize (GTK_WIDGET (box));
825
600
systray_box_compare_function (gconstpointer a,
828
const SystrayBoxChild *child_a = a;
829
const SystrayBoxChild *child_b = b;
603
const gchar *name_a, *name_b;
604
gboolean hidden_a, hidden_b;
831
606
/* sort hidden icons before visible ones */
832
if (child_a->auto_hide != child_b->auto_hide)
833
return (child_a->auto_hide ? -1 : 1);
835
/* put icons without name after the hidden icons */
836
if (exo_str_is_empty (child_a->name) || exo_str_is_empty (child_b->name))
838
if (!exo_str_is_empty (child_a->name) == !exo_str_is_empty (child_b->name))
841
return exo_str_is_empty (child_a->name) ? -1 : 1;
845
return strcmp (child_a->name, child_b->name);
851
systray_box_update_hidden (SystrayBox *box)
853
SystrayBoxChild *child_info;
855
gint n_hidden_childeren;
857
panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (box));
860
n_hidden_childeren = 0;
862
/* update the icons */
863
for (li = box->childeren; li != NULL; li = li->next)
865
child_info = li->data;
867
/* update the hidden state */
868
child_info->auto_hide = systray_box_name_get_hidden (box, child_info->name);
870
/* increase counter if needed */
871
if (child_info->auto_hide && !child_info->invalid)
872
n_hidden_childeren++;
875
if (box->n_hidden_childeren != n_hidden_childeren)
878
box->n_hidden_childeren = n_hidden_childeren;
880
/* sort the list again */
881
box->childeren = g_slist_sort (box->childeren,
882
systray_box_compare_function);
885
gtk_widget_queue_resize (GTK_WIDGET (box));
607
hidden_a = systray_socket_get_hidden (XFCE_SYSTRAY_SOCKET (a));
608
hidden_b = systray_socket_get_hidden (XFCE_SYSTRAY_SOCKET (b));
609
if (hidden_a != hidden_b)
610
return hidden_a ? 1 : -1;
612
/* sort icons by name */
613
name_a = systray_socket_get_name (XFCE_SYSTRAY_SOCKET (a));
614
name_b = systray_socket_get_name (XFCE_SYSTRAY_SOCKET (b));
616
#if GLIB_CHECK_VERSION (2, 16, 0)
617
return g_strcmp0 (name_a, name_b);
620
return -(name_a != name_b);
622
return name_a != name_b;
624
return strcmp (name_a, name_b);
953
systray_box_get_rows (SystrayBox *box)
955
panel_return_val_if_fail (XFCE_IS_SYSTRAY_BOX (box), 1);
963
systray_box_add_with_name (SystrayBox *box,
967
SystrayBoxChild *child_info;
969
panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (box));
970
panel_return_if_fail (GTK_IS_WIDGET (child));
971
panel_return_if_fail (child->parent == NULL);
972
panel_return_if_fail (name == NULL || g_utf8_validate (name, -1, NULL));
974
/* create child info */
975
child_info = g_slice_new (SystrayBoxChild);
976
child_info->widget = child;
977
child_info->invalid = FALSE;
978
child_info->name = g_strdup (name);
979
child_info->auto_hide = systray_box_name_get_hidden (box, child_info->name);
981
/* update hidden counter */
982
if (child_info->auto_hide)
983
box->n_hidden_childeren++;
986
box->childeren = g_slist_insert_sorted (box->childeren, child_info,
987
systray_box_compare_function);
989
/* set parent widget */
990
gtk_widget_set_parent (child, GTK_WIDGET (box));
996
systray_box_name_add (SystrayBox *box,
1000
panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (box));
1001
panel_return_if_fail (!exo_str_is_empty (name));
1003
/* insert the application */
1004
g_hash_table_insert (box->names, g_strdup (name),
1005
GUINT_TO_POINTER (hidden ? 1 : 0));
1007
g_object_notify (G_OBJECT (box), hidden ? "names-hidden"
1014
systray_box_name_set_hidden (SystrayBox *box,
1018
panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (box));
1019
panel_return_if_fail (!exo_str_is_empty (name));
1021
/* replace the old name */
1022
g_hash_table_replace (box->names, g_strdup (name),
1023
GUINT_TO_POINTER (hidden ? 1 : 0));
1025
/* save new values */
1026
g_object_notify (G_OBJECT (box), "names-hidden");
1027
g_object_notify (G_OBJECT (box), "names-visible");
1029
/* update the box */
1030
systray_box_update_hidden (box);
678
systray_box_get_size_max (SystrayBox *box)
680
panel_return_val_if_fail (XFCE_IS_SYSTRAY_BOX (box), SIZE_MAX_DEFAULT);
682
return box->size_max;
688
systray_box_set_size_alloc (SystrayBox *box,
691
panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (box));
693
if (G_LIKELY (size_alloc != box->size_alloc))
695
box->size_alloc = size_alloc;
697
if (box->childeren != NULL)
698
gtk_widget_queue_resize (GTK_WIDGET (box));
705
systray_box_set_show_hidden (SystrayBox *box,
706
gboolean show_hidden)
708
panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (box));
710
if (box->show_hidden != show_hidden)
712
box->show_hidden = show_hidden;
714
if (box->childeren != NULL)
715
gtk_widget_queue_resize (GTK_WIDGET (box));
1036
systray_box_name_get_hidden (SystrayBox *box,
1041
/* do not hide icons without name */
1042
if (G_UNLIKELY (name == NULL))
1045
/* lookup the name in the table */
1046
p = g_hash_table_lookup (box->names, name);
1047
if (G_UNLIKELY (p == NULL))
1050
systray_box_name_add (box, name, FALSE);
1052
/* do not hide the icon */
1057
return (GPOINTER_TO_UINT (p) == 1 ? TRUE : FALSE);
1064
systray_box_name_list (SystrayBox *box)
1068
/* get the hash table keys */
1069
keys = g_hash_table_get_keys (box->names);
1072
keys = g_list_sort (keys, (GCompareFunc) strcmp);
722
systray_box_get_show_hidden (SystrayBox *box)
724
panel_return_val_if_fail (XFCE_IS_SYSTRAY_BOX (box), FALSE);
726
return box->show_hidden;
1080
systray_box_name_clear (SystrayBox *box)
732
systray_box_update (SystrayBox *box)
1082
/* remove all the entries from the list */
1083
g_hash_table_remove_all (box->names);
1085
g_object_notify (G_OBJECT (box), "names-hidden");
1086
g_object_notify (G_OBJECT (box), "names-visible");
1088
systray_box_update_hidden (box);
734
panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (box));
736
box->childeren = g_slist_sort (box->childeren,
737
systray_box_compare_function);
739
/* update the box, so we update the has-hidden property */
740
gtk_widget_queue_resize (GTK_WIDGET (box));