void
pnl_dock_transient_grab_add_item (PnlDockTransientGrab *self,
                                  PnlDockItem          *item)
{
  g_return_if_fail (PNL_IS_DOCK_TRANSIENT_GRAB (self));
  g_return_if_fail (PNL_IS_DOCK_ITEM (item));

  g_ptr_array_add (self->items, item);

  g_object_weak_ref (G_OBJECT (item),
                     pnl_dock_transient_grab_weak_notify,
                     self);
}
gboolean
pnl_dock_transient_grab_contains (PnlDockTransientGrab *self,
                                  PnlDockItem          *item)
{
  guint i;

  g_return_val_if_fail (PNL_IS_DOCK_TRANSIENT_GRAB (self), FALSE);
  g_return_val_if_fail (PNL_IS_DOCK_ITEM (item), FALSE);

  for (i = 0; i < self->items->len; i++)
    if (g_ptr_array_index (self->items, i) == item)
      return TRUE;

  return FALSE;
}
Example #3
0
static void
pnl_dock_overlay_edge_add (GtkContainer *container,
                           GtkWidget    *child)
{
  PnlDockOverlayEdge *self = (PnlDockOverlayEdge *)container;

  g_assert (PNL_IS_DOCK_OVERLAY_EDGE (self));
  g_assert (GTK_IS_WIDGET (child));

  GTK_CONTAINER_CLASS (pnl_dock_overlay_edge_parent_class)->add (container, child);

  pnl_dock_overlay_edge_update_edge (self);

  if (PNL_IS_DOCK_ITEM (child))
    pnl_dock_item_adopt (PNL_DOCK_ITEM (self), PNL_DOCK_ITEM (child));
}
void
pnl_dock_transient_grab_remove_item (PnlDockTransientGrab *self,
                                     PnlDockItem          *item)
{
  guint i;

  g_return_if_fail (PNL_IS_DOCK_TRANSIENT_GRAB (self));
  g_return_if_fail (PNL_IS_DOCK_ITEM (item));

  for (i = 0; i < self->items->len; i++)
    {
      PnlDockItem *iter = g_ptr_array_index (self->items, i);

      if (item == iter)
        {
          pnl_dock_transient_grab_remove_index (self, i);
          return;
        }
    }
}